Replace Options with SegmentedOptions in most places

This commit is contained in:
Matt Nadareski
2026-02-07 13:23:57 -05:00
parent 9a075ad5de
commit 992fb507e7
28 changed files with 529 additions and 394 deletions

View File

@@ -22,6 +22,7 @@
- Check should not default to update checking
- Add save and load for new options type
- Add conversion method from new options type
- Replace Options with SegmentedOptions in most places
### 3.6.0 (2025-11-28)

View File

@@ -19,7 +19,7 @@ namespace MPF.CLI.Features
/// <summary>
/// User-defined options
/// </summary>
public Options Options { get; protected set; }
public SegmentedOptions Options { get; protected set; }
/// <summary>
/// Currently-selected system
@@ -65,33 +65,35 @@ namespace MPF.CLI.Features
protected BaseFeature(string name, string[] flags, string description, string? detailed = null)
: base(name, flags, description, detailed)
{
Options = new Options()
{
// Internal Program
InternalProgram = InternalProgram.NONE,
Options = new SegmentedOptions();
// Extra Dumping Options
ScanForProtection = false,
AddPlaceholders = true,
PullAllInformation = false,
AddFilenameSuffix = false,
OutputSubmissionJSON = false,
IncludeArtifacts = false,
CompressLogFiles = false,
LogCompression = LogCompression.DeflateMaximum,
DeleteUnnecessaryFiles = false,
CreateIRDAfterDumping = false,
// Internal Program
Options.Dumping.InternalProgram = InternalProgram.NONE;
// Protection Scanning Options
ScanArchivesForProtection = true,
IncludeDebugProtectionInformation = false,
HideDriveLetters = false,
// Protection Scanning Options
Options.Processing.ProtectionScanning.ScanForProtection = false;
Options.Processing.ProtectionScanning.ScanArchivesForProtection = true;
Options.Processing.ProtectionScanning.IncludeDebugProtectionInformation = false;
Options.Processing.ProtectionScanning.HideDriveLetters = false;
// Redump Login Information
Options.Processing.Login.RetrieveMatchInformation = true;
Options.Processing.Login.RedumpUsername = null;
Options.Processing.Login.RedumpPassword = null;
// Media Information
Options.Processing.MediaInformation.AddPlaceholders = true;
Options.Processing.MediaInformation.PullAllInformation = false;
// Post-Information Options
Options.Processing.AddFilenameSuffix = false;
Options.Processing.CreateIRDAfterDumping = false;
Options.Processing.OutputSubmissionJSON = false;
Options.Processing.IncludeArtifacts = false;
Options.Processing.CompressLogFiles = false;
Options.Processing.LogCompression = LogCompression.DeflateMaximum;
Options.Processing.DeleteUnnecessaryFiles = false;
// Redump Login Information
RetrieveMatchInformation = true,
RedumpUsername = null,
RedumpPassword = null,
};
}
/// <inheritdoc/>
@@ -108,11 +110,11 @@ namespace MPF.CLI.Features
Console.WriteLine($"Using system: {System.LongName()}");
// Validate the supplied credentials
if (Options.RetrieveMatchInformation
&& !string.IsNullOrEmpty(Options.RedumpUsername)
&& !string.IsNullOrEmpty(Options.RedumpPassword))
if (Options.Processing.Login.RetrieveMatchInformation
&& !string.IsNullOrEmpty(Options.Processing.Login.RedumpUsername)
&& !string.IsNullOrEmpty(Options.Processing.Login.RedumpPassword))
{
bool? validated = RedumpClient.ValidateCredentials(Options.RedumpUsername!, Options.RedumpPassword!).GetAwaiter().GetResult();
bool? validated = RedumpClient.ValidateCredentials(Options.Processing.Login.RedumpUsername!, Options.Processing.Login.RedumpPassword!).GetAwaiter().GetResult();
string message = validated switch
{
true => "Redump username and password accepted!",
@@ -125,10 +127,10 @@ namespace MPF.CLI.Features
// Validate the internal program
#pragma warning disable IDE0010
switch (Options.InternalProgram)
switch (Options.Dumping.InternalProgram)
{
case InternalProgram.Aaru:
if (!File.Exists(Options.AaruPath))
if (!File.Exists(Options.Dumping.AaruPath))
{
Console.Error.WriteLine("A path needs to be supplied in config.json for Aaru, exiting...");
return false;
@@ -137,7 +139,7 @@ namespace MPF.CLI.Features
break;
case InternalProgram.DiscImageCreator:
if (!File.Exists(Options.DiscImageCreatorPath))
if (!File.Exists(Options.Dumping.DiscImageCreatorPath))
{
Console.Error.WriteLine("A path needs to be supplied in config.json for DIC, exiting...");
return false;
@@ -146,7 +148,7 @@ namespace MPF.CLI.Features
break;
// case InternalProgram.Dreamdump:
// if (!File.Exists(Options.DreamdumpPath))
// if (!File.Exists(Options.Dumping.DreamdumpPath))
// {
// Console.Error.WriteLine("A path needs to be supplied in config.json for Dreamdump, exiting...");
// return false;
@@ -155,7 +157,7 @@ namespace MPF.CLI.Features
// break;
case InternalProgram.Redumper:
if (!File.Exists(Options.RedumperPath))
if (!File.Exists(Options.Dumping.RedumperPath))
{
Console.Error.WriteLine("A path needs to be supplied in config.json for Redumper, exiting...");
return false;
@@ -164,7 +166,7 @@ namespace MPF.CLI.Features
break;
default:
Console.Error.WriteLine($"{Options.InternalProgram} is not a supported dumping program, exiting...");
Console.Error.WriteLine($"{Options.Dumping.InternalProgram} is not a supported dumping program, exiting...");
break;
}
#pragma warning restore IDE0010
@@ -176,7 +178,7 @@ namespace MPF.CLI.Features
return false;
}
if (Options.InternalProgram == InternalProgram.DiscImageCreator
if (Options.Dumping.InternalProgram == InternalProgram.DiscImageCreator
&& CustomParams is null
&& (MediaType is null || MediaType == SabreTools.RedumpLib.Data.MediaType.NONE))
{
@@ -201,8 +203,8 @@ namespace MPF.CLI.Features
{
string defaultFileName = $"track_{DateTime.Now:yyyyMMdd-HHmm}";
FilePath = Path.Combine(defaultFileName, $"{defaultFileName}.bin");
if (Options.DefaultOutputPath is not null)
FilePath = Path.Combine(Options.DefaultOutputPath, FilePath);
if (Options.Dumping.DefaultOutputPath is not null)
FilePath = Path.Combine(Options.Dumping.DefaultOutputPath, FilePath);
}
if (FilePath is not null)
@@ -217,7 +219,7 @@ namespace MPF.CLI.Features
FilePath,
drive,
System,
Options.InternalProgram);
Options.Dumping.InternalProgram);
env.SetExecutionContext(MediaType, null);
env.SetProcessor();
@@ -232,7 +234,7 @@ namespace MPF.CLI.Features
env.SetExecutionContext(MediaType, paramStr);
// Invoke the dumping program
Console.WriteLine($"Invoking {Options.InternalProgram} using '{paramStr}'");
Console.WriteLine($"Invoking {Options.Dumping.InternalProgram} using '{paramStr}'");
var dumpResult = env.Run(MediaType).GetAwaiter().GetResult();
Console.WriteLine(dumpResult.Message);
if (dumpResult == false)

View File

@@ -40,11 +40,11 @@ namespace MPF.CLI.Features
MediaType = SabreTools.RedumpLib.Data.MediaType.NONE;
string defaultFileName = $"track_{DateTime.Now:yyyyMMdd-HHmm}";
#if NET20 || NET35
FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", Path.Combine(defaultFileName, $"{defaultFileName}.bin"));
FilePath = Path.Combine(Options.Dumping.DefaultOutputPath ?? "ISO", Path.Combine(defaultFileName, $"{defaultFileName}.bin"));
#else
FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", defaultFileName, $"{defaultFileName}.bin");
FilePath = Path.Combine(Options.Dumping.DefaultOutputPath ?? "ISO", defaultFileName, $"{defaultFileName}.bin");
#endif
System = Options.DefaultSystem;
System = Options.Dumping.DefaultSystem;
// Create state values
string? result;
@@ -55,7 +55,7 @@ namespace MPF.CLI.Features
Console.WriteLine("-------------------------");
Console.WriteLine();
Console.WriteLine($"1) Set system (Currently '{System}')");
Console.WriteLine($"2) Set dumping program (Currently '{Options.InternalProgram}')");
Console.WriteLine($"2) Set dumping program (Currently '{Options.Dumping.InternalProgram}')");
Console.WriteLine($"3) Set media type (Currently '{MediaType}')");
Console.WriteLine($"4) Set device path (Currently '{DevicePath}')");
Console.WriteLine($"5) Set mounted path (Currently '{MountedPath}')");
@@ -128,7 +128,7 @@ namespace MPF.CLI.Features
Console.WriteLine("Input the dumping program and press Enter:");
Console.Write("> ");
result = Console.ReadLine();
Options.InternalProgram = result.ToInternalProgram();
Options.Dumping.InternalProgram = result.ToInternalProgram();
goto root;
mediaType:

View File

@@ -75,7 +75,7 @@ namespace MPF.CLI.Features
{
// Use specific program
if (UseInput.ProcessInput(args, ref index))
Options.InternalProgram = UseInput.Value.ToInternalProgram();
Options.Dumping.InternalProgram = UseInput.Value.ToInternalProgram();
// Set a media type
else if (MediaTypeInput.ProcessInput(args, ref index))

View File

@@ -18,7 +18,7 @@ namespace MPF.Check.Features
/// <summary>
/// User-defined options
/// </summary>
public Options Options { get; protected set; }
public SegmentedOptions Options { get; protected set; }
/// <summary>
/// Currently-selected system
@@ -40,36 +40,34 @@ namespace MPF.Check.Features
protected BaseFeature(string name, string[] flags, string description, string? detailed = null)
: base(name, flags, description, detailed)
{
Options = new Options()
{
// Internal Program
InternalProgram = InternalProgram.NONE,
Options = new SegmentedOptions();
// UI Defaults
CheckForUpdatesOnStartup = false,
// Internal Program
Options.Dumping.InternalProgram = InternalProgram.NONE;
// Extra Dumping Options
ScanForProtection = false,
AddPlaceholders = true,
PullAllInformation = false,
AddFilenameSuffix = false,
OutputSubmissionJSON = false,
IncludeArtifacts = false,
CompressLogFiles = false,
LogCompression = LogCompression.DeflateMaximum,
DeleteUnnecessaryFiles = false,
CreateIRDAfterDumping = false,
// Protection Scanning Options
Options.Processing.ProtectionScanning.ScanForProtection = false;
Options.Processing.ProtectionScanning.ScanArchivesForProtection = true;
Options.Processing.ProtectionScanning.IncludeDebugProtectionInformation = false;
Options.Processing.ProtectionScanning.HideDriveLetters = false;
// Protection Scanning Options
ScanArchivesForProtection = true,
IncludeDebugProtectionInformation = false,
HideDriveLetters = false,
// Redump Login Information
Options.Processing.Login.RetrieveMatchInformation = true;
Options.Processing.Login.RedumpUsername = null;
Options.Processing.Login.RedumpPassword = null;
// Redump Login Information
RetrieveMatchInformation = true,
RedumpUsername = null,
RedumpPassword = null,
};
// Media Information
Options.Processing.MediaInformation.AddPlaceholders = true;
Options.Processing.MediaInformation.PullAllInformation = false;
// Post-Information Options
Options.Processing.AddFilenameSuffix = false;
Options.Processing.CreateIRDAfterDumping = false;
Options.Processing.OutputSubmissionJSON = false;
Options.Processing.IncludeArtifacts = false;
Options.Processing.CompressLogFiles = false;
Options.Processing.LogCompression = LogCompression.DeflateMaximum;
Options.Processing.DeleteUnnecessaryFiles = false;
}
/// <inheritdoc/>
@@ -86,18 +84,18 @@ namespace MPF.Check.Features
Console.WriteLine($"Using system: {System.LongName()}");
// Validate a program is provided
if (Options.InternalProgram == InternalProgram.NONE)
if (Options.Dumping.InternalProgram == InternalProgram.NONE)
{
Console.Error.WriteLine("A program name needs to be provided");
return false;
}
// Validate the supplied credentials
if (Options.RetrieveMatchInformation
&& !string.IsNullOrEmpty(Options.RedumpUsername)
&& !string.IsNullOrEmpty(Options.RedumpPassword))
if (Options.Processing.Login.RetrieveMatchInformation
&& !string.IsNullOrEmpty(Options.Processing.Login.RedumpUsername)
&& !string.IsNullOrEmpty(Options.Processing.Login.RedumpPassword))
{
bool? validated = RedumpClient.ValidateCredentials(Options.RedumpUsername!, Options.RedumpPassword!).GetAwaiter().GetResult();
bool? validated = RedumpClient.ValidateCredentials(Options.Processing.Login.RedumpUsername!, Options.Processing.Login.RedumpPassword!).GetAwaiter().GetResult();
string message = validated switch
{
true => "Redump username and password accepted!",

View File

@@ -38,33 +38,34 @@ namespace MPF.Check.Features
Options = OptionsLoader.LoadFromConfig();
if (Options.FirstRun)
{
Options = new Options()
{
// Internal Program
InternalProgram = InternalProgram.NONE,
Options = new SegmentedOptions();
// Extra Dumping Options
ScanForProtection = false,
AddPlaceholders = true,
PullAllInformation = false,
AddFilenameSuffix = false,
OutputSubmissionJSON = false,
IncludeArtifacts = false,
CompressLogFiles = false,
LogCompression = LogCompression.DeflateMaximum,
DeleteUnnecessaryFiles = false,
CreateIRDAfterDumping = false,
// Internal Program
Options.Dumping.InternalProgram = InternalProgram.NONE;
// Protection Scanning Options
ScanArchivesForProtection = true,
IncludeDebugProtectionInformation = false,
HideDriveLetters = false,
// Protection Scanning Options
Options.Processing.ProtectionScanning.ScanForProtection = false;
Options.Processing.ProtectionScanning.ScanArchivesForProtection = true;
Options.Processing.ProtectionScanning.IncludeDebugProtectionInformation = false;
Options.Processing.ProtectionScanning.HideDriveLetters = false;
// Redump Login Information
RetrieveMatchInformation = true,
RedumpUsername = null,
RedumpPassword = null,
};
// Redump Login Information
Options.Processing.Login.RetrieveMatchInformation = true;
Options.Processing.Login.RedumpUsername = null;
Options.Processing.Login.RedumpPassword = null;
// Media Information
Options.Processing.MediaInformation.AddPlaceholders = true;
Options.Processing.MediaInformation.PullAllInformation = false;
// Post-Information Options
Options.Processing.AddFilenameSuffix = false;
Options.Processing.CreateIRDAfterDumping = false;
Options.Processing.OutputSubmissionJSON = false;
Options.Processing.IncludeArtifacts = false;
Options.Processing.CompressLogFiles = false;
Options.Processing.LogCompression = LogCompression.DeflateMaximum;
Options.Processing.DeleteUnnecessaryFiles = false;
}
// Create return values
@@ -85,24 +86,24 @@ namespace MPF.Check.Features
Console.WriteLine("-------------------------");
Console.WriteLine();
Console.WriteLine($"1) Set system (Currently '{System}')");
Console.WriteLine($"2) Set dumping program (Currently '{Options.InternalProgram}')");
Console.WriteLine($"2) Set dumping program (Currently '{Options.Dumping.InternalProgram}')");
Console.WriteLine($"3) Set seed path (Currently '{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($"4) Add placeholders (Currently '{Options.Processing.MediaInformation.AddPlaceholders}')");
Console.WriteLine($"5) Create IRD (Currently '{Options.Processing.CreateIRDAfterDumping}')");
Console.WriteLine($"6) Attempt Redump matches (Currently '{Options.Processing.Login.RetrieveMatchInformation}')");
Console.WriteLine($"7) Redump credentials (Currently '{Options.Processing.Login.RedumpUsername}')");
Console.WriteLine($"8) Pull all information (Currently '{Options.Processing.MediaInformation.PullAllInformation}')");
Console.WriteLine($"9) Set device path (Currently '{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) Log compression (Currently '{Options.LogCompression.LongName()}')");
Console.WriteLine($"J) Delete unnecessary files (Currently '{Options.DeleteUnnecessaryFiles}')");
Console.WriteLine($"E) Hide filename suffix (Currently '{Options.Processing.AddFilenameSuffix}')");
Console.WriteLine($"F) Output submission JSON (Currently '{Options.Processing.OutputSubmissionJSON}')");
Console.WriteLine($"G) Include JSON artifacts (Currently '{Options.Processing.IncludeArtifacts}')");
Console.WriteLine($"H) Compress logs (Currently '{Options.Processing.CompressLogFiles}')");
Console.WriteLine($"I) Log compression (Currently '{Options.Processing.LogCompression.LongName()}')");
Console.WriteLine($"J) Delete unnecessary files (Currently '{Options.Processing.DeleteUnnecessaryFiles}')");
Console.WriteLine();
Console.WriteLine($"Q) Exit the program");
Console.WriteLine($"X) Start checking");
@@ -118,18 +119,18 @@ namespace MPF.Check.Features
case "3":
goto seedPath;
case "4":
Options.AddPlaceholders = !Options.AddPlaceholders;
Options.Processing.MediaInformation.AddPlaceholders = !Options.Processing.MediaInformation.AddPlaceholders;
goto root;
case "5":
Options.CreateIRDAfterDumping = !Options.CreateIRDAfterDumping;
Options.Processing.CreateIRDAfterDumping = !Options.Processing.CreateIRDAfterDumping;
goto root;
case "6":
Options.RetrieveMatchInformation = !Options.RetrieveMatchInformation;
Options.Processing.Login.RetrieveMatchInformation = !Options.Processing.Login.RetrieveMatchInformation;
goto root;
case "7":
goto redumpCredentials;
case "8":
Options.PullAllInformation = !Options.PullAllInformation;
Options.Processing.MediaInformation.PullAllInformation = !Options.Processing.MediaInformation.PullAllInformation;
goto root;
case "9":
goto devicePath;
@@ -151,26 +152,26 @@ namespace MPF.Check.Features
goto root;
case "e":
case "E":
Options.AddFilenameSuffix = !Options.AddFilenameSuffix;
Options.Processing.AddFilenameSuffix = !Options.Processing.AddFilenameSuffix;
goto root;
case "f":
case "F":
Options.OutputSubmissionJSON = !Options.OutputSubmissionJSON;
Options.Processing.OutputSubmissionJSON = !Options.Processing.OutputSubmissionJSON;
goto root;
case "g":
case "G":
Options.IncludeArtifacts = !Options.IncludeArtifacts;
Options.Processing.IncludeArtifacts = !Options.Processing.IncludeArtifacts;
goto root;
case "h":
case "H":
Options.CompressLogFiles = !Options.CompressLogFiles;
Options.Processing.CompressLogFiles = !Options.Processing.CompressLogFiles;
goto root;
case "i":
case "I":
goto logCompression;
case "j":
case "J":
Options.DeleteUnnecessaryFiles = !Options.DeleteUnnecessaryFiles;
Options.Processing.DeleteUnnecessaryFiles = !Options.Processing.DeleteUnnecessaryFiles;
goto root;
case "q":
@@ -219,7 +220,7 @@ namespace MPF.Check.Features
Console.WriteLine("Input the dumping program and press Enter:");
Console.Write("> ");
result = Console.ReadLine();
Options.InternalProgram = result.ToInternalProgram();
Options.Dumping.InternalProgram = result.ToInternalProgram();
goto root;
seedPath:
@@ -234,18 +235,18 @@ namespace MPF.Check.Features
Console.WriteLine();
Console.WriteLine("Enter your Redump username and press Enter:");
Console.Write("> ");
Options.RedumpUsername = Console.ReadLine();
Options.Processing.Login.RedumpUsername = Console.ReadLine();
Console.WriteLine("Enter your Redump password (hidden) and press Enter:");
Console.Write("> ");
Options.RedumpPassword = string.Empty;
Options.Processing.Login.RedumpPassword = string.Empty;
while (true)
{
var key = Console.ReadKey(true);
if (key.Key == ConsoleKey.Enter)
break;
Options.RedumpPassword += key.KeyChar;
Options.Processing.Login.RedumpPassword += key.KeyChar;
}
goto root;
@@ -269,15 +270,15 @@ namespace MPF.Check.Features
Console.WriteLine("Input the log compression type and press Enter:");
Console.Write("> ");
result = Console.ReadLine();
Options.LogCompression = result.ToLogCompression();
Options.Processing.LogCompression = result.ToLogCompression();
goto root;
exit:
// Now deal with the complex options
Options.ScanForProtection = scan && !string.IsNullOrEmpty(DevicePath);
Options.ScanArchivesForProtection = enableArchives && scan && !string.IsNullOrEmpty(DevicePath);
Options.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(DevicePath);
Options.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.ScanForProtection = scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.ScanArchivesForProtection = enableArchives && scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(DevicePath);
return true;
}

View File

@@ -123,33 +123,34 @@ namespace MPF.Check.Features
Options = OptionsLoader.LoadFromConfig();
if (Options.FirstRun)
{
Options = new Options()
{
// Internal Program
InternalProgram = InternalProgram.NONE,
Options = new SegmentedOptions();
// Extra Dumping Options
ScanForProtection = false,
AddPlaceholders = true,
PullAllInformation = false,
AddFilenameSuffix = false,
OutputSubmissionJSON = false,
IncludeArtifacts = false,
CompressLogFiles = false,
LogCompression = LogCompression.DeflateMaximum,
DeleteUnnecessaryFiles = false,
CreateIRDAfterDumping = false,
// Internal Program
Options.Dumping.InternalProgram = InternalProgram.NONE;
// Protection Scanning Options
ScanArchivesForProtection = true,
IncludeDebugProtectionInformation = false,
HideDriveLetters = false,
// Protection Scanning Options
Options.Processing.ProtectionScanning.ScanForProtection = false;
Options.Processing.ProtectionScanning.ScanArchivesForProtection = true;
Options.Processing.ProtectionScanning.IncludeDebugProtectionInformation = false;
Options.Processing.ProtectionScanning.HideDriveLetters = false;
// Redump Login Information
RetrieveMatchInformation = true,
RedumpUsername = null,
RedumpPassword = null,
};
// Redump Login Information
Options.Processing.Login.RetrieveMatchInformation = true;
Options.Processing.Login.RedumpUsername = null;
Options.Processing.Login.RedumpPassword = null;
// Media Information
Options.Processing.MediaInformation.AddPlaceholders = true;
Options.Processing.MediaInformation.PullAllInformation = false;
// Post-Information Options
Options.Processing.AddFilenameSuffix = false;
Options.Processing.CreateIRDAfterDumping = false;
Options.Processing.OutputSubmissionJSON = false;
Options.Processing.IncludeArtifacts = false;
Options.Processing.CompressLogFiles = false;
Options.Processing.LogCompression = LogCompression.DeflateMaximum;
Options.Processing.DeleteUnnecessaryFiles = false;
}
else
{
@@ -164,7 +165,7 @@ namespace MPF.Check.Features
{
// Use specific program
if (UseInput.ProcessInput(args, ref index))
Options.InternalProgram = UseInput.Value.ToInternalProgram();
Options.Dumping.InternalProgram = UseInput.Value.ToInternalProgram();
// Include seed info file
else if (LoadSeedInput.ProcessInput(args, ref index))
@@ -172,45 +173,45 @@ namespace MPF.Check.Features
// Disable placeholder values in submission info
else if (NoPlaceholdersInput.ProcessInput(args, ref index))
Options.AddPlaceholders = !Options.AddPlaceholders;
Options.Processing.MediaInformation.AddPlaceholders = !Options.Processing.MediaInformation.AddPlaceholders;
// Create IRD from output files (PS3 only)
else if (CreateIrdInput.ProcessInput(args, ref index))
Options.CreateIRDAfterDumping = !Options.CreateIRDAfterDumping;
Options.Processing.CreateIRDAfterDumping = !Options.Processing.CreateIRDAfterDumping;
// Set the log compression type (requires compression enabled)
else if (LogCompressionInput.ProcessInput(args, ref index))
Options.LogCompression = LogCompressionInput.Value.ToLogCompression();
Options.Processing.LogCompression = LogCompressionInput.Value.ToLogCompression();
// Retrieve Redump match information
else if (NoRetrieveInput.ProcessInput(args, ref index))
Options.RetrieveMatchInformation = !Options.RetrieveMatchInformation;
Options.Processing.Login.RetrieveMatchInformation = !Options.Processing.Login.RetrieveMatchInformation;
// Redump login
else if (args[index].StartsWith("-c=") || args[index].StartsWith("--credentials="))
{
string[] credentials = args[index].Split('=')[1].Split(';');
Options.RedumpUsername = credentials[0];
Options.RedumpPassword = credentials[1];
Options.Processing.Login.RedumpUsername = credentials[0];
Options.Processing.Login.RedumpPassword = credentials[1];
}
else if (args[index] == "-c" || args[index] == "--credentials")
{
Options.RedumpUsername = args[index + 1];
Options.RedumpPassword = args[index + 2];
Options.Processing.Login.RedumpUsername = args[index + 1];
Options.Processing.Login.RedumpPassword = args[index + 2];
index += 2;
}
// Redump username
else if (UsernameInput.ProcessInput(args, ref index))
Options.RedumpUsername = UsernameInput.Value;
Options.Processing.Login.RedumpUsername = UsernameInput.Value;
// Redump password
else if (PasswordInput.ProcessInput(args, ref index))
Options.RedumpPassword = PasswordInput.Value;
Options.Processing.Login.RedumpPassword = PasswordInput.Value;
// Pull all information (requires Redump login)
else if (PullAllInput.ProcessInput(args, ref index))
Options.PullAllInformation = !Options.PullAllInformation;
Options.Processing.MediaInformation.PullAllInformation = !Options.Processing.MediaInformation.PullAllInformation;
// Use a device path for physical checks
else if (PathInput.ProcessInput(args, ref index))
@@ -234,23 +235,23 @@ namespace MPF.Check.Features
// Add filename suffix
else if (SuffixInput.ProcessInput(args, ref index))
Options.AddFilenameSuffix = !Options.AddFilenameSuffix;
Options.Processing.AddFilenameSuffix = !Options.Processing.AddFilenameSuffix;
// Output submission JSON
else if (JsonInput.ProcessInput(args, ref index))
Options.OutputSubmissionJSON = !Options.OutputSubmissionJSON;
Options.Processing.OutputSubmissionJSON = !Options.Processing.OutputSubmissionJSON;
// Include JSON artifacts
else if (IncludeArtifactsInput.ProcessInput(args, ref index))
Options.IncludeArtifacts = !Options.IncludeArtifacts;
Options.Processing.IncludeArtifacts = !Options.Processing.IncludeArtifacts;
// Compress log and extraneous files
else if (ZipInput.ProcessInput(args, ref index))
Options.CompressLogFiles = !Options.CompressLogFiles;
Options.Processing.CompressLogFiles = !Options.Processing.CompressLogFiles;
// Delete unnecessary files
else if (DeleteInput.ProcessInput(args, ref index))
Options.DeleteUnnecessaryFiles = !Options.DeleteUnnecessaryFiles;
Options.Processing.DeleteUnnecessaryFiles = !Options.Processing.DeleteUnnecessaryFiles;
// Default, add to inputs
else
@@ -258,10 +259,10 @@ namespace MPF.Check.Features
}
// Now deal with the complex options
Options.ScanForProtection = scan && !string.IsNullOrEmpty(DevicePath);
Options.ScanArchivesForProtection = enableArchives && scan && !string.IsNullOrEmpty(DevicePath);
Options.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(DevicePath);
Options.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.ScanForProtection = scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.ScanArchivesForProtection = enableArchives && scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.IncludeDebugProtectionInformation = enableDebug && scan && !string.IsNullOrEmpty(DevicePath);
Options.Processing.ProtectionScanning.HideDriveLetters = hideDriveLetters && scan && !string.IsNullOrEmpty(DevicePath);
return true;
}

View File

@@ -13,9 +13,10 @@ namespace MPF.Frontend.Test
[InlineData("fd A test.img", 'A', true, MediaType.FloppyDisk, true)]
[InlineData("dvd X test.iso 8 /raw", 'X', false, MediaType.FloppyDisk, false)]
[InlineData("stop D", 'D', false, MediaType.DVD, true)]
public void ParametersValidTest(string? parameters, char letter, bool isFloppy, MediaType? mediaType, bool expected)
public void ParametersValidSegmentedTest(string? parameters, char letter, bool isFloppy, MediaType? mediaType, bool expected)
{
var options = new Options() { InternalProgram = InternalProgram.DiscImageCreator };
var options = new SegmentedOptions();
options.Dumping.InternalProgram = InternalProgram.DiscImageCreator;
// TODO: This relies on creating real objects for the drive. Can we mock this out instead?
var drive = isFloppy

View File

@@ -19,15 +19,13 @@ namespace MPF.Frontend.Test.Tools
[InlineData(MediaType.HDDVD, 24)]
[InlineData(MediaType.BluRay, 16)]
[InlineData(MediaType.NintendoWiiUOpticalDisc, 16)]
public void GetDefaultSpeedForMediaTypeTest(MediaType? mediaType, int expected)
public void GetDefaultSpeedForMediaTypeSegmentedTest(MediaType? mediaType, int expected)
{
var options = new Options
{
PreferredDumpSpeedCD = 72,
PreferredDumpSpeedDVD = 24,
PreferredDumpSpeedHDDVD = 24,
PreferredDumpSpeedBD = 16,
};
var options = new SegmentedOptions();
options.Dumping.PreferredDumpSpeedCD = 72;
options.Dumping.PreferredDumpSpeedDVD = 24;
options.Dumping.PreferredDumpSpeedHDDVD = 24;
options.Dumping.PreferredDumpSpeedBD = 16;
int actual = FrontendTool.GetDefaultSpeedForMediaType(mediaType, options);
Assert.Equal(expected, actual);

View File

@@ -47,9 +47,9 @@ namespace MPF.Frontend
private readonly InternalProgram _internalProgram;
/// <summary>
/// Options object representing user-defined options
/// SegmentedOptions object representing user-defined options
/// </summary>
private readonly Options _options;
private readonly SegmentedOptions _options;
/// <summary>
/// Processor object representing how to process the outputs
@@ -106,22 +106,22 @@ namespace MPF.Frontend
/// <param name="drive"></param>
/// <param name="system"></param>
/// <param name="internalProgram"></param>
public DumpEnvironment(Options options,
public DumpEnvironment(SegmentedOptions options,
string? outputPath,
Drive? drive,
RedumpSystem? system,
InternalProgram? internalProgram)
{
// Set options object
_options = options;
_options = new SegmentedOptions(options);
// Output paths
OutputPath = FrontendTool.NormalizeOutputPaths(outputPath, false);
// UI information
_drive = drive;
_system = system ?? options.DefaultSystem;
_internalProgram = internalProgram ?? options.InternalProgram;
_system = system ?? options.Dumping.DefaultSystem;
_internalProgram = internalProgram ?? options.Dumping.InternalProgram;
}
#region Internal Program Management
@@ -216,10 +216,10 @@ namespace MPF.Frontend
#pragma warning disable IDE0072
_executionContext = _internalProgram switch
{
InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(parameters) { ExecutablePath = _options.AaruPath },
InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(parameters) { ExecutablePath = _options.DiscImageCreatorPath },
// InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(parameters) { ExecutablePath = _options.DreamdumpPath },
InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(parameters) { ExecutablePath = _options.RedumperPath },
InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(parameters) { ExecutablePath = _options.Dumping.AaruPath },
InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(parameters) { ExecutablePath = _options.Dumping.DiscImageCreatorPath },
// InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(parameters) { ExecutablePath = _options.Dumping.DreamdumpPath },
InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(parameters) { ExecutablePath = _options.Dumping.RedumperPath },
// If no dumping program found, set to null
InternalProgram.NONE => null,
@@ -284,10 +284,10 @@ namespace MPF.Frontend
// Set the proper parameters
_executionContext = _internalProgram switch
{
InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
// InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
// InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
// If no dumping program found, set to null
InternalProgram.NONE => null,
@@ -554,7 +554,7 @@ namespace MPF.Frontend
}
// Get user-modifiable information if configured to
if (_options.PromptForDiscInformation && processUserInfo is not null)
if (_options.Processing.MediaInformation.PromptForDiscInformation && processUserInfo is not null)
{
resultProgress.Report(ResultEventArgs.Neutral("Waiting for additional media information..."));
bool? filledInfo = processUserInfo.Invoke(_options, ref submissionInfo);
@@ -571,14 +571,14 @@ namespace MPF.Frontend
// Format the information for the text output
resultProgress.Report(ResultEventArgs.Neutral("Formatting information..."));
var formattedValues = Formatter.FormatOutputData(submissionInfo, _options.EnableRedumpCompatibility, out string? formatResult);
var formattedValues = Formatter.FormatOutputData(submissionInfo, _options.Processing.MediaInformation.EnableRedumpCompatibility, out string? formatResult);
if (formattedValues is null)
resultProgress.Report(ResultEventArgs.Failure(formatResult));
else
resultProgress.Report(ResultEventArgs.Success(formatResult));
// Get the filename suffix for auto-generated files
var filenameSuffix = _options.AddFilenameSuffix ? Path.GetFileNameWithoutExtension(outputFilename) : null;
var filenameSuffix = _options.Processing.AddFilenameSuffix ? Path.GetFileNameWithoutExtension(outputFilename) : null;
// Write the text output
resultProgress.Report(ResultEventArgs.Neutral("Writing submission information file..."));
@@ -591,10 +591,10 @@ namespace MPF.Frontend
// Write the copy protection output
if (submissionInfo?.CopyProtection?.FullProtections is not null && submissionInfo.CopyProtection.FullProtections.Count > 0)
{
if (_options.ScanForProtection)
if (_options.Processing.ProtectionScanning.ScanForProtection)
{
resultProgress.Report(ResultEventArgs.Neutral("Writing protection information file..."));
bool scanSuccess = WriteProtectionData(outputDirectory, filenameSuffix, submissionInfo, _options.HideDriveLetters);
bool scanSuccess = WriteProtectionData(outputDirectory, filenameSuffix, submissionInfo, _options.Processing.ProtectionScanning.HideDriveLetters);
if (scanSuccess)
resultProgress.Report(ResultEventArgs.Success("Writing complete!"));
else
@@ -603,10 +603,10 @@ namespace MPF.Frontend
}
// Write the JSON output, if required
if (_options.OutputSubmissionJSON)
if (_options.Processing.OutputSubmissionJSON)
{
resultProgress.Report(ResultEventArgs.Neutral($"Writing submission information JSON file{(_options.IncludeArtifacts ? " with artifacts" : string.Empty)}..."));
bool jsonSuccess = WriteOutputData(outputDirectory, filenameSuffix, submissionInfo, _options.IncludeArtifacts);
resultProgress.Report(ResultEventArgs.Neutral($"Writing submission information JSON file{(_options.Processing.IncludeArtifacts ? " with artifacts" : string.Empty)}..."));
bool jsonSuccess = WriteOutputData(outputDirectory, filenameSuffix, submissionInfo, _options.Processing.IncludeArtifacts);
if (jsonSuccess)
resultProgress.Report(ResultEventArgs.Success("Writing complete!"));
else
@@ -614,7 +614,7 @@ namespace MPF.Frontend
}
// Compress the logs, if required
if (_options.CompressLogFiles)
if (_options.Processing.CompressLogFiles)
{
resultProgress.Report(ResultEventArgs.Neutral("Compressing log files..."));
#if NET40
@@ -623,7 +623,7 @@ namespace MPF.Frontend
await Task.Run(() =>
#endif
{
bool compressSuccess = _processor.CompressLogFiles(mediaType, _options.LogCompression, outputDirectory, outputFilename, filenameSuffix, out string compressResult);
bool compressSuccess = _processor.CompressLogFiles(mediaType, _options.Processing.LogCompression, outputDirectory, outputFilename, filenameSuffix, out string compressResult);
if (compressSuccess)
resultProgress.Report(ResultEventArgs.Success(compressResult));
else
@@ -634,7 +634,7 @@ namespace MPF.Frontend
}
// Delete unnecessary files, if required
if (_options.DeleteUnnecessaryFiles)
if (_options.Processing.DeleteUnnecessaryFiles)
{
resultProgress.Report(ResultEventArgs.Neutral("Deleting unnecessary files..."));
bool deleteSuccess = _processor.DeleteUnnecessaryFiles(mediaType, outputDirectory, outputFilename, out string deleteResult);
@@ -645,7 +645,7 @@ namespace MPF.Frontend
}
// Create PS3 IRD, if required
if (_options.CreateIRDAfterDumping && _system == RedumpSystem.SonyPlayStation3 && mediaType == MediaType.BluRay)
if (_options.Processing.CreateIRDAfterDumping && _system == RedumpSystem.SonyPlayStation3 && mediaType == MediaType.BluRay)
{
resultProgress.Report(ResultEventArgs.Neutral("Creating IRD... please wait!"));
bool deleteSuccess = await IRDTool.WriteIRD(OutputPath, submissionInfo?.Extras?.DiscKey, submissionInfo?.Extras?.DiscID, submissionInfo?.Extras?.PIC, submissionInfo?.SizeAndChecksums.Layerbreak, submissionInfo?.SizeAndChecksums.CRC32);

View File

@@ -63,7 +63,34 @@ namespace MPF.Frontend
}
}
/// <summary>
/// Get the string representation of the DreamdumpSectorOrder enum values
/// </summary>
/// <param name="order">DreamdumpSectorOrder value to convert</param>
/// <returns>String representing the value, if possible</returns>
public static string LongName(this DreamdumpSectorOrder order)
=> ((DreamdumpSectorOrder?)order).LongName();
/// <summary>
/// Get the string representation of the DreamdumpSectorOrder enum values
/// </summary>
/// <param name="order">DreamdumpSectorOrder value to convert</param>
/// <returns>String representing the value, if possible</returns>
public static string LongName(this DreamdumpSectorOrder? order)
{
return order switch
{
DreamdumpSectorOrder.DATA_C2_SUB => "DATA_C2_SUB",
DreamdumpSectorOrder.DATA_SUB_C2 => "DATA_SUB_C2",
DreamdumpSectorOrder.DATA_SUB => "DATA_SUB",
DreamdumpSectorOrder.DATA_C2 => "DATA_C2",
DreamdumpSectorOrder.NONE => "Default",
_ => "Unknown",
};
}
/// <summary>
/// Get the string representation of the InterfaceLanguage enum values
/// </summary>
/// <param name="lang">InterfaceLanguage value to convert</param>

View File

@@ -23,6 +23,7 @@ namespace MPF.Frontend.Features
}
/// <inheritdoc/>
/// TODO: Restructure this to fit SegmentedOptions
public override bool Execute()
{
// Try to load the current config
@@ -35,110 +36,118 @@ namespace MPF.Frontend.Features
// Paths
Console.WriteLine("Paths:");
Console.WriteLine($" Aaru Path = {options.AaruPath}");
Console.WriteLine($" DiscImageCreator Path = {options.DiscImageCreatorPath}");
Console.WriteLine($" Redumper Path = {options.RedumperPath}");
Console.WriteLine($" Default Program = {options.InternalProgram.LongName()}");
Console.WriteLine($" Aaru Path = {options.Dumping.AaruPath}");
Console.WriteLine($" DiscImageCreator Path = {options.Dumping.DiscImageCreatorPath}");
Console.WriteLine($" Dreamdump Path = {options.Dumping.DreamdumpPath}");
Console.WriteLine($" Redumper Path = {options.Dumping.RedumperPath}");
Console.WriteLine($" Default Program = {options.Dumping.InternalProgram.LongName()}");
Console.WriteLine();
// UI Defaults
Console.WriteLine("UI Defaults:");
Console.WriteLine($" Dark Mode = {options.EnableDarkMode}");
Console.WriteLine($" Purp Mode = {options.EnablePurpMode}");
Console.WriteLine($" Custom Background Color = {options.CustomBackgroundColor}");
Console.WriteLine($" Custom Text Color = {options.CustomTextColor}");
Console.WriteLine($" Dark Mode = {options.GUI.Theming.EnableDarkMode}");
Console.WriteLine($" Purp Mode = {options.GUI.Theming.EnablePurpMode}");
Console.WriteLine($" Custom Background Color = {options.GUI.Theming.CustomBackgroundColor}");
Console.WriteLine($" Custom Text Color = {options.GUI.Theming.CustomTextColor}");
Console.WriteLine($" Check for Updates on Startup = {options.CheckForUpdatesOnStartup}");
Console.WriteLine($" Copy Update URL to Clipboard = {options.CopyUpdateUrlToClipboard}");
Console.WriteLine($" Fast Label Update = {options.FastUpdateLabel}");
Console.WriteLine($" Default Interface Language = {options.DefaultInterfaceLanguage.LongName()}");
Console.WriteLine($" Default Output Path = {options.DefaultOutputPath}");
Console.WriteLine($" Default System = {options.DefaultSystem.LongName()}");
Console.WriteLine($" Show Debug Menu Item = {options.ShowDebugViewMenuItem}");
Console.WriteLine($" Copy Update URL to Clipboard = {options.GUI.CopyUpdateUrlToClipboard}");
Console.WriteLine($" Fast Label Update = {options.GUI.FastUpdateLabel}");
Console.WriteLine($" Default Interface Language = {options.GUI.DefaultInterfaceLanguage.LongName()}");
Console.WriteLine($" Default Output Path = {options.Dumping.DefaultOutputPath}");
Console.WriteLine($" Default System = {options.Dumping.DefaultSystem.LongName()}");
Console.WriteLine($" Show Debug Menu Item = {options.GUI.ShowDebugViewMenuItem}");
Console.WriteLine();
// Dumping Speeds
Console.WriteLine("Dumping Speeds:");
Console.WriteLine($" Default CD Speed = {options.PreferredDumpSpeedCD}");
Console.WriteLine($" Default DVD Speed = {options.PreferredDumpSpeedDVD}");
Console.WriteLine($" Default HD-DVD Speed = {options.PreferredDumpSpeedHDDVD}");
Console.WriteLine($" Default Blu-ray Speed = {options.PreferredDumpSpeedBD}");
Console.WriteLine($" Default CD Speed = {options.Dumping.PreferredDumpSpeedCD}");
Console.WriteLine($" Default DVD Speed = {options.Dumping.PreferredDumpSpeedDVD}");
Console.WriteLine($" Default HD-DVD Speed = {options.Dumping.PreferredDumpSpeedHDDVD}");
Console.WriteLine($" Default Blu-ray Speed = {options.Dumping.PreferredDumpSpeedBD}");
Console.WriteLine();
// Aaru
Console.WriteLine("Aaru-Specific Options:");
Console.WriteLine($" Enable Debug = {options.AaruEnableDebug}");
Console.WriteLine($" Enable Verbose = {options.AaruEnableVerbose}");
Console.WriteLine($" Force Dumping = {options.AaruForceDumping}");
Console.WriteLine($" Reread Count = {options.AaruRereadCount}");
Console.WriteLine($" Strip Personal Data = {options.AaruStripPersonalData}");
Console.WriteLine($" Enable Debug = {options.Dumping.Aaru.EnableDebug}");
Console.WriteLine($" Enable Verbose = {options.Dumping.Aaru.EnableVerbose}");
Console.WriteLine($" Force Dumping = {options.Dumping.Aaru.ForceDumping}");
Console.WriteLine($" Reread Count = {options.Dumping.Aaru.RereadCount}");
Console.WriteLine($" Strip Personal Data = {options.Dumping.Aaru.StripPersonalData}");
Console.WriteLine();
// DiscImageCreator
Console.WriteLine("DiscImageCreator-Specific Options:");
Console.WriteLine($" Multi-Sector Read Flag = {options.DICMultiSectorRead}");
Console.WriteLine($" Multi-Sector Read Value = {options.DICMultiSectorReadValue}");
Console.WriteLine($" Overly-Secure Flags = {options.DICParanoidMode}");
Console.WriteLine($" Quiet Flag = {options.DICQuietMode}");
Console.WriteLine($" CD Reread Count = {options.DICRereadCount}");
Console.WriteLine($" DVD Reread Count = {options.DICDVDRereadCount}");
Console.WriteLine($" Use CMI Flag = {options.DICUseCMIFlag}");
Console.WriteLine($" Multi-Sector Read Flag = {options.Dumping.DIC.MultiSectorRead}");
Console.WriteLine($" Multi-Sector Read Value = {options.Dumping.DIC.MultiSectorReadValue}");
Console.WriteLine($" Overly-Secure Flags = {options.Dumping.DIC.ParanoidMode}");
Console.WriteLine($" Quiet Flag = {options.Dumping.DIC.QuietMode}");
Console.WriteLine($" CD Reread Count = {options.Dumping.DIC.RereadCount}");
Console.WriteLine($" DVD Reread Count = {options.Dumping.DIC.DVDRereadCount}");
Console.WriteLine($" Use CMI Flag = {options.Dumping.DIC.UseCMIFlag}");
Console.WriteLine();
// Dreamdump
Console.WriteLine("Dreamdump-Specific Options:");
Console.WriteLine($" Non-Redump Mode = {options.Dumping.Dreamdump.NonRedumpMode}");
Console.WriteLine($" Sector Order = {options.Dumping.Dreamdump.SectorOrder.LongName()}");
Console.WriteLine($" Reread Count = {options.Dumping.Dreamdump.RereadCount}");
Console.WriteLine();
// Redumper
Console.WriteLine("Redumper-Specific Options:");
Console.WriteLine($" Enable Skeleton = {options.RedumperEnableSkeleton}");
Console.WriteLine($" Enable Verbose = {options.RedumperEnableVerbose}");
Console.WriteLine($" Lead-in Retry Count = {options.RedumperLeadinRetryCount}");
Console.WriteLine($" Non-Redump Mode = {options.RedumperNonRedumpMode}");
Console.WriteLine($" Drive Type = {options.RedumperDriveType.LongName()}");
Console.WriteLine($" Read Method = {options.RedumperReadMethod.LongName()}");
Console.WriteLine($" Sector Order = {options.RedumperSectorOrder.LongName()}");
Console.WriteLine($" Reread Count = {options.RedumperRereadCount}");
Console.WriteLine($" Refine Sector Mode = {options.RedumperRefineSectorMode}");
Console.WriteLine($" Enable Skeleton = {options.Dumping.Redumper.EnableSkeleton}");
Console.WriteLine($" Enable Verbose = {options.Dumping.Redumper.EnableVerbose}");
Console.WriteLine($" Lead-in Retry Count = {options.Dumping.Redumper.LeadinRetryCount}");
Console.WriteLine($" Non-Redump Mode = {options.Dumping.Redumper.NonRedumpMode}");
Console.WriteLine($" Drive Type = {options.Dumping.Redumper.DriveType.LongName()}");
Console.WriteLine($" Read Method = {options.Dumping.Redumper.ReadMethod.LongName()}");
Console.WriteLine($" Sector Order = {options.Dumping.Redumper.SectorOrder.LongName()}");
Console.WriteLine($" Reread Count = {options.Dumping.Redumper.RereadCount}");
Console.WriteLine($" Refine Sector Mode = {options.Dumping.Redumper.RefineSectorMode}");
Console.WriteLine();
// Extra Dumping Options
Console.WriteLine("Extra Dumping Options:");
Console.WriteLine($" Scan for Protection = {options.ScanForProtection}");
Console.WriteLine($" Add Placeholders = {options.AddPlaceholders}");
Console.WriteLine($" Prompt for Media Information = {options.PromptForDiscInformation}");
Console.WriteLine($" Pull All Information = {options.PullAllInformation}");
Console.WriteLine($" Enable Tabs in Input Fields = {options.EnableTabsInInputFields}");
Console.WriteLine($" Enable Redump Compatibility = {options.EnableRedumpCompatibility}");
Console.WriteLine($" Show Disc Eject Reminder = {options.ShowDiscEjectReminder}");
Console.WriteLine($" Ignore Fixed Drives = {options.IgnoreFixedDrives}");
Console.WriteLine($" Add Filename Suffix = {options.AddFilenameSuffix}");
Console.WriteLine($" Output Submission JSON = {options.OutputSubmissionJSON}");
Console.WriteLine($" Include Artifacts = {options.IncludeArtifacts}");
Console.WriteLine($" Compress Log Files = {options.CompressLogFiles}");
Console.WriteLine($" Log Compression = {options.LogCompression.LongName()}");
Console.WriteLine($" Delete Unnecessary Files = {options.DeleteUnnecessaryFiles}");
Console.WriteLine($" Create IRD After Dumping = {options.CreateIRDAfterDumping}");
Console.WriteLine($" Scan for Protection = {options.Processing.ProtectionScanning.ScanForProtection}");
Console.WriteLine($" Add Placeholders = {options.Processing.MediaInformation.AddPlaceholders}");
Console.WriteLine($" Prompt for Media Information = {options.Processing.MediaInformation.PromptForDiscInformation}");
Console.WriteLine($" Pull All Information = {options.Processing.MediaInformation.PullAllInformation}");
Console.WriteLine($" Enable Tabs in Input Fields = {options.Processing.MediaInformation.EnableTabsInInputFields}");
Console.WriteLine($" Enable Redump Compatibility = {options.Processing.MediaInformation.EnableRedumpCompatibility}");
Console.WriteLine($" Show Disc Eject Reminder = {options.Processing.ShowDiscEjectReminder}");
Console.WriteLine($" Ignore Fixed Drives = {options.GUI.IgnoreFixedDrives}");
Console.WriteLine($" Add Filename Suffix = {options.Processing.AddFilenameSuffix}");
Console.WriteLine($" Output Submission JSON = {options.Processing.OutputSubmissionJSON}");
Console.WriteLine($" Include Artifacts = {options.Processing.IncludeArtifacts}");
Console.WriteLine($" Compress Log Files = {options.Processing.CompressLogFiles}");
Console.WriteLine($" Log Compression = {options.Processing.LogCompression.LongName()}");
Console.WriteLine($" Delete Unnecessary Files = {options.Processing.DeleteUnnecessaryFiles}");
Console.WriteLine($" Create IRD After Dumping = {options.Processing.CreateIRDAfterDumping}");
Console.WriteLine();
// Skip Options
Console.WriteLine("Skip Options:");
Console.WriteLine($" Skip System Detection = {options.SkipSystemDetection}");
Console.WriteLine($" Skip System Detection = {options.GUI.SkipSystemDetection}");
Console.WriteLine();
// Protection Scanning Options
Console.WriteLine("Protection Scanning Options:");
Console.WriteLine($" Scan Archives for Protection = {options.ScanArchivesForProtection}");
Console.WriteLine($" Include Debug Protection Information = {options.IncludeDebugProtectionInformation}");
Console.WriteLine($" Hide Drive Letters = {options.HideDriveLetters}");
Console.WriteLine($" Scan Archives for Protection = {options.Processing.ProtectionScanning.ScanArchivesForProtection}");
Console.WriteLine($" Include Debug Protection Information = {options.Processing.ProtectionScanning.IncludeDebugProtectionInformation}");
Console.WriteLine($" Hide Drive Letters = {options.Processing.ProtectionScanning.HideDriveLetters}");
Console.WriteLine();
// Logging Options
Console.WriteLine("Logging Options:");
Console.WriteLine($" Verbose Logging = {options.VerboseLogging}");
Console.WriteLine($" Open Log Window at Startup = {options.OpenLogWindowAtStartup}");
Console.WriteLine($" Open Log Window at Startup = {options.GUI.OpenLogWindowAtStartup}");
Console.WriteLine();
// Redump Login Information
Console.WriteLine("Redump Login Information:");
Console.WriteLine($" Retrieve Match Information = {options.RetrieveMatchInformation}");
Console.WriteLine($" Redump Username = {options.RedumpUsername}");
Console.WriteLine($" Redump Password = {(string.IsNullOrEmpty(options.RedumpPassword) ? "[UNSET]" : "[SET]")}");
Console.WriteLine($" Retrieve Match Information = {options.Processing.Login.RetrieveMatchInformation}");
Console.WriteLine($" Redump Username = {options.Processing.Login.RedumpUsername}");
Console.WriteLine($" Redump Password = {(string.IsNullOrEmpty(options.Processing.Login.RedumpPassword) ? "[UNSET]" : "[SET]")}");
Console.WriteLine();
return true;

View File

@@ -5,8 +5,8 @@ namespace MPF.Frontend
/// <summary>
/// Determines how user information is processed, if at all
/// </summary>
/// <param name="options">Options set that may impact processing</params>
/// <param name="options">SegmentedOptions set that may impact processing</params>
/// <param name="info">Submission info that may be overwritten</param>
/// <returns>True for successful updating, false or null otherwise</returns>
public delegate bool? ProcessUserInfoDelegate(Options? options, ref SubmissionInfo? info);
public delegate bool? ProcessUserInfoDelegate(SegmentedOptions? options, ref SubmissionInfo? info);
}

View File

@@ -154,6 +154,100 @@ namespace MPF.Frontend
Processing.DeleteUnnecessaryFiles = source.DeleteUnnecessaryFiles;
}
/// <summary>
/// Constructor that converts from an existing SegmentedOptions object
/// </summary>
/// <param name="source">SegmentedOptions object to read from</param>
public SegmentedOptions(SegmentedOptions? source)
{
source ??= new SegmentedOptions();
FirstRun = source.FirstRun;
CheckForUpdatesOnStartup = source.CheckForUpdatesOnStartup;
VerboseLogging = source.VerboseLogging;
GUI.CopyUpdateUrlToClipboard = source.GUI.CopyUpdateUrlToClipboard;
GUI.DefaultInterfaceLanguage = source.GUI.DefaultInterfaceLanguage;
GUI.ShowDebugViewMenuItem = source.GUI.ShowDebugViewMenuItem;
GUI.OpenLogWindowAtStartup = source.GUI.OpenLogWindowAtStartup;
GUI.Theming.EnableDarkMode = source.GUI.Theming.EnableDarkMode;
GUI.Theming.EnablePurpMode = source.GUI.Theming.EnablePurpMode;
GUI.Theming.CustomBackgroundColor = source.GUI.Theming.CustomBackgroundColor;
GUI.Theming.CustomTextColor = source.GUI.Theming.CustomTextColor;
GUI.FastUpdateLabel = source.GUI.FastUpdateLabel;
GUI.IgnoreFixedDrives = source.GUI.IgnoreFixedDrives;
GUI.SkipSystemDetection = source.GUI.SkipSystemDetection;
Dumping.AaruPath = source.Dumping.AaruPath;
Dumping.DiscImageCreatorPath = source.Dumping.DiscImageCreatorPath;
Dumping.DreamdumpPath = source.Dumping.DreamdumpPath;
Dumping.RedumperPath = source.Dumping.RedumperPath;
Dumping.InternalProgram = source.Dumping.InternalProgram;
Dumping.DefaultOutputPath = source.Dumping.DefaultOutputPath;
Dumping.DefaultSystem = source.Dumping.DefaultSystem;
Dumping.PreferredDumpSpeedCD = source.Dumping.PreferredDumpSpeedCD;
Dumping.PreferredDumpSpeedDVD = source.Dumping.PreferredDumpSpeedDVD;
Dumping.PreferredDumpSpeedHDDVD = source.Dumping.PreferredDumpSpeedHDDVD;
Dumping.PreferredDumpSpeedBD = source.Dumping.PreferredDumpSpeedBD;
Dumping.Aaru.EnableDebug = source.Dumping.Aaru.EnableDebug;
Dumping.Aaru.EnableVerbose = source.Dumping.Aaru.EnableVerbose;
Dumping.Aaru.ForceDumping = source.Dumping.Aaru.ForceDumping;
Dumping.Aaru.RereadCount = source.Dumping.Aaru.RereadCount;
Dumping.Aaru.StripPersonalData = source.Dumping.Aaru.StripPersonalData;
Dumping.DIC.MultiSectorRead = source.Dumping.DIC.MultiSectorRead;
Dumping.DIC.MultiSectorReadValue = source.Dumping.DIC.MultiSectorReadValue;
Dumping.DIC.ParanoidMode = source.Dumping.DIC.ParanoidMode;
Dumping.DIC.QuietMode = source.Dumping.DIC.QuietMode;
Dumping.DIC.RereadCount = source.Dumping.DIC.RereadCount;
Dumping.DIC.DVDRereadCount = source.Dumping.DIC.DVDRereadCount;
Dumping.DIC.UseCMIFlag = source.Dumping.DIC.UseCMIFlag;
Dumping.Dreamdump.NonRedumpMode = source.Dumping.Dreamdump.NonRedumpMode;
Dumping.Dreamdump.SectorOrder = source.Dumping.Dreamdump.SectorOrder;
Dumping.Dreamdump.RereadCount = source.Dumping.Dreamdump.RereadCount;
Dumping.Redumper.EnableSkeleton = source.Dumping.Redumper.EnableSkeleton;
Dumping.Redumper.EnableVerbose = source.Dumping.Redumper.EnableVerbose;
Dumping.Redumper.LeadinRetryCount = source.Dumping.Redumper.LeadinRetryCount;
Dumping.Redumper.NonRedumpMode = source.Dumping.Redumper.NonRedumpMode;
Dumping.Redumper.DriveType = source.Dumping.Redumper.DriveType;
Dumping.Redumper.DrivePregapStart = source.Dumping.Redumper.DrivePregapStart;
Dumping.Redumper.ReadMethod = source.Dumping.Redumper.ReadMethod;
Dumping.Redumper.SectorOrder = source.Dumping.Redumper.SectorOrder;
Dumping.Redumper.RereadCount = source.Dumping.Redumper.RereadCount;
Dumping.Redumper.RefineSectorMode = source.Dumping.Redumper.RefineSectorMode;
Processing.ProtectionScanning.ScanForProtection = source.Processing.ProtectionScanning.ScanForProtection;
Processing.ProtectionScanning.ScanArchivesForProtection = source.Processing.ProtectionScanning.ScanArchivesForProtection;
Processing.ProtectionScanning.IncludeDebugProtectionInformation = source.Processing.ProtectionScanning.IncludeDebugProtectionInformation;
Processing.ProtectionScanning.HideDriveLetters = source.Processing.ProtectionScanning.HideDriveLetters;
Processing.Login.RetrieveMatchInformation = source.Processing.Login.RetrieveMatchInformation;
Processing.Login.RedumpUsername = source.Processing.Login.RedumpUsername;
Processing.Login.RedumpPassword = source.Processing.Login.RedumpPassword;
Processing.MediaInformation.AddPlaceholders = source.Processing.MediaInformation.AddPlaceholders;
Processing.MediaInformation.PromptForDiscInformation = source.Processing.MediaInformation.PromptForDiscInformation;
Processing.MediaInformation.PullAllInformation = source.Processing.MediaInformation.PullAllInformation;
Processing.MediaInformation.EnableTabsInInputFields = source.Processing.MediaInformation.EnableTabsInInputFields;
Processing.MediaInformation.EnableRedumpCompatibility = source.Processing.MediaInformation.EnableRedumpCompatibility;
Processing.ShowDiscEjectReminder = source.Processing.ShowDiscEjectReminder;
Processing.AddFilenameSuffix = source.Processing.AddFilenameSuffix;
Processing.CreateIRDAfterDumping = source.Processing.CreateIRDAfterDumping;
Processing.OutputSubmissionJSON = source.Processing.OutputSubmissionJSON;
Processing.IncludeArtifacts = source.Processing.IncludeArtifacts;
Processing.CompressLogFiles = source.Processing.CompressLogFiles;
Processing.LogCompression = source.Processing.LogCompression;
Processing.DeleteUnnecessaryFiles = source.Processing.DeleteUnnecessaryFiles;
}
/// <summary>
/// Convert to an Options object
/// </summary>

View File

@@ -14,29 +14,29 @@ namespace MPF.Frontend.Tools
/// <summary>
/// Get the default speed for a given media type from the supplied options
/// </summary>
public static int GetDefaultSpeedForMediaType(MediaType? mediaType, Options options)
public static int GetDefaultSpeedForMediaType(MediaType? mediaType, SegmentedOptions options)
{
#pragma warning disable IDE0072
return mediaType switch
{
// CD dump speed
MediaType.CDROM => options.PreferredDumpSpeedCD,
MediaType.GDROM => options.PreferredDumpSpeedCD,
MediaType.CDROM => options.Dumping.PreferredDumpSpeedCD,
MediaType.GDROM => options.Dumping.PreferredDumpSpeedCD,
// DVD dump speed
MediaType.DVD => options.PreferredDumpSpeedDVD,
MediaType.NintendoGameCubeGameDisc => options.PreferredDumpSpeedDVD,
MediaType.NintendoWiiOpticalDisc => options.PreferredDumpSpeedDVD,
MediaType.DVD => options.Dumping.PreferredDumpSpeedDVD,
MediaType.NintendoGameCubeGameDisc => options.Dumping.PreferredDumpSpeedDVD,
MediaType.NintendoWiiOpticalDisc => options.Dumping.PreferredDumpSpeedDVD,
// HD-DVD dump speed
MediaType.HDDVD => options.PreferredDumpSpeedHDDVD,
MediaType.HDDVD => options.Dumping.PreferredDumpSpeedHDDVD,
// BD dump speed
MediaType.BluRay => options.PreferredDumpSpeedBD,
MediaType.NintendoWiiUOpticalDisc => options.PreferredDumpSpeedBD,
MediaType.BluRay => options.Dumping.PreferredDumpSpeedBD,
MediaType.NintendoWiiUOpticalDisc => options.Dumping.PreferredDumpSpeedBD,
// Default
_ => options.PreferredDumpSpeedCD,
_ => options.Dumping.PreferredDumpSpeedCD,
};
#pragma warning restore IDE0072
}

View File

@@ -182,28 +182,28 @@ namespace MPF.Frontend.Tools
/// <summary>
/// Load the current set of options from the application configuration
/// </summary>
public static Options LoadFromConfig()
public static SegmentedOptions LoadFromConfig()
{
// If no options path can be found
if (string.IsNullOrEmpty(ConfigurationPath))
return new Options();
return new SegmentedOptions();
// If the file does not exist
if (!File.Exists(ConfigurationPath) || new FileInfo(ConfigurationPath).Length == 0)
return new Options();
return new SegmentedOptions();
var serializer = JsonSerializer.Create();
var stream = File.Open(ConfigurationPath, FileMode.Open, FileAccess.Read, FileShare.None);
using var reader = new StreamReader(stream);
var settings = serializer.Deserialize(reader, typeof(Dictionary<string, string?>)) as Dictionary<string, string?>;
return new Options(settings);
return new SegmentedOptions(new Options(settings));
}
/// <summary>
/// Load the current set of options from the application configuration
/// </summary>
public static SegmentedOptions LoadFromConfigSegmented()
public static SegmentedOptions LoadFromConfigNative()
{
// If no options path can be found
if (string.IsNullOrEmpty(ConfigurationPath))

View File

@@ -73,11 +73,11 @@ namespace MPF.Frontend.Tools
/// </summary>
/// <param name="basePath">Base output image path</param>
/// <param name="drive">Drive object representing the current drive</param>
/// <param name="options">Options object that determines what to scan</param>
/// <param name="options">SegmentedOptions object that determines what to scan</param>
/// <param name="progress">Optional progress callback</param>
public static async Task<Dictionary<string, List<string>>> RunCombinedProtectionScans(string basePath,
Drive? drive,
Options options,
SegmentedOptions options,
IProgress<ProtectionProgress>? protectionProgress = null)
{
// Setup the output protections dictionary
@@ -137,11 +137,11 @@ namespace MPF.Frontend.Tools
/// Run protection scan on a given path
/// </summary>
/// <param name="path">Path to scan for protection</param>
/// <param name="options">Options object that determines what to scan</param>
/// <param name="options">SegmentedOptions object that determines what to scan</param>
/// <param name="progress">Optional progress callback</param>
/// <returns>Set of all detected copy protections with an optional error string</returns>
public static async Task<Dictionary<string, List<string>>> RunProtectionScanOnPath(string path,
Options options,
SegmentedOptions options,
IProgress<ProtectionProgress>? progress = null)
{
#if NET40
@@ -151,11 +151,11 @@ namespace MPF.Frontend.Tools
#endif
{
var scanner = new Scanner(
options.ScanArchivesForProtection,
options.Processing.ProtectionScanning.ScanArchivesForProtection,
scanContents: true, // Hardcoded value to avoid issues
scanPaths: true, // Hardcoded value to avoid issues
scanSubdirectories: true, // Hardcoded value to avoid issues
options.IncludeDebugProtectionInformation,
options.Processing.ProtectionScanning.IncludeDebugProtectionInformation,
progress);
return scanner.GetProtections(path);
@@ -173,11 +173,11 @@ namespace MPF.Frontend.Tools
/// Run protection scan on a disc image
/// </summary>
/// <param name="image">Image path to scan for protection</param>
/// <param name="options">Options object that determines what to scan</param>
/// <param name="options">SegmentedOptions object that determines what to scan</param>
/// <param name="progress">Optional progress callback</param>
/// <returns>Set of all detected copy protections with an optional error string</returns>
public static async Task<Dictionary<string, List<string>>> RunProtectionScanOnImage(string image,
Options options,
SegmentedOptions options,
IProgress<ProtectionProgress>? progress = null)
{
#if NET40
@@ -191,7 +191,7 @@ namespace MPF.Frontend.Tools
scanContents: false, // Disabled for image scanning
scanPaths: false, // Disabled for image scanning
scanSubdirectories: false, // Disabled for image scanning
options.IncludeDebugProtectionInformation,
options.Processing.ProtectionScanning.IncludeDebugProtectionInformation,
progress);
return scanner.GetProtections(image);

View File

@@ -37,7 +37,7 @@ namespace MPF.Frontend.Tools
/// <param name="drive">Drive object representing the current drive</param>
/// <param name="system">Currently selected system</param>
/// <param name="mediaType">Currently selected media type</param>
/// <param name="options">Options object representing user-defined options</param>
/// <param name="options">SegmentedOptions object representing user-defined options</param>
/// <param name="processor">Processor object representing how to process the outputs</param>
/// <param name="resultProgress">Optional result progress callback</param>
/// <param name="protectionProgress">Optional protection progress callback</param>
@@ -47,7 +47,7 @@ namespace MPF.Frontend.Tools
Drive? drive,
RedumpSystem? system,
MediaType? mediaType,
Options options,
SegmentedOptions options,
BaseProcessor processor,
IProgress<ResultEventArgs>? resultProgress = null,
IProgress<ProtectionProgress>? protectionProgress = null)
@@ -86,11 +86,11 @@ namespace MPF.Frontend.Tools
basePath = Path.Combine(outputDirectory, basePath);
// Create the default submission info
SubmissionInfo info = CreateDefaultSubmissionInfo(processor, system, mediaType, options.AddPlaceholders);
SubmissionInfo info = CreateDefaultSubmissionInfo(processor, system, mediaType, options.Processing.MediaInformation.AddPlaceholders);
// Get specific tool output handling
processor.GenerateSubmissionInfo(info, mediaType, basePath, options.EnableRedumpCompatibility);
if (options.IncludeArtifacts)
processor.GenerateSubmissionInfo(info, mediaType, basePath, options.Processing.MediaInformation.EnableRedumpCompatibility);
if (options.Processing.IncludeArtifacts)
info.Artifacts = processor.GenerateArtifacts(mediaType, outputDirectory, outputFilename);
// Get a list of matching IDs for each line in the DAT
@@ -113,10 +113,10 @@ namespace MPF.Frontend.Tools
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.VolumeLabel] = volLabels;
// Extract info based generically on MediaType
ProcessMediaType(info, mediaType, options.AddPlaceholders);
ProcessMediaType(info, mediaType, options.Processing.MediaInformation.AddPlaceholders);
// Extract info based specifically on RedumpSystem
ProcessSystem(info, system, drive, options.AddPlaceholders, processor is DiscImageCreator, basePath);
ProcessSystem(info, system, drive, options.Processing.MediaInformation.AddPlaceholders, processor is DiscImageCreator, basePath);
// Run anti-modchip check, if necessary
if (drive is not null && system.SupportsAntiModchipScans() && info.CopyProtection.AntiModchip == YesNo.NULL)
@@ -134,7 +134,7 @@ namespace MPF.Frontend.Tools
try
{
Dictionary<string, List<string>>? protections = null;
if (options.ScanForProtection)
if (options.Processing.ProtectionScanning.ScanForProtection)
{
// Explicitly note missing/invalid device paths
if (drive?.Name is null)
@@ -157,13 +157,13 @@ namespace MPF.Frontend.Tools
// Set fields that may have automatic filling otherwise
info.CommonDiscInfo.Category ??= DiscCategory.Games;
info.VersionAndEditions.Version ??= options.AddPlaceholders ? RequiredIfExistsValue : string.Empty;
info.VersionAndEditions.Version ??= options.Processing.MediaInformation.AddPlaceholders ? RequiredIfExistsValue : string.Empty;
// Comments and contents have odd handling
if (string.IsNullOrEmpty(info.CommonDiscInfo.Comments))
info.CommonDiscInfo.Comments = options.AddPlaceholders ? OptionalValue : string.Empty;
info.CommonDiscInfo.Comments = options.Processing.MediaInformation.AddPlaceholders ? OptionalValue : string.Empty;
if (string.IsNullOrEmpty(info.CommonDiscInfo.Contents))
info.CommonDiscInfo.Contents = options.AddPlaceholders ? OptionalValue : string.Empty;
info.CommonDiscInfo.Contents = options.Processing.MediaInformation.AddPlaceholders ? OptionalValue : string.Empty;
// Normalize the disc type with all current information
Validator.NormalizeDiscType(info);
@@ -174,26 +174,26 @@ namespace MPF.Frontend.Tools
/// <summary>
/// Fill in a SubmissionInfo object from Redump, if possible
/// </summary>
/// <param name="options">Options object representing user-defined options</param>
/// <param name="options">SegmentedOptions object representing user-defined options</param>
/// <param name="info">Existing SubmissionInfo object to fill</param>
/// <param name="resultProgress">Optional result progress callback</param>
public static async Task<bool> FillFromRedump(Options options,
public static async Task<bool> FillFromRedump(SegmentedOptions options,
SubmissionInfo info,
IProgress<ResultEventArgs>? resultProgress = null)
{
// If information should not be pulled at all
if (!options.RetrieveMatchInformation)
if (!options.Processing.Login.RetrieveMatchInformation)
return false;
// Set the current dumper based on username
info.DumpersAndStatus.Dumpers = [options.RedumpUsername ?? "Anonymous User"];
info.DumpersAndStatus.Dumpers = [options.Processing.Login.RedumpUsername ?? "Anonymous User"];
info.PartiallyMatchedIDs = [];
// Login to Redump, if possible
var wc = new RedumpClient();
if (!string.IsNullOrEmpty(options.RedumpUsername) && !string.IsNullOrEmpty(options.RedumpPassword))
if (!string.IsNullOrEmpty(options.Processing.Login.RedumpUsername) && !string.IsNullOrEmpty(options.Processing.Login.RedumpPassword))
{
bool? loggedIn = await wc.Login(options.RedumpUsername!, options.RedumpPassword!);
bool? loggedIn = await wc.Login(options.Processing.Login.RedumpUsername!, options.Processing.Login.RedumpPassword!);
if (loggedIn is null)
{
resultProgress?.Report(ResultEventArgs.Failure("There was an unknown error connecting to Redump, skipping..."));
@@ -350,7 +350,7 @@ namespace MPF.Frontend.Tools
// Fill in the fields from the existing ID
resultProgress?.Report(ResultEventArgs.Neutral($"Filling fields from existing ID {fullyMatchedIdsList[i]}..."));
_ = await Builder.FillFromId(wc, info, fullyMatchedIdsList[i], options.PullAllInformation);
_ = await Builder.FillFromId(wc, info, fullyMatchedIdsList[i], options.Processing.MediaInformation.PullAllInformation);
resultProgress?.Report(ResultEventArgs.Success("Information filling complete!"));
// Set the fully matched ID to the current

View File

@@ -22,11 +22,11 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Access to the current options
/// </summary>
public Options Options
public SegmentedOptions Options
{
get => _options;
}
private readonly Options _options;
private readonly SegmentedOptions _options;
/// <summary>
/// Indicates if SelectionChanged events can be executed
@@ -348,7 +348,7 @@ namespace MPF.Frontend.ViewModels
DisableEventHandlers();
// Get the current internal program
InternalProgram internalProgram = Options.InternalProgram;
InternalProgram internalProgram = Options.Dumping.InternalProgram;
// Create a static list of supported Check programs, not everything
var internalPrograms = new List<InternalProgram>

View File

@@ -16,11 +16,11 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Access to the current options
/// </summary>
public Options Options
public SegmentedOptions Options
{
get => _options;
}
private readonly Options _options;
private readonly SegmentedOptions _options;
/// <summary>
/// Indicates if SelectionChanged events can be executed
@@ -549,11 +549,13 @@ namespace MPF.Frontend.ViewModels
CreateIRDStatus = "Please provide an ISO";
return false;
}
if (string.IsNullOrEmpty(LogPath) && string.IsNullOrEmpty(HexKey) && string.IsNullOrEmpty(KeyPath))
{
CreateIRDStatus = "Please provide a GetKey log or Disc Key";
return false;
}
CreateIRDStatus = "Ready to create IRD";
return true;
}
@@ -654,6 +656,7 @@ namespace MPF.Frontend.ViewModels
DiscIDStatus = "ERROR: Invalid *.getkey.log path";
PICStatus = "ERROR: Invalid *.getkey.log path";
}
CreateIRDButtonEnabled = false;
}
}

View File

@@ -20,16 +20,16 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Access to the current options
/// </summary>
public Options Options
public SegmentedOptions Options
{
get => _options;
set
{
_options = value;
OptionsLoader.SaveToConfig(_options);
OptionsLoader.SaveToConfig(_options.ConvertToOptions());
}
}
private Options _options;
private SegmentedOptions _options;
/// <summary>
/// Indicates if SelectionChanged events can be executed
@@ -584,7 +584,7 @@ namespace MPF.Frontend.ViewModels
MediaScanButtonEnabled = true;
ParametersCheckBoxEnabled = true;
EnableParametersCheckBoxEnabled = true;
LogPanelExpanded = _options.OpenLogWindowAtStartup;
LogPanelExpanded = _options.GUI.OpenLogWindowAtStartup;
MediaTypes = [];
Systems = RedumpSystemComboBoxItem.GenerateElements();
@@ -650,7 +650,7 @@ namespace MPF.Frontend.ViewModels
char? lastSelectedDrive = CurrentDrive?.Name?[0] ?? null;
// Populate the list of drives and add it to the combo box
Drives = Drive.CreateListOfDrives(Options.IgnoreFixedDrives);
Drives = Drive.CreateListOfDrives(Options.GUI.IgnoreFixedDrives);
if (Drives.Count > 0)
{
@@ -747,7 +747,7 @@ namespace MPF.Frontend.ViewModels
InternalPrograms = [.. Array.ConvertAll(ipArr, ip => new Element<InternalProgram>(ip))];
// Get the current internal program
InternalProgram internalProgram = Options.InternalProgram;
InternalProgram internalProgram = Options.Dumping.InternalProgram;
// Select the current default dumping program
if (InternalPrograms.Count == 0)
@@ -983,14 +983,14 @@ namespace MPF.Frontend.ViewModels
/// </summary>
/// <param name="savedSettings">Indicates if the settings were saved or not</param>
/// <param name="newOptions">Options representing the new, saved values</param>
public void UpdateOptions(bool savedSettings, Options? newOptions)
public void UpdateOptions(bool savedSettings, SegmentedOptions? newOptions)
{
// Get which options to save
var optionsToSave = savedSettings ? newOptions : Options;
// Ensure the first run flag is unset
var continuingOptions = new Options(optionsToSave) { FirstRun = false };
Options = continuingOptions;
var continuingOptions = new SegmentedOptions(optionsToSave) { FirstRun = false };
Options = new SegmentedOptions(continuingOptions);
// If settings were changed, reinitialize the UI
if (savedSettings)
@@ -1267,7 +1267,7 @@ namespace MPF.Frontend.ViewModels
{
VerboseLogLn("Skipping system type detection because no valid drives found!");
}
else if (!Options.SkipSystemDetection)
else if (!Options.GUI.SkipSystemDetection)
{
VerboseLog($"Trying to detect system for drive {CurrentDrive.Name}.. ");
var currentSystem = GetRedumpSystem(CurrentDrive);
@@ -1275,7 +1275,7 @@ namespace MPF.Frontend.ViewModels
VerboseLogLn($"detected {currentSystem.LongName()}.");
// If undetected system on inactive drive, and PC is the default system, check for potential Mac disc
if (currentSystem is null && !CurrentDrive.MarkedActive && Options.DefaultSystem == RedumpSystem.IBMPCcompatible)
if (currentSystem is null && !CurrentDrive.MarkedActive && Options.Dumping.DefaultSystem == RedumpSystem.IBMPCcompatible)
{
try
{
@@ -1292,7 +1292,7 @@ namespace MPF.Frontend.ViewModels
// Fallback to default system only if drive is active
if (currentSystem is null && CurrentDrive.MarkedActive)
{
currentSystem = Options.DefaultSystem;
currentSystem = Options.Dumping.DefaultSystem;
VerboseLogLn($"unable to detect, defaulting to {currentSystem.LongName()}.");
}
@@ -1302,9 +1302,9 @@ namespace MPF.Frontend.ViewModels
CurrentSystem = Systems[sysIndex];
}
}
else if (Options.SkipSystemDetection && Options.DefaultSystem is not null)
else if (Options.GUI.SkipSystemDetection && Options.Dumping.DefaultSystem is not null)
{
var currentSystem = Options.DefaultSystem;
var currentSystem = Options.Dumping.DefaultSystem;
VerboseLogLn($"System detection disabled, defaulting to {currentSystem.LongName()}.");
int sysIndex = Systems.FindIndex(s => s == currentSystem);
CurrentSystem = Systems[sysIndex];
@@ -1446,7 +1446,7 @@ namespace MPF.Frontend.ViewModels
}
// Get path pieces that are used in all branches
string defaultOutputPath = Options.DefaultOutputPath ?? "ISO";
string defaultOutputPath = Options.Dumping.DefaultOutputPath ?? "ISO";
string extension = _environment?.GetDefaultExtension(CurrentMediaType) ?? ".bin";
string label = GetFormattedVolumeLabel(CurrentDrive) ?? CurrentSystem.LongName() ?? $"track_{DateTime.Now:yyyyMMdd-HHmm}";
string defaultFilename = $"{label}{extension}";
@@ -2462,10 +2462,10 @@ namespace MPF.Frontend.ViewModels
#pragma warning disable IDE0072
return program switch
{
InternalProgram.Aaru => File.Exists(Options.AaruPath),
InternalProgram.DiscImageCreator => File.Exists(Options.DiscImageCreatorPath),
// InternalProgram.Dreamdump => File.Exists(Options.DreamdumpPath),
InternalProgram.Redumper => File.Exists(Options.RedumperPath),
InternalProgram.Aaru => File.Exists(Options.Dumping.AaruPath),
InternalProgram.DiscImageCreator => File.Exists(Options.Dumping.DiscImageCreatorPath),
// InternalProgram.Dreamdump => File.Exists(Options.Dumping.DreamdumpPath),
InternalProgram.Redumper => File.Exists(Options.Dumping.RedumperPath),
_ => false,
};
#pragma warning restore IDE0072

View File

@@ -12,9 +12,9 @@ namespace MPF.Frontend.ViewModels
#region Fields
/// <summary>
/// Application-level Options object
/// Application-level SegmentedOptions object
/// </summary>
public Options Options { get; private set; }
public SegmentedOptions Options { get; private set; }
/// <summary>
/// SubmissionInfo object to fill and save
@@ -195,7 +195,7 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Constructor
/// </summary>
public MediaInformationViewModel(Options options, SubmissionInfo? submissionInfo)
public MediaInformationViewModel(SegmentedOptions options, SubmissionInfo? submissionInfo)
{
Options = options;
SubmissionInfo = submissionInfo?.Clone() as SubmissionInfo ?? new SubmissionInfo();

View File

@@ -32,7 +32,7 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// Current set of options
/// </summary>
public Options Options { get; }
public SegmentedOptions Options { get; }
/// <summary>
/// Flag for if settings were saved or not
@@ -88,15 +88,15 @@ namespace MPF.Frontend.ViewModels
/// </summary>
public OptionsViewModel()
{
Options = new Options();
Options = new SegmentedOptions();
}
/// <summary>
/// Constructor for in-code
/// </summary>
public OptionsViewModel(Options baseOptions)
public OptionsViewModel(SegmentedOptions baseOptions)
{
Options = new Options(baseOptions);
Options = new SegmentedOptions(baseOptions);
}
#region Population
@@ -138,9 +138,9 @@ namespace MPF.Frontend.ViewModels
/// </summary>
public void NonRedumpModeUnChecked()
{
Options.RedumperReadMethod = RedumperReadMethod.NONE;
Options.RedumperSectorOrder = RedumperSectorOrder.NONE;
Options.RedumperDriveType = RedumperDriveType.NONE;
Options.Dumping.Redumper.ReadMethod = RedumperReadMethod.NONE;
Options.Dumping.Redumper.SectorOrder = RedumperSectorOrder.NONE;
Options.Dumping.Redumper.DriveType = RedumperDriveType.NONE;
TriggerPropertyChanged(nameof(Options));
}

View File

@@ -101,8 +101,8 @@ namespace MPF.UI.Windows
{
// Get the current path, if possible
string? currentPath = CheckDumpViewModel.InputPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CheckDumpViewModel.Options.DefaultOutputPath))
currentPath = CheckDumpViewModel.Options.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CheckDumpViewModel.Options.Dumping.DefaultOutputPath))
currentPath = CheckDumpViewModel.Options.Dumping.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath))
currentPath = AppDomain.CurrentDomain.BaseDirectory!;
@@ -128,9 +128,9 @@ namespace MPF.UI.Windows
/// <param name="options">Options set to pass to the information window</param>
/// <param name="submissionInfo">SubmissionInfo object to display and possibly change</param>
/// <returns>Dialog open result</returns>
public bool? ShowMediaInformationWindow(Options? options, ref SubmissionInfo? submissionInfo)
public bool? ShowMediaInformationWindow(SegmentedOptions? options, ref SubmissionInfo? submissionInfo)
{
var mediaInformationWindow = new MediaInformationWindow(options ?? new Options(), submissionInfo)
var mediaInformationWindow = new MediaInformationWindow(options ?? new SegmentedOptions(), submissionInfo)
{
Focusable = true,
Owner = this,

View File

@@ -119,8 +119,8 @@ namespace MPF.UI.Windows
{
// Get the current path, if possible
string? currentPath = CreateIRDViewModel.InputPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.Dumping.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.Dumping.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath))
currentPath = AppDomain.CurrentDomain.BaseDirectory!;
@@ -147,8 +147,8 @@ namespace MPF.UI.Windows
{
// Get the current path, if possible
string? currentPath = CreateIRDViewModel.LogPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.Dumping.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.Dumping.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath))
currentPath = AppDomain.CurrentDomain.BaseDirectory!;
@@ -175,8 +175,8 @@ namespace MPF.UI.Windows
{
// Get the current path, if possible
string? currentPath = CreateIRDViewModel.LogPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.Dumping.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.Dumping.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath))
currentPath = AppDomain.CurrentDomain.BaseDirectory!;
@@ -204,8 +204,8 @@ namespace MPF.UI.Windows
{
// Get the current path, if possible
string? currentPath = CreateIRDViewModel.InputPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.DefaultOutputPath))
currentPath = Path.Combine(CreateIRDViewModel.Options.DefaultOutputPath, "game.ird");
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.Dumping.DefaultOutputPath))
currentPath = Path.Combine(CreateIRDViewModel.Options.Dumping.DefaultOutputPath, "game.ird");
else if (string.IsNullOrEmpty(currentPath))
currentPath = "game.ird";
if (string.IsNullOrEmpty(currentPath))
@@ -240,8 +240,8 @@ namespace MPF.UI.Windows
{
// Get the current path, if possible
string? currentPath = CreateIRDViewModel.LogPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(CreateIRDViewModel.Options.Dumping.DefaultOutputPath))
currentPath = CreateIRDViewModel.Options.Dumping.DefaultOutputPath!;
if (string.IsNullOrEmpty(currentPath))
currentPath = AppDomain.CurrentDomain.BaseDirectory!;

View File

@@ -125,7 +125,7 @@ namespace MPF.UI.Windows
AddEventHandlers();
// Display the debug option in the menu, if necessary
if (MainViewModel.Options.ShowDebugViewMenuItem)
if (MainViewModel.Options.GUI.ShowDebugViewMenuItem)
DebugViewMenuItem!.Visibility = Visibility.Visible;
MainViewModel.Init(LogOutput!.EnqueueLog, DisplayUserMessage, ShowMediaInformationWindow);
@@ -139,7 +139,7 @@ namespace MPF.UI.Windows
MainViewModel.TranslateStrings(translationStrings);
// Set interface language according to the options
SetInterfaceLanguage(MainViewModel.Options.DefaultInterfaceLanguage);
SetInterfaceLanguage(MainViewModel.Options.GUI.DefaultInterfaceLanguage);
// Set the UI color scheme according to the options
ApplyTheme();
@@ -321,8 +321,8 @@ namespace MPF.UI.Windows
{
// Get the current path, if possible
string currentPath = MainViewModel.OutputPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(MainViewModel.Options.DefaultOutputPath))
currentPath = Path.Combine(MainViewModel.Options.DefaultOutputPath, $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin");
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(MainViewModel.Options.Dumping.DefaultOutputPath))
currentPath = Path.Combine(MainViewModel.Options.Dumping.DefaultOutputPath, $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin");
else if (string.IsNullOrEmpty(currentPath))
currentPath = $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin";
if (string.IsNullOrEmpty(currentPath))
@@ -363,7 +363,7 @@ namespace MPF.UI.Windows
message += $"{Environment.NewLine}You have the newest version!";
// If we have a new version, put it in the clipboard
if (MainViewModel.Options.CopyUpdateUrlToClipboard && different && !string.IsNullOrEmpty(url))
if (MainViewModel.Options.GUI.CopyUpdateUrlToClipboard && different && !string.IsNullOrEmpty(url))
{
try
{
@@ -406,13 +406,13 @@ namespace MPF.UI.Windows
/// <param name="options">Options set to pass to the information window</param>
/// <param name="submissionInfo">SubmissionInfo object to display and possibly change</param>
/// <returns>Dialog open result</returns>
public bool? ShowMediaInformationWindow(Options? options, ref SubmissionInfo? submissionInfo)
public bool? ShowMediaInformationWindow(SegmentedOptions? options, ref SubmissionInfo? submissionInfo)
{
if (options?.ShowDiscEjectReminder == true)
if (options?.Processing?.ShowDiscEjectReminder == true)
CustomMessageBox.Show(this, (string)Application.Current.FindResource("EjectMessageString"),
(string)Application.Current.FindResource("EjectTitleString"), MessageBoxButton.OK, MessageBoxImage.Information);
var mediaInformationWindow = new MediaInformationWindow(options ?? new Options(), submissionInfo)
var mediaInformationWindow = new MediaInformationWindow(options ?? new SegmentedOptions(), submissionInfo)
{
Focusable = true,
Owner = this,
@@ -540,12 +540,12 @@ namespace MPF.UI.Windows
private void ApplyTheme()
{
Theme theme;
if (MainViewModel.Options.EnableDarkMode)
if (MainViewModel.Options.GUI.Theming.EnableDarkMode)
theme = new DarkModeTheme();
else if (MainViewModel.Options.EnablePurpMode)
else if (MainViewModel.Options.GUI.Theming.EnablePurpMode)
theme = new CustomTheme("111111", "9A5EC0");
else if (IsHexColor(MainViewModel.Options.CustomBackgroundColor) && IsHexColor(MainViewModel.Options.CustomTextColor))
theme = new CustomTheme(MainViewModel.Options.CustomBackgroundColor, MainViewModel.Options.CustomTextColor);
else if (IsHexColor(MainViewModel.Options.GUI.Theming.CustomBackgroundColor) && IsHexColor(MainViewModel.Options.GUI.Theming.CustomTextColor))
theme = new CustomTheme(MainViewModel.Options.GUI.Theming.CustomBackgroundColor, MainViewModel.Options.GUI.Theming.CustomTextColor);
else
theme = new LightModeTheme();
@@ -643,14 +643,14 @@ namespace MPF.UI.Windows
var options = optionsWindow.OptionsViewModel.Options;
// Force a refresh of the path, if necessary
if (MainViewModel.Options.DefaultOutputPath != options.DefaultOutputPath)
if (MainViewModel.Options.Dumping.DefaultOutputPath != options.Dumping.DefaultOutputPath)
MainViewModel.OutputPath = string.Empty;
// Set the language according to the settings
if (savedSettings)
{
var oldDefaultLang = MainViewModel.Options.DefaultInterfaceLanguage;
var newDefaultLang = options.DefaultInterfaceLanguage;
var oldDefaultLang = MainViewModel.Options.GUI.DefaultInterfaceLanguage;
var newDefaultLang = options.GUI.DefaultInterfaceLanguage;
if (oldDefaultLang != newDefaultLang)
{
SetInterfaceLanguage(newDefaultLang);
@@ -869,7 +869,7 @@ namespace MPF.UI.Windows
{
if (MainViewModel.CanExecuteSelectionChanged)
{
if (MainViewModel.Options.FastUpdateLabel)
if (MainViewModel.Options.GUI.FastUpdateLabel)
MainViewModel.FastUpdateLabel(removeEventHandlers: true);
else
MainViewModel.InitializeUIValues(removeEventHandlers: true, rebuildPrograms: false, rescanDrives: false);

View File

@@ -112,12 +112,12 @@ namespace MPF.UI.Windows
/// <summary>
/// Read-only access to the current media information view model
/// </summary>
public MediaInformationViewModel MediaInformationViewModel => DataContext as MediaInformationViewModel ?? new MediaInformationViewModel(new Options(), new SubmissionInfo());
public MediaInformationViewModel MediaInformationViewModel => DataContext as MediaInformationViewModel ?? new MediaInformationViewModel(new SegmentedOptions(), new SubmissionInfo());
/// <summary>
/// Constructor
/// </summary>
public MediaInformationWindow(Options options, SubmissionInfo? submissionInfo)
public MediaInformationWindow(SegmentedOptions options, SubmissionInfo? submissionInfo)
{
#if NET40_OR_GREATER || NETCOREAPP
InitializeComponent();
@@ -136,7 +136,7 @@ namespace MPF.UI.Windows
MediaInformationViewModel.Load();
// Limit lists, if necessary
if (options.EnableRedumpCompatibility)
if (options.Processing.MediaInformation.EnableRedumpCompatibility)
{
MediaInformationViewModel.SetRedumpRegions();
MediaInformationViewModel.SetRedumpLanguages();
@@ -156,10 +156,10 @@ namespace MPF.UI.Windows
/// <summary>
/// Manipulate fields based on the current disc
/// </summary>
private void ManipulateFields(Options options, SubmissionInfo? submissionInfo)
private void ManipulateFields(SegmentedOptions options, SubmissionInfo? submissionInfo)
{
// Enable tabs in all fields, if required
if (options.EnableTabsInInputFields)
if (options.Processing.MediaInformation.EnableTabsInInputFields)
EnableTabsInInputFields();
// Hide read-only fields that don't have values set

View File

@@ -18,7 +18,7 @@ namespace MPF.UI.Windows
/// <summary>
/// Read-only access to the current options view model
/// </summary>
public OptionsViewModel OptionsViewModel => DataContext as OptionsViewModel ?? new OptionsViewModel(new Options());
public OptionsViewModel OptionsViewModel => DataContext as OptionsViewModel ?? new OptionsViewModel();
#if NET35
@@ -37,7 +37,7 @@ namespace MPF.UI.Windows
/// <summary>
/// Constructor
/// </summary>
public OptionsWindow(Options options)
public OptionsWindow(SegmentedOptions options)
{
#if NET40_OR_GREATER || NETCOREAPP
InitializeComponent();
@@ -61,7 +61,7 @@ namespace MPF.UI.Windows
DataContext = new OptionsViewModel(options);
// Set initial value for binding
RedumpPasswordBox!.Password = options.RedumpPassword;
RedumpPasswordBox!.Password = options.Processing.Login.RedumpPassword;
// Add handlers
AaruPathButton!.Click += BrowseForPathClick;
@@ -136,7 +136,7 @@ namespace MPF.UI.Windows
if (exists)
{
OptionsViewModel.Options[pathSettingName] = path;
OptionsViewModel.Options.ConvertToOptions()[pathSettingName] = path;
var textBox = TextBoxForPathSetting(parent, pathSettingName);
textBox?.Text = path;
}
@@ -213,7 +213,7 @@ namespace MPF.UI.Windows
/// </summary>
private void NonRedumpModeClicked(object sender, EventArgs e)
{
if (OptionsViewModel.Options.RedumperNonRedumpMode)
if (OptionsViewModel.Options.Dumping.Redumper.NonRedumpMode)
CustomMessageBox.Show(this, "All logs generated with these options will not be acceptable for Redump submission",
(string)System.Windows.Application.Current.FindResource("WarningMessageString"), MessageBoxButton.OK, MessageBoxImage.Warning);
else
@@ -243,7 +243,7 @@ namespace MPF.UI.Windows
/// </summary>
private void OnPasswordChanged(object sender, EventArgs e)
{
OptionsViewModel.Options.RedumpPassword = RedumpPasswordBox!.Password;
OptionsViewModel.Options.Processing.Login.RedumpPassword = RedumpPasswordBox!.Password;
}
/// <summary>