2019-02-10 14:47:53 -08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
2025-10-06 10:32:16 -04:00
|
|
|
|
using MPF.Check.Features;
|
|
|
|
|
|
|
2024-07-24 11:45:12 -04:00
|
|
|
|
#if NET40
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
#endif
|
2024-05-23 15:40:12 -04:00
|
|
|
|
using MPF.Frontend;
|
2024-05-28 14:19:59 -04:00
|
|
|
|
using MPF.Frontend.Tools;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
using SabreTools.RedumpLib;
|
2023-09-05 00:08:09 -04:00
|
|
|
|
using SabreTools.RedumpLib.Data;
|
|
|
|
|
|
using SabreTools.RedumpLib.Web;
|
2019-02-10 14:47:53 -08:00
|
|
|
|
|
2020-11-10 17:43:21 -08:00
|
|
|
|
namespace MPF.Check
|
2019-02-10 14:47:53 -08:00
|
|
|
|
{
|
|
|
|
|
|
public class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
// Create a default options object
|
2025-06-02 10:19:48 -04:00
|
|
|
|
var options = new Options()
|
2024-06-26 03:24:44 -04:00
|
|
|
|
{
|
2024-08-06 14:18:08 -04:00
|
|
|
|
// Internal Program
|
2024-06-26 03:24:44 -04:00
|
|
|
|
InternalProgram = InternalProgram.NONE,
|
2024-08-06 14:09:05 -04:00
|
|
|
|
|
2024-08-06 14:18:08 -04:00
|
|
|
|
// Extra Dumping Options
|
2024-08-06 14:09:05 -04:00
|
|
|
|
ScanForProtection = false,
|
|
|
|
|
|
AddPlaceholders = true,
|
|
|
|
|
|
PullAllInformation = false,
|
2024-06-26 03:24:44 -04:00
|
|
|
|
AddFilenameSuffix = false,
|
|
|
|
|
|
OutputSubmissionJSON = false,
|
2024-07-19 10:20:45 -04:00
|
|
|
|
IncludeArtifacts = false,
|
2024-06-26 03:24:44 -04:00
|
|
|
|
CompressLogFiles = false,
|
|
|
|
|
|
DeleteUnnecessaryFiles = false,
|
2024-08-06 14:09:05 -04:00
|
|
|
|
CreateIRDAfterDumping = false,
|
|
|
|
|
|
|
2024-08-06 14:18:08 -04:00
|
|
|
|
// Protection Scanning Options
|
2024-08-06 14:16:44 -04:00
|
|
|
|
ScanArchivesForProtection = true,
|
|
|
|
|
|
IncludeDebugProtectionInformation = false,
|
2024-08-06 14:09:05 -04:00
|
|
|
|
HideDriveLetters = false,
|
|
|
|
|
|
|
2024-08-06 14:18:08 -04:00
|
|
|
|
// Redump Login Information
|
2025-06-02 09:35:26 -04:00
|
|
|
|
RetrieveMatchInformation = true,
|
2024-08-06 14:09:05 -04:00
|
|
|
|
RedumpUsername = null,
|
|
|
|
|
|
RedumpPassword = null,
|
2024-06-26 03:24:44 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
2022-04-12 12:06:45 -07:00
|
|
|
|
// Try processing the standalone arguments
|
2023-10-11 12:54:40 -04:00
|
|
|
|
bool? standaloneProcessed = OptionsLoader.ProcessStandaloneArguments(args);
|
|
|
|
|
|
if (standaloneProcessed != false)
|
2023-10-10 15:15:42 -04:00
|
|
|
|
{
|
2023-10-11 12:54:40 -04:00
|
|
|
|
if (standaloneProcessed == null)
|
|
|
|
|
|
DisplayHelp();
|
2019-04-04 00:37:17 -07:00
|
|
|
|
return;
|
2023-10-10 15:15:42 -04:00
|
|
|
|
}
|
2019-04-04 00:37:17 -07:00
|
|
|
|
|
2025-04-30 16:49:28 -04:00
|
|
|
|
// Setup common outputs
|
|
|
|
|
|
CommandOptions opts;
|
|
|
|
|
|
RedumpSystem? knownSystem;
|
|
|
|
|
|
int startIndex;
|
|
|
|
|
|
|
|
|
|
|
|
// Use interactive mode
|
2025-10-06 10:32:16 -04:00
|
|
|
|
if (args.Length > 0 && (args[0] == "i" || args[0] == "interactive"))
|
2023-10-10 15:15:42 -04:00
|
|
|
|
{
|
2025-04-30 16:49:28 -04:00
|
|
|
|
startIndex = 1;
|
2025-10-06 10:32:16 -04:00
|
|
|
|
var interactive = new InteractiveFeature();
|
|
|
|
|
|
interactive.Execute();
|
|
|
|
|
|
|
|
|
|
|
|
opts = interactive.CommandOptions;
|
|
|
|
|
|
options = interactive.Options;
|
|
|
|
|
|
knownSystem = interactive.System;
|
2025-04-30 16:49:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Use normal commandline parameters
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Try processing the common arguments
|
2025-06-17 15:36:23 -04:00
|
|
|
|
bool success = OptionsLoader.ProcessCommonArguments(args, out knownSystem, out var error);
|
2025-04-30 16:49:28 -04:00
|
|
|
|
if (!success)
|
|
|
|
|
|
{
|
|
|
|
|
|
DisplayHelp(error);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Loop through and process options
|
2025-06-17 17:18:12 -04:00
|
|
|
|
startIndex = 1;
|
2025-04-30 16:49:28 -04:00
|
|
|
|
opts = LoadFromArguments(args, options, ref startIndex);
|
2023-10-10 15:15:42 -04:00
|
|
|
|
}
|
2019-04-04 00:37:17 -07:00
|
|
|
|
|
2024-06-26 03:24:44 -04:00
|
|
|
|
if (options.InternalProgram == InternalProgram.NONE)
|
2023-08-15 00:30:30 -04:00
|
|
|
|
{
|
|
|
|
|
|
DisplayHelp("A program name needs to be provided");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2019-05-14 01:46:10 -07:00
|
|
|
|
|
2022-04-12 11:27:10 -07:00
|
|
|
|
// Validate the supplied credentials
|
2025-06-01 20:36:18 -04:00
|
|
|
|
if (options.RetrieveMatchInformation
|
|
|
|
|
|
&& !string.IsNullOrEmpty(options.RedumpUsername)
|
|
|
|
|
|
&& !string.IsNullOrEmpty(options.RedumpPassword))
|
2024-10-18 13:04:53 -04:00
|
|
|
|
{
|
2024-12-23 20:23:25 -05:00
|
|
|
|
bool? validated = RedumpClient.ValidateCredentials(options.RedumpUsername!, options.RedumpPassword!).GetAwaiter().GetResult();
|
|
|
|
|
|
string message = validated switch
|
|
|
|
|
|
{
|
|
|
|
|
|
true => "Redump username and password accepted!",
|
|
|
|
|
|
false => "Redump username and password denied!",
|
|
|
|
|
|
null => "An error occurred validating your credentials!",
|
|
|
|
|
|
};
|
2024-10-18 13:04:53 -04:00
|
|
|
|
|
2025-06-01 20:36:18 -04:00
|
|
|
|
Console.WriteLine(message);
|
2024-12-23 20:23:25 -05:00
|
|
|
|
}
|
2020-06-16 11:16:39 -07:00
|
|
|
|
|
2019-02-10 14:47:53 -08:00
|
|
|
|
// Loop through all the rest of the args
|
2019-05-14 01:46:10 -07:00
|
|
|
|
for (int i = startIndex; i < args.Length; i++)
|
2019-02-10 14:47:53 -08:00
|
|
|
|
{
|
2019-03-30 21:44:57 -07:00
|
|
|
|
// Check for a file
|
2020-06-16 13:25:45 -07:00
|
|
|
|
if (!File.Exists(args[i].Trim('"')))
|
2019-02-10 14:47:53 -08:00
|
|
|
|
{
|
2020-06-16 13:25:45 -07:00
|
|
|
|
DisplayHelp($"{args[i].Trim('"')} does not exist");
|
2019-02-10 14:47:53 -08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-04-20 22:03:23 -07:00
|
|
|
|
// Get the full file path
|
2020-06-16 13:25:45 -07:00
|
|
|
|
string filepath = Path.GetFullPath(args[i].Trim('"'));
|
2019-04-20 22:03:23 -07:00
|
|
|
|
|
2019-02-10 14:47:53 -08:00
|
|
|
|
// Now populate an environment
|
2023-10-10 23:22:21 -04:00
|
|
|
|
Drive? drive = null;
|
2024-06-25 17:29:32 -04:00
|
|
|
|
if (!string.IsNullOrEmpty(opts.DevicePath))
|
|
|
|
|
|
drive = Drive.Create(null, opts.DevicePath!);
|
2020-08-07 21:15:36 -07:00
|
|
|
|
|
2025-06-17 15:36:23 -04:00
|
|
|
|
var env = new DumpEnvironment(options,
|
|
|
|
|
|
filepath,
|
|
|
|
|
|
drive,
|
|
|
|
|
|
knownSystem,
|
|
|
|
|
|
internalProgram: null);
|
|
|
|
|
|
env.SetProcessor();
|
2019-02-10 14:47:53 -08:00
|
|
|
|
|
|
|
|
|
|
// Finally, attempt to do the output dance
|
2024-12-18 22:55:53 -05:00
|
|
|
|
var result = env.VerifyAndSaveDumpOutput(seedInfo: opts.Seed)
|
2024-11-21 13:27:57 -05:00
|
|
|
|
.ConfigureAwait(false).GetAwaiter().GetResult();
|
2019-02-10 14:47:53 -08:00
|
|
|
|
Console.WriteLine(result.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-04-04 00:37:17 -07:00
|
|
|
|
/// <summary>
|
2020-11-10 17:43:21 -08:00
|
|
|
|
/// Display help for MPF.Check
|
2019-04-04 00:37:17 -07:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="error">Error string to prefix the help text with</param>
|
2023-10-10 23:22:21 -04:00
|
|
|
|
private static void DisplayHelp(string? error = null)
|
2019-02-10 14:47:53 -08:00
|
|
|
|
{
|
|
|
|
|
|
if (error != null)
|
|
|
|
|
|
Console.WriteLine(error);
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Usage:");
|
2025-06-17 15:36:23 -04:00
|
|
|
|
Console.WriteLine("MPF.Check <system> [options] </path/to/output.cue/iso> ...");
|
2019-02-10 14:47:53 -08:00
|
|
|
|
Console.WriteLine();
|
2020-08-07 21:15:36 -07:00
|
|
|
|
Console.WriteLine("Standalone Options:");
|
2025-10-06 10:11:44 -04:00
|
|
|
|
Console.WriteLine("?, h, help Show this help text");
|
|
|
|
|
|
Console.WriteLine("version Print the program version");
|
|
|
|
|
|
Console.WriteLine("lc, listcodes List supported comment/content site codes");
|
|
|
|
|
|
Console.WriteLine("lm, listmedia List supported media types");
|
|
|
|
|
|
Console.WriteLine("ls, listsystems List supported system types");
|
|
|
|
|
|
Console.WriteLine("lp, listprograms List supported dumping program outputs");
|
2025-10-06 10:32:16 -04:00
|
|
|
|
Console.WriteLine("i, interactive Enable interactive mode");
|
2020-05-07 14:23:49 -07:00
|
|
|
|
Console.WriteLine();
|
2022-04-12 11:27:10 -07:00
|
|
|
|
|
2020-08-07 21:15:36 -07:00
|
|
|
|
Console.WriteLine("Check Options:");
|
2024-06-25 16:48:24 -04:00
|
|
|
|
Console.WriteLine("-u, --use <program> Dumping program output type [REQUIRED]");
|
2024-08-06 14:09:05 -04:00
|
|
|
|
Console.WriteLine(" --load-seed <path> Load a seed submission JSON for user information");
|
|
|
|
|
|
Console.WriteLine(" --no-placeholders Disable placeholder values in submission info");
|
|
|
|
|
|
Console.WriteLine(" --create-ird Create IRD from output files (PS3 only)");
|
2025-06-02 09:35:26 -04:00
|
|
|
|
Console.WriteLine(" --no-retrieve Disable retrieving match information from Redump");
|
|
|
|
|
|
Console.WriteLine("-c, --credentials <user> <pw> Redump username and password (incompatible with --no-retrieve)");
|
2024-07-19 10:20:45 -04:00
|
|
|
|
Console.WriteLine(" --pull-all Pull all information from Redump (requires --credentials)");
|
2024-06-25 16:48:24 -04:00
|
|
|
|
Console.WriteLine("-p, --path <drivepath> Physical drive path for additional checks");
|
|
|
|
|
|
Console.WriteLine("-s, --scan Enable copy protection scan (requires --path)");
|
2024-08-06 14:16:44 -04:00
|
|
|
|
Console.WriteLine(" --disable-archives Disable scanning archives (requires --scan)");
|
|
|
|
|
|
Console.WriteLine(" --enable-debug Enable debug protection information (requires --scan)");
|
2024-07-19 15:55:23 +01:00
|
|
|
|
Console.WriteLine(" --hide-drive-letters Hide drive letters from scan output (requires --scan)");
|
2024-06-25 16:48:24 -04:00
|
|
|
|
Console.WriteLine("-x, --suffix Enable adding filename suffix");
|
|
|
|
|
|
Console.WriteLine("-j, --json Enable submission JSON output");
|
2024-07-19 10:20:45 -04:00
|
|
|
|
Console.WriteLine(" --include-artifacts Include artifacts in JSON (requires --json)");
|
2024-06-25 16:48:24 -04:00
|
|
|
|
Console.WriteLine("-z, --zip Enable log file compression");
|
|
|
|
|
|
Console.WriteLine("-d, --delete Enable unnecessary file deletion");
|
|
|
|
|
|
Console.WriteLine();
|
2025-05-05 13:05:35 -04:00
|
|
|
|
Console.WriteLine("WARNING: Check will overwrite both any existing submission information files as well");
|
|
|
|
|
|
Console.WriteLine("as any log archives. Please make backups of those if you need to before running Check.");
|
|
|
|
|
|
Console.WriteLine();
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Load the current set of options from application arguments
|
|
|
|
|
|
/// </summary>
|
2025-06-02 10:19:48 -04:00
|
|
|
|
private static CommandOptions LoadFromArguments(string[] args, Options options, ref int startIndex)
|
2024-06-25 16:48:24 -04:00
|
|
|
|
{
|
2024-06-25 17:29:32 -04:00
|
|
|
|
// Create return values
|
|
|
|
|
|
var opts = new CommandOptions();
|
|
|
|
|
|
|
2024-06-25 16:48:24 -04:00
|
|
|
|
// These values require multiple parts to be active
|
2024-08-06 14:16:44 -04:00
|
|
|
|
bool scan = false,
|
|
|
|
|
|
enableArchives = true,
|
|
|
|
|
|
enableDebug = false,
|
|
|
|
|
|
hideDriveLetters = false;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
|
|
|
|
|
|
// If we have no arguments, just return
|
|
|
|
|
|
if (args == null || args.Length == 0)
|
2024-11-03 23:14:22 -05:00
|
|
|
|
{
|
|
|
|
|
|
startIndex = 0;
|
|
|
|
|
|
return opts;
|
|
|
|
|
|
}
|
2024-06-25 16:48:24 -04:00
|
|
|
|
|
|
|
|
|
|
// If we have an invalid start index, just return
|
|
|
|
|
|
if (startIndex < 0 || startIndex >= args.Length)
|
2024-11-03 23:14:22 -05:00
|
|
|
|
return opts;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
|
|
|
|
|
|
// Loop through the arguments and parse out values
|
|
|
|
|
|
for (; startIndex < args.Length; startIndex++)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Use specific program
|
|
|
|
|
|
if (args[startIndex].StartsWith("-u=") || args[startIndex].StartsWith("--use="))
|
|
|
|
|
|
{
|
|
|
|
|
|
string internalProgram = args[startIndex].Split('=')[1];
|
2024-12-31 13:43:57 -05:00
|
|
|
|
options.InternalProgram = internalProgram.ToInternalProgram();
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
else if (args[startIndex] == "-u" || args[startIndex] == "--use")
|
|
|
|
|
|
{
|
|
|
|
|
|
string internalProgram = args[startIndex + 1];
|
2024-12-31 13:43:57 -05:00
|
|
|
|
options.InternalProgram = internalProgram.ToInternalProgram();
|
2024-06-25 16:48:24 -04:00
|
|
|
|
startIndex++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-06 14:09:05 -04:00
|
|
|
|
// Include seed info file
|
|
|
|
|
|
else if (args[startIndex].StartsWith("--load-seed="))
|
|
|
|
|
|
{
|
|
|
|
|
|
string seedInfo = args[startIndex].Split('=')[1];
|
|
|
|
|
|
opts.Seed = Builder.CreateFromFile(seedInfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (args[startIndex] == "--load-seed")
|
|
|
|
|
|
{
|
|
|
|
|
|
string seedInfo = args[startIndex + 1];
|
|
|
|
|
|
opts.Seed = Builder.CreateFromFile(seedInfo);
|
|
|
|
|
|
startIndex++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Disable placeholder values in submission info
|
|
|
|
|
|
else if (args[startIndex].Equals("--no-placeholders"))
|
|
|
|
|
|
{
|
|
|
|
|
|
options.AddPlaceholders = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Create IRD from output files (PS3 only)
|
|
|
|
|
|
else if (args[startIndex].Equals("--create-ird"))
|
|
|
|
|
|
{
|
|
|
|
|
|
options.CreateIRDAfterDumping = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-02 09:35:26 -04:00
|
|
|
|
// Retrieve Redump match information
|
|
|
|
|
|
else if (args[startIndex] == "--no-retrieve")
|
|
|
|
|
|
{
|
|
|
|
|
|
options.RetrieveMatchInformation = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-25 16:48:24 -04:00
|
|
|
|
// Redump login
|
|
|
|
|
|
else if (args[startIndex].StartsWith("-c=") || args[startIndex].StartsWith("--credentials="))
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] credentials = args[startIndex].Split('=')[1].Split(';');
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.RedumpUsername = credentials[0];
|
|
|
|
|
|
options.RedumpPassword = credentials[1];
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
else if (args[startIndex] == "-c" || args[startIndex] == "--credentials")
|
|
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.RedumpUsername = args[startIndex + 1];
|
|
|
|
|
|
options.RedumpPassword = args[startIndex + 2];
|
2024-06-25 16:48:24 -04:00
|
|
|
|
startIndex += 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Pull all information (requires Redump login)
|
2024-07-19 10:20:45 -04:00
|
|
|
|
else if (args[startIndex].Equals("--pull-all"))
|
2024-06-25 16:48:24 -04:00
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.PullAllInformation = true;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Use a device path for physical checks
|
|
|
|
|
|
else if (args[startIndex].StartsWith("-p=") || args[startIndex].StartsWith("--path="))
|
|
|
|
|
|
{
|
2024-06-25 17:29:32 -04:00
|
|
|
|
opts.DevicePath = args[startIndex].Split('=')[1];
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
else if (args[startIndex] == "-p" || args[startIndex] == "--path")
|
|
|
|
|
|
{
|
2024-06-25 17:29:32 -04:00
|
|
|
|
opts.DevicePath = args[startIndex + 1];
|
2024-06-25 16:48:24 -04:00
|
|
|
|
startIndex++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Scan for protection (requires device path)
|
|
|
|
|
|
else if (args[startIndex].Equals("-s") || args[startIndex].Equals("--scan"))
|
|
|
|
|
|
{
|
|
|
|
|
|
scan = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-06 14:16:44 -04:00
|
|
|
|
// Disable scanning archives (requires --scan)
|
|
|
|
|
|
else if (args[startIndex].Equals("--disable-archives"))
|
|
|
|
|
|
{
|
|
|
|
|
|
enableArchives = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Enable debug protection information (requires --scan)
|
|
|
|
|
|
else if (args[startIndex].Equals("--enable-debug"))
|
|
|
|
|
|
{
|
|
|
|
|
|
enableDebug = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-19 15:55:23 +01:00
|
|
|
|
// Hide drive letters from scan output (requires --scan)
|
2024-07-19 10:20:45 -04:00
|
|
|
|
else if (args[startIndex].Equals("--hide-drive-letters"))
|
2024-06-25 16:48:24 -04:00
|
|
|
|
{
|
|
|
|
|
|
hideDriveLetters = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add filename suffix
|
|
|
|
|
|
else if (args[startIndex].Equals("-x") || args[startIndex].Equals("--suffix"))
|
|
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.AddFilenameSuffix = true;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Output submission JSON
|
|
|
|
|
|
else if (args[startIndex].Equals("-j") || args[startIndex].Equals("--json"))
|
|
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.OutputSubmissionJSON = true;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-30 16:49:28 -04:00
|
|
|
|
// Include JSON artifacts
|
2024-07-19 10:20:45 -04:00
|
|
|
|
else if (args[startIndex].Equals("--include-artifacts"))
|
|
|
|
|
|
{
|
|
|
|
|
|
options.IncludeArtifacts = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-25 16:48:24 -04:00
|
|
|
|
// Compress log and extraneous files
|
|
|
|
|
|
else if (args[startIndex].Equals("-z") || args[startIndex].Equals("--zip"))
|
|
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.CompressLogFiles = true;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-30 16:49:28 -04:00
|
|
|
|
// Delete unnecessary files
|
2024-06-25 16:48:24 -04:00
|
|
|
|
else if (args[startIndex].Equals("-d") || args[startIndex].Equals("--delete"))
|
|
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.DeleteUnnecessaryFiles = true;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Default, we fall out
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2022-04-12 11:27:10 -07:00
|
|
|
|
}
|
2024-06-25 16:48:24 -04:00
|
|
|
|
|
|
|
|
|
|
// Now deal with the complex options
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.ScanForProtection = scan && !string.IsNullOrEmpty(opts.DevicePath);
|
2024-08-06 14:16:44 -04:00
|
|
|
|
options.ScanArchivesForProtection = enableArchives && scan && !string.IsNullOrEmpty(opts.DevicePath);
|
|
|
|
|
|
options.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(opts.DevicePath);
|
2024-06-26 03:24:44 -04:00
|
|
|
|
options.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(opts.DevicePath);
|
2024-06-25 17:29:32 -04:00
|
|
|
|
|
2024-11-03 23:14:22 -05:00
|
|
|
|
return opts;
|
2024-06-25 17:29:32 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-26 03:24:44 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents commandline options
|
|
|
|
|
|
/// </summary>
|
2025-10-06 10:32:16 -04:00
|
|
|
|
internal class CommandOptions
|
2024-06-25 17:29:32 -04:00
|
|
|
|
{
|
2024-06-26 03:24:44 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Seed submission info from an input file
|
|
|
|
|
|
/// </summary>
|
2024-06-25 17:29:32 -04:00
|
|
|
|
public SubmissionInfo? Seed { get; set; } = null;
|
2024-06-25 16:48:24 -04:00
|
|
|
|
|
2024-06-26 03:24:44 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Path to the device to scan
|
|
|
|
|
|
/// </summary>
|
2024-06-25 17:29:32 -04:00
|
|
|
|
public string? DevicePath { get; set; } = null;
|
2019-02-10 14:47:53 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|