From e1961612c046605ce5485e83f4fef8d6fac85b7c Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 23 May 2024 13:41:43 -0400 Subject: [PATCH] Rename Protection to ProtectionTool --- CHANGELIST.md | 1 + MPF.Core/Processors/DiscImageCreator.cs | 2 +- MPF.Core/{Protection.cs => ProtectionTool.cs} | 2 +- MPF.Core/UI/ViewModels/MainViewModel.cs | 6 ++-- MPF.Core/Utilities/InfoTool.cs | 4 +-- MPF.Core/Utilities/SubmissionInfoTool.cs | 2 +- MPF.Test/Library/ProtectionTests.cs | 30 +++++++++---------- 7 files changed, 24 insertions(+), 23 deletions(-) rename MPF.Core/{Protection.cs => ProtectionTool.cs} (99%) diff --git a/CHANGELIST.md b/CHANGELIST.md index 24debe34..81e9a61c 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -79,6 +79,7 @@ - Move InfoTool to Core.Utilities - Move SubmissionInfoTool to Core.Utilities - Fix build +- Rename Protection to ProtectionTool ### 3.1.9a (2024-05-21) diff --git a/MPF.Core/Processors/DiscImageCreator.cs b/MPF.Core/Processors/DiscImageCreator.cs index 96e52d0f..d6e00ee6 100644 --- a/MPF.Core/Processors/DiscImageCreator.cs +++ b/MPF.Core/Processors/DiscImageCreator.cs @@ -1305,7 +1305,7 @@ namespace MPF.Core.Processors /// Status of the LibCrypt data, if possible private static void GetLibCryptDetected(string basePath, out YesNo detected, out string? data) { - bool? psLibCryptStatus = Protection.GetLibCryptDetected(basePath + ".sub"); + bool? psLibCryptStatus = ProtectionTool.GetLibCryptDetected(basePath + ".sub"); if (psLibCryptStatus == true) { // Guard against false positives diff --git a/MPF.Core/Protection.cs b/MPF.Core/ProtectionTool.cs similarity index 99% rename from MPF.Core/Protection.cs rename to MPF.Core/ProtectionTool.cs index e117fdb1..966b79c8 100644 --- a/MPF.Core/Protection.cs +++ b/MPF.Core/ProtectionTool.cs @@ -11,7 +11,7 @@ using psxt001z; namespace MPF.Core { - public static class Protection + public static class ProtectionTool { /// /// Run protection scan on a given path diff --git a/MPF.Core/UI/ViewModels/MainViewModel.cs b/MPF.Core/UI/ViewModels/MainViewModel.cs index 771ade13..390e658d 100644 --- a/MPF.Core/UI/ViewModels/MainViewModel.cs +++ b/MPF.Core/UI/ViewModels/MainViewModel.cs @@ -1527,13 +1527,13 @@ namespace MPF.Core.UI.ViewModels var progress = new Progress(); progress.ProgressChanged += ProgressUpdated; #if NET40 - var protectionTask = Protection.RunProtectionScanOnPath(this.CurrentDrive.Name, this.Options, progress); + var protectionTask = ProtectionTool.RunProtectionScanOnPath(this.CurrentDrive.Name, this.Options, progress); protectionTask.Wait(); var (protections, error) = protectionTask.Result; #else - var (protections, error) = await Protection.RunProtectionScanOnPath(this.CurrentDrive.Name, this.Options, progress); + var (protections, error) = await ProtectionTool.RunProtectionScanOnPath(this.CurrentDrive.Name, this.Options, progress); #endif - var output = Protection.FormatProtections(protections); + var output = ProtectionTool.FormatProtections(protections); // If SmartE is detected on the current disc, remove `/sf` from the flags for DIC only -- Disabled until further notice //if (Env.InternalProgram == InternalProgram.DiscImageCreator && output.Contains("SmartE")) diff --git a/MPF.Core/Utilities/InfoTool.cs b/MPF.Core/Utilities/InfoTool.cs index a3797747..8138c9e2 100644 --- a/MPF.Core/Utilities/InfoTool.cs +++ b/MPF.Core/Utilities/InfoTool.cs @@ -90,8 +90,8 @@ namespace MPF.Core.Utilities { if (options.ScanForProtection && drive?.Name != null) { - (var protection, _) = await Protection.RunProtectionScanOnPath(drive.Name, options, progress); - return (Protection.FormatProtections(protection), protection); + (var protection, _) = await ProtectionTool.RunProtectionScanOnPath(drive.Name, options, progress); + return (ProtectionTool.FormatProtections(protection), protection); } return ("(CHECK WITH PROTECTIONID)", null); diff --git a/MPF.Core/Utilities/SubmissionInfoTool.cs b/MPF.Core/Utilities/SubmissionInfoTool.cs index bd24ec0b..35bfd0ab 100644 --- a/MPF.Core/Utilities/SubmissionInfoTool.cs +++ b/MPF.Core/Utilities/SubmissionInfoTool.cs @@ -111,7 +111,7 @@ namespace MPF.Core.Utilities if (drive != null && SupportsAntiModchipScans(system) && info.CopyProtection!.AntiModchip == YesNo.NULL) { resultProgress?.Report(ResultEventArgs.Success("Checking for anti-modchip strings... this might take a while!")); - info.CopyProtection.AntiModchip = await Protection.GetPlayStationAntiModchipDetected(drive?.Name) ? YesNo.Yes : YesNo.No; + info.CopyProtection.AntiModchip = await ProtectionTool.GetPlayStationAntiModchipDetected(drive?.Name) ? YesNo.Yes : YesNo.No; resultProgress?.Report(ResultEventArgs.Success("Anti-modchip string scan complete!")); } diff --git a/MPF.Test/Library/ProtectionTests.cs b/MPF.Test/Library/ProtectionTests.cs index 2a100d9e..b35c95f7 100644 --- a/MPF.Test/Library/ProtectionTests.cs +++ b/MPF.Test/Library/ProtectionTests.cs @@ -17,7 +17,7 @@ namespace MPF.Test.Library "ActiveMARK 5", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("ActiveMARK 5", sanitized); } @@ -30,7 +30,7 @@ namespace MPF.Test.Library "Cactus Data Shield 200 (Build 3.0.100a)", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Cactus Data Shield 200 (Build 3.0.100a)", sanitized); } @@ -43,7 +43,7 @@ namespace MPF.Test.Library "Executable-Based CD Check", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Anything Else Protection", sanitized); } @@ -56,7 +56,7 @@ namespace MPF.Test.Library "CD-Cops v1.2.0", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("CD-Cops v1.2.0", sanitized); } @@ -69,7 +69,7 @@ namespace MPF.Test.Library "CD-Key / Serial", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Anything Else Protection", sanitized); } @@ -82,7 +82,7 @@ namespace MPF.Test.Library "EA CdKey Registration Module v1.2.0", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("EA CdKey Registration Module v1.2.0", sanitized); } @@ -95,7 +95,7 @@ namespace MPF.Test.Library "EA DRM Protection v1.2.0", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("EA DRM Protection v1.2.0", sanitized); } @@ -108,7 +108,7 @@ namespace MPF.Test.Library "Games for Windows LIVE v1.2.0", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Games for Windows LIVE v1.2.0", sanitized); } @@ -121,7 +121,7 @@ namespace MPF.Test.Library "Games for Windows LIVE Zero Day Piracy Protection", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Games for Windows LIVE, Games for Windows LIVE Zero Day Piracy Protection", sanitized); } @@ -134,7 +134,7 @@ namespace MPF.Test.Library "Impulse Reactor Core Module v1.2.0", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Impulse Reactor Core Module v1.2.0", sanitized); } @@ -161,7 +161,7 @@ namespace MPF.Test.Library // The list is in order of preference protections = protections.Skip(skip).ToList(); - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal(protections[0], sanitized); } @@ -174,7 +174,7 @@ namespace MPF.Test.Library "Executable-Based Online Registration", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Anything Else Protection", sanitized); } @@ -201,7 +201,7 @@ namespace MPF.Test.Library // The list is in order of preference protections = protections.Skip(skip).ToList(); - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal(protections[0], sanitized); } @@ -214,7 +214,7 @@ namespace MPF.Test.Library "Sysiphus v1.2.0", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("Sysiphus v1.2.0", sanitized); } @@ -227,7 +227,7 @@ namespace MPF.Test.Library "XCP v1.2.0", ]; - string sanitized = Protection.SanitizeFoundProtections(protections); + string sanitized = ProtectionTool.SanitizeFoundProtections(protections); Assert.Equal("XCP v1.2.0", sanitized); } }