Files
BinaryObjectScanner/Test/Program.cs

72 lines
2.2 KiB
C#
Raw Permalink Normal View History

using System;
2023-09-18 00:33:24 -04:00
using BinaryObjectScanner;
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
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;
}
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);
// 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)
2024-05-15 12:24:40 -04:00
extractor.ExtractPath(inputPath, options.OutputPath);
2023-01-04 10:05:21 -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);
#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();
}
}
}