diff --git a/CHANGELIST.md b/CHANGELIST.md
index 4abeebe2..ec18bdef 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -5,6 +5,7 @@
- Rename log zip on collision
- Update packages
- Use CommandLine library for CLI executables
+- Create interactive mode features
### 3.4.2 (2025-09-30)
diff --git a/MPF.CLI/Features/InteractiveFeature.cs b/MPF.CLI/Features/InteractiveFeature.cs
new file mode 100644
index 00000000..40d83f79
--- /dev/null
+++ b/MPF.CLI/Features/InteractiveFeature.cs
@@ -0,0 +1,195 @@
+
+using System;
+using System.IO;
+using MPF.Frontend;
+using MPF.Frontend.Tools;
+using SabreTools.RedumpLib.Data;
+
+namespace MPF.CLI.Features
+{
+ internal sealed class InteractiveFeature : SabreTools.CommandLine.Feature
+ {
+ #region Feature Definition
+
+ public const string DisplayName = "interactive";
+
+ private static readonly string[] _flags = ["i", "interactive"];
+
+ private const string _description = "Enable interactive mode";
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Progrma-specific options
+ ///
+ public Program.CommandOptions CommandOptions { get; private set; }
+
+ ///
+ /// User-defined options
+ ///
+ public Options Options { get; }
+
+ ///
+ /// Currently-selected system
+ ///
+ public RedumpSystem? System { get; private set; }
+
+ #endregion
+
+ public InteractiveFeature()
+ : base(DisplayName, _flags, _description)
+ {
+ CommandOptions = new Program.CommandOptions();
+ Options = OptionsLoader.LoadFromConfig();
+ }
+
+ public override bool Execute()
+ {
+ // Create return values
+ CommandOptions = new Program.CommandOptions
+ {
+ MediaType = MediaType.NONE,
+ FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", "track.bin"),
+ };
+ System = Options.DefaultSystem;
+
+ // Create state values
+ string? result = string.Empty;
+
+ root:
+ Console.Clear();
+ Console.WriteLine("MPF.CLI Interactive Mode - Main Menu");
+ Console.WriteLine("-------------------------");
+ Console.WriteLine();
+ Console.WriteLine($"1) Set system (Currently '{System}')");
+ Console.WriteLine($"2) Set dumping program (Currently '{Options.InternalProgram}')");
+ Console.WriteLine($"3) Set media type (Currently '{CommandOptions.MediaType}')");
+ Console.WriteLine($"4) Set device path (Currently '{CommandOptions.DevicePath}')");
+ Console.WriteLine($"5) Set mounted path (Currently '{CommandOptions.MountedPath}')");
+ Console.WriteLine($"6) Set file path (Currently '{CommandOptions.FilePath}')");
+ Console.WriteLine($"7) Set override speed (Currently '{CommandOptions.DriveSpeed}')");
+ Console.WriteLine($"8) Set custom parameters (Currently '{CommandOptions.CustomParams}')");
+ Console.WriteLine();
+ Console.WriteLine($"Q) Exit the program");
+ Console.WriteLine($"X) Start dumping");
+ Console.Write("> ");
+
+ result = Console.ReadLine();
+ switch (result)
+ {
+ case "1":
+ goto system;
+ case "2":
+ goto dumpingProgram;
+ case "3":
+ goto mediaType;
+ case "4":
+ goto devicePath;
+ case "5":
+ goto mountedPath;
+ case "6":
+ goto filePath;
+ case "7":
+ goto overrideSpeed;
+ case "8":
+ goto customParams;
+
+ case "q":
+ case "Q":
+ Environment.Exit(0);
+ break;
+ case "x":
+ case "X":
+ Console.Clear();
+ goto exit;
+ case "z":
+ case "Z":
+ Console.WriteLine("It is pitch black. You are likely to be eaten by a grue.");
+ Console.Write("> ");
+ Console.ReadLine();
+ goto root;
+ default:
+ Console.WriteLine($"Invalid selection: {result}");
+ Console.ReadLine();
+ goto root;
+ }
+
+ system:
+ Console.WriteLine();
+ Console.WriteLine("Input the system and press Enter:");
+ Console.Write("> ");
+ result = Console.ReadLine();
+ System = Extensions.ToRedumpSystem(result);
+ goto root;
+
+ dumpingProgram:
+ Console.WriteLine();
+ Console.WriteLine("Input the dumping program and press Enter:");
+ Console.Write("> ");
+ result = Console.ReadLine();
+ Options.InternalProgram = result.ToInternalProgram();
+ goto root;
+
+ mediaType:
+ Console.WriteLine();
+ Console.WriteLine("Input the media type and press Enter:");
+ Console.Write("> ");
+ result = Console.ReadLine();
+ CommandOptions.MediaType = OptionsLoader.ToMediaType(result);
+ goto root;
+
+ devicePath:
+ Console.WriteLine();
+ Console.WriteLine("Input the device path and press Enter:");
+ Console.Write("> ");
+ CommandOptions.DevicePath = Console.ReadLine();
+ goto root;
+
+ mountedPath:
+ Console.WriteLine();
+ Console.WriteLine("Input the mounted path and press Enter:");
+ Console.Write("> ");
+ CommandOptions.MountedPath = Console.ReadLine();
+ goto root;
+
+ filePath:
+ Console.WriteLine();
+ Console.WriteLine("Input the file path and press Enter:");
+ Console.Write("> ");
+
+ result = Console.ReadLine();
+ if (!string.IsNullOrEmpty(result))
+ result = Path.GetFullPath(result!);
+
+ CommandOptions.FilePath = result;
+ goto root;
+
+ overrideSpeed:
+ Console.WriteLine();
+ Console.WriteLine("Input the override speed and press Enter:");
+ Console.Write("> ");
+
+ result = Console.ReadLine();
+ if (!int.TryParse(result, out int speed))
+ speed = -1;
+
+ CommandOptions.DriveSpeed = speed;
+ goto root;
+
+ customParams:
+ Console.WriteLine();
+ Console.WriteLine("Input the custom parameters and press Enter:");
+ Console.Write("> ");
+ CommandOptions.CustomParams = Console.ReadLine();
+ goto root;
+
+ exit:
+ return true;
+ }
+
+ ///
+ public override bool VerifyInputs() => true;
+ }
+}
diff --git a/MPF.CLI/Program.cs b/MPF.CLI/Program.cs
index a585e3c5..ca650143 100644
--- a/MPF.CLI/Program.cs
+++ b/MPF.CLI/Program.cs
@@ -1,5 +1,7 @@
using System;
using System.IO;
+using MPF.CLI.Features;
+
#if NET40
using System.Threading.Tasks;
#endif
@@ -47,9 +49,14 @@ namespace MPF.CLI
RedumpSystem? knownSystem;
// Use interactive mode
- if (args.Length > 0 && (args[0] == "-i" || args[0] == "--interactive"))
+ if (args.Length > 0 && (args[0] == "i" || args[0] == "interactive"))
{
- opts = InteractiveMode(options, out knownSystem);
+ var interactive = new InteractiveFeature();
+ interactive.Execute();
+
+ opts = interactive.CommandOptions;
+ options = interactive.Options;
+ knownSystem = interactive.System;
}
// Use normal commandline parameters
@@ -131,8 +138,8 @@ namespace MPF.CLI
}
// Normalize the file path
- if (opts.FilePath != null)
- opts.FilePath = FrontendTool.NormalizeOutputPaths(opts.FilePath, getFullPath: true);
+ if (opts.FilePath != null)
+ opts.FilePath = FrontendTool.NormalizeOutputPaths(opts.FilePath, getFullPath: true);
// Get the speed from the options
int speed = opts.DriveSpeed ?? FrontendTool.GetDefaultSpeedForMediaType(opts.MediaType, options);
@@ -209,7 +216,7 @@ namespace MPF.CLI
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");
- Console.WriteLine("-i, --interactive Enable interactive mode");
+ Console.WriteLine("i, interactive Enable interactive mode");
Console.WriteLine();
Console.WriteLine("CLI Options:");
@@ -237,153 +244,6 @@ namespace MPF.CLI
Console.WriteLine();
}
- ///
- /// Enable interactive mode for entering information
- ///
- private static CommandOptions InteractiveMode(Options options, out RedumpSystem? system)
- {
- // Create return values
- var opts = new CommandOptions
- {
- MediaType = MediaType.NONE,
- FilePath = Path.Combine(options.DefaultOutputPath ?? "ISO", "track.bin"),
- };
- system = options.DefaultSystem;
-
- // Create state values
- string? result = string.Empty;
-
- root:
- Console.Clear();
- Console.WriteLine("MPF.CLI Interactive Mode - Main Menu");
- Console.WriteLine("-------------------------");
- Console.WriteLine();
- Console.WriteLine($"1) Set system (Currently '{system}')");
- Console.WriteLine($"2) Set dumping program (Currently '{options.InternalProgram}')");
- Console.WriteLine($"3) Set media type (Currently '{opts.MediaType}')");
- Console.WriteLine($"4) Set device path (Currently '{opts.DevicePath}')");
- Console.WriteLine($"5) Set mounted path (Currently '{opts.MountedPath}')");
- Console.WriteLine($"6) Set file path (Currently '{opts.FilePath}')");
- Console.WriteLine($"7) Set override speed (Currently '{opts.DriveSpeed}')");
- Console.WriteLine($"8) Set custom parameters (Currently '{opts.CustomParams}')");
- Console.WriteLine();
- Console.WriteLine($"Q) Exit the program");
- Console.WriteLine($"X) Start dumping");
- Console.Write("> ");
-
- result = Console.ReadLine();
- switch (result)
- {
- case "1":
- goto system;
- case "2":
- goto dumpingProgram;
- case "3":
- goto mediaType;
- case "4":
- goto devicePath;
- case "5":
- goto mountedPath;
- case "6":
- goto filePath;
- case "7":
- goto overrideSpeed;
- case "8":
- goto customParams;
-
- case "q":
- case "Q":
- Environment.Exit(0);
- break;
- case "x":
- case "X":
- Console.Clear();
- goto exit;
- case "z":
- case "Z":
- Console.WriteLine("It is pitch black. You are likely to be eaten by a grue.");
- Console.Write("> ");
- Console.ReadLine();
- goto root;
- default:
- Console.WriteLine($"Invalid selection: {result}");
- Console.ReadLine();
- goto root;
- }
-
- system:
- Console.WriteLine();
- Console.WriteLine("Input the system and press Enter:");
- Console.Write("> ");
- result = Console.ReadLine();
- system = Extensions.ToRedumpSystem(result);
- goto root;
-
- dumpingProgram:
- Console.WriteLine();
- Console.WriteLine("Input the dumping program and press Enter:");
- Console.Write("> ");
- result = Console.ReadLine();
- options.InternalProgram = result.ToInternalProgram();
- goto root;
-
- mediaType:
- Console.WriteLine();
- Console.WriteLine("Input the media type and press Enter:");
- Console.Write("> ");
- result = Console.ReadLine();
- opts.MediaType = OptionsLoader.ToMediaType(result);
- goto root;
-
- devicePath:
- Console.WriteLine();
- Console.WriteLine("Input the device path and press Enter:");
- Console.Write("> ");
- opts.DevicePath = Console.ReadLine();
- goto root;
-
- mountedPath:
- Console.WriteLine();
- Console.WriteLine("Input the mounted path and press Enter:");
- Console.Write("> ");
- opts.MountedPath = Console.ReadLine();
- goto root;
-
- filePath:
- Console.WriteLine();
- Console.WriteLine("Input the file path and press Enter:");
- Console.Write("> ");
-
- result = Console.ReadLine();
- if (!string.IsNullOrEmpty(result))
- result = Path.GetFullPath(result!);
-
- opts.FilePath = result;
- goto root;
-
- overrideSpeed:
- Console.WriteLine();
- Console.WriteLine("Input the override speed and press Enter:");
- Console.Write("> ");
-
- result = Console.ReadLine();
- if (!int.TryParse(result, out int speed))
- speed = -1;
-
- opts.DriveSpeed = speed;
- goto root;
-
- customParams:
- Console.WriteLine();
- Console.WriteLine("Input the custom parameters and press Enter:");
- Console.Write("> ");
- opts.CustomParams = Console.ReadLine();
- goto root;
-
- exit:
- return opts;
- }
-
///
/// Load the current set of options from application arguments
///
@@ -504,7 +364,7 @@ namespace MPF.CLI
///
/// Represents commandline options
///
- private class CommandOptions
+ internal class CommandOptions
{
///
/// Media type to dump
diff --git a/MPF.Check/Features/InteractiveFeature.cs b/MPF.Check/Features/InteractiveFeature.cs
new file mode 100644
index 00000000..efffd7c7
--- /dev/null
+++ b/MPF.Check/Features/InteractiveFeature.cs
@@ -0,0 +1,261 @@
+
+using System;
+using MPF.Frontend;
+using SabreTools.RedumpLib;
+using SabreTools.RedumpLib.Data;
+
+namespace MPF.Check.Features
+{
+ internal sealed class InteractiveFeature : SabreTools.CommandLine.Feature
+ {
+ #region Feature Definition
+
+ public const string DisplayName = "interactive";
+
+ private static readonly string[] _flags = ["i", "interactive"];
+
+ private const string _description = "Enable interactive mode";
+
+ #endregion
+
+ #region Properties
+
+ ///
+ /// Progrma-specific options
+ ///
+ public Program.CommandOptions CommandOptions { get; private set; }
+
+ ///
+ /// User-defined options
+ ///
+ public Options Options { get; }
+
+ ///
+ /// Currently-selected system
+ ///
+ public RedumpSystem? System { get; private set; }
+
+ #endregion
+
+ public InteractiveFeature()
+ : base(DisplayName, _flags, _description)
+ {
+ CommandOptions = new Program.CommandOptions();
+ Options = new Options()
+ {
+ // Internal Program
+ InternalProgram = InternalProgram.NONE,
+
+ // Extra Dumping Options
+ ScanForProtection = false,
+ AddPlaceholders = true,
+ PullAllInformation = false,
+ AddFilenameSuffix = false,
+ OutputSubmissionJSON = false,
+ IncludeArtifacts = false,
+ CompressLogFiles = false,
+ DeleteUnnecessaryFiles = false,
+ CreateIRDAfterDumping = false,
+
+ // Protection Scanning Options
+ ScanArchivesForProtection = true,
+ IncludeDebugProtectionInformation = false,
+ HideDriveLetters = false,
+
+ // Redump Login Information
+ RetrieveMatchInformation = true,
+ RedumpUsername = null,
+ RedumpPassword = null,
+ };
+ }
+
+ public override bool Execute()
+ {
+ // Create return values
+ CommandOptions = new Program.CommandOptions();
+ System = null;
+
+ // These values require multiple parts to be active
+ bool scan = false,
+ enableArchives = true,
+ enableDebug = false,
+ hideDriveLetters = false;
+
+ // Create state values
+ string? result = string.Empty;
+
+ root:
+ Console.Clear();
+ Console.WriteLine("MPF.Check Interactive Mode - Main Menu");
+ Console.WriteLine("-------------------------");
+ Console.WriteLine();
+ Console.WriteLine($"1) Set system (Currently '{System}')");
+ Console.WriteLine($"2) Set dumping program (Currently '{Options.InternalProgram}')");
+ Console.WriteLine($"3) Set seed path (Currently '{CommandOptions.Seed}')");
+ Console.WriteLine($"4) Add placeholders (Currently '{Options.AddPlaceholders}')");
+ Console.WriteLine($"5) Create IRD (Currently '{Options.CreateIRDAfterDumping}')");
+ Console.WriteLine($"6) Attempt Redump matches (Currently '{Options.RetrieveMatchInformation}')");
+ Console.WriteLine($"7) Redump credentials (Currently '{Options.RedumpUsername}')");
+ Console.WriteLine($"8) Pull all information (Currently '{Options.PullAllInformation}')");
+ Console.WriteLine($"9) Set device path (Currently '{CommandOptions.DevicePath}')");
+ Console.WriteLine($"A) Scan for protection (Currently '{scan}')");
+ Console.WriteLine($"B) Scan archives for protection (Currently '{enableArchives}')");
+ Console.WriteLine($"C) Debug protection scan output (Currently '{enableDebug}')");
+ Console.WriteLine($"D) Hide drive letters in protection output (Currently '{hideDriveLetters}')");
+ Console.WriteLine($"E) Hide filename suffix (Currently '{Options.AddFilenameSuffix}')");
+ Console.WriteLine($"F) Output submission JSON (Currently '{Options.OutputSubmissionJSON}')");
+ Console.WriteLine($"G) Include JSON artifacts (Currently '{Options.IncludeArtifacts}')");
+ Console.WriteLine($"H) Compress logs (Currently '{Options.CompressLogFiles}')");
+ Console.WriteLine($"I) Delete unnecessary files (Currently '{Options.DeleteUnnecessaryFiles}')");
+ Console.WriteLine();
+ Console.WriteLine($"Q) Exit the program");
+ Console.WriteLine($"X) Start checking");
+ Console.Write("> ");
+
+ result = Console.ReadLine();
+ switch (result)
+ {
+ case "1":
+ goto system;
+ case "2":
+ goto dumpingProgram;
+ case "3":
+ goto seedPath;
+ case "4":
+ Options.AddPlaceholders = !Options.AddPlaceholders;
+ goto root;
+ case "5":
+ Options.CreateIRDAfterDumping = !Options.CreateIRDAfterDumping;
+ goto root;
+ case "6":
+ Options.RetrieveMatchInformation = !Options.RetrieveMatchInformation;
+ goto root;
+ case "7":
+ goto redumpCredentials;
+ case "8":
+ Options.PullAllInformation = !Options.PullAllInformation;
+ goto root;
+ case "9":
+ goto devicePath;
+ case "a":
+ case "A":
+ scan = !scan;
+ goto root;
+ case "b":
+ case "B":
+ enableArchives = !enableArchives;
+ goto root;
+ case "c":
+ case "C":
+ enableDebug = !enableDebug;
+ goto root;
+ case "d":
+ case "D":
+ hideDriveLetters = !hideDriveLetters;
+ goto root;
+ case "e":
+ case "E":
+ Options.AddFilenameSuffix = !Options.AddFilenameSuffix;
+ goto root;
+ case "f":
+ case "F":
+ Options.OutputSubmissionJSON = !Options.OutputSubmissionJSON;
+ goto root;
+ case "g":
+ case "G":
+ Options.IncludeArtifacts = !Options.IncludeArtifacts;
+ goto root;
+ case "h":
+ case "H":
+ Options.CompressLogFiles = !Options.CompressLogFiles;
+ goto root;
+ case "i":
+ case "I":
+ Options.DeleteUnnecessaryFiles = !Options.DeleteUnnecessaryFiles;
+ goto root;
+
+ case "q":
+ case "Q":
+ Environment.Exit(0);
+ break;
+ case "x":
+ case "X":
+ Console.Clear();
+ goto exit;
+ case "z":
+ case "Z":
+ Console.WriteLine("It is pitch black. You are likely to be eaten by a grue.");
+ Console.Write("> ");
+ Console.ReadLine();
+ goto root;
+ default:
+ Console.WriteLine($"Invalid selection: {result}");
+ Console.ReadLine();
+ goto root;
+ }
+
+ system:
+ Console.WriteLine();
+ Console.WriteLine("Input the system and press Enter:");
+ Console.Write("> ");
+ result = Console.ReadLine();
+ System = Extensions.ToRedumpSystem(result);
+ goto root;
+
+ dumpingProgram:
+ Console.WriteLine();
+ Console.WriteLine("Input the dumping program and press Enter:");
+ Console.Write("> ");
+ result = Console.ReadLine();
+ Options.InternalProgram = result.ToInternalProgram();
+ goto root;
+
+ seedPath:
+ Console.WriteLine();
+ Console.WriteLine("Input the seed path and press Enter:");
+ Console.Write("> ");
+ result = Console.ReadLine();
+ CommandOptions.Seed = Builder.CreateFromFile(result);
+ goto root;
+
+ redumpCredentials:
+ Console.WriteLine();
+ Console.WriteLine("Enter your Redumper username and press Enter:");
+ Console.Write("> ");
+ Options.RedumpUsername = Console.ReadLine();
+
+ Console.WriteLine("Enter your Redumper password (hidden) and press Enter:");
+ Console.Write("> ");
+ Options.RedumpPassword = string.Empty;
+ while (true)
+ {
+ var key = Console.ReadKey(true);
+ if (key.Key == ConsoleKey.Enter)
+ break;
+
+ Options.RedumpPassword += key.KeyChar;
+ }
+
+ goto root;
+
+ devicePath:
+ Console.WriteLine();
+ Console.WriteLine("Input the device path and press Enter:");
+ Console.Write("> ");
+ CommandOptions.DevicePath = Console.ReadLine();
+ goto root;
+
+ exit:
+ // Now deal with the complex options
+ Options.ScanForProtection = scan && !string.IsNullOrEmpty(CommandOptions.DevicePath);
+ Options.ScanArchivesForProtection = enableArchives && scan && !string.IsNullOrEmpty(CommandOptions.DevicePath);
+ Options.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(CommandOptions.DevicePath);
+ Options.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(CommandOptions.DevicePath);
+
+ return true;
+ }
+
+ ///
+ public override bool VerifyInputs() => true;
+ }
+}
diff --git a/MPF.Check/Program.cs b/MPF.Check/Program.cs
index 7ad27416..1c9b677f 100644
--- a/MPF.Check/Program.cs
+++ b/MPF.Check/Program.cs
@@ -1,5 +1,7 @@
using System;
using System.IO;
+using MPF.Check.Features;
+
#if NET40
using System.Threading.Tasks;
#endif
@@ -58,10 +60,15 @@ namespace MPF.Check
int startIndex;
// Use interactive mode
- if (args.Length > 0 && (args[0] == "-i" || args[0] == "--interactive"))
+ if (args.Length > 0 && (args[0] == "i" || args[0] == "interactive"))
{
startIndex = 1;
- opts = InteractiveMode(options, out knownSystem);
+ var interactive = new InteractiveFeature();
+ interactive.Execute();
+
+ opts = interactive.CommandOptions;
+ options = interactive.Options;
+ knownSystem = interactive.System;
}
// Use normal commandline parameters
@@ -153,7 +160,7 @@ namespace MPF.Check
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");
- Console.WriteLine("-i, --interactive Enable interactive mode");
+ Console.WriteLine("i, interactive Enable interactive mode");
Console.WriteLine();
Console.WriteLine("Check Options:");
@@ -180,195 +187,6 @@ namespace MPF.Check
Console.WriteLine();
}
- ///
- /// Enable interactive mode for entering information
- ///
- private static CommandOptions InteractiveMode(Options options, out RedumpSystem? system)
- {
- // Create return values
- var opts = new CommandOptions();
- system = null;
-
- // These values require multiple parts to be active
- bool scan = false,
- enableArchives = true,
- enableDebug = false,
- hideDriveLetters = false;
-
- // Create state values
- string? result = string.Empty;
-
- root:
- Console.Clear();
- Console.WriteLine("MPF.Check Interactive Mode - Main Menu");
- Console.WriteLine("-------------------------");
- Console.WriteLine();
- Console.WriteLine($"1) Set system (Currently '{system}')");
- Console.WriteLine($"2) Set dumping program (Currently '{options.InternalProgram}')");
- Console.WriteLine($"3) Set seed path (Currently '{opts.Seed}')");
- Console.WriteLine($"4) Add placeholders (Currently '{options.AddPlaceholders}')");
- Console.WriteLine($"5) Create IRD (Currently '{options.CreateIRDAfterDumping}')");
- Console.WriteLine($"6) Attempt Redump matches (Currently '{options.RetrieveMatchInformation}')");
- Console.WriteLine($"7) Redump credentials (Currently '{options.RedumpUsername}')");
- Console.WriteLine($"8) Pull all information (Currently '{options.PullAllInformation}')");
- Console.WriteLine($"9) Set device path (Currently '{opts.DevicePath}')");
- Console.WriteLine($"A) Scan for protection (Currently '{scan}')");
- Console.WriteLine($"B) Scan archives for protection (Currently '{enableArchives}')");
- Console.WriteLine($"C) Debug protection scan output (Currently '{enableDebug}')");
- Console.WriteLine($"D) Hide drive letters in protection output (Currently '{hideDriveLetters}')");
- Console.WriteLine($"E) Hide filename suffix (Currently '{options.AddFilenameSuffix}')");
- Console.WriteLine($"F) Output submission JSON (Currently '{options.OutputSubmissionJSON}')");
- Console.WriteLine($"G) Include JSON artifacts (Currently '{options.IncludeArtifacts}')");
- Console.WriteLine($"H) Compress logs (Currently '{options.CompressLogFiles}')");
- Console.WriteLine($"I) Delete unnecessary files (Currently '{options.DeleteUnnecessaryFiles}')");
- Console.WriteLine();
- Console.WriteLine($"Q) Exit the program");
- Console.WriteLine($"X) Start checking");
- Console.Write("> ");
-
- result = Console.ReadLine();
- switch (result)
- {
- case "1":
- goto system;
- case "2":
- goto dumpingProgram;
- case "3":
- goto seedPath;
- case "4":
- options.AddPlaceholders = !options.AddPlaceholders;
- goto root;
- case "5":
- options.CreateIRDAfterDumping = !options.CreateIRDAfterDumping;
- goto root;
- case "6":
- options.RetrieveMatchInformation = !options.RetrieveMatchInformation;
- goto root;
- case "7":
- goto redumpCredentials;
- case "8":
- options.PullAllInformation = !options.PullAllInformation;
- goto root;
- case "9":
- goto devicePath;
- case "a":
- case "A":
- scan = !scan;
- goto root;
- case "b":
- case "B":
- enableArchives = !enableArchives;
- goto root;
- case "c":
- case "C":
- enableDebug = !enableDebug;
- goto root;
- case "d":
- case "D":
- hideDriveLetters = !hideDriveLetters;
- goto root;
- case "e":
- case "E":
- options.AddFilenameSuffix = !options.AddFilenameSuffix;
- goto root;
- case "f":
- case "F":
- options.OutputSubmissionJSON = !options.OutputSubmissionJSON;
- goto root;
- case "g":
- case "G":
- options.IncludeArtifacts = !options.IncludeArtifacts;
- goto root;
- case "h":
- case "H":
- options.CompressLogFiles = !options.CompressLogFiles;
- goto root;
- case "i":
- case "I":
- options.DeleteUnnecessaryFiles = !options.DeleteUnnecessaryFiles;
- goto root;
-
- case "q":
- case "Q":
- Environment.Exit(0);
- break;
- case "x":
- case "X":
- Console.Clear();
- goto exit;
- case "z":
- case "Z":
- Console.WriteLine("It is pitch black. You are likely to be eaten by a grue.");
- Console.Write("> ");
- Console.ReadLine();
- goto root;
- default:
- Console.WriteLine($"Invalid selection: {result}");
- Console.ReadLine();
- goto root;
- }
-
- system:
- Console.WriteLine();
- Console.WriteLine("Input the system and press Enter:");
- Console.Write("> ");
- result = Console.ReadLine();
- system = Extensions.ToRedumpSystem(result);
- goto root;
-
- dumpingProgram:
- Console.WriteLine();
- Console.WriteLine("Input the dumping program and press Enter:");
- Console.Write("> ");
- result = Console.ReadLine();
- options.InternalProgram = result.ToInternalProgram();
- goto root;
-
- seedPath:
- Console.WriteLine();
- Console.WriteLine("Input the seed path and press Enter:");
- Console.Write("> ");
- result = Console.ReadLine();
- opts.Seed = Builder.CreateFromFile(result);
- goto root;
-
- redumpCredentials:
- Console.WriteLine();
- Console.WriteLine("Enter your Redumper username and press Enter:");
- Console.Write("> ");
- options.RedumpUsername = Console.ReadLine();
-
- Console.WriteLine("Enter your Redumper password (hidden) and press Enter:");
- Console.Write("> ");
- options.RedumpPassword = string.Empty;
- while (true)
- {
- var key = Console.ReadKey(true);
- if (key.Key == ConsoleKey.Enter)
- break;
-
- options.RedumpPassword += key.KeyChar;
- }
-
- goto root;
-
- devicePath:
- Console.WriteLine();
- Console.WriteLine("Input the device path and press Enter:");
- Console.Write("> ");
- opts.DevicePath = Console.ReadLine();
- goto root;
-
- exit:
- // Now deal with the complex options
- options.ScanForProtection = scan && !string.IsNullOrEmpty(opts.DevicePath);
- options.ScanArchivesForProtection = enableArchives && scan && !string.IsNullOrEmpty(opts.DevicePath);
- options.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(opts.DevicePath);
- options.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(opts.DevicePath);
-
- return opts;
- }
-
///
/// Load the current set of options from application arguments
///
@@ -545,7 +363,7 @@ namespace MPF.Check
///
/// Represents commandline options
///
- private class CommandOptions
+ internal class CommandOptions
{
///
/// Seed submission info from an input file