Post-separation cleanup

This commit is contained in:
Matt Nadareski
2021-09-29 15:18:35 -07:00
parent 88ab691f07
commit 6d79ebf449
7 changed files with 21 additions and 22 deletions

View File

@@ -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

View File

@@ -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<int> cd { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
private static IReadOnlyList<int> dvd { get; } = cd.Where(s => s <= 24).ToList();
private static IReadOnlyList<int> bd { get; } = cd.Where(s => s <= 16).ToList();
private static IReadOnlyList<int> unknown { get; } = new List<int> { 1 };
private static IReadOnlyList<int> CD { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
private static IReadOnlyList<int> DVD { get; } = CD.Where(s => s <= 24).ToList();
private static IReadOnlyList<int> BD { get; } = CD.Where(s => s <= 16).ToList();
private static IReadOnlyList<int> Unknown { get; } = new List<int> { 1 };
/// <summary>
/// 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;
}
}
}

View File

@@ -8,7 +8,7 @@ namespace MPF.Core.Data
{
public class Options : IDictionary<string, string>, ICloneable
{
private Dictionary<string, string> _settings;
private readonly Dictionary<string, string> _settings;
#region Internal Program

View File

@@ -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
/// <summary>
/// Get the existance of an anti-modchip string from a PlayStation disc, if possible
/// </summary>
/// <param name="progress">Optional progress callback</param>
/// <returns>Anti-modchip existance if possible, false on error</returns>
private async Task<bool> GetPlayStationAntiModchipDetected(IProgress<ProtectionProgress> progress = null)
private async Task<bool> GetPlayStationAntiModchipDetected()
{
return await Protection.GetPlayStationAntiModchipDetected($"{Drive.Letter}:\\", progress);
return await Protection.GetPlayStationAntiModchipDetected($"{Drive.Letter}:\\");
}
/// <summary>

View File

@@ -61,7 +61,7 @@ namespace MPF.Library
/// </summary>
/// <param name="path">Path to scan for anti-modchip strings</param>
/// <returns>Anti-modchip existance if possible, false on error</returns>
public static async Task<bool> GetPlayStationAntiModchipDetected(string path, IProgress<ProtectionProgress> progress = null)
public static async Task<bool> GetPlayStationAntiModchipDetected(string path)
{
return await Task.Run(() =>
{

View File

@@ -11,14 +11,14 @@ namespace MPF
public static class Constants
{
// Private lists of known drive speed ranges
private static IReadOnlyList<int> cd { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
private static IReadOnlyList<int> dvd { get; } = cd.Where(s => s <= 24).ToList();
private static IReadOnlyList<int> bd { get; } = cd.Where(s => s <= 16).ToList();
private static IReadOnlyList<int> CD { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
private static IReadOnlyList<int> DVD { get; } = CD.Where(s => s <= 24).ToList();
private static IReadOnlyList<int> 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<int> list)
=> new DoubleCollection(list.Select(i => Convert.ToDouble(i)).ToList());
}

View File

@@ -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;