diff --git a/MPF.Library/Aaru/Parameters.cs b/MPF.Library/Aaru/Parameters.cs index d94c4128..e400061d 100644 --- a/MPF.Library/Aaru/Parameters.cs +++ b/MPF.Library/Aaru/Parameters.cs @@ -2211,9 +2211,11 @@ namespace MPF.Aaru // Required variables uint totalTracks = 0; - CueSheet cueSheet = new CueSheet(); - cueSheet.Performer = string.Join(", ", cicmSidecar.Performer ?? new string[0]); - cueSheet.Files = new List(); + CueSheet cueSheet = new CueSheet + { + Performer = string.Join(", ", cicmSidecar.Performer ?? new string[0]), + Files = new List(), + }; // Only care about OpticalDisc types if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0) @@ -2237,17 +2239,21 @@ namespace MPF.Aaru foreach (TrackType track in opticalDisc.Track) { // Create cue track entry - CueTrack cueTrack = new CueTrack(); - cueTrack.Number = (int)(track.Sequence?.TrackNumber ?? 0); - cueTrack.DataType = ConvertToDataType(track.TrackType1, track.BytesPerSector); - cueTrack.Flags = ConvertToTrackFlag(track.Flags); - cueTrack.ISRC = track.ISRC; + CueTrack cueTrack = new CueTrack + { + Number = (int)(track.Sequence?.TrackNumber ?? 0), + DataType = ConvertToDataType(track.TrackType1, track.BytesPerSector), + Flags = ConvertToTrackFlag(track.Flags), + ISRC = track.ISRC, + }; // Create cue file entry - CueFile cueFile = new CueFile(); - cueFile.FileName = GenerateTrackName(basePath, (int)totalTracks, cueTrack.Number, opticalDisc.DiscType); - cueFile.FileType = CueFileType.BINARY; - cueFile.Tracks = new List(); + CueFile cueFile = new CueFile + { + FileName = GenerateTrackName(basePath, (int)totalTracks, cueTrack.Number, opticalDisc.DiscType), + FileType = CueFileType.BINARY, + Tracks = new List(), + }; // Add index data if (track.Indexes != null && track.Indexes.Length > 0) diff --git a/MPF.Library/Utilities/Drive.cs b/MPF.Library/Data/Drive.cs similarity index 97% rename from MPF.Library/Utilities/Drive.cs rename to MPF.Library/Data/Drive.cs index 2995fda3..77259b6f 100644 --- a/MPF.Library/Utilities/Drive.cs +++ b/MPF.Library/Data/Drive.cs @@ -1,7 +1,6 @@ using System.IO; -using MPF.Data; -namespace MPF.Utilities +namespace MPF.Data { /// /// Represents information for a single drive @@ -54,7 +53,7 @@ namespace MPF.Utilities /// /// DriveInfo object representing the drive, if possible /// - private DriveInfo driveInfo = null; + private readonly DriveInfo driveInfo; public Drive(InternalDriveType? driveType, DriveInfo driveInfo) { diff --git a/MPF.Library/Utilities/DumpEnvironment.cs b/MPF.Library/Data/DumpEnvironment.cs similarity index 98% rename from MPF.Library/Utilities/DumpEnvironment.cs rename to MPF.Library/Data/DumpEnvironment.cs index ba6e892a..0865930e 100644 --- a/MPF.Library/Utilities/DumpEnvironment.cs +++ b/MPF.Library/Data/DumpEnvironment.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -9,11 +8,11 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BurnOutSharp; -using MPF.Data; using MPF.Redump; +using MPF.Utilities; using Newtonsoft.Json; -namespace MPF.Utilities +namespace MPF.Data { /// /// Represents the state of all settings to be used during dumping @@ -139,40 +138,33 @@ namespace MPF.Utilities { // Dumping support case InternalProgram.Aaru: - this.Parameters = new Aaru.Parameters(parameters); - this.Parameters.ExecutablePath = Options.AaruPath; + this.Parameters = new Aaru.Parameters(parameters) { ExecutablePath = Options.AaruPath }; break; case InternalProgram.DD: - this.Parameters = new DD.Parameters(parameters); - this.Parameters.ExecutablePath = Options.DDPath; + this.Parameters = new DD.Parameters(parameters) { ExecutablePath = Options.DDPath }; break; case InternalProgram.DiscImageCreator: - this.Parameters = new DiscImageCreator.Parameters(parameters); - this.Parameters.ExecutablePath = Options.DiscImageCreatorPath; + this.Parameters = new DiscImageCreator.Parameters(parameters) { ExecutablePath = Options.DiscImageCreatorPath }; break; // Verification support only case InternalProgram.CleanRip: - this.Parameters = new CleanRip.Parameters(parameters); - this.Parameters.ExecutablePath = null; + this.Parameters = new CleanRip.Parameters(parameters) { ExecutablePath = null }; break; case InternalProgram.DCDumper: this.Parameters = null; // TODO: Create correct parameter type when supported - this.Parameters.ExecutablePath = null; break; case InternalProgram.UmdImageCreator: - this.Parameters = new UmdImageCreator.Parameters(parameters); - this.Parameters.ExecutablePath = null; + this.Parameters = new UmdImageCreator.Parameters(parameters) { ExecutablePath = null }; break; // This should never happen, but it needs a fallback default: - this.Parameters = new DiscImageCreator.Parameters(parameters); - this.Parameters.ExecutablePath = Options.DiscImageCreatorPath; + this.Parameters = new DiscImageCreator.Parameters(parameters) { ExecutablePath = Options.DiscImageCreatorPath }; break; } @@ -778,9 +770,9 @@ namespace MPF.Utilities info.CommonDiscInfo.Layer1ToolstampMasteringCode = (Options.AddPlaceholders ? Template.RequiredIfExistsValue : ""); } - info.SizeAndChecksums.CRC32 = info.SizeAndChecksums.CRC32 == null ? (Options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : "") : info.SizeAndChecksums.CRC32; - info.SizeAndChecksums.MD5 = info.SizeAndChecksums.MD5 == null ? (Options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : "") : info.SizeAndChecksums.MD5; - info.SizeAndChecksums.SHA1 = info.SizeAndChecksums.SHA1 == null ? (Options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : "") : info.SizeAndChecksums.SHA1; + info.SizeAndChecksums.CRC32 = info.SizeAndChecksums.CRC32 ?? (Options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : ""); + info.SizeAndChecksums.MD5 = info.SizeAndChecksums.MD5 ?? (Options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : ""); + info.SizeAndChecksums.SHA1 = info.SizeAndChecksums.SHA1 ?? (Options.AddPlaceholders ? Template.RequiredValue + " [Not automatically generated for UMD]" : ""); info.TracksAndWriteOffsets.ClrMameProData = null; break; } @@ -1181,7 +1173,11 @@ namespace MPF.Utilities // TODO: Figure out what the addtional layerbreaks indicate case MediaType.BluRay: - if (layerbreak != default) + if (layerbreak3 != default) + return $"{mediaType.LongName()}-50"; + else if (layerbreak2 != default) + return $"{mediaType.LongName()}-50"; + else if (layerbreak != default) return $"{mediaType.LongName()}-50"; else return $"{mediaType.LongName()}-25"; diff --git a/MPF.Library/Utilities/IniFile.cs b/MPF.Library/Data/IniFile.cs similarity index 99% rename from MPF.Library/Utilities/IniFile.cs rename to MPF.Library/Data/IniFile.cs index f1c66175..c68ae546 100644 --- a/MPF.Library/Utilities/IniFile.cs +++ b/MPF.Library/Data/IniFile.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -namespace MPF.Utilities +namespace MPF.Data { public class IniFile : IDictionary { diff --git a/MPF.Library/Utilities/ProcessingQueue.cs b/MPF.Library/Data/ProcessingQueue.cs similarity index 98% rename from MPF.Library/Utilities/ProcessingQueue.cs rename to MPF.Library/Data/ProcessingQueue.cs index bfbcf92d..00ccd0e5 100644 --- a/MPF.Library/Utilities/ProcessingQueue.cs +++ b/MPF.Library/Data/ProcessingQueue.cs @@ -2,7 +2,7 @@ using System.Collections.Concurrent; using System.Threading.Tasks; -namespace MPF.Utilities +namespace MPF.Data { public class ProcessingQueue : IDisposable { diff --git a/MPF.Library/Utilities/Result.cs b/MPF.Library/Data/Result.cs similarity index 98% rename from MPF.Library/Utilities/Result.cs rename to MPF.Library/Data/Result.cs index 3ad6ebd9..e55ac57c 100644 --- a/MPF.Library/Utilities/Result.cs +++ b/MPF.Library/Data/Result.cs @@ -1,4 +1,4 @@ -namespace MPF.Utilities +namespace MPF.Data { /// /// Generic success/failure result object, with optional message diff --git a/MPF.Library/Utilities/BinaryReaderExtensions.cs b/MPF.Library/Utilities/BinaryReaderExtensions.cs index e61d6974..6b870da0 100644 --- a/MPF.Library/Utilities/BinaryReaderExtensions.cs +++ b/MPF.Library/Utilities/BinaryReaderExtensions.cs @@ -6,7 +6,7 @@ namespace MPF.Utilities /// /// Big endian reading overloads for BinaryReader /// - public static class BinaryReaderExtensions + internal static class BinaryReaderExtensions { /// /// Reads the specified number of bytes from the stream, starting from a specified point in the byte array. diff --git a/MPF.Library/Utilities/Converters.cs b/MPF.Library/Utilities/Converters.cs index 7857073f..d1127bec 100644 --- a/MPF.Library/Utilities/Converters.cs +++ b/MPF.Library/Utilities/Converters.cs @@ -464,7 +464,7 @@ namespace MPF.Utilities /// /// Long name method cache /// - private static ConcurrentDictionary LongNameMethods = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary LongNameMethods = new ConcurrentDictionary(); /// /// Get the string representation of a generic enumerable value @@ -1455,7 +1455,7 @@ namespace MPF.Utilities /// /// Short name method cache /// - private static ConcurrentDictionary ShortNameMethods = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary ShortNameMethods = new ConcurrentDictionary(); /// /// Get the short string representation of a generic enumerable value diff --git a/MPF.Library/Utilities/Extensions.cs b/MPF.Library/Utilities/EnumExtensions.cs similarity index 99% rename from MPF.Library/Utilities/Extensions.cs rename to MPF.Library/Utilities/EnumExtensions.cs index 850dd591..5c4700fb 100644 --- a/MPF.Library/Utilities/Extensions.cs +++ b/MPF.Library/Utilities/EnumExtensions.cs @@ -2,7 +2,7 @@ namespace MPF.Utilities { - public static class Extensions + public static class EnumExtensions { /// /// Determine the category based on the system diff --git a/MPF/UserControls/LogOutput.xaml.cs b/MPF/UserControls/LogOutput.xaml.cs index 67114f2a..00f6c037 100644 --- a/MPF/UserControls/LogOutput.xaml.cs +++ b/MPF/UserControls/LogOutput.xaml.cs @@ -7,7 +7,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; -using MPF.Utilities; +using MPF.Data; namespace MPF.UserControls { diff --git a/MPF/Windows/MainWindow.xaml.cs b/MPF/Windows/MainWindow.xaml.cs index fd02a6b8..e781040f 100644 --- a/MPF/Windows/MainWindow.xaml.cs +++ b/MPF/Windows/MainWindow.xaml.cs @@ -567,9 +567,11 @@ namespace MPF.Windows /// Dialog open result private bool? ShowDiscInformationWindow(SubmissionInfo submissionInfo) { - var discInformationWindow = new DiscInformationWindow(submissionInfo); - discInformationWindow.Owner = this; - discInformationWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; + var discInformationWindow = new DiscInformationWindow(submissionInfo) + { + Owner = this, + WindowStartupLocation = WindowStartupLocation.CenterOwner, + }; return discInformationWindow.ShowDialog(); } @@ -824,9 +826,11 @@ namespace MPF.Windows /// private void OptionsMenuItemClick(object sender, RoutedEventArgs e) { - var optionsWindow = new OptionsWindow(UIOptions); - optionsWindow.Owner = this; - optionsWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; + var optionsWindow = new OptionsWindow(UIOptions) + { + Owner = this, + WindowStartupLocation = WindowStartupLocation.CenterOwner, + }; optionsWindow.Closed += OnOptionsUpdated; optionsWindow.Show(); }