Create separate Options object

This commit is contained in:
Matt Nadareski
2023-03-09 13:26:20 -05:00
parent 70bdb8f37d
commit d351f1d08e
2 changed files with 58 additions and 26 deletions

33
BurnOutSharp/Options.cs Normal file
View File

@@ -0,0 +1,33 @@
namespace BurnOutSharp
{
/// <summary>
/// Scanning options
/// </summary>
public class Options
{
/// <summary>
/// Determines whether archives are decompressed and scanned
/// </summary>
public bool ScanArchives { get; set; }
/// <summary>
/// Determines if content matches are used or not
/// </summary>
public bool ScanContents { get; set; }
/// <summary>
/// Determines if packers are counted as detected protections or not
/// </summary>
public bool ScanPackers { get; set; }
/// <summary>
/// Determines if path matches are used or not
/// </summary>
public bool ScanPaths { get; set; }
/// <summary>
/// Determines if debug information is output or not
/// </summary>
public bool IncludeDebug { get; set; }
}
}

View File

@@ -15,30 +15,25 @@ namespace BurnOutSharp
{
#region Options
/// <summary>
/// Determines whether archives are decompressed and scanned
/// </summary>
public bool ScanArchives { get; private set; }
/// <inheritdoc cref="Options.ScanArchives"/>
public bool ScanArchives => options?.ScanArchives ?? false;
/// <inheritdoc cref="Options.ScanContents"/>
public bool ScanContents => options?.ScanContents ?? false;
/// <inheritdoc cref="Options.ScanPaths"/>
public bool ScanPackers => options?.ScanPackers ?? false;
/// <inheritdoc cref="Options.ScanArchives"/>
public bool ScanPaths => options?.ScanPaths ?? false;
/// <inheritdoc cref="Options.IncludeDebug"/>
public bool IncludeDebug => options?.IncludeDebug ?? false;
/// <summary>
/// Determines if content matches are used or not
/// Options object for configuration
/// </summary>
public bool ScanContents { get; private set; }
/// <summary>
/// Determines if packers are counted as detected protections or not
/// </summary>
public bool ScanPackers { get; private set; }
/// <summary>
/// Determines if path matches are used or not
/// </summary>
public bool ScanPaths { get; private set; }
/// <summary>
/// Determines if debug information is output or not
/// </summary>
public bool IncludeDebug { get; private set; }
private readonly Options options;
#endregion
@@ -58,11 +53,15 @@ namespace BurnOutSharp
/// <param name="fileProgress">Optional progress callback</param>
public Scanner(bool scanArchives, bool scanContents, bool scanPackers, bool scanPaths, bool includeDebug, IProgress<ProtectionProgress> fileProgress = null)
{
ScanArchives = scanArchives;
ScanContents = scanContents;
ScanPackers = scanPackers;
ScanPaths = scanPaths;
IncludeDebug = includeDebug;
this.options = new Options
{
ScanArchives = scanArchives,
ScanContents = scanContents,
ScanPackers = scanPackers,
ScanPaths = scanPaths,
IncludeDebug = includeDebug,
};
this.fileProgress = fileProgress;
// Register the codepages