diff --git a/CHANGELIST.md b/CHANGELIST.md index 63645df4..97f64deb 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -122,6 +122,7 @@ - Remove unused byte array helper methods - Move GetSupportStatus to DumpEnvironment - Call psxt001z direct from DIC processor +- Move GetCopyProtection to ProtectionTool ### 3.1.9a (2024-05-21) diff --git a/MPF.Core/Utilities/InfoTool.cs b/MPF.Core/Utilities/InfoTool.cs index a82ead54..e96e1f63 100644 --- a/MPF.Core/Utilities/InfoTool.cs +++ b/MPF.Core/Utilities/InfoTool.cs @@ -21,26 +21,6 @@ namespace MPF.Core.Utilities { #region Information Extraction - /// - /// Get the current detected copy protection(s), if possible - /// - /// Drive object representing the current drive - /// Options object that determines what to scan - /// Optional progress callback - /// Detected copy protection(s) if possible, null on error - public static async Task<(string?, Dictionary>?)> GetCopyProtection(Drive? drive, - Core.Options options, - IProgress? progress = null) - { - if (options.ScanForProtection && drive?.Name != null) - { - (var protection, _) = await ProtectionTool.RunProtectionScanOnPath(drive.Name, options, progress); - return (ProtectionTool.FormatProtections(protection), protection); - } - - return ("(CHECK WITH PROTECTIONID)", null); - } - /// /// Get the EXE name from a PlayStation disc, if possible /// diff --git a/MPF.Core/Utilities/ProtectionTool.cs b/MPF.Core/Utilities/ProtectionTool.cs index 4e2bb4e1..e86f0fa2 100644 --- a/MPF.Core/Utilities/ProtectionTool.cs +++ b/MPF.Core/Utilities/ProtectionTool.cs @@ -12,6 +12,26 @@ namespace MPF.Core.Utilities { public static class ProtectionTool { + /// + /// Get the current detected copy protection(s), if possible + /// + /// Drive object representing the current drive + /// Options object that determines what to scan + /// Optional progress callback + /// Detected copy protection(s) if possible, null on error + public static async Task<(string?, Dictionary>?)> GetCopyProtection(Drive? drive, + Core.Options options, + IProgress? progress = null) + { + if (options.ScanForProtection && drive?.Name != null) + { + (var protection, _) = await RunProtectionScanOnPath(drive.Name, options, progress); + return (FormatProtections(protection), protection); + } + + return ("(CHECK WITH PROTECTIONID)", null); + } + /// /// Run protection scan on a given path /// @@ -20,7 +40,7 @@ namespace MPF.Core.Utilities /// Optional progress callback /// Set of all detected copy protections with an optional error string public static async Task<(Dictionary>?, string?)> RunProtectionScanOnPath(string path, - Options options, + Core.Options options, IProgress? progress = null) { try diff --git a/MPF.Frontend/SubmissionGenerator.cs b/MPF.Frontend/SubmissionGenerator.cs index 95a41c04..9b3b3c43 100644 --- a/MPF.Frontend/SubmissionGenerator.cs +++ b/MPF.Frontend/SubmissionGenerator.cs @@ -120,7 +120,7 @@ namespace MPF.Frontend if (SupportsCopyProtectionScans(system)) { resultProgress?.Report(ResultEventArgs.Success("Running copy protection scan... this might take a while!")); - var (protectionString, fullProtections) = await InfoTool.GetCopyProtection(drive, options, protectionProgress); + var (protectionString, fullProtections) = await ProtectionTool.GetCopyProtection(drive, options, protectionProgress); info.CopyProtection!.Protection += protectionString; info.CopyProtection.FullProtections = fullProtections as Dictionary?> ?? [];