2018-07-16 17:10:45 -07:00
|
|
|
|
using System;
|
2023-09-18 00:33:24 -04:00
|
|
|
|
using BinaryObjectScanner;
|
2018-07-16 17:10:45 -07:00
|
|
|
|
|
|
|
|
|
|
namespace Test
|
|
|
|
|
|
{
|
|
|
|
|
|
class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
|
{
|
2023-11-21 10:17:25 -05:00
|
|
|
|
#if NET462_OR_GREATER || NETCOREAPP
|
2022-12-08 23:38:28 -08:00
|
|
|
|
// Register the codepages
|
2023-11-21 10:17:25 -05:00
|
|
|
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
2023-11-14 16:10:10 -05:00
|
|
|
|
#endif
|
2022-12-08 23:38:28 -08:00
|
|
|
|
|
2020-10-31 14:00:31 -07:00
|
|
|
|
// Create progress indicator
|
2023-01-16 21:52:32 -08:00
|
|
|
|
var fileProgress = new Progress<ProtectionProgress>();
|
|
|
|
|
|
fileProgress.ProgressChanged += Protector.Changed;
|
2020-10-31 14:00:31 -07:00
|
|
|
|
|
2023-01-16 21:52:32 -08:00
|
|
|
|
// Get the options from the arguments
|
|
|
|
|
|
var options = Options.ParseOptions(args);
|
2022-03-02 10:17:50 -08:00
|
|
|
|
|
2023-01-16 21:52:32 -08:00
|
|
|
|
// If we have an invalid state
|
|
|
|
|
|
if (options == null)
|
2022-03-02 10:17:50 -08:00
|
|
|
|
{
|
2023-01-16 21:52:32 -08:00
|
|
|
|
Options.DisplayHelp();
|
2022-03-02 10:17:50 -08:00
|
|
|
|
Console.WriteLine("Press enter to close the program...");
|
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-15 12:24:40 -04:00
|
|
|
|
// Create extractor for all paths
|
|
|
|
|
|
var extractor = new Extractor(options.Debug);
|
|
|
|
|
|
|
|
|
|
|
|
// Create printer for all paths
|
|
|
|
|
|
var printer = new Printer(options.Debug);
|
|
|
|
|
|
|
2021-03-24 20:50:58 -07:00
|
|
|
|
// Create scanner for all paths
|
2023-01-16 21:52:32 -08:00
|
|
|
|
var scanner = new Scanner(
|
|
|
|
|
|
options.ScanArchives,
|
|
|
|
|
|
options.ScanContents,
|
2023-03-21 10:42:14 -04:00
|
|
|
|
options.ScanGameEngines,
|
2023-01-16 21:52:32 -08:00
|
|
|
|
options.ScanPackers,
|
|
|
|
|
|
options.ScanPaths,
|
|
|
|
|
|
options.Debug,
|
|
|
|
|
|
fileProgress);
|
2020-10-31 14:00:31 -07:00
|
|
|
|
|
2023-01-16 21:52:32 -08:00
|
|
|
|
// Loop through the input paths
|
|
|
|
|
|
foreach (string inputPath in options.InputPaths)
|
2023-01-04 10:05:21 -08:00
|
|
|
|
{
|
2023-01-16 21:52:32 -08:00
|
|
|
|
// Extraction
|
|
|
|
|
|
if (options.EnableExtraction)
|
2024-05-15 12:24:40 -04:00
|
|
|
|
extractor.ExtractPath(inputPath, options.OutputPath);
|
2023-01-04 10:05:21 -08:00
|
|
|
|
|
2023-01-16 21:52:32 -08:00
|
|
|
|
// Information printing
|
|
|
|
|
|
if (options.EnableInformation)
|
2023-11-08 11:59:50 -05:00
|
|
|
|
#if NETFRAMEWORK
|
2024-05-15 12:24:40 -04:00
|
|
|
|
printer.PrintPathInfo(inputPath, false, options.Debug);
|
2023-09-18 13:56:07 -04:00
|
|
|
|
#else
|
2024-05-15 12:24:40 -04:00
|
|
|
|
printer.PrintPathInfo(inputPath, options.Json, options.Debug);
|
2023-01-16 21:52:32 -08:00
|
|
|
|
#endif
|
2023-01-04 10:05:21 -08:00
|
|
|
|
|
2023-01-16 21:52:32 -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
|
|
|
|
}
|
2020-10-31 14:16:51 -07:00
|
|
|
|
|
2021-03-24 20:50:58 -07:00
|
|
|
|
Console.WriteLine("Press enter to close the program...");
|
2021-03-23 16:55:19 -07:00
|
|
|
|
Console.ReadLine();
|
|
|
|
|
|
}
|
2018-07-16 17:10:45 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|