diff --git a/CHANGELIST.md b/CHANGELIST.md index 3c0293b0..3658ef15 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -6,6 +6,7 @@ - Try to get PS3 data from SFB - Fix PS3 version finding - Pull PS3 Firmware Version (Deterous) +- Fix default layerbreak output ### 2.7.4 (2023-10-31) diff --git a/MPF.Core/InfoTool.cs b/MPF.Core/InfoTool.cs index fe11a01f..3db84a50 100644 --- a/MPF.Core/InfoTool.cs +++ b/MPF.Core/InfoTool.cs @@ -1630,7 +1630,7 @@ namespace MPF.Core || (info.CommonDiscInfo?.Media.ToMediaType() != MediaType.BluRay && info.CommonDiscInfo?.System.IsXGD() == false)) { - AddIfExists(output, Template.LayerbreakField, (info.SizeAndChecksums?.Layerbreak == default && info.SizeAndChecksums?.Layerbreak != default(long) ? null : info.SizeAndChecksums?.Layerbreak.ToString()), 1); + AddIfExists(output, Template.LayerbreakField, info.SizeAndChecksums?.Layerbreak, 1); } AddIfExists(output, Template.SizeField, info.SizeAndChecksums?.Size.ToString(), 1); @@ -1980,7 +1980,7 @@ namespace MPF.Core if (value == null) return; - string prefix = ""; + string prefix = string.Empty; for (int i = 0; i < indent; i++) prefix += "\t"; @@ -2041,6 +2041,26 @@ namespace MPF.Core AddIfExists(output, key, string.Join(", ", value), indent); } + /// + /// Add the properly formatted key and value, if possible + /// + /// Output list + /// Name of the output key to write + /// Name of the output value to write + /// Number of tabs to indent the line + private static void AddIfExists(List output, string key, long? value, int indent) + { + // If there's no valid value to write + if (value == null || value == default(long)) + return; + + string prefix = string.Empty; + for (int i = 0; i < indent; i++) + prefix += "\t"; + + output.Add(prefix + key + ": " + value); + } + /// /// Add the properly formatted key and value, if possible ///