diff --git a/CHANGELIST.md b/CHANGELIST.md
index 1d7241b8..74d11270 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -2,6 +2,7 @@
- Enum, no more
- Sony works backward
- Add experimental dark mode
+- Allow users to customize protection scanning
### 2.0 (2021-04-23)
- Rename DICUI to Media Preservation Frontend (MPF)
diff --git a/MPF.Library/Data/DumpEnvironment.cs b/MPF.Library/Data/DumpEnvironment.cs
index dd6e0865..d83e4290 100644
--- a/MPF.Library/Data/DumpEnvironment.cs
+++ b/MPF.Library/Data/DumpEnvironment.cs
@@ -1363,7 +1363,7 @@ namespace MPF.Data
{
if (Options.ScanForProtection)
{
- (bool success, string output) = await Validators.RunProtectionScanOnPath($"{Drive.Letter}:\\", progress);
+ (bool success, string output) = await Validators.RunProtectionScanOnPath($"{Drive.Letter}:\\", this.Options, progress);
if (success)
return output;
else
diff --git a/MPF.Library/Data/Options.cs b/MPF.Library/Data/Options.cs
index efb8ebd1..699db978 100644
--- a/MPF.Library/Data/Options.cs
+++ b/MPF.Library/Data/Options.cs
@@ -329,6 +329,46 @@ namespace MPF.Data
#endregion
+ #region Protection Scanning Options
+
+ ///
+ /// Scan archive contents during protection scanning
+ ///
+ public bool ScanArchivesForProtection
+ {
+ get { return GetBooleanSetting(_settings, "ScanArchivesForProtection", true); }
+ set { _settings["ScanArchivesForProtection"] = value.ToString(); }
+ }
+
+ ///
+ /// Scan for executable packers during protection scanning
+ ///
+ public bool ScanPackersForProtection
+ {
+ get { return GetBooleanSetting(_settings, "ScanPackersForProtection", false); }
+ set { _settings["ScanPackersForProtection"] = value.ToString(); }
+ }
+
+ ///
+ /// Force scanning all files for protection
+ ///
+ public bool ForceScanningForProtection
+ {
+ get { return GetBooleanSetting(_settings, "ForceScanningForProtection", false); }
+ set { _settings["ForceScanningForProtection"] = value.ToString(); }
+ }
+
+ ///
+ /// Include debug information with scan results
+ ///
+ public bool IncludeDebugProtectionInformation
+ {
+ get { return GetBooleanSetting(_settings, "IncludeDebugProtectionInformation", false); }
+ set { _settings["IncludeDebugProtectionInformation"] = value.ToString(); }
+ }
+
+ #endregion
+
#region Logging Options
///
diff --git a/MPF.Library/Utilities/Validators.cs b/MPF.Library/Utilities/Validators.cs
index acf3aca3..a642af50 100644
--- a/MPF.Library/Utilities/Validators.cs
+++ b/MPF.Library/Utilities/Validators.cs
@@ -1023,9 +1023,10 @@ namespace MPF.Utilities
/// Run protection scan on a given dump environment
///
/// Path to scan for protection
+ /// Options object that determines what to scan
/// Optional progress callback
/// TCopy protection detected in the envirionment, if any
- public static async Task<(bool, string)> RunProtectionScanOnPath(string path, IProgress progress = null)
+ public static async Task<(bool, string)> RunProtectionScanOnPath(string path, Options options, IProgress progress = null)
{
try
{
@@ -1033,10 +1034,10 @@ namespace MPF.Utilities
{
var scanner = new Scanner(progress)
{
- IncludePosition = false, // Debug flag to include protection position in file
- ScanAllFiles = false, // Forces all files to be scanned as executables
- ScanArchives = true, // Allows archives to have internals extracted and scanned
- ScanPackers = false, // Allows executable packers to be detected
+ IncludePosition = options.IncludeDebugProtectionInformation,
+ ScanAllFiles = options.ForceScanningForProtection,
+ ScanArchives = options.ScanArchivesForProtection,
+ ScanPackers = options.ScanPackersForProtection,
};
return scanner.GetProtections(path);
});
diff --git a/MPF/Windows/MainWindow.xaml.cs b/MPF/Windows/MainWindow.xaml.cs
index b316a7a4..2c855aef 100644
--- a/MPF/Windows/MainWindow.xaml.cs
+++ b/MPF/Windows/MainWindow.xaml.cs
@@ -744,7 +744,7 @@ namespace MPF.Windows
var progress = new Progress();
progress.ProgressChanged += ProgressUpdated;
- (bool success, string output) = await Validators.RunProtectionScanOnPath(drive.Letter + ":\\", progress);
+ (bool success, string output) = await Validators.RunProtectionScanOnPath(drive.Letter + ":\\", this.Options, progress);
// If SmartE is detected on the current disc, remove `/sf` from the flags for DIC only
if (Env.Options.InternalProgram == InternalProgram.DiscImageCreator && output.Contains("SmartE"))
diff --git a/MPF/Windows/OptionsWindow.xaml b/MPF/Windows/OptionsWindow.xaml
index b526267a..ea7f02c9 100644
--- a/MPF/Windows/OptionsWindow.xaml
+++ b/MPF/Windows/OptionsWindow.xaml
@@ -223,6 +223,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+