diff --git a/CHANGELIST.md b/CHANGELIST.md
index be58fe28..aede9412 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -38,6 +38,7 @@
- Replace Aaru flag values with input types
- Add Redumper parameters tests
- Add quotes option to string input
+- Replace Redumper flag values with input types
### 3.2.4 (2024-11-24)
diff --git a/MPF.ExecutionContexts/Data/Int16Input.cs b/MPF.ExecutionContexts/Data/Int16Input.cs
index fc629dfc..ad7c0bde 100644
--- a/MPF.ExecutionContexts/Data/Int16Input.cs
+++ b/MPF.ExecutionContexts/Data/Int16Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == short.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/Int32Input.cs b/MPF.ExecutionContexts/Data/Int32Input.cs
index d9701472..714dcf7c 100644
--- a/MPF.ExecutionContexts/Data/Int32Input.cs
+++ b/MPF.ExecutionContexts/Data/Int32Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == int.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/Int64Input.cs b/MPF.ExecutionContexts/Data/Int64Input.cs
index 4d893a50..ed51e50f 100644
--- a/MPF.ExecutionContexts/Data/Int64Input.cs
+++ b/MPF.ExecutionContexts/Data/Int64Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == long.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/Int8Input.cs b/MPF.ExecutionContexts/Data/Int8Input.cs
index 22405efd..57b32cb6 100644
--- a/MPF.ExecutionContexts/Data/Int8Input.cs
+++ b/MPF.ExecutionContexts/Data/Int8Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == sbyte.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/StringInput.cs b/MPF.ExecutionContexts/Data/StringInput.cs
index 0673ee41..16844c03 100644
--- a/MPF.ExecutionContexts/Data/StringInput.cs
+++ b/MPF.ExecutionContexts/Data/StringInput.cs
@@ -53,10 +53,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == string.Empty)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/UInt16Input.cs b/MPF.ExecutionContexts/Data/UInt16Input.cs
index fa9b621f..f5ee0185 100644
--- a/MPF.ExecutionContexts/Data/UInt16Input.cs
+++ b/MPF.ExecutionContexts/Data/UInt16Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == ushort.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/UInt32Input.cs b/MPF.ExecutionContexts/Data/UInt32Input.cs
index a5ee3579..ab7b7c23 100644
--- a/MPF.ExecutionContexts/Data/UInt32Input.cs
+++ b/MPF.ExecutionContexts/Data/UInt32Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == uint.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/UInt64Input.cs b/MPF.ExecutionContexts/Data/UInt64Input.cs
index 71406271..1318f0bf 100644
--- a/MPF.ExecutionContexts/Data/UInt64Input.cs
+++ b/MPF.ExecutionContexts/Data/UInt64Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == ulong.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Data/UInt8Input.cs b/MPF.ExecutionContexts/Data/UInt8Input.cs
index a356d885..a0987c4a 100644
--- a/MPF.ExecutionContexts/Data/UInt8Input.cs
+++ b/MPF.ExecutionContexts/Data/UInt8Input.cs
@@ -44,10 +44,6 @@ namespace MPF.ExecutionContexts.Data
if (Value == null)
return string.Empty;
- // Do not output if required value is invalid
- if (_required && Value == byte.MinValue)
- return string.Empty;
-
// Build the output format
var builder = new StringBuilder();
diff --git a/MPF.ExecutionContexts/Redumper/ExecutionContext.cs b/MPF.ExecutionContexts/Redumper/ExecutionContext.cs
index 05bc45ef..8eb7f372 100644
--- a/MPF.ExecutionContexts/Redumper/ExecutionContext.cs
+++ b/MPF.ExecutionContexts/Redumper/ExecutionContext.cs
@@ -1,7 +1,7 @@
-using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
+using MPF.ExecutionContexts.Data;
using SabreTools.RedumpLib.Data;
namespace MPF.ExecutionContexts.Redumper
@@ -14,16 +14,27 @@ namespace MPF.ExecutionContexts.Redumper
#region Generic Dumping Information
///
- public override string? InputPath => DriveValue?.Trim('"');
+ public override string? InputPath
+ => (_inputs[FlagStrings.Drive] as StringInput)?.Value?.Trim('"');
///
public override string? OutputPath => Path.Combine(
- ImagePathValue?.Trim('"') ?? string.Empty,
- ImageNameValue?.Trim('"') ?? string.Empty)
+ (_inputs[FlagStrings.ImagePath] as StringInput)?.Value?.Trim('"') ?? string.Empty,
+ (_inputs[FlagStrings.ImageName] as StringInput)?.Value?.Trim('"') ?? string.Empty)
+ GetDefaultExtension(MediaType);
///
- public override int? Speed => SpeedValue;
+ public override int? Speed
+ {
+ get
+ {
+ return (_inputs[FlagStrings.Speed] as Int32Input)?.Value;
+ }
+ set
+ {
+ (_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(value);
+ }
+ }
#endregion
@@ -34,125 +45,63 @@ namespace MPF.ExecutionContexts.Redumper
///
public List? ModeValues { get; set; }
- #region General
-
///
- /// Drive to use, first available drive with disc, if not provided
+ /// Set of all command flags
///
- public string? DriveValue { get; set; }
+ private readonly Dictionary _inputs = new()
+ {
+ // General
+ [FlagStrings.HelpLong] = new FlagInput(FlagStrings.HelpShort, FlagStrings.HelpLong),
+ [FlagStrings.Version] = new FlagInput(FlagStrings.Version),
+ [FlagStrings.Verbose] = new FlagInput(FlagStrings.Verbose),
+ [FlagStrings.AutoEject] = new FlagInput(FlagStrings.AutoEject),
+ [FlagStrings.Debug] = new FlagInput(FlagStrings.Debug),
+ [FlagStrings.Drive] = new StringInput(FlagStrings.Drive),
+ [FlagStrings.Speed] = new Int32Input(FlagStrings.Speed),
+ [FlagStrings.Retries] = new Int32Input(FlagStrings.Retries),
+ [FlagStrings.ImagePath] = new StringInput(FlagStrings.ImagePath) { Quotes = true },
+ [FlagStrings.ImageName] = new StringInput(FlagStrings.ImageName) { Quotes = true },
+ [FlagStrings.Overwrite] = new FlagInput(FlagStrings.Overwrite),
- ///
- /// Drive read speed, optimal drive speed will be used if not provided
- ///
- public int? SpeedValue { get; set; }
+ // Drive Configuration
+ [FlagStrings.Overwrite] = new FlagInput(FlagStrings.Overwrite),
+ [FlagStrings.DriveType] = new StringInput(FlagStrings.DriveType),
+ [FlagStrings.DriveReadOffset] = new Int32Input(FlagStrings.DriveReadOffset),
+ [FlagStrings.DriveC2Shift] = new Int32Input(FlagStrings.DriveC2Shift),
+ [FlagStrings.DrivePregapStart] = new Int32Input(FlagStrings.DrivePregapStart),
+ [FlagStrings.DriveReadMethod] = new StringInput(FlagStrings.DriveReadMethod),
+ [FlagStrings.DriveSectorOrder] = new StringInput(FlagStrings.DriveSectorOrder),
- ///
- /// Number of sector retries in case of SCSI/C2 error (default: 0)
- ///
- public int? RetriesValue { get; set; }
+ // Drive Specific
+ [FlagStrings.PlextorSkipLeadin] = new FlagInput(FlagStrings.PlextorSkipLeadin),
+ [FlagStrings.PlextorLeadinRetries] = new Int32Input(FlagStrings.PlextorLeadinRetries),
+ [FlagStrings.AsusSkipLeadout] = new FlagInput(FlagStrings.AsusSkipLeadout),
- ///
- /// Dump files base directory
- ///
- public string? ImagePathValue { get; set; }
+ // Offset
+ [FlagStrings.ForceOffset] = new Int32Input(FlagStrings.ForceOffset),
+ [FlagStrings.AudioSilenceThreshold] = new Int32Input(FlagStrings.AudioSilenceThreshold),
+ [FlagStrings.CorrectOffsetShift] = new FlagInput(FlagStrings.CorrectOffsetShift),
+ [FlagStrings.OffsetShiftRelocate] = new FlagInput(FlagStrings.OffsetShiftRelocate),
- ///
- /// Dump files prefix, autogenerated in dump mode, if not provided
- ///
- public string? ImageNameValue { get; set; }
+ // Split
+ [FlagStrings.ForceSplit] = new FlagInput(FlagStrings.ForceSplit),
+ [FlagStrings.LeaveUnchanged] = new FlagInput(FlagStrings.LeaveUnchanged),
+ [FlagStrings.ForceQTOC] = new FlagInput(FlagStrings.ForceQTOC),
+ [FlagStrings.SkipFill] = new UInt8Input(FlagStrings.SkipFill),
+ [FlagStrings.ISO9660Trim] = new FlagInput(FlagStrings.ISO9660Trim),
- #endregion
-
- #region Drive Configuration
-
- ///
- /// Override drive type, possible values: GENERIC, PLEXTOR, LG_ASUS
- ///
- public string? DriveTypeValue { get; set; }
-
- ///
- /// Override drive read offset
- ///
- public int? DriveReadOffsetValue { get; set; }
-
- ///
- /// Override drive C2 shift
- ///
- public int? DriveC2ShiftValue { get; set; }
-
- ///
- /// Override drive pre-gap start LBA
- ///
- public int? DrivePregapStartValue { get; set; }
-
- ///
- /// Override drive read method, possible values: BE, D8, BE_CDDA
- ///
- public string? DriveReadMethodValue { get; set; }
-
- ///
- /// Override drive sector order, possible values: DATA_C2_SUB, DATA_SUB_C2
- ///
- public string? DriveSectorOrderValue { get; set; }
-
- #endregion
-
- #region Offset
-
- ///
- /// Override offset autodetection and use supplied value
- ///
- public int? ForceOffsetValue { get; set; }
-
- ///
- /// Maximum absolute sample value to treat it as silence (default: 32)
- ///
- public int? AudioSilenceThresholdValue { get; set; }
-
- #endregion
-
- #region Split
-
- ///
- /// Fill byte value for skipped sectors (default: 0x55)
- ///
- public byte? SkipFillValue { get; set; }
-
- #endregion
-
- #region Miscellaneous
-
- ///
- /// LBA to start dumping from
- ///
- public int? LBAStartValue { get; set; }
-
- ///
- /// LBA to stop dumping at (everything before the value), useful for discs with fake TOC
- ///
- public int? LBAEndValue { get; set; }
-
- ///
- /// LBA ranges of sectors to skip
- ///
- public string? SkipValue { get; set; }
-
- ///
- /// Write offset for dumps when reading as data
- ///
- public int? DumpWriteOffsetValue { get; set; }
-
- ///
- /// Number of sectors to read at once on initial dump, DVD only (Default 32)
- ///
- public int? DumpReadSizeValue { get; set; }
-
- ///
- /// Maximum number of lead-in retries per session (Default 4)
- ///
- public int? PlextorLeadinRetriesValue { get; set; }
-
- #endregion
+ // Miscellaneous
+ [FlagStrings.LBAStart] = new Int32Input(FlagStrings.LBAStart),
+ [FlagStrings.LBAEnd] = new Int32Input(FlagStrings.LBAEnd),
+ [FlagStrings.RefineSubchannel] = new FlagInput(FlagStrings.RefineSubchannel),
+ [FlagStrings.Skip] = new StringInput(FlagStrings.Skip),
+ [FlagStrings.DumpWriteOffset] = new Int32Input(FlagStrings.DumpWriteOffset),
+ [FlagStrings.DumpReadSize] = new Int32Input(FlagStrings.DumpReadSize),
+ [FlagStrings.OverreadLeadout] = new FlagInput(FlagStrings.OverreadLeadout),
+ [FlagStrings.ForceUnscrambled] = new FlagInput(FlagStrings.ForceUnscrambled),
+ [FlagStrings.LegacySubs] = new FlagInput(FlagStrings.LegacySubs),
+ [FlagStrings.DisableCDText] = new FlagInput(FlagStrings.DisableCDText),
+ };
#endregion
@@ -252,251 +201,18 @@ namespace MPF.ExecutionContexts.Redumper
if (modes.Length > 0)
parameters.Append($"{modes} ");
- #region General
-
- // Help
- if (this[FlagStrings.HelpLong] == true)
- parameters.Append($"{FlagStrings.HelpLong} ");
-
- // Version
- if (this[FlagStrings.Version] == true)
- parameters.Append($"{FlagStrings.Version} ");
-
- // Verbose
- if (this[FlagStrings.Verbose] == true)
- parameters.Append($"{FlagStrings.Verbose} ");
-
- // Auto Eject
- if (this[FlagStrings.AutoEject] == true)
- parameters.Append($"{FlagStrings.AutoEject} ");
-
- // Debug
- if (this[FlagStrings.Debug] == true)
- parameters.Append($"{FlagStrings.Debug} ");
-
- // Drive
- if (this[FlagStrings.Drive] == true)
+ // Loop though and append all existing
+ foreach (var kvp in _inputs)
{
- if (DriveValue != null)
- {
- if (DriveValue.Contains(" "))
- parameters.Append($"{FlagStrings.Drive}=\"{DriveValue}\" ");
- else
- parameters.Append($"{FlagStrings.Drive}={DriveValue} ");
- }
+ // If the value doesn't exist
+ string formatted = kvp.Value.Format(useEquals: true);
+ if (formatted.Length == 0)
+ continue;
+
+ // Append the parameter
+ parameters.Append($"{formatted} ");
}
- // Speed
- if (this[FlagStrings.Speed] == true)
- {
- if (SpeedValue != null)
- parameters.Append($"{FlagStrings.Speed}={SpeedValue} ");
- }
-
- // Retries
- if (this[FlagStrings.Retries] == true)
- {
- if (RetriesValue != null)
- parameters.Append($"{FlagStrings.Retries}={RetriesValue} ");
- }
-
- // Image Path
- if (this[FlagStrings.ImagePath] == true)
- {
- if (ImagePathValue != null)
- parameters.Append($"{FlagStrings.ImagePath}={ImagePathValue} ");
- }
-
- // Image Name
- if (this[FlagStrings.ImageName] == true)
- {
- if (ImageNameValue != null)
- parameters.Append($"{FlagStrings.ImageName}={ImageNameValue} ");
- }
-
- // Overwrite
- if (this[FlagStrings.Overwrite] == true)
- parameters.Append($"{FlagStrings.Overwrite} ");
-
- #endregion
-
- #region Drive Configuration
-
- // Drive Type
- if (this[FlagStrings.DriveType] == true)
- {
- if (DriveTypeValue != null)
- parameters.Append($"{FlagStrings.DriveType}={DriveTypeValue} ");
- }
-
- // Drive Read Offset
- if (this[FlagStrings.DriveReadOffset] == true)
- {
- if (DriveReadOffsetValue != null)
- parameters.Append($"{FlagStrings.DriveReadOffset}={DriveReadOffsetValue} ");
- }
-
- // Drive C2 Shift
- if (this[FlagStrings.DriveC2Shift] == true)
- {
- if (DriveC2ShiftValue != null)
- parameters.Append($"{FlagStrings.DriveC2Shift}={DriveC2ShiftValue} ");
- }
-
- // Drive Pregap Start
- if (this[FlagStrings.DrivePregapStart] == true)
- {
- if (DrivePregapStartValue != null)
- parameters.Append($"{FlagStrings.DrivePregapStart}={DrivePregapStartValue} ");
- }
-
- // Drive Read Method
- if (this[FlagStrings.DriveReadMethod] == true)
- {
- if (DriveReadMethodValue != null)
- parameters.Append($"{FlagStrings.DriveReadMethod}={DriveReadMethodValue} ");
- }
-
- // Drive Sector Order
- if (this[FlagStrings.DriveSectorOrder] == true)
- {
- if (DriveSectorOrderValue != null)
- parameters.Append($"{FlagStrings.DriveSectorOrder}={DriveSectorOrderValue} ");
- }
-
- #endregion
-
- #region Drive Specific
-
- // Plextor Leadin Skip
- if (this[FlagStrings.PlextorSkipLeadin] == true)
- parameters.Append($"{FlagStrings.PlextorSkipLeadin} ");
-
- // Plextor Leadin Retries
- if (this[FlagStrings.PlextorLeadinRetries] == true)
- {
- if (PlextorLeadinRetriesValue != null)
- parameters.Append($"{FlagStrings.PlextorLeadinRetries}={PlextorLeadinRetriesValue} ");
- }
-
- // Asus Skip Leadout
- if (this[FlagStrings.AsusSkipLeadout] == true)
- parameters.Append($"{FlagStrings.AsusSkipLeadout} ");
-
- #endregion
-
- #region Offset
-
- // Force Offset
- if (this[FlagStrings.ForceOffset] == true)
- {
- if (ForceOffsetValue != null)
- parameters.Append($"{FlagStrings.ForceOffset}={ForceOffsetValue} ");
- }
-
- // Audio Silence Threshold
- if (this[FlagStrings.AudioSilenceThreshold] == true)
- {
- if (AudioSilenceThresholdValue != null)
- parameters.Append($"{FlagStrings.AudioSilenceThreshold}={AudioSilenceThresholdValue} ");
- }
-
- // Correct Offset Shift
- if (this[FlagStrings.CorrectOffsetShift] == true)
- parameters.Append($"{FlagStrings.CorrectOffsetShift} ");
-
- // Offset Shift Relocate
- if (this[FlagStrings.OffsetShiftRelocate] == true)
- parameters.Append($"{FlagStrings.OffsetShiftRelocate} ");
-
- #endregion
-
- #region Split
-
- // Force Split
- if (this[FlagStrings.ForceSplit] == true)
- parameters.Append($"{FlagStrings.ForceSplit} ");
-
- // Leave Unchanged
- if (this[FlagStrings.LeaveUnchanged] == true)
- parameters.Append($"{FlagStrings.LeaveUnchanged} ");
-
- // Force QTOC
- if (this[FlagStrings.ForceQTOC] == true)
- parameters.Append($"{FlagStrings.ForceQTOC} ");
-
- // Skip Fill
- if (this[FlagStrings.SkipFill] == true)
- {
- if (SkipFillValue != null)
- parameters.Append($"{FlagStrings.SkipFill}={SkipFillValue:x} ");
- }
-
- // ISO9660 Trim
- if (this[FlagStrings.ISO9660Trim] == true)
- parameters.Append($"{FlagStrings.ISO9660Trim} ");
-
- #endregion
-
- #region Miscellaneous
-
- // LBA Start
- if (this[FlagStrings.LBAStart] == true)
- {
- if (LBAStartValue != null)
- parameters.Append($"{FlagStrings.LBAStart}={LBAStartValue} ");
- }
-
- // LBA End
- if (this[FlagStrings.LBAEnd] == true)
- {
- if (LBAEndValue != null)
- parameters.Append($"{FlagStrings.LBAEnd}={LBAEndValue} ");
- }
-
- // Refine Subchannel
- if (this[FlagStrings.RefineSubchannel] == true)
- parameters.Append($"{FlagStrings.RefineSubchannel} ");
-
- // Skip
- if (this[FlagStrings.Skip] == true)
- {
- if (!string.IsNullOrEmpty(SkipValue))
- parameters.Append($"{FlagStrings.Skip}={SkipValue} ");
- }
-
- // Dump Write Offset
- if (this[FlagStrings.DumpWriteOffset] == true)
- {
- if (DumpWriteOffsetValue != null)
- parameters.Append($"{FlagStrings.DumpWriteOffset}={DumpWriteOffsetValue} ");
- }
-
- // Dump Read Size
- if (this[FlagStrings.DumpReadSize] == true)
- {
- if (DumpReadSizeValue != null)
- parameters.Append($"{FlagStrings.DumpReadSize}={DumpReadSizeValue} ");
- }
-
- // Overread Leadout
- if (this[FlagStrings.OverreadLeadout] == true)
- parameters.Append($"{FlagStrings.OverreadLeadout} ");
-
- // Force Unscrambled
- if (this[FlagStrings.ForceUnscrambled] == true)
- parameters.Append($"{FlagStrings.ForceUnscrambled} ");
-
- // Legacy Subs
- if (this[FlagStrings.LegacySubs] == true)
- parameters.Append($"{FlagStrings.LegacySubs} ");
-
- // Disable CD Text
- if (this[FlagStrings.DisableCDText] == true)
- parameters.Append($"{FlagStrings.DisableCDText} ");
-
- #endregion
-
return parameters.ToString().TrimEnd();
}
@@ -526,33 +242,8 @@ namespace MPF.ExecutionContexts.Redumper
flags = [];
- // General
- DriveValue = null;
- SpeedValue = null;
- RetriesValue = null;
- ImagePathValue = null;
- ImageNameValue = null;
-
- // Drive Configuration
- DriveTypeValue = null;
- DriveReadOffsetValue = null;
- DriveC2ShiftValue = null;
- DrivePregapStartValue = null;
- DriveReadMethodValue = null;
- DriveSectorOrderValue = null;
-
- // Offset
- ForceOffsetValue = null;
- AudioSilenceThresholdValue = null;
-
- // Split
- SkipFillValue = null;
-
- // Miscellaneous
- LBAStartValue = null;
- LBAEndValue = null;
- SkipValue = null;
- DumpReadSizeValue = null;
+ foreach (var kvp in _inputs)
+ kvp.Value.ClearValue();
}
///
@@ -595,36 +286,42 @@ namespace MPF.ExecutionContexts.Redumper
}
this[FlagStrings.Drive] = true;
- DriveValue = drivePath;
+ (_inputs[FlagStrings.Drive] as StringInput)?.SetValue(drivePath ?? string.Empty);
this[FlagStrings.Speed] = true;
- SpeedValue = driveSpeed;
+ (_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(driveSpeed);
// Set user-defined options
if (GetBooleanSetting(options, SettingConstants.EnableVerbose, SettingConstants.EnableVerboseDefault))
+ {
this[FlagStrings.Verbose] = true;
+ (_inputs[FlagStrings.Verbose] as BooleanInput)?.SetValue(true);
+ }
if (GetBooleanSetting(options, SettingConstants.EnableDebug, SettingConstants.EnableDebugDefault))
+ {
this[FlagStrings.Debug] = true;
+ (_inputs[FlagStrings.Debug] as BooleanInput)?.SetValue(true);
+ }
string? readMethod = GetStringSetting(options, SettingConstants.ReadMethod, SettingConstants.ReadMethodDefault);
-
+
if (!string.IsNullOrEmpty(readMethod) && readMethod != ReadMethod.NONE.ToString())
{
this[FlagStrings.DriveReadMethod] = true;
- DriveReadMethodValue = readMethod;
+ (_inputs[FlagStrings.DriveReadMethod] as StringInput)?.SetValue(readMethod!);
}
string? sectorOrder = GetStringSetting(options, SettingConstants.SectorOrder, SettingConstants.SectorOrderDefault);
if (!string.IsNullOrEmpty(sectorOrder) && sectorOrder != SectorOrder.NONE.ToString())
{
this[FlagStrings.DriveSectorOrder] = true;
- DriveSectorOrderValue = sectorOrder;
+ (_inputs[FlagStrings.DriveSectorOrder] as StringInput)?.SetValue(sectorOrder!);
}
if (GetBooleanSetting(options, SettingConstants.UseGenericDriveType, SettingConstants.UseGenericDriveTypeDefault))
{
this[FlagStrings.DriveType] = true;
- DriveTypeValue = "GENERIC";
+ (_inputs[FlagStrings.DriveType] as StringInput)?.SetValue("GENERIC");
}
// Set the output paths
@@ -634,24 +331,24 @@ namespace MPF.ExecutionContexts.Redumper
if (!string.IsNullOrEmpty(imagePath))
{
this[FlagStrings.ImagePath] = true;
- ImagePathValue = $"\"{imagePath}\"";
+ (_inputs[FlagStrings.ImagePath] as StringInput)?.SetValue(imagePath!);
}
string imageName = Path.GetFileNameWithoutExtension(filename);
if (!string.IsNullOrEmpty(imageName))
{
this[FlagStrings.ImageName] = true;
- ImageNameValue = $"\"{imageName}\"";
+ (_inputs[FlagStrings.ImageName] as StringInput)?.SetValue(imageName!);
}
}
this[FlagStrings.Retries] = true;
- RetriesValue = GetInt32Setting(options, SettingConstants.RereadCount, SettingConstants.RereadCountDefault);
+ (_inputs[FlagStrings.Retries] as Int32Input)?.SetValue(GetInt32Setting(options, SettingConstants.RereadCount, SettingConstants.RereadCountDefault));
if (GetBooleanSetting(options, SettingConstants.EnableLeadinRetry, SettingConstants.EnableLeadinRetryDefault))
{
this[FlagStrings.PlextorLeadinRetries] = true;
- PlextorLeadinRetriesValue = GetInt32Setting(options, SettingConstants.LeadinRetryCount, SettingConstants.LeadinRetryCountDefault);
+ (_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(GetInt32Setting(options, SettingConstants.LeadinRetryCount, SettingConstants.LeadinRetryCountDefault));
}
}
@@ -700,7 +397,7 @@ namespace MPF.ExecutionContexts.Redumper
case CommandStrings.Info:
case CommandStrings.Skeleton:
case CommandStrings.Debug:
- //case CommandStrings.FixMSF:
+ //case CommandStrings.FixMSF:
ModeValues.Add(part);
break;
@@ -725,196 +422,21 @@ namespace MPF.ExecutionContexts.Redumper
// Loop through all auxiliary flags, if necessary
for (int i = index; i < parts.Length; i++)
{
- // Flag read-out values
- byte? byteValue = null;
- int? intValue = null;
- string? stringValue = null;
+ // Match all possible flags
+ foreach (var kvp in _inputs)
+ {
+ // If the value was not a match
+ if (!kvp.Value.Process(parts, ref i))
+ continue;
- #region General
-
- // Help
- ProcessFlagParameter(parts, FlagStrings.HelpShort, FlagStrings.HelpLong, ref i);
-
- // Version
- ProcessFlagParameter(parts, FlagStrings.Version, ref i);
-
- // Verbose
- ProcessFlagParameter(parts, FlagStrings.Verbose, ref i);
-
- // Auto Eject
- ProcessFlagParameter(parts, FlagStrings.AutoEject, ref i);
-
- // Debug
- ProcessFlagParameter(parts, FlagStrings.Debug, ref i);
-
- // Drive
- stringValue = ProcessStringParameter(parts, FlagStrings.Drive, ref i);
- if (!string.IsNullOrEmpty(stringValue))
- DriveValue = stringValue;
-
- // Speed
- intValue = ProcessInt32Parameter(parts, FlagStrings.Speed, ref i);
- if (intValue != null && intValue != int.MinValue)
- SpeedValue = intValue;
-
- // Retries
- intValue = ProcessInt32Parameter(parts, FlagStrings.Retries, ref i);
- if (intValue != null && intValue != int.MinValue)
- RetriesValue = intValue;
-
- // Image Path
- stringValue = ProcessStringParameter(parts, FlagStrings.ImagePath, ref i);
- if (!string.IsNullOrEmpty(stringValue))
- ImagePathValue = $"\"{stringValue!.Trim('"')}\"";
-
- // Image Name
- stringValue = ProcessStringParameter(parts, FlagStrings.ImageName, ref i);
- if (!string.IsNullOrEmpty(stringValue))
- ImageNameValue = $"\"{stringValue!.Trim('"')}\"";
-
- // Overwrite
- ProcessFlagParameter(parts, FlagStrings.Overwrite, ref i);
-
- #endregion
-
- #region Drive Configuration
-
- // Drive Type
- stringValue = ProcessStringParameter(parts, FlagStrings.DriveType, ref i);
- if (!string.IsNullOrEmpty(stringValue))
- DriveTypeValue = stringValue;
-
- // Drive Read Offset
- intValue = ProcessInt32Parameter(parts, FlagStrings.DriveReadOffset, ref i);
- if (intValue != null && intValue != int.MinValue)
- DriveReadOffsetValue = intValue;
-
- // Drive C2 Shift
- intValue = ProcessInt32Parameter(parts, FlagStrings.DriveC2Shift, ref i);
- if (intValue != null && intValue != int.MinValue)
- DriveC2ShiftValue = intValue;
-
- // Drive Pregap Start
- intValue = ProcessInt32Parameter(parts, FlagStrings.DrivePregapStart, ref i);
- if (intValue != null && intValue != int.MinValue)
- DrivePregapStartValue = intValue;
-
- // Drive Read Method
- stringValue = ProcessStringParameter(parts, FlagStrings.DriveReadMethod, ref i);
- if (!string.IsNullOrEmpty(stringValue))
- DriveReadMethodValue = stringValue;
-
- // Drive Sector Order
- stringValue = ProcessStringParameter(parts, FlagStrings.DriveSectorOrder, ref i);
- if (!string.IsNullOrEmpty(stringValue))
- DriveSectorOrderValue = stringValue;
-
- #endregion
-
- #region Drive Specific
-
- // Plextor Skip Leadin
- ProcessFlagParameter(parts, FlagStrings.PlextorSkipLeadin, ref i);
-
- // Plextor Leadin Retries
- intValue = ProcessInt32Parameter(parts, FlagStrings.PlextorLeadinRetries, ref i);
- if (intValue != null && intValue != int.MinValue)
- PlextorLeadinRetriesValue = intValue;
-
- // Asus Skip Leadout
- ProcessFlagParameter(parts, FlagStrings.AsusSkipLeadout, ref i);
-
- #endregion
-
- #region Offset
-
- // Force Offset
- intValue = ProcessInt32Parameter(parts, FlagStrings.ForceOffset, ref i);
- if (intValue != null && intValue != int.MinValue)
- ForceOffsetValue = intValue;
-
- // Audio Silence Threshold
- intValue = ProcessInt32Parameter(parts, FlagStrings.AudioSilenceThreshold, ref i);
- if (intValue != null && intValue != int.MinValue)
- AudioSilenceThresholdValue = intValue;
-
- // Correct Offset Shift
- ProcessFlagParameter(parts, FlagStrings.CorrectOffsetShift, ref i);
-
- // Correct Shift Relocate
- ProcessFlagParameter(parts, FlagStrings.OffsetShiftRelocate, ref i);
-
- #endregion
-
- #region Split
-
- // Force Split
- ProcessFlagParameter(parts, FlagStrings.ForceSplit, ref i);
-
- // Leave Unchanged
- ProcessFlagParameter(parts, FlagStrings.LeaveUnchanged, ref i);
-
- // Force QTOC
- ProcessFlagParameter(parts, FlagStrings.ForceQTOC, ref i);
-
- // Skip Fill
- byteValue = ProcessUInt8Parameter(parts, FlagStrings.SkipFill, ref i);
- if (byteValue != null)
- SkipFillValue = byteValue;
-
- // ISO9660 Trim
- ProcessFlagParameter(parts, FlagStrings.ISO9660Trim, ref i);
-
- #endregion
-
- #region Miscellaneous
-
- // LBA Start
- intValue = ProcessInt32Parameter(parts, FlagStrings.LBAStart, ref i);
- if (intValue != null && intValue != int.MinValue)
- LBAStartValue = intValue;
-
- // LBA End
- intValue = ProcessInt32Parameter(parts, FlagStrings.LBAEnd, ref i);
- if (intValue != null && intValue != int.MinValue)
- LBAEndValue = intValue;
-
- // Refine Subchannel
- ProcessFlagParameter(parts, FlagStrings.RefineSubchannel, ref i);
-
- // Skip
- stringValue = ProcessStringParameter(parts, FlagStrings.Skip, ref i);
- if (!string.IsNullOrEmpty(stringValue))
- SkipValue = stringValue;
-
- // Dump Write Offset
- intValue = ProcessInt32Parameter(parts, FlagStrings.DumpWriteOffset, ref i);
- if (intValue != null && intValue != int.MinValue)
- DumpWriteOffsetValue = intValue;
-
- // Dump Read Size
- intValue = ProcessInt32Parameter(parts, FlagStrings.DumpReadSize, ref i);
- if (intValue != null && intValue != int.MinValue)
- DumpReadSizeValue = intValue;
-
- // Overread Leadout
- ProcessFlagParameter(parts, FlagStrings.OverreadLeadout, ref i);
-
- // Force Unscrambled
- ProcessFlagParameter(parts, FlagStrings.ForceUnscrambled, ref i);
-
- // Legacy Subs
- ProcessFlagParameter(parts, FlagStrings.LegacySubs, ref i);
-
- // Disable CD Text
- ProcessFlagParameter(parts, FlagStrings.DisableCDText, ref i);
-
- #endregion
+ // Set the flag
+ this[kvp.Key] = true;
+ }
}
// If the image name was not set, set it with a default value
- if (string.IsNullOrEmpty(ImageNameValue))
- ImageNameValue = "track";
+ if (string.IsNullOrEmpty((_inputs[FlagStrings.ImageName] as StringInput)?.Value))
+ (_inputs[FlagStrings.ImageName] as StringInput)?.SetValue("track");
return true;
}