mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Allow users to customize protection scanning
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -329,6 +329,46 @@ namespace MPF.Data
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protection Scanning Options
|
||||
|
||||
/// <summary>
|
||||
/// Scan archive contents during protection scanning
|
||||
/// </summary>
|
||||
public bool ScanArchivesForProtection
|
||||
{
|
||||
get { return GetBooleanSetting(_settings, "ScanArchivesForProtection", true); }
|
||||
set { _settings["ScanArchivesForProtection"] = value.ToString(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scan for executable packers during protection scanning
|
||||
/// </summary>
|
||||
public bool ScanPackersForProtection
|
||||
{
|
||||
get { return GetBooleanSetting(_settings, "ScanPackersForProtection", false); }
|
||||
set { _settings["ScanPackersForProtection"] = value.ToString(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Force scanning all files for protection
|
||||
/// </summary>
|
||||
public bool ForceScanningForProtection
|
||||
{
|
||||
get { return GetBooleanSetting(_settings, "ForceScanningForProtection", false); }
|
||||
set { _settings["ForceScanningForProtection"] = value.ToString(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Include debug information with scan results
|
||||
/// </summary>
|
||||
public bool IncludeDebugProtectionInformation
|
||||
{
|
||||
get { return GetBooleanSetting(_settings, "IncludeDebugProtectionInformation", false); }
|
||||
set { _settings["IncludeDebugProtectionInformation"] = value.ToString(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logging Options
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1023,9 +1023,10 @@ namespace MPF.Utilities
|
||||
/// Run protection scan on a given dump environment
|
||||
/// </summary>
|
||||
/// <param name="path">Path to scan for protection</param>
|
||||
/// <param name="options">Options object that determines what to scan</param>
|
||||
/// <param name="progress">Optional progress callback</param>
|
||||
/// <returns>TCopy protection detected in the envirionment, if any</returns>
|
||||
public static async Task<(bool, string)> RunProtectionScanOnPath(string path, IProgress<ProtectionProgress> progress = null)
|
||||
public static async Task<(bool, string)> RunProtectionScanOnPath(string path, Options options, IProgress<ProtectionProgress> 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);
|
||||
});
|
||||
|
||||
@@ -744,7 +744,7 @@ namespace MPF.Windows
|
||||
|
||||
var progress = new Progress<ProtectionProgress>();
|
||||
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"))
|
||||
|
||||
@@ -223,6 +223,32 @@
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Protection Scanning" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<StackPanel>
|
||||
<UniformGrid Columns="2" Rows="2">
|
||||
<CheckBox VerticalAlignment="Center" Content="Scan Archive Contents"
|
||||
IsChecked="{Binding Options.ScanArchivesForProtection}"
|
||||
ToolTip="Enable scanning archive contents during protection scanning (may drastically increase scanning time but is more accurate)" Margin="0,4"
|
||||
/>
|
||||
|
||||
<CheckBox VerticalAlignment="Center" Content="Include Executable Packers"
|
||||
IsChecked="{Binding Options.ScanPackersForProtection}"
|
||||
ToolTip="Include executable packers in outputted protections" Margin="0,4"
|
||||
/>
|
||||
|
||||
<CheckBox VerticalAlignment="Center" Content="Force Scanning All Files"
|
||||
IsChecked="{Binding Options.ForceScanningForProtection}"
|
||||
ToolTip="Force scanning all files even if they're not executables" Margin="0,4"
|
||||
/>
|
||||
|
||||
<CheckBox VerticalAlignment="Center" Content="Include Debug Information"
|
||||
IsChecked="{Binding Options.IncludeDebugProtectionInformation}"
|
||||
ToolTip="Include debug information during protection scans" Margin="0,4"
|
||||
/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Aaru" Style="{DynamicResource CustomTabItemStyle}">
|
||||
<UniformGrid Columns="2" Rows="3">
|
||||
<CheckBox VerticalAlignment="Center" Content="Enable Debug Output"
|
||||
|
||||
Reference in New Issue
Block a user