Finalize wire-through and clean up

This commit is contained in:
Matt Nadareski
2025-10-07 19:43:34 -04:00
parent 08829ed811
commit b9e4bbf744
10 changed files with 107 additions and 5 deletions

View File

@@ -24,6 +24,7 @@
- Use GC.SharpCompress as archive handling library
- Start wiring through log compression changes
- Fix minor issues with options loading
- Finalize wire-through and clean up
### 3.4.2 (2025-09-30)

View File

@@ -103,6 +103,8 @@ namespace MPF.CLI.Features
}
system:
Console.WriteLine();
Console.WriteLine("For possible inputs, use the List Systems commandline option");
Console.WriteLine();
Console.WriteLine("Input the system and press Enter:");
Console.Write("> ");
@@ -111,6 +113,13 @@ namespace MPF.CLI.Features
goto root;
dumpingProgram:
Console.WriteLine();
Console.WriteLine("Options:");
foreach (var program in (InternalProgram[])Enum.GetValues(typeof(InternalProgram)))
{
Console.WriteLine($"{program.ToString().ToLowerInvariant().PadRight(15)} => {program.LongName()}");
}
Console.WriteLine();
Console.WriteLine("Input the dumping program and press Enter:");
Console.Write("> ");
@@ -119,6 +128,8 @@ namespace MPF.CLI.Features
goto root;
mediaType:
Console.WriteLine();
Console.WriteLine("For possible inputs, use the List Media commandline option");
Console.WriteLine();
Console.WriteLine("Input the media type and press Enter:");
Console.Write("> ");

View File

@@ -164,6 +164,7 @@ namespace MPF.Check.Features
Console.WriteLine("-j, --json Enable submission JSON output");
Console.WriteLine(" --include-artifacts Include artifacts in JSON (requires --json)");
Console.WriteLine("-z, --zip Enable log file compression");
Console.WriteLine(" --log-compression Set the log compression type (requires --zip)");
Console.WriteLine("-d, --delete Enable unnecessary file deletion");
Console.WriteLine();
Console.WriteLine("WARNING: Check will overwrite both any existing submission information files as well");

View File

@@ -101,7 +101,8 @@ namespace MPF.Check.Features
Console.WriteLine($"F) Output submission JSON (Currently '{Options.OutputSubmissionJSON}')");
Console.WriteLine($"G) Include JSON artifacts (Currently '{Options.IncludeArtifacts}')");
Console.WriteLine($"H) Compress logs (Currently '{Options.CompressLogFiles}')");
Console.WriteLine($"I) Delete unnecessary files (Currently '{Options.DeleteUnnecessaryFiles}')");
Console.WriteLine($"I) Log compression (Currently '{Options.LogCompression.LongName()}')");
Console.WriteLine($"J) Delete unnecessary files (Currently '{Options.DeleteUnnecessaryFiles}')");
Console.WriteLine();
Console.WriteLine($"Q) Exit the program");
Console.WriteLine($"X) Start checking");
@@ -166,6 +167,9 @@ namespace MPF.Check.Features
goto root;
case "i":
case "I":
goto logCompression;
case "j":
case "J":
Options.DeleteUnnecessaryFiles = !Options.DeleteUnnecessaryFiles;
goto root;
@@ -190,6 +194,8 @@ namespace MPF.Check.Features
}
system:
Console.WriteLine();
Console.WriteLine("For possible inputs, use the List Systems commandline option");
Console.WriteLine();
Console.WriteLine("Input the system and press Enter:");
Console.Write("> ");
@@ -198,6 +204,13 @@ namespace MPF.Check.Features
goto root;
dumpingProgram:
Console.WriteLine();
Console.WriteLine("Options:");
foreach (var program in (InternalProgram[])Enum.GetValues(typeof(InternalProgram)))
{
Console.WriteLine($"{program.ToString().ToLowerInvariant().PadRight(15)} => {program.LongName()}");
}
Console.WriteLine();
Console.WriteLine("Input the dumping program and press Enter:");
Console.Write("> ");
@@ -215,11 +228,11 @@ namespace MPF.Check.Features
redumpCredentials:
Console.WriteLine();
Console.WriteLine("Enter your Redumper username and press Enter:");
Console.WriteLine("Enter your Redump username and press Enter:");
Console.Write("> ");
Options.RedumpUsername = Console.ReadLine();
Console.WriteLine("Enter your Redumper password (hidden) and press Enter:");
Console.WriteLine("Enter your Redump password (hidden) and press Enter:");
Console.Write("> ");
Options.RedumpPassword = string.Empty;
while (true)
@@ -240,6 +253,21 @@ namespace MPF.Check.Features
DevicePath = Console.ReadLine();
goto root;
logCompression:
Console.WriteLine();
Console.WriteLine("Options:");
foreach (var compressionType in (LogCompression[])Enum.GetValues(typeof(LogCompression)))
{
Console.WriteLine($"{compressionType.ToString().ToLowerInvariant().PadRight(15)} => {compressionType.LongName()}");
}
Console.WriteLine();
Console.WriteLine("Input the log compression type and press Enter:");
Console.Write("> ");
result = Console.ReadLine();
Options.LogCompression = result.ToLogCompression();
goto root;
exit:
// Now deal with the complex options
Options.ScanForProtection = scan && !string.IsNullOrEmpty(DevicePath);

View File

@@ -47,6 +47,9 @@ namespace MPF.Check.Features
private const string _loadSeedName = "load-seed";
internal readonly StringInput LoadSeedInput = new(_loadSeedName, "--load-seed", "Load a seed submission JSON for user information");
private const string _logCompressionName = "log-compression";
internal readonly StringInput LogCompressionInput = new(_logCompressionName, "--log-compression", "Set the log compression type (requires --zip)");
private const string _noPlaceholdersName = "no-placeholders";
internal readonly FlagInput NoPlaceholdersInput = new(_noPlaceholdersName, "--no-placeholders", "Disable placeholder values in submission info");
@@ -92,6 +95,7 @@ namespace MPF.Check.Features
Add(JsonInput);
Add(IncludeArtifactsInput);
Add(ZipInput);
Add(LogCompressionInput);
Add(DeleteInput);
}
@@ -163,6 +167,10 @@ namespace MPF.Check.Features
else if (CreateIrdInput.ProcessInput(args, ref index))
Options.CreateIRDAfterDumping = true;
// Set the log compression type (requires --zip)
else if (LogCompressionInput.ProcessInput(args, ref index))
Options.LogCompression = LogCompressionInput.Value.ToLogCompression();
// Retrieve Redump match information
else if (NoRetrieveInput.ProcessInput(args, ref index))
Options.RetrieveMatchInformation = false;

View File

@@ -129,6 +129,7 @@ namespace MPF.Check
commandSet.Add(mainFeature.JsonInput);
commandSet.Add(mainFeature.IncludeArtifactsInput);
commandSet.Add(mainFeature.ZipInput);
commandSet.Add(mainFeature.LogCompressionInput);
commandSet.Add(mainFeature.DeleteInput);
return commandSet;

View File

@@ -28,6 +28,12 @@ namespace MPF.Frontend.Test
{
string? actual = prog.LongName();
Assert.Equal(expected, actual);
if (prog != null)
{
actual = EnumExtensions.GetLongName(prog);
Assert.Equal(expected, actual);
}
}
[Theory]
@@ -39,6 +45,12 @@ namespace MPF.Frontend.Test
{
string? actual = comp.LongName();
Assert.Equal(expected, actual);
if (comp != null)
{
actual = EnumExtensions.GetLongName(comp);
Assert.Equal(expected, actual);
}
}
[Theory]
@@ -50,6 +62,12 @@ namespace MPF.Frontend.Test
{
string? actual = method.LongName();
Assert.Equal(expected, actual);
if (method != null)
{
actual = EnumExtensions.GetLongName(method);
Assert.Equal(expected, actual);
}
}
[Theory]
@@ -63,6 +81,12 @@ namespace MPF.Frontend.Test
{
string? actual = order.LongName();
Assert.Equal(expected, actual);
if (order != null)
{
actual = EnumExtensions.GetLongName(order);
Assert.Equal(expected, actual);
}
}
[Theory]
@@ -79,6 +103,12 @@ namespace MPF.Frontend.Test
{
string? actual = type.LongName();
Assert.Equal(expected, actual);
if (type != null)
{
actual = EnumExtensions.GetLongName(type);
Assert.Equal(expected, actual);
}
}
#endregion

View File

@@ -62,6 +62,14 @@ namespace MPF.Frontend
}
}
/// <summary>
/// Get the string representation of the InternalProgram enum values
/// </summary>
/// <param name="prog">InternalProgram value to convert</param>
/// <returns>String representing the value, if possible</returns>
public static string LongName(this InternalProgram prog)
=> ((InternalProgram?)prog).LongName();
/// <summary>
/// Get the string representation of the InternalProgram enum values
/// </summary>
@@ -93,6 +101,14 @@ namespace MPF.Frontend
};
}
/// <summary>
/// Get the string representation of the LogCompression enum values
/// </summary>
/// <param name="comp">LogCompression value to convert</param>
/// <returns>String representing the value, if possible</returns>
public static string LongName(this LogCompression comp)
=> ((LogCompression?)comp).LongName();
/// <summary>
/// Get the string representation of the LogCompression enum values
/// </summary>

View File

@@ -54,7 +54,7 @@ namespace MPF.Frontend.ViewModels
/// <summary>
/// List of available log compression methods
/// </summary>
public static List<Element<LogCompression>> LogCompressions = PopulateLogCompressions();
public static List<Element<LogCompression>> LogCompressions => PopulateLogCompressions();
/// <summary>
/// Current list of supported Redumper read methods

View File

@@ -191,7 +191,7 @@
<TabItem Header="Dumping" Style="{DynamicResource CustomTabItemStyle}">
<StackPanel>
<GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Dumping">
<UniformGrid Columns="2" Rows="6">
<UniformGrid Columns="2" Rows="7">
<CheckBox VerticalAlignment="Center" Content="Show Disc Info"
IsChecked="{Binding Options.PromptForDiscInformation}"
ToolTip="Enable showing the media information output after dumping" Margin="0,4"
@@ -243,6 +243,12 @@
ToolTip="Compress output log files to reduce space" Margin="0,4"
/>
<Label VerticalAlignment="Center" Content="Log Compression:" HorizontalAlignment="Right" />
<ComboBox x:Name="LogCompressionComboBox" Height="22" Width="200" HorizontalAlignment="Left"
ItemsSource="{Binding LogCompressions}" SelectedItem="{Binding Options.LogCompression, Converter={StaticResource ElementConverter}, Mode=TwoWay}"
Style="{DynamicResource CustomComboBoxStyle}" IsEnabled="{Binding Options.CompressLogFiles}"
/>
<CheckBox VerticalAlignment="Center" Content="Delete Unnecessary Files"
IsChecked="{Binding Options.DeleteUnnecessaryFiles}"
ToolTip="Delete unnecesary output files to reduce space" Margin="0,4"