Files
BinaryObjectScanner/Test/Program.cs

65 lines
1.9 KiB
C#
Raw Normal View History

using System;
2022-12-08 23:38:28 -08:00
using System.Text;
using BurnOutSharp;
namespace Test
{
class Program
{
static void Main(string[] args)
{
2022-12-08 23:38:28 -08:00
// Register the codepages
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
2020-10-31 14:00:31 -07:00
// Create progress indicator
var fileProgress = new Progress<ProtectionProgress>();
fileProgress.ProgressChanged += Protector.Changed;
2020-10-31 14:00:31 -07:00
// Get the options from the arguments
var options = Options.ParseOptions(args);
2022-03-02 10:17:50 -08:00
// If we have an invalid state
if (options == null)
2022-03-02 10:17:50 -08:00
{
Options.DisplayHelp();
2022-03-02 10:17:50 -08:00
Console.WriteLine("Press enter to close the program...");
Console.ReadLine();
return;
}
// Create scanner for all paths
var scanner = new Scanner(
options.ScanArchives,
options.ScanContents,
2023-03-21 10:42:14 -04:00
options.ScanGameEngines,
options.ScanPackers,
options.ScanPaths,
options.Debug,
fileProgress);
2020-10-31 14:00:31 -07:00
// Loop through the input paths
foreach (string inputPath in options.InputPaths)
2023-01-04 10:05:21 -08:00
{
// Extraction
if (options.EnableExtraction)
Extractor.ExtractPath(inputPath, options.OutputPath);
2023-01-04 10:05:21 -08:00
// Information printing
if (options.EnableInformation)
#if NET6_0_OR_GREATER
Printer.PrintPathInfo(inputPath, options.Json, options.Debug);
#else
Printer.PrintPathInfo(inputPath, false, options.Debug);
#endif
2023-01-04 10:05:21 -08:00
// Scanning
if (options.EnableScanning)
2023-01-04 10:23:03 -08:00
Protector.GetAndWriteProtections(scanner, inputPath);
2021-03-23 16:55:19 -07:00
}
Console.WriteLine("Press enter to close the program...");
2021-03-23 16:55:19 -07:00
Console.ReadLine();
}
}
}