From 6d79ebf449ad1a5c86aa09f53c466b43e36a17fe Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 29 Sep 2021 15:18:35 -0700 Subject: [PATCH] Post-separation cleanup --- CHANGELIST.md | 1 + MPF.Core/Data/Constants.cs | 16 ++++++++-------- MPF.Core/Data/Options.cs | 2 +- MPF.Library/DumpEnvironment.cs | 7 +++---- MPF.Library/Protection.cs | 2 +- MPF/Constants.cs | 12 ++++++------ MPF/ViewModels/MainViewModel.cs | 3 +-- 7 files changed, 21 insertions(+), 22 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index bc2b48ae..f25b3e6b 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -13,6 +13,7 @@ - Null-safeguard RedumpLib conversions - Move cuesheet code to separate DLL - Move CICMMetadata to top-level +- Separate out remaining functionality into individual DLLs ### 2.1 (2021-07-22) - Enum, no more diff --git a/MPF.Core/Data/Constants.cs b/MPF.Core/Data/Constants.cs index 237fe9b6..d9fe3be6 100644 --- a/MPF.Core/Data/Constants.cs +++ b/MPF.Core/Data/Constants.cs @@ -17,10 +17,10 @@ namespace MPF.Core.Data public static readonly byte[] SaturnSectorZeroStart = new byte[] { 0x53, 0x45, 0x47, 0x41, 0x20, 0x53, 0x45, 0x47, 0x41, 0x53, 0x41, 0x54, 0x55, 0x52, 0x4E, 0x20 }; // Private lists of known drive speed ranges - private static IReadOnlyList cd { get; } = new List { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 }; - private static IReadOnlyList dvd { get; } = cd.Where(s => s <= 24).ToList(); - private static IReadOnlyList bd { get; } = cd.Where(s => s <= 16).ToList(); - private static IReadOnlyList unknown { get; } = new List { 1 }; + private static IReadOnlyList CD { get; } = new List { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 }; + private static IReadOnlyList DVD { get; } = CD.Where(s => s <= 24).ToList(); + private static IReadOnlyList BD { get; } = CD.Where(s => s <= 16).ToList(); + private static IReadOnlyList Unknown { get; } = new List { 1 }; /// /// Get list of all drive speeds for a given MediaType @@ -33,16 +33,16 @@ namespace MPF.Core.Data { case MediaType.CDROM: case MediaType.GDROM: - return cd; + return CD; case MediaType.DVD: case MediaType.HDDVD: case MediaType.NintendoGameCubeGameDisc: case MediaType.NintendoWiiOpticalDisc: - return dvd; + return DVD; case MediaType.BluRay: - return bd; + return BD; default: - return unknown; + return Unknown; } } } diff --git a/MPF.Core/Data/Options.cs b/MPF.Core/Data/Options.cs index d1a2dd40..1fab9b01 100644 --- a/MPF.Core/Data/Options.cs +++ b/MPF.Core/Data/Options.cs @@ -8,7 +8,7 @@ namespace MPF.Core.Data { public class Options : IDictionary, ICloneable { - private Dictionary _settings; + private readonly Dictionary _settings; #region Internal Program diff --git a/MPF.Library/DumpEnvironment.cs b/MPF.Library/DumpEnvironment.cs index b7d07a5c..2892d9b6 100644 --- a/MPF.Library/DumpEnvironment.cs +++ b/MPF.Library/DumpEnvironment.cs @@ -939,7 +939,7 @@ namespace MPF.Library case RedumpSystem.SonyPlayStation: resultProgress?.Report(Result.Success("Checking for anti-modchip strings... this might take a while!")); - info.CopyProtection.AntiModchip = await GetPlayStationAntiModchipDetected(protectionProgress) ? YesNo.Yes : YesNo.No; + info.CopyProtection.AntiModchip = await GetPlayStationAntiModchipDetected() ? YesNo.Yes : YesNo.No; resultProgress?.Report(Result.Success("Anti-modchip string scan complete!")); // Special case for DIC only @@ -1466,11 +1466,10 @@ namespace MPF.Library /// /// Get the existance of an anti-modchip string from a PlayStation disc, if possible /// - /// Optional progress callback /// Anti-modchip existance if possible, false on error - private async Task GetPlayStationAntiModchipDetected(IProgress progress = null) + private async Task GetPlayStationAntiModchipDetected() { - return await Protection.GetPlayStationAntiModchipDetected($"{Drive.Letter}:\\", progress); + return await Protection.GetPlayStationAntiModchipDetected($"{Drive.Letter}:\\"); } /// diff --git a/MPF.Library/Protection.cs b/MPF.Library/Protection.cs index 56cc4a42..211b0235 100644 --- a/MPF.Library/Protection.cs +++ b/MPF.Library/Protection.cs @@ -61,7 +61,7 @@ namespace MPF.Library /// /// Path to scan for anti-modchip strings /// Anti-modchip existance if possible, false on error - public static async Task GetPlayStationAntiModchipDetected(string path, IProgress progress = null) + public static async Task GetPlayStationAntiModchipDetected(string path) { return await Task.Run(() => { diff --git a/MPF/Constants.cs b/MPF/Constants.cs index 52a00569..12644dcb 100644 --- a/MPF/Constants.cs +++ b/MPF/Constants.cs @@ -11,14 +11,14 @@ namespace MPF public static class Constants { // Private lists of known drive speed ranges - private static IReadOnlyList cd { get; } = new List { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 }; - private static IReadOnlyList dvd { get; } = cd.Where(s => s <= 24).ToList(); - private static IReadOnlyList bd { get; } = cd.Where(s => s <= 16).ToList(); + private static IReadOnlyList CD { get; } = new List { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 }; + private static IReadOnlyList DVD { get; } = CD.Where(s => s <= 24).ToList(); + private static IReadOnlyList BD { get; } = CD.Where(s => s <= 16).ToList(); // Create collections for UI based on known drive speeds - public static DoubleCollection SpeedsForCDAsCollection { get; } = GetDoubleCollectionFromIntList(cd); - public static DoubleCollection SpeedsForDVDAsCollection { get; } = GetDoubleCollectionFromIntList(dvd); - public static DoubleCollection SpeedsForBDAsCollection { get; } = GetDoubleCollectionFromIntList(bd); + public static DoubleCollection SpeedsForCDAsCollection { get; } = GetDoubleCollectionFromIntList(CD); + public static DoubleCollection SpeedsForDVDAsCollection { get; } = GetDoubleCollectionFromIntList(DVD); + public static DoubleCollection SpeedsForBDAsCollection { get; } = GetDoubleCollectionFromIntList(BD); private static DoubleCollection GetDoubleCollectionFromIntList(IReadOnlyList list) => new DoubleCollection(list.Select(i => Convert.ToDouble(i)).ToList()); } diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index d958596f..432725a8 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -570,8 +570,7 @@ namespace MPF.GUI.ViewModels private void EnableDarkMode() { // Setup needed brushes - var darkModeBrush = new SolidColorBrush(); - darkModeBrush.Color = Color.FromArgb(0xff, 0x20, 0x20, 0x20); + var darkModeBrush = new SolidColorBrush { Color = Color.FromArgb(0xff, 0x20, 0x20, 0x20) }; // Handle application-wide resources Application.Current.Resources[SystemColors.ActiveBorderBrushKey] = Brushes.Black;