Simplify construction and access in Scanner

This commit is contained in:
Matt Nadareski
2022-05-01 14:11:09 -07:00
parent 802734b515
commit aac3c391db
2 changed files with 20 additions and 19 deletions

View File

@@ -12,25 +12,25 @@ namespace BurnOutSharp
{
public class Scanner
{
/// <summary>
/// Optional progress callback during scanning
/// </summary>
public IProgress<ProtectionProgress> FileProgress { get; set; }
/// <summary>
/// Determines if debug information is output or not
/// </summary>
public bool IncludeDebug { get; set; }
/// <summary>
/// Determines whether archives are decompressed and scanned
/// </summary>
public bool ScanArchives { get; set; }
public bool ScanArchives { get; private set; }
/// <summary>
/// Determines if packers are counted as detected protections or not
/// </summary>
public bool ScanPackers { get; set; }
public bool ScanPackers { get; private set; }
/// <summary>
/// Determines if debug information is output or not
/// </summary>
public bool IncludeDebug { get; private set; }
/// <summary>
/// Optional progress callback during scanning
/// </summary>
public IProgress<ProtectionProgress> FileProgress { get; private set; }
/// <summary>
/// Cache for all IPathCheck types
@@ -40,9 +40,15 @@ namespace BurnOutSharp
/// <summary>
/// Constructor
/// </summary>
/// <param name="scanArchives">Enable scanning archive contents</param>
/// <param name="scanPackers">Enable including packers in output</param>
/// <param name="includeDebug">Enable including debug information</param>
/// <param name="fileProgress">Optional progress callback</param>
public Scanner(IProgress<ProtectionProgress> fileProgress = null)
public Scanner(bool scanArchives, bool scanPackers, bool includeDebug, IProgress<ProtectionProgress> fileProgress = null)
{
ScanArchives = scanArchives;
ScanPackers = scanPackers;
IncludeDebug = includeDebug;
FileProgress = fileProgress;
}

View File

@@ -63,12 +63,7 @@ namespace Test
}
// Create scanner for all paths
var scanner = new Scanner(p)
{
IncludeDebug = debug,
ScanArchives = archives,
ScanPackers = packers,
};
var scanner = new Scanner(archives, packers, debug, p);
// Loop through the input paths
foreach (string inputPath in inputPaths)