2018-07-16 17:10:45 -07:00
|
|
|
|
using System;
|
2022-12-08 23:38:28 -08:00
|
|
|
|
using System.Text;
|
2018-07-16 17:10:45 -07:00
|
|
|
|
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
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
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)
|
|
|
|
|
|
#if NET6_0_OR_GREATER
|
|
|
|
|
|
Printer.PrintPathInfo(inputPath, options.Json, options.Debug);
|
|
|
|
|
|
#else
|
2023-01-16 22:15:45 -08:00
|
|
|
|
Printer.PrintPathInfo(inputPath, false, 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
|
|
|
|
}
|
|
|
|
|
|
}
|