mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-11 05:35:15 +00:00
72 lines
2.2 KiB
C#
72 lines
2.2 KiB
C#
using System;
|
|
using BinaryObjectScanner;
|
|
|
|
namespace Test
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
#if NET462_OR_GREATER || NETCOREAPP
|
|
// Register the codepages
|
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
|
#endif
|
|
|
|
// Create progress indicator
|
|
var fileProgress = new Progress<ProtectionProgress>();
|
|
fileProgress.ProgressChanged += Protector.Changed;
|
|
|
|
// Get the options from the arguments
|
|
var options = Options.ParseOptions(args);
|
|
|
|
// If we have an invalid state
|
|
if (options == null)
|
|
{
|
|
Options.DisplayHelp();
|
|
Console.WriteLine("Press enter to close the program...");
|
|
Console.ReadLine();
|
|
return;
|
|
}
|
|
|
|
// Create extractor for all paths
|
|
var extractor = new Extractor(options.Debug);
|
|
|
|
// Create printer for all paths
|
|
var printer = new Printer(options.Debug);
|
|
|
|
// Create scanner for all paths
|
|
var scanner = new Scanner(
|
|
options.ScanArchives,
|
|
options.ScanContents,
|
|
options.ScanGameEngines,
|
|
options.ScanPackers,
|
|
options.ScanPaths,
|
|
options.Debug,
|
|
fileProgress);
|
|
|
|
// Loop through the input paths
|
|
foreach (string inputPath in options.InputPaths)
|
|
{
|
|
// Extraction
|
|
if (options.EnableExtraction)
|
|
extractor.ExtractPath(inputPath, options.OutputPath);
|
|
|
|
// Information printing
|
|
if (options.EnableInformation)
|
|
#if NETFRAMEWORK
|
|
printer.PrintPathInfo(inputPath, false, options.Debug);
|
|
#else
|
|
printer.PrintPathInfo(inputPath, options.Json, options.Debug);
|
|
#endif
|
|
|
|
// Scanning
|
|
if (options.EnableScanning)
|
|
Protector.GetAndWriteProtections(scanner, inputPath);
|
|
}
|
|
|
|
Console.WriteLine("Press enter to close the program...");
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
}
|