diff --git a/CHANGELIST.md b/CHANGELIST.md index 535bb35b..90de55dd 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -6,6 +6,7 @@ - Fix usings ordering in ItemHelper - Add physical drive extensions to new tool - Fix build for older .NET +- Move two extensions to a better location ### 3.2.1 (2024-08-05) diff --git a/MPF.Frontend/EnumExtensions.cs b/MPF.Frontend/EnumExtensions.cs index 7f9a79e8..3b914a97 100644 --- a/MPF.Frontend/EnumExtensions.cs +++ b/MPF.Frontend/EnumExtensions.cs @@ -183,5 +183,39 @@ namespace MPF.Frontend } #endregion + + #region Functionality Support + + /// + /// Get if a system requires an anti-modchip scan + /// + public static bool SupportsAntiModchipScans(this RedumpSystem? system) + { + return system switch + { + RedumpSystem.SonyPlayStation => true, + _ => false, + }; + } + + /// + /// Get if a system requires a copy protection scan + /// + public static bool SupportsCopyProtectionScans(this RedumpSystem? system) + { + return system switch + { + RedumpSystem.AppleMacintosh => true, + RedumpSystem.EnhancedCD => true, + RedumpSystem.IBMPCcompatible => true, + RedumpSystem.PalmOS => true, + RedumpSystem.PocketPC => true, + RedumpSystem.RainbowDisc => true, + RedumpSystem.SonyElectronicBook => true, + _ => false, + }; + } + + #endregion } } diff --git a/MPF.Frontend/Tools/SubmissionGenerator.cs b/MPF.Frontend/Tools/SubmissionGenerator.cs index 7a6204e4..3a81fa53 100644 --- a/MPF.Frontend/Tools/SubmissionGenerator.cs +++ b/MPF.Frontend/Tools/SubmissionGenerator.cs @@ -107,7 +107,7 @@ namespace MPF.Frontend.Tools ProcessSystem(info, system, drive, options.AddPlaceholders, processor is DiscImageCreator, combinedBase); // Run anti-modchip check, if necessary - if (drive != null && SupportsAntiModchipScans(system) && info.CopyProtection!.AntiModchip == YesNo.NULL) + if (drive != null && system.SupportsAntiModchipScans() && info.CopyProtection!.AntiModchip == YesNo.NULL) { resultProgress?.Report(ResultEventArgs.Success("Checking for anti-modchip strings... this might take a while!")); info.CopyProtection.AntiModchip = await ProtectionTool.GetPlayStationAntiModchipDetected(drive?.Name) ? YesNo.Yes : YesNo.No; @@ -115,7 +115,7 @@ namespace MPF.Frontend.Tools } // Run copy protection, if possible or necessary - if (SupportsCopyProtectionScans(system)) + if (system.SupportsCopyProtectionScans()) { resultProgress?.Report(ResultEventArgs.Success("Running copy protection scan... this might take a while!")); var (protectionString, fullProtections) = await ProtectionTool.GetCopyProtection(drive, options, protectionProgress); @@ -885,36 +885,6 @@ namespace MPF.Frontend.Tools return true; } - /// - /// Helper to determine if a system requires an anti-modchip scan - /// - private static bool SupportsAntiModchipScans(RedumpSystem? system) - { - return system switch - { - RedumpSystem.SonyPlayStation => true, - _ => false, - }; - } - - /// - /// Helper to determine if a system requires a copy protection scan - /// - private static bool SupportsCopyProtectionScans(RedumpSystem? system) - { - return system switch - { - RedumpSystem.AppleMacintosh => true, - RedumpSystem.EnhancedCD => true, - RedumpSystem.IBMPCcompatible => true, - RedumpSystem.PalmOS => true, - RedumpSystem.PocketPC => true, - RedumpSystem.RainbowDisc => true, - RedumpSystem.SonyElectronicBook => true, - _ => false, - }; - } - #endregion } }