mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-05 13:49:40 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
299fafe1f8 | ||
|
|
8f6305a7c4 | ||
|
|
3f61957715 | ||
|
|
57750295fb | ||
|
|
286ec864ab | ||
|
|
e4fd644c61 | ||
|
|
7502d7e8df | ||
|
|
439fb2717c | ||
|
|
089ab1c4a2 | ||
|
|
89a50ea424 | ||
|
|
740d867d7b | ||
|
|
83fa4852c9 | ||
|
|
ecc00a28c2 | ||
|
|
2d90c849e1 | ||
|
|
1d065ffd48 | ||
|
|
ca885c3b89 | ||
|
|
94fd614673 | ||
|
|
9fc5799999 |
169
.editorconfig
169
.editorconfig
@@ -1,4 +1,167 @@
|
||||
[*.cs]
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# SYSLIB1045: Convert to 'GeneratedRegexAttribute'.
|
||||
dotnet_diagnostic.SYSLIB1045.severity = silent
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
# Indentation and spacing
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# New line preferences
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
max_line_length = unset
|
||||
|
||||
# using directive preferences
|
||||
csharp_using_directive_placement = outside_namespace
|
||||
dotnet_diagnostic.IDE0005.severity = error
|
||||
|
||||
# Code-block preferences
|
||||
csharp_style_namespace_declarations = block_scoped
|
||||
csharp_style_prefer_method_group_conversion = true
|
||||
csharp_style_prefer_top_level_statements = false
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true
|
||||
csharp_style_inlined_variable_declaration = true
|
||||
csharp_style_unused_value_assignment_preference = discard_variable
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable
|
||||
dotnet_diagnostic.IDE0001.severity = warning
|
||||
dotnet_diagnostic.IDE0002.severity = warning
|
||||
dotnet_diagnostic.IDE0004.severity = warning
|
||||
dotnet_diagnostic.IDE0010.severity = error
|
||||
dotnet_diagnostic.IDE0051.severity = warning
|
||||
dotnet_diagnostic.IDE0052.severity = warning
|
||||
dotnet_diagnostic.IDE0072.severity = warning
|
||||
dotnet_diagnostic.IDE0080.severity = warning
|
||||
dotnet_diagnostic.IDE0100.severity = error
|
||||
dotnet_diagnostic.IDE0110.severity = error
|
||||
dotnet_diagnostic.IDE0120.severity = warning
|
||||
dotnet_diagnostic.IDE0121.severity = warning
|
||||
dotnet_diagnostic.IDE0240.severity = error
|
||||
dotnet_diagnostic.IDE0241.severity = error
|
||||
dotnet_style_coalesce_expression = true
|
||||
dotnet_style_namespace_match_folder = false
|
||||
dotnet_style_null_propagation = true
|
||||
dotnet_style_prefer_auto_properties = true
|
||||
dotnet_style_prefer_collection_expression = when_types_loosely_match
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
|
||||
dotnet_style_prefer_compound_assignment = true
|
||||
csharp_style_prefer_simple_property_accessors = true
|
||||
dotnet_style_prefer_simplified_interpolation = true
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true
|
||||
csharp_style_prefer_unbound_generic_type_in_nameof = true
|
||||
|
||||
# Field preferences
|
||||
dotnet_diagnostic.IDE0044.severity = warning
|
||||
dotnet_style_readonly_field = true
|
||||
|
||||
# Language keyword vs. framework types preferences
|
||||
dotnet_diagnostic.IDE0049.severity = error
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true
|
||||
dotnet_style_predefined_type_for_member_access = true
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true
|
||||
csharp_style_prefer_readonly_struct = true
|
||||
dotnet_diagnostic.IDE0036.severity = warning
|
||||
dotnet_diagnostic.IDE0040.severity = error
|
||||
dotnet_diagnostic.IDE0380.severity = error
|
||||
dotnet_style_require_accessibility_modifiers = always
|
||||
|
||||
# New-line preferences
|
||||
dotnet_diagnostic.IDE2000.severity = warning
|
||||
dotnet_diagnostic.IDE2002.severity = warning
|
||||
dotnet_diagnostic.IDE2003.severity = warning
|
||||
dotnet_diagnostic.IDE2004.severity = warning
|
||||
dotnet_diagnostic.IDE2005.severity = warning
|
||||
dotnet_diagnostic.IDE2006.severity = warning
|
||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
|
||||
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
|
||||
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
|
||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
|
||||
dotnet_style_allow_multiple_blank_lines_experimental = false
|
||||
dotnet_style_allow_statement_immediately_after_block_experimental = false
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all
|
||||
dotnet_diagnostic.IDE0280.severity = error
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_diagnostic.IDE0047.severity = warning
|
||||
dotnet_diagnostic.IDE0048.severity = warning
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_other_operators = always_for_clarity
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
|
||||
|
||||
# Pattern-matching preferences
|
||||
dotnet_diagnostic.IDE0019.severity = warning
|
||||
dotnet_diagnostic.IDE0020.severity = warning
|
||||
dotnet_diagnostic.IDE0038.severity = warning
|
||||
dotnet_diagnostic.IDE0066.severity = none
|
||||
dotnet_diagnostic.IDE0083.severity = warning
|
||||
dotnet_diagnostic.IDE0260.severity = warning
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true
|
||||
csharp_style_prefer_not_pattern = true
|
||||
csharp_style_prefer_pattern_matching = true
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false
|
||||
dotnet_style_qualification_for_field = false
|
||||
dotnet_style_qualification_for_method = false
|
||||
dotnet_style_qualification_for_property = false
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_for_built_in_types = false
|
||||
csharp_style_var_when_type_is_apparent = true
|
||||
|
||||
# .NET formatting options
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = true
|
||||
|
||||
# C# formatting options
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = false
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
### WIP (xxxx-xx-xx)
|
||||
|
||||
- Check for null or empty layerbreak arrays
|
||||
- Check range-specific values in layerbreak
|
||||
- Update Redumper to build 671
|
||||
- Update Redumper to build 676 (rename asus flags to mediatek)
|
||||
- Use default media type if not provided
|
||||
- Update Redumper to build 682 (Dreamcast support)
|
||||
- Add default subfolder to CLI outputs
|
||||
- Update DIC to 20260101
|
||||
- Update Redumper to build 683
|
||||
- Add editorconfig, fix issues
|
||||
- Add MPRESS to packer filters
|
||||
- Update RedumpLib to 1.9.1
|
||||
- Split path creation in OptionsLoader
|
||||
- Add unused Dreamdump execution context
|
||||
- Validate a system is provided for CLI applications
|
||||
- Log the system being used, in case it came from config
|
||||
- Extend logging with a new state
|
||||
|
||||
### 3.6.0 (2025-11-28)
|
||||
|
||||
- Add BCA to list of files to select in Check UI
|
||||
|
||||
@@ -97,6 +97,16 @@ namespace MPF.CLI.Features
|
||||
/// <inheritdoc/>
|
||||
public override bool Execute()
|
||||
{
|
||||
// Validate a system type is provided
|
||||
if (System == null)
|
||||
{
|
||||
Console.Error.WriteLine("A system name needs to be provided");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Log the system being used, in case it came from config
|
||||
Console.WriteLine($"Using system: {System.LongName()}");
|
||||
|
||||
// Validate the supplied credentials
|
||||
if (Options.RetrieveMatchInformation
|
||||
&& !string.IsNullOrEmpty(Options.RedumpUsername)
|
||||
@@ -114,6 +124,7 @@ namespace MPF.CLI.Features
|
||||
}
|
||||
|
||||
// Validate the internal program
|
||||
#pragma warning disable IDE0010
|
||||
switch (Options.InternalProgram)
|
||||
{
|
||||
case InternalProgram.Aaru:
|
||||
@@ -122,6 +133,7 @@ namespace MPF.CLI.Features
|
||||
Console.Error.WriteLine("A path needs to be supplied in config.json for Aaru, exiting...");
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case InternalProgram.DiscImageCreator:
|
||||
@@ -130,43 +142,70 @@ namespace MPF.CLI.Features
|
||||
Console.Error.WriteLine("A path needs to be supplied in config.json for DIC, exiting...");
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// case InternalProgram.Dreamdump:
|
||||
// if (!File.Exists(Options.DreamdumpPath))
|
||||
// {
|
||||
// Console.Error.WriteLine("A path needs to be supplied in config.json for Dreamdump, exiting...");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// break;
|
||||
|
||||
case InternalProgram.Redumper:
|
||||
if (!File.Exists(Options.RedumperPath))
|
||||
{
|
||||
Console.Error.WriteLine("A path needs to be supplied in config.json for Redumper, exiting...");
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
Console.Error.WriteLine($"{Options.InternalProgram} is not a supported dumping program, exiting...");
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
// Ensure we have the values we need
|
||||
if (CustomParams == null && DevicePath == null)
|
||||
if (CustomParams is null && DevicePath is null)
|
||||
{
|
||||
Console.Error.WriteLine("Either custom parameters or a device path need to be provided, exiting...");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Options.InternalProgram == InternalProgram.DiscImageCreator
|
||||
&& CustomParams == null
|
||||
&& (MediaType == null || MediaType == SabreTools.RedumpLib.Data.MediaType.NONE))
|
||||
&& CustomParams is null
|
||||
&& (MediaType is null || MediaType == SabreTools.RedumpLib.Data.MediaType.NONE))
|
||||
{
|
||||
Console.Error.WriteLine("Media type is required for DiscImageCreator, exiting...");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Normalize the file path
|
||||
if (DevicePath != null && FilePath == null)
|
||||
// If no media type is provided, use a default
|
||||
if (CustomParams is null && (MediaType is null || MediaType == SabreTools.RedumpLib.Data.MediaType.NONE))
|
||||
{
|
||||
FilePath = $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin";
|
||||
if (Options.DefaultOutputPath != null)
|
||||
// Get reasonable default values based on the current system
|
||||
var mediaTypes = System.MediaTypes();
|
||||
MediaType = mediaTypes.Count > 0 ? mediaTypes[0] : SabreTools.RedumpLib.Data.MediaType.CDROM;
|
||||
if (MediaType == SabreTools.RedumpLib.Data.MediaType.NONE)
|
||||
MediaType = SabreTools.RedumpLib.Data.MediaType.CDROM;
|
||||
|
||||
Console.WriteLine($"No media type was provided, using {MediaType.LongName()}");
|
||||
}
|
||||
|
||||
// Normalize the file path
|
||||
if (DevicePath is not null && FilePath is null)
|
||||
{
|
||||
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 (FilePath != null)
|
||||
|
||||
if (FilePath is not null)
|
||||
FilePath = FrontendTool.NormalizeOutputPaths(FilePath, getFullPath: true);
|
||||
|
||||
// Get the speed from the options
|
||||
@@ -196,7 +235,7 @@ namespace MPF.CLI.Features
|
||||
Console.WriteLine($"Invoking {Options.InternalProgram} using '{paramStr}'");
|
||||
var dumpResult = env.Run(MediaType).GetAwaiter().GetResult();
|
||||
Console.WriteLine(dumpResult.Message);
|
||||
if (!dumpResult)
|
||||
if (dumpResult == false)
|
||||
return false;
|
||||
|
||||
// If it was not a dumping command
|
||||
@@ -208,7 +247,7 @@ namespace MPF.CLI.Features
|
||||
}
|
||||
|
||||
// If we have a mounted path, replace the environment
|
||||
if (MountedPath != null && Directory.Exists(MountedPath))
|
||||
if (MountedPath is not null && Directory.Exists(MountedPath))
|
||||
{
|
||||
drive = Drive.Create(null, MountedPath);
|
||||
env = new DumpEnvironment(Options,
|
||||
|
||||
@@ -38,7 +38,12 @@ namespace MPF.CLI.Features
|
||||
|
||||
// Create return values
|
||||
MediaType = SabreTools.RedumpLib.Data.MediaType.NONE;
|
||||
FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin");
|
||||
string defaultFileName = $"track_{DateTime.Now:yyyyMMdd-HHmm}";
|
||||
#if NET20 || NET35
|
||||
FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", Path.Combine(defaultFileName, $"{defaultFileName}.bin"));
|
||||
#else
|
||||
FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", defaultFileName, $"{defaultFileName}.bin");
|
||||
#endif
|
||||
System = Options.DefaultSystem;
|
||||
|
||||
// Create state values
|
||||
@@ -118,6 +123,7 @@ namespace MPF.CLI.Features
|
||||
Console.WriteLine($"{InternalProgram.Redumper.ToString().ToLowerInvariant(),-15} => {InternalProgram.Redumper.LongName()}");
|
||||
Console.WriteLine($"{InternalProgram.DiscImageCreator.ToString().ToLowerInvariant(),-15} => {InternalProgram.DiscImageCreator.LongName()}");
|
||||
Console.WriteLine($"{InternalProgram.Aaru.ToString().ToLowerInvariant(),-15} => {InternalProgram.Aaru.LongName()}");
|
||||
// Console.WriteLine($"{InternalProgram.Dreamdump.ToString().ToLowerInvariant(),-15} => {InternalProgram.Dreamdump.LongName()}");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Input the dumping program and press Enter:");
|
||||
Console.Write("> ");
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace MPF.CLI.Features
|
||||
public override bool ProcessArgs(string[] args, int index)
|
||||
{
|
||||
// If we have no arguments, just return
|
||||
if (args == null || args.Length == 0)
|
||||
if (args is null || args.Length == 0)
|
||||
return true;
|
||||
|
||||
// Read the options from config, if possible
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.CommandLine" Version="[1.4.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -33,7 +33,7 @@ namespace MPF.CLI
|
||||
var commandSet = CreateCommands(mainFeature);
|
||||
|
||||
// If we have no args, show the help and quit
|
||||
if (args == null || args.Length == 0)
|
||||
if (args is null || args.Length == 0)
|
||||
{
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
@@ -62,6 +62,7 @@ namespace MPF.CLI
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!interactive.Execute())
|
||||
{
|
||||
BaseFeature.DisplayHelp();
|
||||
@@ -77,6 +78,7 @@ namespace MPF.CLI
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainFeature.Execute())
|
||||
{
|
||||
BaseFeature.DisplayHelp();
|
||||
|
||||
@@ -72,6 +72,17 @@ namespace MPF.Check.Features
|
||||
/// <inheritdoc/>
|
||||
public override bool Execute()
|
||||
{
|
||||
// Validate a system type is provided
|
||||
if (System == null)
|
||||
{
|
||||
Console.Error.WriteLine("A system name needs to be provided");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Log the system being used, in case it came from config
|
||||
Console.WriteLine($"Using system: {System.LongName()}");
|
||||
|
||||
// Validate a program is provided
|
||||
if (Options.InternalProgram == InternalProgram.NONE)
|
||||
{
|
||||
Console.Error.WriteLine("A program name needs to be provided");
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace MPF.Check.Features
|
||||
hideDriveLetters = false;
|
||||
|
||||
// If we have no arguments, just return
|
||||
if (args == null || args.Length == 0)
|
||||
if (args is null || args.Length == 0)
|
||||
return true;
|
||||
|
||||
// Read the options from config, if possible
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.CommandLine" Version="[1.4.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -19,7 +19,7 @@ namespace MPF.Check
|
||||
var commandSet = CreateCommands(mainFeature);
|
||||
|
||||
// If we have no args, show the help and quit
|
||||
if (args == null || args.Length == 0)
|
||||
if (args is null || args.Length == 0)
|
||||
{
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
@@ -48,12 +48,14 @@ namespace MPF.Check
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!interactive.VerifyInputs())
|
||||
{
|
||||
Console.Error.WriteLine("At least one input is required");
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!interactive.Execute())
|
||||
{
|
||||
BaseFeature.DisplayHelp();
|
||||
@@ -69,12 +71,14 @@ namespace MPF.Check
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainFeature.VerifyInputs())
|
||||
{
|
||||
Console.Error.WriteLine("At least one input is required");
|
||||
BaseFeature.DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainFeature.Execute())
|
||||
{
|
||||
BaseFeature.DisplayHelp();
|
||||
|
||||
@@ -102,6 +102,21 @@ namespace MPF.ExecutionContexts.Test
|
||||
|
||||
#endregion
|
||||
|
||||
#region AuthPS3
|
||||
|
||||
[Theory]
|
||||
[InlineData("authps3 f")]
|
||||
public void AuthPS3Test(string parameters)
|
||||
{
|
||||
string? expected = "authps3 f";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
Assert.False(context.IsDumpingCommand());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BluRay
|
||||
|
||||
[Theory]
|
||||
|
||||
68
MPF.ExecutionContexts.Test/DreamdumpTests.cs
Normal file
68
MPF.ExecutionContexts.Test/DreamdumpTests.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System.Collections.Generic;
|
||||
using MPF.ExecutionContexts.Dreamdump;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using Xunit;
|
||||
|
||||
namespace MPF.ExecutionContexts.Test
|
||||
{
|
||||
public class DreamdumpTests
|
||||
{
|
||||
#region Default Values
|
||||
|
||||
private static readonly Dictionary<string, string?> AllOptions = new()
|
||||
{
|
||||
[SettingConstants.RereadCount] = "1000",
|
||||
[SettingConstants.SectorOrder] = "DATA_C2_SUB",
|
||||
};
|
||||
|
||||
// None of these scenarios are actually supported as all are treated like GD-ROM
|
||||
[Theory]
|
||||
[InlineData(null, null, null, "filename.bin", null, "--retries=20 --image-name=\"filename\" --sector-order=DATA_C2_SUB")]
|
||||
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.CDROM, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.DVD, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.NintendoWii, MediaType.NintendoWiiOpticalDisc, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.HDDVDVideo, MediaType.HDDVD, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.BDVideo, MediaType.BluRay, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
[InlineData(RedumpSystem.NintendoWiiU, MediaType.NintendoWiiUOpticalDisc, "/dev/sr0", "path/filename.bin", 2, "--retries=20 --image-name=\"filename\" --image-path=\"path\" --speed=2 --sector-order=DATA_C2_SUB --drive=/dev/sr0")]
|
||||
public void DefaultValueTest(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
string? expected)
|
||||
{
|
||||
var context = new ExecutionContext(system, type, drivePath, filename, driveSpeed, AllOptions);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Default
|
||||
|
||||
[Theory]
|
||||
[InlineData("--force-qtoc --train --retries=20 --image-name=image --image-path=path --read-offset=0 --read-at-once=0 --speed=8 --sector-order=so --drive=/dev/sr0")]
|
||||
public void DiscTest(string parameters)
|
||||
{
|
||||
string? expected = "--force-qtoc --train --retries=20 --image-name=\"image\" --image-path=\"path\" --read-offset=0 --read-at-once=0 --speed=8 --sector-order=so --drive=/dev/sr0";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
Assert.True(context.IsDumpingCommand());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("--image-name=\"image name.bin\" --image-path=\"directory name\"")]
|
||||
public void SpacesTest(string parameters)
|
||||
{
|
||||
string? expected = "--image-name=\"image name.bin\" --image-path=\"directory name\"";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
Assert.True(context.IsDumpingCommand());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="18.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="18.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
||||
<PackageReference Include="xunit.analyzers" Version="1.25.0" />
|
||||
<PackageReference Include="xunit.analyzers" Version="1.27.0" />
|
||||
<PackageReference Include="xunit.assert" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.core" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.extensibility.core" Version="2.9.3" />
|
||||
|
||||
@@ -66,11 +66,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Disc
|
||||
|
||||
[Theory]
|
||||
[InlineData("disc -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("disc --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("disc -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("disc --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DiscTest(string parameters)
|
||||
{
|
||||
string? expected = "disc --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "disc --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -93,11 +93,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Rings
|
||||
|
||||
[Theory]
|
||||
[InlineData("rings -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("rings --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("rings -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("rings --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void RingsTest(string parameters)
|
||||
{
|
||||
string? expected = "rings --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "rings --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -109,11 +109,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Dump
|
||||
|
||||
[Theory]
|
||||
[InlineData("dump -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dump --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dump -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dump --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DumpTest(string parameters)
|
||||
{
|
||||
string? expected = "dump --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "dump --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -125,11 +125,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region DumpExtra
|
||||
|
||||
[Theory]
|
||||
[InlineData("dump::extra -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dump::extra --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dump::extra -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dump::extra --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DumpExtraTest(string parameters)
|
||||
{
|
||||
string? expected = "dump::extra --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "dump::extra --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -141,11 +141,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Refine
|
||||
|
||||
[Theory]
|
||||
[InlineData("refine -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("refine --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("refine -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("refine --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void RefineTest(string parameters)
|
||||
{
|
||||
string? expected = "refine --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "refine --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -157,11 +157,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Verify
|
||||
|
||||
[Theory]
|
||||
[InlineData("verify -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("verify --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("verify -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("verify --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void VerifyTest(string parameters)
|
||||
{
|
||||
string? expected = "verify --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "verify --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -173,11 +173,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region DVDKey
|
||||
|
||||
[Theory]
|
||||
[InlineData("dvdkey -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dvdkey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dvdkey -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dvdkey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DVDKeyTest(string parameters)
|
||||
{
|
||||
string? expected = "dvdkey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "dvdkey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -189,11 +189,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Eject
|
||||
|
||||
[Theory]
|
||||
[InlineData("eject -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("eject --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("eject -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("eject --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void EjectTest(string parameters)
|
||||
{
|
||||
string? expected = "eject --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "eject --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -205,11 +205,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region DVDIsoKey
|
||||
|
||||
[Theory]
|
||||
[InlineData("dvdisokey -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dvdisokey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dvdisokey -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("dvdisokey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DVDIsoKeyTest(string parameters)
|
||||
{
|
||||
string? expected = "dvdisokey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "dvdisokey --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -221,11 +221,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Protection
|
||||
|
||||
[Theory]
|
||||
[InlineData("protection -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("protection --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs --disable-cdtext")]
|
||||
[InlineData("protection -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("protection --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs --disable-cdtext")]
|
||||
public void ProtectionTest(string parameters)
|
||||
{
|
||||
string? expected = "protection --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "protection --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -237,11 +237,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Split
|
||||
|
||||
[Theory]
|
||||
[InlineData("split -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("split --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("split -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("split --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void SplitTest(string parameters)
|
||||
{
|
||||
string? expected = "split --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "split --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -253,11 +253,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Hash
|
||||
|
||||
[Theory]
|
||||
[InlineData("hash -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("hash --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("hash -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("hash --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void HashTest(string parameters)
|
||||
{
|
||||
string? expected = "hash --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "hash --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -269,11 +269,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Info
|
||||
|
||||
[Theory]
|
||||
[InlineData("info -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("info --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("info -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("info --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void InfoTest(string parameters)
|
||||
{
|
||||
string? expected = "info --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "info --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -285,11 +285,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Skeleton
|
||||
|
||||
[Theory]
|
||||
[InlineData("skeleton -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("skeleton --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("skeleton -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("skeleton --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void SkeletonTest(string parameters)
|
||||
{
|
||||
string? expected = "skeleton --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "skeleton --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -301,11 +301,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Subchannel
|
||||
|
||||
[Theory]
|
||||
[InlineData("subchannel -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("subchannel --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("subchannel -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("subchannel --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void SubchannelTest(string parameters)
|
||||
{
|
||||
string? expected = "subchannel --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "subchannel --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -317,11 +317,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region Debug
|
||||
|
||||
[Theory]
|
||||
[InlineData("debug -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("debug --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("debug -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("debug --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DebugTest(string parameters)
|
||||
{
|
||||
string? expected = "debug --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "debug --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -333,11 +333,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region FixMSF
|
||||
|
||||
[Theory]
|
||||
[InlineData("fixmsf -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("fixmsf --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("fixmsf -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("fixmsf --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void FixMSFTest(string parameters)
|
||||
{
|
||||
string? expected = "fixmsf --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "fixmsf --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -348,11 +348,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region DebugFlip
|
||||
|
||||
[Theory]
|
||||
[InlineData("debug::flip -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("debug::flip --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("debug::flip -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("debug::flip --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DebugFlipTest(string parameters)
|
||||
{
|
||||
string? expected = "debug::flip --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "debug::flip --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -363,11 +363,11 @@ namespace MPF.ExecutionContexts.Test
|
||||
#region DriveTest
|
||||
|
||||
[Theory]
|
||||
[InlineData("drive::test -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("drive::test --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("drive::test -h --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
[InlineData("drive::test --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=path --image-name=image --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs")]
|
||||
public void DriveTestTest(string parameters)
|
||||
{
|
||||
string? expected = "drive::test --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --asus-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --iso9660-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
string? expected = "drive::test --help --version --verbose --auto-eject --skeleton --drive=dr --speed=8 --retries=0 --image-path=\"path\" --image-name=\"image\" --overwrite --drive-type=dt --drive-read-offset=0 --drive-c2-shift=0 --drive-pregap-start=0 --drive-read-method=drm --drive-sector-order=dso --plextor-skip-leadin --plextor-leadin-retries=0 --mediatek-skip-leadout --disable-cdtext --force-offset=0 --audio-silence-threshold=0 --correct-offset-shift --offset-shift-relocate --force-split --leave-unchanged --force-qtoc --skip-fill=0 --filesystem-trim --lba-start=0 --lba-end=0 --refine-subchannel --refine-sector-mode --skip=0 --dump-write-offset=0 --dump-read-size=0 --overread-leadout --force-unscrambled --legacy-subs";
|
||||
var context = new ExecutionContext(parameters);
|
||||
string? actual = context.GenerateParameters();
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
@@ -511,6 +511,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
}
|
||||
|
||||
// Handle filenames based on command, if necessary
|
||||
#pragma warning disable IDE0010
|
||||
switch (BaseCommand)
|
||||
{
|
||||
// Input value only (file path)
|
||||
@@ -586,6 +587,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
parameters.Append($"\"{RemoteHostValue}\" ");
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
return parameters.ToString().TrimEnd();
|
||||
}
|
||||
@@ -636,7 +638,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
InputValue = drivePath;
|
||||
OutputValue = filename;
|
||||
|
||||
if (driveSpeed != null)
|
||||
if (driveSpeed is not null)
|
||||
{
|
||||
this[FlagStrings.SpeedLong] = true;
|
||||
(_inputs[FlagStrings.SpeedLong] as Int8Input)?.SetValue((sbyte)driveSpeed);
|
||||
@@ -656,16 +658,19 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
this[FlagStrings.DebugLong] = true;
|
||||
_preCommandInputs[FlagStrings.DebugLong].SetValue(true);
|
||||
}
|
||||
|
||||
if (GetBooleanSetting(options, SettingConstants.EnableVerbose, SettingConstants.EnableVerboseDefault))
|
||||
{
|
||||
this[FlagStrings.VerboseLong] = true;
|
||||
_preCommandInputs[FlagStrings.VerboseLong].SetValue(true);
|
||||
}
|
||||
|
||||
if (GetBooleanSetting(options, SettingConstants.ForceDumping, SettingConstants.ForceDumpingDefault))
|
||||
{
|
||||
this[FlagStrings.ForceLong] = true;
|
||||
(_inputs[FlagStrings.ForceLong] as BooleanInput)?.SetValue(true);
|
||||
}
|
||||
|
||||
if (GetBooleanSetting(options, SettingConstants.StripPersonalData, SettingConstants.StripPersonalDataDefault))
|
||||
{
|
||||
this[FlagStrings.PrivateLong] = true;
|
||||
@@ -757,6 +762,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
}
|
||||
|
||||
// Handle filenames based on command, if necessary
|
||||
#pragma warning disable IDE0010
|
||||
switch (BaseCommand)
|
||||
{
|
||||
// Input value only
|
||||
@@ -823,6 +829,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
// If we didn't reach the end for some reason, it failed
|
||||
if (i != parts.Length)
|
||||
@@ -854,7 +861,7 @@ namespace MPF.ExecutionContexts.Aaru
|
||||
var normalized = NormalizeCommand($"{partOne} {partTwo}".Trim());
|
||||
|
||||
// Null normalization means invalid command
|
||||
if (normalized == null)
|
||||
if (normalized is null)
|
||||
return null;
|
||||
|
||||
// Determine if start should be incremented
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace MPF.ExecutionContexts
|
||||
/// Returns if the current Parameter object is valid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsValid() => GenerateParameters() != null;
|
||||
public bool IsValid() => GenerateParameters() is not null;
|
||||
|
||||
/// <summary>
|
||||
/// Reset all special variables to have default values
|
||||
@@ -222,7 +222,7 @@ namespace MPF.ExecutionContexts
|
||||
{
|
||||
try
|
||||
{
|
||||
while (process != null && !process.HasExited)
|
||||
while (process is not null && !process.HasExited)
|
||||
{
|
||||
process.Kill();
|
||||
}
|
||||
@@ -294,6 +294,28 @@ namespace MPF.ExecutionContexts
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an UInt8 setting from a settings, dictionary
|
||||
/// </summary>
|
||||
/// <param name="settings">Dictionary representing the settings</param>
|
||||
/// <param name="key">Setting key to get a value for</param>
|
||||
/// <param name="defaultValue">Default value to return if no value is found</param>
|
||||
/// <returns>Setting value if possible, default value otherwise</returns>
|
||||
internal static byte GetUInt8Setting(Dictionary<string, string?> settings, string key, byte defaultValue)
|
||||
{
|
||||
if (settings.ContainsKey(key))
|
||||
{
|
||||
if (byte.TryParse(settings[key], out byte value))
|
||||
return value;
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parameter Parsing
|
||||
@@ -331,9 +353,9 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>True if the flag value is supported, false otherwise</returns>
|
||||
protected bool IsFlagSupported(string flag)
|
||||
{
|
||||
if (CommandSupport == null)
|
||||
if (CommandSupport is null)
|
||||
return false;
|
||||
if (BaseCommand == null)
|
||||
if (BaseCommand is null)
|
||||
return false;
|
||||
if (!CommandSupport.TryGetValue(BaseCommand, out var supported))
|
||||
return false;
|
||||
@@ -360,9 +382,9 @@ namespace MPF.ExecutionContexts
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!sbyte.TryParse(value, out sbyte temp))
|
||||
return false;
|
||||
else if (lowerBound != null && temp < lowerBound)
|
||||
else if (lowerBound is not null && temp < lowerBound)
|
||||
return false;
|
||||
else if (upperBound != null && temp > upperBound)
|
||||
else if (upperBound is not null && temp > upperBound)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -380,9 +402,9 @@ namespace MPF.ExecutionContexts
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!short.TryParse(value, out short temp))
|
||||
return false;
|
||||
else if (lowerBound != null && temp < lowerBound)
|
||||
else if (lowerBound is not null && temp < lowerBound)
|
||||
return false;
|
||||
else if (upperBound != null && temp > upperBound)
|
||||
else if (upperBound is not null && temp > upperBound)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -400,9 +422,9 @@ namespace MPF.ExecutionContexts
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!int.TryParse(value, out int temp))
|
||||
return false;
|
||||
else if (lowerBound != null && temp < lowerBound)
|
||||
else if (lowerBound is not null && temp < lowerBound)
|
||||
return false;
|
||||
else if (upperBound != null && temp > upperBound)
|
||||
else if (upperBound is not null && temp > upperBound)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -420,9 +442,9 @@ namespace MPF.ExecutionContexts
|
||||
string value = ExtractFactorFromValue(parameter, out _);
|
||||
if (!long.TryParse(value, out long temp))
|
||||
return false;
|
||||
else if (lowerBound != null && temp < lowerBound)
|
||||
else if (lowerBound is not null && temp < lowerBound)
|
||||
return false;
|
||||
else if (upperBound != null && temp > upperBound)
|
||||
else if (upperBound is not null && temp > upperBound)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -448,7 +470,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>True if the parameter was processed successfully or skipped, false otherwise</returns>
|
||||
protected bool ProcessFlagParameter(string[] parts, string? shortFlagString, string longFlagString, ref int i)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return false;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -484,7 +506,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>True if the parameter was processed successfully or skipped, false otherwise</returns>
|
||||
protected bool ProcessBooleanParameter(string[] parts, string? shortFlagString, string longFlagString, ref int i, bool missingAllowed = false)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return false;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -559,7 +581,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>SByte value if success, SByte.MinValue if skipped, null on error/returns>
|
||||
protected sbyte? ProcessInt8Parameter(string[] parts, string? shortFlagString, string longFlagString, ref int i, bool missingAllowed = false)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return null;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -622,7 +644,7 @@ namespace MPF.ExecutionContexts
|
||||
return null;
|
||||
}
|
||||
|
||||
return SByte.MinValue;
|
||||
return sbyte.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -647,7 +669,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>Int16 value if success, Int16.MinValue if skipped, null on error/returns>
|
||||
protected short? ProcessInt16Parameter(string[] parts, string? shortFlagString, string longFlagString, ref int i, bool missingAllowed = false)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return null;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -709,7 +731,7 @@ namespace MPF.ExecutionContexts
|
||||
return null;
|
||||
}
|
||||
|
||||
return Int16.MinValue;
|
||||
return short.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -734,7 +756,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>Int32 value if success, Int32.MinValue if skipped, null on error/returns>
|
||||
protected int? ProcessInt32Parameter(string[] parts, string? shortFlagString, string longFlagString, ref int i, bool missingAllowed = false)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return null;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -821,7 +843,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>Int64 value if success, Int64.MinValue if skipped, null on error/returns>
|
||||
protected long? ProcessInt64Parameter(string[] parts, string? shortFlagString, string longFlagString, ref int i, bool missingAllowed = false)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return null;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -856,10 +878,10 @@ namespace MPF.ExecutionContexts
|
||||
i++;
|
||||
string value = ExtractFactorFromValue(parts[i], out long factor);
|
||||
if (long.TryParse(value, out long longValue))
|
||||
return (long)(longValue * factor);
|
||||
return longValue * factor;
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
if (long.TryParse(hexValue, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out long longHexValue))
|
||||
return (long)(longHexValue * factor);
|
||||
return longHexValue * factor;
|
||||
return null;
|
||||
}
|
||||
else if (parts[i].StartsWith(shortFlagString + "=") || parts[i].StartsWith(longFlagString + "="))
|
||||
@@ -876,10 +898,10 @@ namespace MPF.ExecutionContexts
|
||||
this[longFlagString] = true;
|
||||
string value = ExtractFactorFromValue(valuePart, out long factor);
|
||||
if (long.TryParse(value, out long longValue))
|
||||
return (long)(longValue * factor);
|
||||
return longValue * factor;
|
||||
string hexValue = RemoveHexIdentifier(value);
|
||||
if (long.TryParse(hexValue, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out long longHexValue))
|
||||
return (long)(longHexValue * factor);
|
||||
return longHexValue * factor;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -908,7 +930,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>String value if possible, string.Empty on missing, null on error</returns>
|
||||
protected string? ProcessStringParameter(string[] parts, string? shortFlagString, string longFlagString, ref int i, bool missingAllowed = false)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return null;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -981,7 +1003,7 @@ namespace MPF.ExecutionContexts
|
||||
/// <returns>Byte value if success, Byte.MinValue if skipped, null on error/returns>
|
||||
protected byte? ProcessUInt8Parameter(string[] parts, string? shortFlagString, string longFlagString, ref int i, bool missingAllowed = false)
|
||||
{
|
||||
if (parts == null)
|
||||
if (parts is null)
|
||||
return null;
|
||||
|
||||
if (parts[i] == shortFlagString || parts[i] == longFlagString)
|
||||
@@ -1044,7 +1066,7 @@ namespace MPF.ExecutionContexts
|
||||
return null;
|
||||
}
|
||||
|
||||
return Byte.MinValue;
|
||||
return byte.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == false)
|
||||
if (!Value)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public T? Value { get; protected set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool ValueSet => Value != null;
|
||||
public override bool ValueSet => Value is not null;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : short.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out short? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out short? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : short.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : short.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out short? value) && value != null)
|
||||
if (ParseValue(val, out short? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : short.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -70,7 +70,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
builder.Append(Name);
|
||||
|
||||
// Only output separator and value if needed
|
||||
if (_required || (!_required && Value != null))
|
||||
if (_required || (!_required && Value is not null))
|
||||
{
|
||||
// Separator
|
||||
if (useEquals)
|
||||
@@ -79,7 +79,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
builder.Append(' ');
|
||||
|
||||
// Value
|
||||
int?[] nonNull = Array.FindAll(Value, i => i != null);
|
||||
int?[] nonNull = Array.FindAll(Value, i => i is not null);
|
||||
string[] stringValues = Array.ConvertAll(nonNull, i => i.ToString() ?? string.Empty);
|
||||
builder.Append(string.Join(" ", stringValues));
|
||||
}
|
||||
@@ -106,12 +106,12 @@ namespace MPF.ExecutionContexts.Data
|
||||
return !_required;
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out int? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out int? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value[i] = value;
|
||||
Value[i] = (MinValue != null && Value[i] < MinValue) ? MinValue : Value[i];
|
||||
Value[i] = (MaxValue != null && Value[i] > MaxValue) ? MaxValue : Value[i];
|
||||
Value[i] = (MinValue is not null && Value[i] < MinValue) ? MinValue : Value[i];
|
||||
Value[i] = (MaxValue is not null && Value[i] > MaxValue) ? MaxValue : Value[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : int.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out int? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out int? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : int.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : int.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out int? value) && value != null)
|
||||
if (ParseValue(val, out int? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : int.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : long.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out long? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out long? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : long.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : long.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out long? value) && value != null)
|
||||
if (ParseValue(val, out long? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : long.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
string baseVal = ExtractFactorFromValue(str, out long factor);
|
||||
if (long.TryParse(baseVal, out value))
|
||||
{
|
||||
output = (long)(value * factor);
|
||||
output = value * factor;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
string hexValue = RemoveHexIdentifier(baseVal);
|
||||
if (long.TryParse(hexValue, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out value))
|
||||
{
|
||||
output = (long)(value * factor);
|
||||
output = value * factor;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : sbyte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out sbyte? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out sbyte? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : sbyte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : sbyte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out sbyte? value) && value != null)
|
||||
if (ParseValue(val, out sbyte? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : sbyte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : ushort.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out ushort? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out ushort? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : ushort.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : ushort.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out ushort? value) && value != null)
|
||||
if (ParseValue(val, out ushort? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : ushort.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : uint.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out uint? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out uint? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : uint.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : uint.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out uint? value) && value != null)
|
||||
if (ParseValue(val, out uint? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : uint.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : ulong.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out ulong? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out ulong? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : ulong.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : ulong.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out ulong? value) && value != null)
|
||||
if (ParseValue(val, out ulong? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : ulong.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
string baseVal = ExtractFactorFromValue(str, out long factor);
|
||||
if (ulong.TryParse(baseVal, out value))
|
||||
{
|
||||
output = (ulong)(value * (ulong)factor);
|
||||
output = value * (ulong)factor;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
string hexValue = RemoveHexIdentifier(baseVal);
|
||||
if (ulong.TryParse(hexValue, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out value))
|
||||
{
|
||||
output = (ulong)(value * (ulong)factor);
|
||||
output = value * (ulong)factor;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MPF.ExecutionContexts.Data
|
||||
public override string Format(bool useEquals)
|
||||
{
|
||||
// Do not output if there is no value
|
||||
if (Value == null)
|
||||
if (Value is null)
|
||||
return string.Empty;
|
||||
|
||||
// Build the output format
|
||||
@@ -95,25 +95,25 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (index + 1 >= parts.Length)
|
||||
{
|
||||
Value = _required ? null : byte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(parts[index + 1], out byte? value) && value != null)
|
||||
if (ParseValue(parts[index + 1], out byte? value) && value is not null)
|
||||
{
|
||||
index++;
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : byte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
@@ -129,24 +129,24 @@ namespace MPF.ExecutionContexts.Data
|
||||
if (string.IsNullOrEmpty(val))
|
||||
{
|
||||
Value = _required ? null : byte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
// If the next value is valid
|
||||
if (ParseValue(val, out byte? value) && value != null)
|
||||
if (ParseValue(val, out byte? value) && value is not null)
|
||||
{
|
||||
Value = value;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return value based on required flag
|
||||
Value = _required ? null : byte.MinValue;
|
||||
Value = (MinValue != null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue != null && Value > MaxValue) ? MaxValue : Value;
|
||||
Value = (MinValue is not null && Value < MinValue) ? MinValue : Value;
|
||||
Value = (MaxValue is not null && Value > MaxValue) ? MaxValue : Value;
|
||||
return !_required;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
{
|
||||
public const string NONE = "";
|
||||
public const string Audio = "audio";
|
||||
public const string AuthPS3 = "authps3";
|
||||
public const string BluRay = "bd";
|
||||
public const string Close = "close";
|
||||
public const string CompactDisc = "cd";
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
/// <returns>Valid extension (with leading '.'), null on error</returns>
|
||||
public static string? Extension(MediaType? type)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return type switch
|
||||
{
|
||||
MediaType.CDROM
|
||||
@@ -93,6 +94,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
MediaType.Cassette => ".wav",
|
||||
_ => null,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -208,6 +208,8 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
FlagStrings.Tages,
|
||||
],
|
||||
|
||||
[CommandStrings.AuthPS3] = [],
|
||||
|
||||
[CommandStrings.BluRay] =
|
||||
[
|
||||
FlagStrings.DatExpand,
|
||||
@@ -418,6 +420,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// Drive Letter
|
||||
if (BaseCommand == CommandStrings.Audio
|
||||
|| BaseCommand == CommandStrings.AuthPS3
|
||||
|| BaseCommand == CommandStrings.BluRay
|
||||
|| BaseCommand == CommandStrings.Close
|
||||
|| BaseCommand == CommandStrings.CompactDisc
|
||||
@@ -438,7 +441,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|| BaseCommand == CommandStrings.XGD2Swap
|
||||
|| BaseCommand == CommandStrings.XGD3Swap)
|
||||
{
|
||||
if (DrivePath != null)
|
||||
if (DrivePath is not null)
|
||||
{
|
||||
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
|
||||
if (DrivePath.Contains(' '))
|
||||
@@ -475,7 +478,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|| BaseCommand == CommandStrings.XGD2Swap
|
||||
|| BaseCommand == CommandStrings.XGD3Swap)
|
||||
{
|
||||
if (Filename != null)
|
||||
if (Filename is not null)
|
||||
parameters.Append($"\"{Filename.Trim('"')}\" ");
|
||||
else
|
||||
return null;
|
||||
@@ -484,7 +487,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
// Optiarc Filename
|
||||
if (BaseCommand == CommandStrings.Merge)
|
||||
{
|
||||
if (OptiarcFilename != null)
|
||||
if (OptiarcFilename is not null)
|
||||
parameters.Append($"\"{OptiarcFilename.Trim('"')}\" ");
|
||||
else
|
||||
return null;
|
||||
@@ -504,7 +507,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|| BaseCommand == CommandStrings.XGD2Swap
|
||||
|| BaseCommand == CommandStrings.XGD3Swap)
|
||||
{
|
||||
if (DriveSpeed != null)
|
||||
if (DriveSpeed is not null)
|
||||
parameters.Append($"{DriveSpeed} ");
|
||||
else
|
||||
return null;
|
||||
@@ -514,7 +517,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (BaseCommand == CommandStrings.Audio
|
||||
|| BaseCommand == CommandStrings.Data)
|
||||
{
|
||||
if (StartLBAValue != null && EndLBAValue != null)
|
||||
if (StartLBAValue is not null && EndLBAValue is not null)
|
||||
{
|
||||
parameters.Append($"{StartLBAValue} ");
|
||||
parameters.Append($"{EndLBAValue} ");
|
||||
@@ -529,7 +532,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.AddOffset] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.AddOffset} ");
|
||||
if (AddOffsetValue != null)
|
||||
if (AddOffsetValue is not null)
|
||||
parameters.Append($"{AddOffsetValue} ");
|
||||
}
|
||||
}
|
||||
@@ -554,7 +557,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.BEOpcode] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.BEOpcode} ");
|
||||
if (BEOpcodeValue != null)
|
||||
if (BEOpcodeValue is not null)
|
||||
parameters.Append($"{BEOpcodeValue} ");
|
||||
}
|
||||
}
|
||||
@@ -565,22 +568,25 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.C2Opcode] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.C2Opcode} ");
|
||||
if (C2OpcodeValue[0] != null)
|
||||
if (C2OpcodeValue[0] is not null)
|
||||
{
|
||||
if (C2OpcodeValue[0] > 0)
|
||||
parameters.Append($"{C2OpcodeValue[0]} ");
|
||||
else
|
||||
return null;
|
||||
}
|
||||
if (C2OpcodeValue[1] != null)
|
||||
|
||||
if (C2OpcodeValue[1] is not null)
|
||||
{
|
||||
parameters.Append($"{C2OpcodeValue[1]} ");
|
||||
}
|
||||
if (C2OpcodeValue[2] != null)
|
||||
|
||||
if (C2OpcodeValue[2] is not null)
|
||||
{
|
||||
parameters.Append($"{C2OpcodeValue[2]} ");
|
||||
}
|
||||
if (C2OpcodeValue[3] != null)
|
||||
|
||||
if (C2OpcodeValue[3] is not null)
|
||||
{
|
||||
if (C2OpcodeValue[3] == 0)
|
||||
{
|
||||
@@ -589,7 +595,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
else if (C2OpcodeValue[3] == 1)
|
||||
{
|
||||
parameters.Append($"{C2OpcodeValue[3]} ");
|
||||
if (C2OpcodeValue[4] != null && C2OpcodeValue[5] != null)
|
||||
if (C2OpcodeValue[4] is not null && C2OpcodeValue[5] is not null)
|
||||
{
|
||||
if (C2OpcodeValue[4] > 0 && C2OpcodeValue[5] > 0)
|
||||
{
|
||||
@@ -616,7 +622,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.C2OpcodeNew] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.C2OpcodeNew} ");
|
||||
if (C2OpcodeValue[0] != null)
|
||||
if (C2OpcodeValue[0] is not null)
|
||||
{
|
||||
if (C2OpcodeValue[0] > 0)
|
||||
parameters.Append($"{C2OpcodeValue[0]} ");
|
||||
@@ -660,7 +666,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.DVDReread] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.DVDReread} ");
|
||||
if (DVDRereadValue != null)
|
||||
if (DVDRereadValue is not null)
|
||||
parameters.Append($"{DVDRereadValue} ");
|
||||
}
|
||||
}
|
||||
@@ -678,7 +684,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.Fix] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.Fix} ");
|
||||
if (FixValue != null)
|
||||
if (FixValue is not null)
|
||||
parameters.Append($"{FixValue} ");
|
||||
else
|
||||
return null;
|
||||
@@ -691,7 +697,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.ForceDescrambleSector] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.ForceDescrambleSector} ");
|
||||
if (ForceDescrambleSectorValue != null)
|
||||
if (ForceDescrambleSectorValue is not null)
|
||||
parameters.Append($"{ForceDescrambleSectorValue} ");
|
||||
else
|
||||
return null;
|
||||
@@ -704,7 +710,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.ForceUnitAccess] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.ForceUnitAccess} ");
|
||||
if (ForceUnitAccessValue != null)
|
||||
if (ForceUnitAccessValue is not null)
|
||||
parameters.Append($"{ForceUnitAccessValue} ");
|
||||
}
|
||||
}
|
||||
@@ -722,7 +728,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.MultiSectorRead] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.MultiSectorRead} ");
|
||||
if (MultiSectorReadValue != null)
|
||||
if (MultiSectorReadValue is not null)
|
||||
parameters.Append($"{MultiSectorReadValue} ");
|
||||
}
|
||||
}
|
||||
@@ -768,7 +774,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.NoSkipSS] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.NoSkipSS} ");
|
||||
if (NoSkipSecuritySectorValue != null)
|
||||
if (NoSkipSecuritySectorValue is not null)
|
||||
parameters.Append($"{NoSkipSecuritySectorValue} ");
|
||||
}
|
||||
}
|
||||
@@ -779,7 +785,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.PadSector] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.PadSector} ");
|
||||
if (PadSectorValue != null)
|
||||
if (PadSectorValue is not null)
|
||||
parameters.Append($"{PadSectorValue} ");
|
||||
}
|
||||
}
|
||||
@@ -793,7 +799,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
if (BaseCommand == CommandStrings.DigitalVideoDisc)
|
||||
{
|
||||
if (RangeStartLBAValue == null || RangeEndLBAValue == null)
|
||||
if (RangeStartLBAValue is null || RangeEndLBAValue is null)
|
||||
return null;
|
||||
|
||||
parameters.Append($"{RangeStartLBAValue} ");
|
||||
@@ -825,7 +831,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
if (BaseCommand == CommandStrings.DigitalVideoDisc)
|
||||
{
|
||||
if (ReverseStartLBAValue == null || ReverseEndLBAValue == null)
|
||||
if (ReverseStartLBAValue is null || ReverseEndLBAValue is null)
|
||||
return null;
|
||||
|
||||
parameters.Append($"{ReverseStartLBAValue} ");
|
||||
@@ -847,7 +853,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.ScanFileProtect] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.ScanFileProtect} ");
|
||||
if (ScanFileProtectValue != null)
|
||||
if (ScanFileProtectValue is not null)
|
||||
{
|
||||
if (ScanFileProtectValue > 0)
|
||||
parameters.Append($"{ScanFileProtectValue} ");
|
||||
@@ -877,14 +883,15 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.SkipSector] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.SkipSector} ");
|
||||
if (SkipSectorValue[0] != null)
|
||||
if (SkipSectorValue[0] is not null)
|
||||
{
|
||||
if (SkipSectorValue[0] > 0)
|
||||
parameters.Append($"{SkipSectorValue[0]} ");
|
||||
else
|
||||
return null;
|
||||
}
|
||||
if (SkipSectorValue[1] != null)
|
||||
|
||||
if (SkipSectorValue[1] is not null)
|
||||
{
|
||||
if (SkipSectorValue[1] == 0)
|
||||
parameters.Append($"{SkipSectorValue[1]} ");
|
||||
@@ -898,7 +905,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.SubchannelReadLevel] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.SubchannelReadLevel} ");
|
||||
if (SubchannelReadLevelValue != null)
|
||||
if (SubchannelReadLevelValue is not null)
|
||||
{
|
||||
if (SubchannelReadLevelValue >= 0 && SubchannelReadLevelValue <= 2)
|
||||
parameters.Append($"{SubchannelReadLevelValue} ");
|
||||
@@ -942,7 +949,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
if (this[FlagStrings.VideoNow] == true)
|
||||
{
|
||||
parameters.Append($"{FlagStrings.VideoNow} ");
|
||||
if (VideoNowValue != null)
|
||||
if (VideoNowValue is not null)
|
||||
{
|
||||
if (VideoNowValue >= 0)
|
||||
parameters.Append($"{VideoNowValue} ");
|
||||
@@ -1067,6 +1074,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
};
|
||||
|
||||
// Now sort based on disc type
|
||||
#pragma warning disable IDE0010
|
||||
switch (MediaType)
|
||||
{
|
||||
case SabreTools.RedumpLib.Data.MediaType.CDROM:
|
||||
@@ -1102,6 +1110,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
this[FlagStrings.NoFixSubQLibCrypt] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case SabreTools.RedumpLib.Data.MediaType.DVD:
|
||||
this[FlagStrings.CopyrightManagementInformation] = GetBooleanSetting(options, SettingConstants.UseCMIFlag, SettingConstants.UseCMIFlagDefault);
|
||||
@@ -1135,6 +1144,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
// Currently no defaults set
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -1186,6 +1196,14 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
index = 6;
|
||||
break;
|
||||
|
||||
case CommandStrings.AuthPS3:
|
||||
if (parts.Length != 2)
|
||||
return false;
|
||||
|
||||
// Blindly assume the path exists
|
||||
DrivePath = parts[1];
|
||||
break;
|
||||
|
||||
case CommandStrings.BluRay:
|
||||
if (parts.Length < 4)
|
||||
return false;
|
||||
@@ -1532,7 +1550,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// Add Offset
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.AddOffset, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue)
|
||||
if (intValue is not null && intValue != int.MinValue)
|
||||
AddOffsetValue = intValue;
|
||||
|
||||
// AMSF
|
||||
@@ -1610,7 +1628,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// DVD/HD-DVD/BD Reread
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.DVDReread, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue)
|
||||
if (intValue is not null && intValue != int.MinValue)
|
||||
DVDRereadValue = intValue;
|
||||
|
||||
// Extract MS-CAB
|
||||
@@ -1618,7 +1636,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// Fix
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.Fix, ref i);
|
||||
if (intValue != null && intValue != int.MinValue)
|
||||
if (intValue is not null && intValue != int.MinValue)
|
||||
FixValue = intValue;
|
||||
|
||||
// Force Descramble Sector
|
||||
@@ -1680,7 +1698,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// Force Unit Access
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.ForceUnitAccess, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue && intValue >= 0)
|
||||
if (intValue is not null && intValue != int.MinValue && intValue >= 0)
|
||||
ForceUnitAccessValue = intValue;
|
||||
|
||||
// Full TOC
|
||||
@@ -1688,7 +1706,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// Multi-Sector Read
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.MultiSectorRead, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue && intValue >= 0)
|
||||
if (intValue is not null && intValue != int.MinValue && intValue >= 0)
|
||||
MultiSectorReadValue = intValue;
|
||||
|
||||
// NoFixSubP
|
||||
@@ -1708,12 +1726,12 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// NoSkipSS
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.NoSkipSS, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue && intValue >= 0)
|
||||
if (intValue is not null && intValue != int.MinValue && intValue >= 0)
|
||||
NoSkipSecuritySectorValue = intValue;
|
||||
|
||||
// PadSector
|
||||
byteValue = ProcessUInt8Parameter(parts, FlagStrings.PadSector, ref i, missingAllowed: true);
|
||||
if (byteValue != null)
|
||||
if (byteValue is not null)
|
||||
PadSectorValue = byteValue;
|
||||
|
||||
// Range
|
||||
@@ -1765,7 +1783,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// ScanFileProtect
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.ScanFileProtect, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue && intValue >= 0)
|
||||
if (intValue is not null && intValue != int.MinValue && intValue >= 0)
|
||||
ScanFileProtectValue = intValue;
|
||||
|
||||
// ScanSectorProtect
|
||||
@@ -1806,7 +1824,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// SubchannelReadLevel
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.SubchannelReadLevel, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue && intValue >= 0 && intValue <= 2)
|
||||
if (intValue is not null && intValue != int.MinValue && intValue >= 0 && intValue <= 2)
|
||||
SubchannelReadLevelValue = intValue;
|
||||
|
||||
// Tages
|
||||
@@ -1823,7 +1841,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
|
||||
// VideoNow
|
||||
intValue = ProcessInt32Parameter(parts, FlagStrings.VideoNow, ref i, missingAllowed: true);
|
||||
if (intValue != null && intValue != int.MinValue && intValue >= 0)
|
||||
if (intValue is not null && intValue != int.MinValue && intValue >= 0)
|
||||
VideoNowValue = intValue;
|
||||
|
||||
// VideoNowColor
|
||||
@@ -1855,6 +1873,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0010
|
||||
switch (type)
|
||||
{
|
||||
case SabreTools.RedumpLib.Data.MediaType.CDROM:
|
||||
@@ -1870,6 +1889,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
BaseCommand = CommandStrings.XBOX;
|
||||
return;
|
||||
}
|
||||
|
||||
BaseCommand = CommandStrings.DigitalVideoDisc;
|
||||
return;
|
||||
case SabreTools.RedumpLib.Data.MediaType.GDROM:
|
||||
@@ -1904,6 +1924,7 @@ namespace MPF.ExecutionContexts.DiscImageCreator
|
||||
BaseCommand = null;
|
||||
return;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
10
MPF.ExecutionContexts/Dreamdump/CommandStrings.cs
Normal file
10
MPF.ExecutionContexts/Dreamdump/CommandStrings.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Top-level commands for Dreamdump
|
||||
/// </summary>
|
||||
public static class CommandStrings
|
||||
{
|
||||
public const string NONE = "";
|
||||
}
|
||||
}
|
||||
15
MPF.ExecutionContexts/Dreamdump/Enumerations.cs
Normal file
15
MPF.ExecutionContexts/Dreamdump/Enumerations.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Drive sector order option
|
||||
/// </summary>
|
||||
public enum SectorOrder
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
DATA_C2,
|
||||
DATA_SUB,
|
||||
DATA_C2_SUB,
|
||||
DATA_SUB_C2,
|
||||
}
|
||||
}
|
||||
257
MPF.ExecutionContexts/Dreamdump/ExecutionContext.cs
Normal file
257
MPF.ExecutionContexts/Dreamdump/ExecutionContext.cs
Normal file
@@ -0,0 +1,257 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using MPF.ExecutionContexts.Data;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic set of Dreamdump parameters
|
||||
/// </summary>
|
||||
public sealed class ExecutionContext : BaseExecutionContext
|
||||
{
|
||||
#region Generic Dumping Information
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? InputPath
|
||||
=> (_inputs[FlagStrings.Drive] as StringInput)?.Value?.Trim('"');
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? OutputPath => Path.Combine(
|
||||
(_inputs[FlagStrings.ImagePath] as StringInput)?.Value?.Trim('"') ?? string.Empty,
|
||||
(_inputs[FlagStrings.ImageName] as StringInput)?.Value?.Trim('"') ?? string.Empty)
|
||||
+ GetDefaultExtension(MediaType);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int? Speed
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_inputs[FlagStrings.Speed] as Int32Input)?.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value is not null && value > 0)
|
||||
{
|
||||
this[FlagStrings.Speed] = true;
|
||||
(_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this[FlagStrings.Speed] = false;
|
||||
(_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Flag Values
|
||||
|
||||
/// <summary>
|
||||
/// Set of all command flags
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, Input> _inputs = new()
|
||||
{
|
||||
// Special
|
||||
[FlagStrings.ForceQTOC] = new FlagInput(FlagStrings.ForceQTOC),
|
||||
[FlagStrings.Train] = new FlagInput(FlagStrings.Train),
|
||||
[FlagStrings.Retries] = new UInt8Input(FlagStrings.Retries),
|
||||
|
||||
// Paths
|
||||
[FlagStrings.ImageName] = new StringInput(FlagStrings.ImageName) { Quotes = true },
|
||||
[FlagStrings.ImagePath] = new StringInput(FlagStrings.ImagePath) { Quotes = true },
|
||||
|
||||
// Drive Part
|
||||
[FlagStrings.ReadOffset] = new Int16Input(FlagStrings.ReadOffset),
|
||||
[FlagStrings.ReadAtOnce] = new UInt8Input(FlagStrings.ReadAtOnce),
|
||||
[FlagStrings.Speed] = new UInt16Input(FlagStrings.Speed),
|
||||
[FlagStrings.SectorOrder] = new StringInput(FlagStrings.SectorOrder),
|
||||
[FlagStrings.Drive] = new StringInput(FlagStrings.Drive),
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ExecutionContext(string? parameters) : base(parameters) { }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ExecutionContext(RedumpSystem? system,
|
||||
MediaType? type,
|
||||
string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
: base(system, type, drivePath, filename, driveSpeed, options)
|
||||
{
|
||||
}
|
||||
|
||||
#region BaseExecutionContext Implementations
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <remarks>Command support is irrelevant for Dreamdump</remarks>
|
||||
public override Dictionary<string, List<string>> GetCommandSupport()
|
||||
{
|
||||
return new Dictionary<string, List<string>>()
|
||||
{
|
||||
[CommandStrings.NONE] =
|
||||
[
|
||||
// Special
|
||||
FlagStrings.ForceQTOC,
|
||||
FlagStrings.Train,
|
||||
FlagStrings.Retries,
|
||||
|
||||
// Paths
|
||||
FlagStrings.ImageName,
|
||||
FlagStrings.ImagePath,
|
||||
|
||||
// Drive Part
|
||||
FlagStrings.ReadOffset,
|
||||
FlagStrings.ReadAtOnce,
|
||||
FlagStrings.Speed,
|
||||
FlagStrings.SectorOrder,
|
||||
FlagStrings.Drive,
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string GenerateParameters()
|
||||
{
|
||||
var parameters = new StringBuilder();
|
||||
|
||||
// Loop though and append all existing
|
||||
foreach (var kvp in _inputs)
|
||||
{
|
||||
// If the value doesn't exist
|
||||
string formatted = kvp.Value.Format(useEquals: true);
|
||||
if (formatted.Length == 0)
|
||||
continue;
|
||||
|
||||
// Append the parameter
|
||||
parameters.Append($"{formatted} ");
|
||||
}
|
||||
|
||||
return parameters.ToString().TrimEnd();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? GetDefaultExtension(MediaType? mediaType) => ".bin";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override MediaType? GetMediaType() => SabreTools.RedumpLib.Data.MediaType.GDROM;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool IsDumpingCommand() => true;
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void ResetValues()
|
||||
{
|
||||
BaseCommand = CommandStrings.NONE;
|
||||
|
||||
flags = [];
|
||||
|
||||
foreach (var kvp in _inputs)
|
||||
kvp.Value.ClearValue();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetDefaultParameters(string? drivePath,
|
||||
string filename,
|
||||
int? driveSpeed,
|
||||
Dictionary<string, string?> options)
|
||||
{
|
||||
BaseCommand = CommandStrings.NONE;
|
||||
|
||||
if (drivePath is not null)
|
||||
{
|
||||
this[FlagStrings.Drive] = true;
|
||||
(_inputs[FlagStrings.Drive] as StringInput)?.SetValue(drivePath);
|
||||
}
|
||||
|
||||
if (driveSpeed is not null && driveSpeed > 0)
|
||||
{
|
||||
this[FlagStrings.Speed] = true;
|
||||
(_inputs[FlagStrings.Speed] as UInt16Input)?.SetValue((ushort)driveSpeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
this[FlagStrings.Speed] = false;
|
||||
(_inputs[FlagStrings.Speed] as UInt16Input)?.SetValue(null);
|
||||
}
|
||||
|
||||
// Set user-defined options
|
||||
string? sectorOrder = GetStringSetting(options, SettingConstants.SectorOrder, SettingConstants.SectorOrderDefault);
|
||||
if (!string.IsNullOrEmpty(sectorOrder) && sectorOrder != SectorOrder.NONE.ToString())
|
||||
{
|
||||
this[FlagStrings.SectorOrder] = true;
|
||||
(_inputs[FlagStrings.SectorOrder] as StringInput)?.SetValue(sectorOrder!);
|
||||
}
|
||||
|
||||
// Set the output paths
|
||||
if (!string.IsNullOrEmpty(filename))
|
||||
{
|
||||
var imagePath = Path.GetDirectoryName(filename);
|
||||
if (!string.IsNullOrEmpty(imagePath))
|
||||
{
|
||||
this[FlagStrings.ImagePath] = true;
|
||||
(_inputs[FlagStrings.ImagePath] as StringInput)?.SetValue(imagePath!);
|
||||
}
|
||||
|
||||
string imageName = Path.GetFileNameWithoutExtension(filename);
|
||||
if (!string.IsNullOrEmpty(imageName))
|
||||
{
|
||||
this[FlagStrings.ImageName] = true;
|
||||
(_inputs[FlagStrings.ImageName] as StringInput)?.SetValue(imageName!);
|
||||
}
|
||||
}
|
||||
|
||||
byte retries = GetUInt8Setting(options, SettingConstants.RereadCount, SettingConstants.RereadCountDefault);
|
||||
if (retries > 0)
|
||||
{
|
||||
this[FlagStrings.Retries] = true;
|
||||
(_inputs[FlagStrings.Retries] as UInt8Input)?.SetValue(retries);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override bool ValidateAndSetParameters(string? parameters)
|
||||
{
|
||||
// The string has to be valid by itself first
|
||||
if (string.IsNullOrEmpty(parameters))
|
||||
return false;
|
||||
|
||||
// Now split the string into parts for easier validation
|
||||
string[] parts = SplitParameterString(parameters!);
|
||||
|
||||
// Setup the modes
|
||||
BaseCommand = null;
|
||||
|
||||
// Loop through all auxiliary flags, if necessary
|
||||
int index = 0;
|
||||
for (int i = index; i < parts.Length; i++)
|
||||
{
|
||||
// Match all possible flags
|
||||
foreach (var kvp in _inputs)
|
||||
{
|
||||
// If the value was not a match
|
||||
if (!kvp.Value.Process(parts, ref i))
|
||||
continue;
|
||||
|
||||
// Set the flag
|
||||
this[kvp.Key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If the image name was not set, set it with a default value
|
||||
if (string.IsNullOrEmpty((_inputs[FlagStrings.ImageName] as StringInput)?.Value))
|
||||
(_inputs[FlagStrings.ImageName] as StringInput)?.SetValue($"track_{DateTime.Now:yyyyMMdd-HHmm}");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
33
MPF.ExecutionContexts/Dreamdump/FlagStrings.cs
Normal file
33
MPF.ExecutionContexts/Dreamdump/FlagStrings.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
/// <summary>
|
||||
/// Dumping flags for Dreamdump
|
||||
/// </summary>
|
||||
public static class FlagStrings
|
||||
{
|
||||
#region Special
|
||||
|
||||
public const string ForceQTOC = "--force-qtoc";
|
||||
public const string Train = "--train";
|
||||
public const string Retries = "--retries";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paths
|
||||
|
||||
public const string ImageName = "--image-name";
|
||||
public const string ImagePath = "--image-path";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Drive Part
|
||||
|
||||
public const string ReadOffset = "--read-offset";
|
||||
public const string ReadAtOnce = "--read-at-once"; // [0,40] (Linux), [0,20] (Windows)
|
||||
public const string Speed = "--speed";
|
||||
public const string SectorOrder = "--sector-order";
|
||||
public const string Drive = "--drive";
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
MPF.ExecutionContexts/Dreamdump/SettingConstants.cs
Normal file
11
MPF.ExecutionContexts/Dreamdump/SettingConstants.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MPF.ExecutionContexts.Dreamdump
|
||||
{
|
||||
public static class SettingConstants
|
||||
{
|
||||
public const string RereadCount = "DreamdumpRereadCount";
|
||||
public const int RereadCountDefault = 20;
|
||||
|
||||
public const string SectorOrder = "DreamdumpSectorOrder";
|
||||
public static readonly string SectorOrderDefault = Dreamdump.SectorOrder.NONE.ToString();
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -13,6 +13,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
/// <returns>Valid extension (with leading '.'), null on error</returns>
|
||||
public static string? Extension(MediaType? type)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return type switch
|
||||
{
|
||||
MediaType.CDROM
|
||||
@@ -25,6 +26,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
MediaType.NintendoWiiUOpticalDisc => ".wud",
|
||||
_ => null,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
|
||||
GENERIC,
|
||||
PLEXTOR,
|
||||
LG_ASU8A,
|
||||
LG_ASU8B,
|
||||
LG_ASU8C,
|
||||
LG_ASU3,
|
||||
LG_ASU2,
|
||||
MTK8A,
|
||||
MTK8B,
|
||||
MTK8C,
|
||||
MTK3,
|
||||
MTK2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != null && value > 0)
|
||||
if (value is not null && value > 0)
|
||||
{
|
||||
this[FlagStrings.Speed] = true;
|
||||
(_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(value);
|
||||
@@ -84,8 +84,8 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
[FlagStrings.PlextorLeadinRetries] = new Int32Input(FlagStrings.PlextorLeadinRetries),
|
||||
[FlagStrings.PlextorLeadinForceStore] = new FlagInput(FlagStrings.PlextorLeadinForceStore),
|
||||
[FlagStrings.KreonPartialSS] = new FlagInput(FlagStrings.KreonPartialSS),
|
||||
[FlagStrings.AsusSkipLeadout] = new FlagInput(FlagStrings.AsusSkipLeadout),
|
||||
[FlagStrings.AsusLeadoutRetries] = new Int32Input(FlagStrings.AsusLeadoutRetries),
|
||||
[FlagStrings.MediatekSkipLeadout] = new FlagInput(FlagStrings.MediatekSkipLeadout),
|
||||
[FlagStrings.MediatekLeadoutRetries] = new Int32Input(FlagStrings.MediatekLeadoutRetries),
|
||||
[FlagStrings.DisableCDText] = new FlagInput(FlagStrings.DisableCDText),
|
||||
|
||||
// Offset
|
||||
@@ -99,7 +99,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
[FlagStrings.LeaveUnchanged] = new FlagInput(FlagStrings.LeaveUnchanged),
|
||||
[FlagStrings.ForceQTOC] = new FlagInput(FlagStrings.ForceQTOC),
|
||||
[FlagStrings.SkipFill] = new UInt8Input(FlagStrings.SkipFill),
|
||||
[FlagStrings.ISO9660Trim] = new FlagInput(FlagStrings.ISO9660Trim),
|
||||
[FlagStrings.FilesystemTrim] = new FlagInput(FlagStrings.FilesystemTrim),
|
||||
|
||||
// Drive Test
|
||||
[FlagStrings.DriveTestSkipPlextorLeadin] = new FlagInput(FlagStrings.DriveTestSkipPlextorLeadin),
|
||||
@@ -109,6 +109,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
[FlagStrings.Continue] = new StringInput(FlagStrings.Continue),
|
||||
[FlagStrings.LBAStart] = new Int32Input(FlagStrings.LBAStart),
|
||||
[FlagStrings.LBAEnd] = new Int32Input(FlagStrings.LBAEnd),
|
||||
[FlagStrings.LBAEndBySubcode] = new Int32Input(FlagStrings.LBAEndBySubcode),
|
||||
[FlagStrings.RefineSubchannel] = new FlagInput(FlagStrings.RefineSubchannel),
|
||||
[FlagStrings.RefineSectorMode] = new FlagInput(FlagStrings.RefineSectorMode),
|
||||
[FlagStrings.Skip] = new StringInput(FlagStrings.Skip),
|
||||
@@ -118,9 +119,10 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
[FlagStrings.ForceUnscrambled] = new FlagInput(FlagStrings.ForceUnscrambled),
|
||||
[FlagStrings.ForceRefine] = new FlagInput(FlagStrings.ForceRefine),
|
||||
//[FlagStrings.Firmware] = new StringInput(FlagStrings.Firmware) { Quotes = true },
|
||||
[FlagStrings.ForceFlash] = new FlagInput(FlagStrings.ForceFlash),
|
||||
[FlagStrings.SkipSubcodeDesync] = new FlagInput(FlagStrings.SkipSubcodeDesync),
|
||||
[FlagStrings.Rings] = new FlagInput(FlagStrings.Rings),
|
||||
[FlagStrings.CdrErrorThreshold] = new Int32Input(FlagStrings.CdrErrorThreshold),
|
||||
[FlagStrings.ScsiTimeout] = new Int32Input(FlagStrings.ScsiTimeout),
|
||||
|
||||
// Undocumented
|
||||
[FlagStrings.Debug] = new FlagInput(FlagStrings.Debug),
|
||||
@@ -183,8 +185,8 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
FlagStrings.PlextorLeadinRetries,
|
||||
FlagStrings.PlextorLeadinForceStore,
|
||||
FlagStrings.KreonPartialSS,
|
||||
FlagStrings.AsusSkipLeadout,
|
||||
FlagStrings.AsusLeadoutRetries,
|
||||
FlagStrings.MediatekSkipLeadout,
|
||||
FlagStrings.MediatekLeadoutRetries,
|
||||
FlagStrings.DisableCDText,
|
||||
|
||||
// Offset
|
||||
@@ -198,7 +200,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
FlagStrings.LeaveUnchanged,
|
||||
FlagStrings.ForceQTOC,
|
||||
FlagStrings.SkipFill,
|
||||
FlagStrings.ISO9660Trim,
|
||||
FlagStrings.FilesystemTrim,
|
||||
|
||||
// Drive Test
|
||||
FlagStrings.DriveTestSkipPlextorLeadin,
|
||||
@@ -208,6 +210,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
FlagStrings.Continue,
|
||||
FlagStrings.LBAStart,
|
||||
FlagStrings.LBAEnd,
|
||||
FlagStrings.LBAEndBySubcode,
|
||||
FlagStrings.RefineSubchannel,
|
||||
FlagStrings.RefineSectorMode,
|
||||
FlagStrings.Skip,
|
||||
@@ -217,9 +220,10 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
FlagStrings.ForceUnscrambled,
|
||||
FlagStrings.ForceRefine,
|
||||
//FlagStrings.Firmware,
|
||||
FlagStrings.ForceFlash,
|
||||
FlagStrings.SkipSubcodeDesync,
|
||||
FlagStrings.Rings,
|
||||
FlagStrings.CdrErrorThreshold,
|
||||
FlagStrings.ScsiTimeout,
|
||||
|
||||
// Undocumented
|
||||
FlagStrings.Debug,
|
||||
@@ -291,13 +295,13 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
{
|
||||
BaseCommand = CommandStrings.Disc;
|
||||
|
||||
if (drivePath != null)
|
||||
if (drivePath is not null)
|
||||
{
|
||||
this[FlagStrings.Drive] = true;
|
||||
(_inputs[FlagStrings.Drive] as StringInput)?.SetValue(drivePath);
|
||||
}
|
||||
|
||||
if (driveSpeed != null && driveSpeed > 0)
|
||||
if (driveSpeed is not null && driveSpeed > 0)
|
||||
{
|
||||
this[FlagStrings.Speed] = true;
|
||||
(_inputs[FlagStrings.Speed] as Int32Input)?.SetValue(driveSpeed);
|
||||
@@ -314,8 +318,10 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
this[FlagStrings.Verbose] = true;
|
||||
(_inputs[FlagStrings.Verbose] as FlagInput)?.SetValue(true);
|
||||
}
|
||||
|
||||
if (GetBooleanSetting(options, SettingConstants.EnableSkeleton, SettingConstants.EnableSkeletonDefault))
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
switch (RedumpSystem)
|
||||
{
|
||||
// Systems known to have significant data outside the ISO9660 filesystem
|
||||
@@ -337,11 +343,12 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
{
|
||||
case SabreTools.RedumpLib.Data.MediaType.CDROM:
|
||||
case SabreTools.RedumpLib.Data.MediaType.DVD:
|
||||
{
|
||||
this[FlagStrings.Skeleton] = true;
|
||||
(_inputs[FlagStrings.Skeleton] as FlagInput)?.SetValue(true);
|
||||
}
|
||||
break;
|
||||
{
|
||||
this[FlagStrings.Skeleton] = true;
|
||||
(_inputs[FlagStrings.Skeleton] as FlagInput)?.SetValue(true);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// If the type is unknown, also enable
|
||||
case null:
|
||||
@@ -352,8 +359,10 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
string? readMethod = GetStringSetting(options, SettingConstants.ReadMethod, SettingConstants.ReadMethodDefault);
|
||||
@@ -469,7 +478,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
case CommandStrings.DebugFlip:
|
||||
case CommandStrings.DriveTest:
|
||||
// Only allow one mode per command
|
||||
if (BaseCommand != null)
|
||||
if (BaseCommand is not null)
|
||||
continue;
|
||||
|
||||
BaseCommand = part;
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public const string PlextorLeadinRetries = "--plextor-leadin-retries";
|
||||
public const string PlextorLeadinForceStore = "--plextor-leadin-force-store";
|
||||
public const string KreonPartialSS = "--kreon-partial-ss";
|
||||
public const string AsusSkipLeadout = "--asus-skip-leadout";
|
||||
public const string AsusLeadoutRetries = "--asus-leadout-retries";
|
||||
public const string MediatekSkipLeadout = "--mediatek-skip-leadout";
|
||||
public const string MediatekLeadoutRetries = "--mediatek-leadout-retries";
|
||||
public const string DisableCDText = "--disable-cdtext";
|
||||
|
||||
#endregion
|
||||
@@ -63,7 +63,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public const string LeaveUnchanged = "--leave-unchanged";
|
||||
public const string ForceQTOC = "--force-qtoc";
|
||||
public const string SkipFill = "--skip-fill";
|
||||
public const string ISO9660Trim = "--iso9660-trim";
|
||||
public const string FilesystemTrim = "--filesystem-trim";
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public const string Continue = "--continue";
|
||||
public const string LBAStart = "--lba-start";
|
||||
public const string LBAEnd = "--lba-end";
|
||||
public const string LBAEndBySubcode = "--lba-end-by-subcode";
|
||||
public const string RefineSubchannel = "--refine-subchannel";
|
||||
public const string RefineSectorMode = "--refine-sector-mode";
|
||||
public const string Skip = "--skip";
|
||||
@@ -88,9 +89,10 @@ namespace MPF.ExecutionContexts.Redumper
|
||||
public const string ForceUnscrambled = "--force-unscrambled";
|
||||
public const string ForceRefine = "--force-refine";
|
||||
public const string Firmware = "--firmware";
|
||||
public const string ForceFlash = "--force-flash";
|
||||
public const string SkipSubcodeDesync = "--skip-subcode-desync";
|
||||
public const string Rings = "--rings";
|
||||
public const string CdrErrorThreshold = "--cdr-error-threshold";
|
||||
public const string ScsiTimeout = "--scsi-timeout";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace MPF.Frontend.Test
|
||||
string? actual = lang.LongName();
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
if (lang != null)
|
||||
if (lang is not null)
|
||||
{
|
||||
actual = EnumExtensions.GetLongName(lang);
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -46,6 +46,7 @@ namespace MPF.Frontend.Test
|
||||
[InlineData(InternalProgram.NONE, "Unknown")]
|
||||
[InlineData(InternalProgram.Aaru, "Aaru")]
|
||||
[InlineData(InternalProgram.DiscImageCreator, "DiscImageCreator")]
|
||||
// [InlineData(InternalProgram.Dreamdump, "Dreamdump")]
|
||||
[InlineData(InternalProgram.Redumper, "Redumper")]
|
||||
[InlineData(InternalProgram.CleanRip, "CleanRip")]
|
||||
[InlineData(InternalProgram.PS3CFW, "PS3 CFW")]
|
||||
@@ -56,7 +57,7 @@ namespace MPF.Frontend.Test
|
||||
string? actual = prog.LongName();
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
if (prog != null)
|
||||
if (prog is not null)
|
||||
{
|
||||
actual = EnumExtensions.GetLongName(prog);
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -73,7 +74,7 @@ namespace MPF.Frontend.Test
|
||||
string? actual = comp.LongName();
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
if (comp != null)
|
||||
if (comp is not null)
|
||||
{
|
||||
actual = EnumExtensions.GetLongName(comp);
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -90,7 +91,7 @@ namespace MPF.Frontend.Test
|
||||
string? actual = method.LongName();
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
if (method != null)
|
||||
if (method is not null)
|
||||
{
|
||||
actual = EnumExtensions.GetLongName(method);
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -109,7 +110,7 @@ namespace MPF.Frontend.Test
|
||||
string? actual = order.LongName();
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
if (order != null)
|
||||
if (order is not null)
|
||||
{
|
||||
actual = EnumExtensions.GetLongName(order);
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -121,17 +122,17 @@ namespace MPF.Frontend.Test
|
||||
[InlineData(RedumperDriveType.NONE, "Default")]
|
||||
[InlineData(RedumperDriveType.GENERIC, "GENERIC")]
|
||||
[InlineData(RedumperDriveType.PLEXTOR, "PLEXTOR")]
|
||||
[InlineData(RedumperDriveType.LG_ASU8A, "LG_ASU8A")]
|
||||
[InlineData(RedumperDriveType.LG_ASU8B, "LG_ASU8B")]
|
||||
[InlineData(RedumperDriveType.LG_ASU8C, "LG_ASU8C")]
|
||||
[InlineData(RedumperDriveType.LG_ASU3, "LG_ASU3")]
|
||||
[InlineData(RedumperDriveType.LG_ASU2, "LG_ASU2")]
|
||||
[InlineData(RedumperDriveType.MTK8A, "MTK8A")]
|
||||
[InlineData(RedumperDriveType.MTK8B, "MTK8B")]
|
||||
[InlineData(RedumperDriveType.MTK8C, "MTK8C")]
|
||||
[InlineData(RedumperDriveType.MTK3, "MTK3")]
|
||||
[InlineData(RedumperDriveType.MTK2, "MTK2")]
|
||||
public void LongName_RedumperDriveType(RedumperDriveType? type, string? expected)
|
||||
{
|
||||
string? actual = type.LongName();
|
||||
Assert.Equal(expected, actual);
|
||||
|
||||
if (type != null)
|
||||
if (type is not null)
|
||||
{
|
||||
actual = EnumExtensions.GetLongName(type);
|
||||
Assert.Equal(expected, actual);
|
||||
@@ -168,6 +169,7 @@ namespace MPF.Frontend.Test
|
||||
[InlineData(InternalProgram.NONE, "Unknown")]
|
||||
[InlineData(InternalProgram.Aaru, "aaru")]
|
||||
[InlineData(InternalProgram.DiscImageCreator, "dic")]
|
||||
// [InlineData(InternalProgram.Dreamdump, "dreamdump")]
|
||||
[InlineData(InternalProgram.Redumper, "redumper")]
|
||||
[InlineData(InternalProgram.CleanRip, "cleanrip")]
|
||||
[InlineData(InternalProgram.PS3CFW, "ps3cfw")]
|
||||
@@ -210,6 +212,7 @@ namespace MPF.Frontend.Test
|
||||
[InlineData("", InternalProgram.NONE)]
|
||||
[InlineData("aaru", InternalProgram.Aaru)]
|
||||
[InlineData("dic", InternalProgram.DiscImageCreator)]
|
||||
// [InlineData("dreamdump", InternalProgram.Dreamdump)]
|
||||
[InlineData("redumper", InternalProgram.Redumper)]
|
||||
[InlineData("cleanrip", InternalProgram.CleanRip)]
|
||||
[InlineData("ps3cfw", InternalProgram.PS3CFW)]
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="18.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="18.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
||||
<PackageReference Include="xunit.analyzers" Version="1.25.0" />
|
||||
<PackageReference Include="xunit.analyzers" Version="1.27.0" />
|
||||
<PackageReference Include="xunit.assert" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.core" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.extensibility.core" Version="2.9.3" />
|
||||
|
||||
@@ -4,6 +4,23 @@ namespace MPF.Frontend.Test
|
||||
{
|
||||
public class ResultEventArgsTests
|
||||
{
|
||||
[Fact]
|
||||
public void EmptyNeutralTest()
|
||||
{
|
||||
var actual = ResultEventArgs.Neutral();
|
||||
Assert.Null((bool?)actual);
|
||||
Assert.Empty(actual.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CustomMessageNeutralTest()
|
||||
{
|
||||
string message = "Success!";
|
||||
var actual = ResultEventArgs.Neutral(message);
|
||||
Assert.Null((bool?)actual);
|
||||
Assert.Equal(message, actual.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmptySuccessTest()
|
||||
{
|
||||
|
||||
@@ -363,6 +363,19 @@ namespace MPF.Frontend.Test.Tools
|
||||
Assert.Empty(sanitized);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SanitizeFoundProtections_MPRESS()
|
||||
{
|
||||
List<string> protections =
|
||||
[
|
||||
"MPRESS",
|
||||
"MPRESS ANYTHING",
|
||||
];
|
||||
|
||||
string sanitized = ProtectionTool.SanitizeFoundProtections(protections);
|
||||
Assert.Empty(sanitized);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SanitizeFoundProtections_NeoLite()
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace MPF.Frontend.ComboBoxItems
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Element<TEnum>? other)
|
||||
{
|
||||
if (other == null)
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
return Name == other.Name;
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
/// <summary>
|
||||
/// Display name for the combo box element
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
public string Name { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace MPF.Frontend.ComboBoxItems
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(RedumpSystemComboBoxItem? other)
|
||||
{
|
||||
if (other == null)
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
return Value == other.Value;
|
||||
|
||||
@@ -10,7 +10,14 @@ namespace MPF.Frontend
|
||||
/// </summary>
|
||||
public static void ProgressUpdated(object? sender, ResultEventArgs value)
|
||||
{
|
||||
Console.WriteLine(value.Message);
|
||||
string prefix = (bool?)value switch
|
||||
{
|
||||
true => "SUCCESS: ",
|
||||
false => "FAILURE: ",
|
||||
_ => "",
|
||||
};
|
||||
|
||||
Console.WriteLine($"{prefix}{value.Message}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace MPF.Frontend
|
||||
|
||||
// Create and validate the drive info object
|
||||
var driveInfo = new DriveInfo(devicePath);
|
||||
if (driveInfo == null || driveInfo == default)
|
||||
if (driveInfo is null || driveInfo == default)
|
||||
return null;
|
||||
|
||||
// Fill in the rest of the data
|
||||
@@ -110,7 +110,7 @@ namespace MPF.Frontend
|
||||
private void PopulateFromDriveInfo(DriveInfo? driveInfo)
|
||||
{
|
||||
// If we have an invalid DriveInfo, just return
|
||||
if (driveInfo == null || driveInfo == default)
|
||||
if (driveInfo is null || driveInfo == default)
|
||||
return;
|
||||
|
||||
// Populate the data fields
|
||||
@@ -142,8 +142,8 @@ namespace MPF.Frontend
|
||||
var drives = GetDriveList(ignoreFixedDrives);
|
||||
drives.Sort((d1, d2) =>
|
||||
{
|
||||
string d1Name = d1?.Name == null ? "\0" : d1.Name;
|
||||
string d2Name = d2?.Name == null ? "\0" : d2.Name;
|
||||
string d1Name = d1?.Name is null ? "\0" : d1.Name;
|
||||
string d2Name = d2?.Name is null ? "\0" : d2.Name;
|
||||
return d1Name.CompareTo(d2Name);
|
||||
});
|
||||
return [.. drives];
|
||||
@@ -156,6 +156,7 @@ namespace MPF.Frontend
|
||||
/// <returns>The detected media type, if possible</returns>
|
||||
public MediaType? GetMediaType(RedumpSystem? system)
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
// Take care of the non-optical stuff first
|
||||
switch (InternalDriveType)
|
||||
{
|
||||
@@ -215,6 +216,7 @@ namespace MPF.Frontend
|
||||
case RedumpSystem.SonyPlayStationPortable:
|
||||
return MediaType.UMD;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
// Handle optical media by size and filesystem
|
||||
if (TotalSize >= 0 && TotalSize <= 800_000_000 && (DriveFormat == "CDFS" || DriveFormat == "UDF"))
|
||||
@@ -286,12 +288,12 @@ namespace MPF.Frontend
|
||||
{
|
||||
CimKeyedCollection<CimProperty> properties = instance.CimInstanceProperties;
|
||||
uint? mediaType = properties["MediaType"]?.Value as uint?;
|
||||
if (mediaType != null && ((mediaType > 0 && mediaType < 11) || (mediaType > 12 && mediaType < 22)))
|
||||
if (mediaType is not null && ((mediaType > 0 && mediaType < 11) || (mediaType > 12 && mediaType < 22)))
|
||||
{
|
||||
char devId = (properties["Caption"].Value as string ?? string.Empty)[0];
|
||||
Array.ForEach(drives, d =>
|
||||
{
|
||||
if (d?.Name != null && d.Name[0] == devId)
|
||||
if (d?.Name is not null && d.Name[0] == devId)
|
||||
d.InternalDriveType = Frontend.InternalDriveType.Floppy;
|
||||
});
|
||||
}
|
||||
@@ -313,6 +315,7 @@ namespace MPF.Frontend
|
||||
/// <returns>InternalDriveType, if possible, null on error</returns>
|
||||
internal static InternalDriveType? ToInternalDriveType(DriveType driveType)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return driveType switch
|
||||
{
|
||||
DriveType.CDRom => (InternalDriveType?)Frontend.InternalDriveType.Optical,
|
||||
@@ -320,6 +323,7 @@ namespace MPF.Frontend
|
||||
DriveType.Removable => (InternalDriveType?)Frontend.InternalDriveType.Removable,
|
||||
_ => null,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -133,28 +133,38 @@ namespace MPF.Frontend
|
||||
{
|
||||
// If a complete dump exists from a different program
|
||||
InternalProgram? programFound = null;
|
||||
if (programFound == null && _internalProgram != InternalProgram.Redumper)
|
||||
if (programFound is null && _internalProgram != InternalProgram.Redumper)
|
||||
{
|
||||
var processor = new Processors.Redumper(_system);
|
||||
var processor = new Redumper(_system);
|
||||
var missingFiles = processor.FoundAllFiles(mediaType, outputDirectory, outputFilename);
|
||||
if (missingFiles.Count == 0)
|
||||
programFound = InternalProgram.Redumper;
|
||||
}
|
||||
if (programFound == null && _internalProgram != InternalProgram.DiscImageCreator)
|
||||
|
||||
if (programFound is null && _internalProgram != InternalProgram.DiscImageCreator)
|
||||
{
|
||||
var processor = new Processors.DiscImageCreator(_system);
|
||||
var processor = new DiscImageCreator(_system);
|
||||
var missingFiles = processor.FoundAllFiles(mediaType, outputDirectory, outputFilename);
|
||||
if (missingFiles.Count == 0)
|
||||
programFound = InternalProgram.DiscImageCreator;
|
||||
}
|
||||
if (programFound == null && _internalProgram != InternalProgram.Aaru)
|
||||
|
||||
if (programFound is null && _internalProgram != InternalProgram.Aaru)
|
||||
{
|
||||
var processor = new Processors.Aaru(_system);
|
||||
var processor = new Aaru(_system);
|
||||
var missingFiles = processor.FoundAllFiles(mediaType, outputDirectory, outputFilename);
|
||||
if (missingFiles.Count == 0)
|
||||
programFound = InternalProgram.Aaru;
|
||||
}
|
||||
|
||||
// if (programFound is null && _internalProgram != InternalProgram.Dreamdump)
|
||||
// {
|
||||
// var processor = new Dreamdump(_system);
|
||||
// var missingFiles = processor.FoundAllFiles(mediaType, outputDirectory, outputFilename);
|
||||
// if (missingFiles.Count == 0)
|
||||
// programFound = InternalProgram.Dreamdump;
|
||||
// }
|
||||
|
||||
return programFound;
|
||||
}
|
||||
|
||||
@@ -165,25 +175,34 @@ namespace MPF.Frontend
|
||||
{
|
||||
// If a complete dump exists from a different program
|
||||
InternalProgram? programFound = null;
|
||||
if (programFound == null && _internalProgram != InternalProgram.Redumper)
|
||||
if (programFound is null && _internalProgram != InternalProgram.Redumper)
|
||||
{
|
||||
var processor = new Processors.Redumper(_system);
|
||||
var processor = new Redumper(_system);
|
||||
if (processor.FoundAnyFiles(mediaType, outputDirectory, outputFilename))
|
||||
programFound = InternalProgram.Redumper;
|
||||
}
|
||||
if (programFound == null && _internalProgram != InternalProgram.DiscImageCreator)
|
||||
|
||||
if (programFound is null && _internalProgram != InternalProgram.DiscImageCreator)
|
||||
{
|
||||
var processor = new Processors.DiscImageCreator(_system);
|
||||
var processor = new DiscImageCreator(_system);
|
||||
if (processor.FoundAnyFiles(mediaType, outputDirectory, outputFilename))
|
||||
programFound = InternalProgram.DiscImageCreator;
|
||||
}
|
||||
if (programFound == null && _internalProgram != InternalProgram.Aaru)
|
||||
|
||||
if (programFound is null && _internalProgram != InternalProgram.Aaru)
|
||||
{
|
||||
var processor = new Processors.Aaru(_system);
|
||||
var processor = new Aaru(_system);
|
||||
if (processor.FoundAnyFiles(mediaType, outputDirectory, outputFilename))
|
||||
programFound = InternalProgram.Aaru;
|
||||
}
|
||||
|
||||
// if (programFound is null && _internalProgram != InternalProgram.Dreamdump)
|
||||
// {
|
||||
// var processor = new Dreamdump(_system);
|
||||
// if (processor.FoundAnyFiles(mediaType, outputDirectory, outputFilename))
|
||||
// programFound = InternalProgram.Dreamdump;
|
||||
// }
|
||||
|
||||
return programFound;
|
||||
}
|
||||
|
||||
@@ -194,19 +213,22 @@ namespace MPF.Frontend
|
||||
/// <param name="parameters">String representation of the parameters</param>
|
||||
public bool SetExecutionContext(MediaType? mediaType, string? parameters)
|
||||
{
|
||||
#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 },
|
||||
|
||||
// If no dumping program found, set to null
|
||||
InternalProgram.NONE => null,
|
||||
_ => null,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
// Set system, type, and drive
|
||||
if (_executionContext != null)
|
||||
if (_executionContext is not null)
|
||||
{
|
||||
_executionContext.RedumpSystem = _system;
|
||||
_executionContext.MediaType = mediaType;
|
||||
@@ -216,7 +238,7 @@ namespace MPF.Frontend
|
||||
_drive ??= Drive.Create(InternalDriveType.Optical, _executionContext.InputPath!);
|
||||
}
|
||||
|
||||
return _executionContext != null;
|
||||
return _executionContext is not null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -226,9 +248,10 @@ namespace MPF.Frontend
|
||||
{
|
||||
_processor = _internalProgram switch
|
||||
{
|
||||
InternalProgram.Aaru => new Processors.Aaru(_system),
|
||||
InternalProgram.Aaru => new Aaru(_system),
|
||||
InternalProgram.CleanRip => new CleanRip(_system),
|
||||
InternalProgram.DiscImageCreator => new DiscImageCreator(_system),
|
||||
// InternalProgram.Dreamdump => new Dreamdump(_system),
|
||||
InternalProgram.PS3CFW => new PS3CFW(_system),
|
||||
InternalProgram.Redumper => new Redumper(_system),
|
||||
InternalProgram.UmdImageCreator => new UmdImageCreator(_system),
|
||||
@@ -239,7 +262,7 @@ namespace MPF.Frontend
|
||||
_ => null,
|
||||
};
|
||||
|
||||
return _processor != null;
|
||||
return _processor is not null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -251,23 +274,26 @@ namespace MPF.Frontend
|
||||
public string? GetFullParameters(MediaType? mediaType, int? driveSpeed)
|
||||
{
|
||||
// Populate with the correct params for inputs (if we're not on the default option)
|
||||
if (_system != null && mediaType != MediaType.NONE)
|
||||
if (_system is not null && mediaType != MediaType.NONE)
|
||||
{
|
||||
// If drive letter is invalid, skip this
|
||||
if (_drive == null)
|
||||
if (_drive is null)
|
||||
return null;
|
||||
|
||||
#pragma warning disable IDE0072
|
||||
// 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),
|
||||
|
||||
// If no dumping program found, set to null
|
||||
InternalProgram.NONE => null,
|
||||
_ => null,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
// Generate and return the param string
|
||||
return _executionContext?.GenerateParameters();
|
||||
@@ -290,6 +316,7 @@ namespace MPF.Frontend
|
||||
/// <returns>True if the media has variable dumping speeds, false otherwise</returns>
|
||||
public static bool DoesSupportDriveSpeed(MediaType? mediaType)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return mediaType switch
|
||||
{
|
||||
MediaType.CDROM
|
||||
@@ -302,12 +329,13 @@ namespace MPF.Frontend
|
||||
or MediaType.NintendoWiiUOpticalDisc => true,
|
||||
_ => false,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BaseProcessor.FoundAllFiles(MediaType?, string?, string)"/>
|
||||
public bool FoundAllFiles(MediaType? mediaType, string? outputDirectory, string outputFilename)
|
||||
{
|
||||
if (_processor == null)
|
||||
if (_processor is null)
|
||||
return false;
|
||||
|
||||
return _processor.FoundAllFiles(mediaType, outputDirectory, outputFilename).Count == 0;
|
||||
@@ -316,7 +344,7 @@ namespace MPF.Frontend
|
||||
/// <inheritdoc cref="BaseProcessor.FoundAnyFiles(MediaType?, string?, string)"/>
|
||||
public bool FoundAnyFiles(MediaType? mediaType, string? outputDirectory, string outputFilename)
|
||||
{
|
||||
if (_processor == null)
|
||||
if (_processor is null)
|
||||
return false;
|
||||
|
||||
return _processor.FoundAnyFiles(mediaType, outputDirectory, outputFilename);
|
||||
@@ -325,7 +353,7 @@ namespace MPF.Frontend
|
||||
/// <inheritdoc cref="BaseExecutionContext.GetDefaultExtension(MediaType?)"/>
|
||||
public string? GetDefaultExtension(MediaType? mediaType)
|
||||
{
|
||||
if (_executionContext == null)
|
||||
if (_executionContext is null)
|
||||
return null;
|
||||
|
||||
return _executionContext.GetDefaultExtension(mediaType);
|
||||
@@ -334,7 +362,7 @@ namespace MPF.Frontend
|
||||
/// <inheritdoc cref="BaseExecutionContext.GetMediaType()"/>
|
||||
public MediaType? GetMediaType()
|
||||
{
|
||||
if (_executionContext == null)
|
||||
if (_executionContext is null)
|
||||
return null;
|
||||
|
||||
return _executionContext.GetMediaType();
|
||||
@@ -346,9 +374,10 @@ namespace MPF.Frontend
|
||||
public ResultEventArgs GetSupportStatus(MediaType? mediaType)
|
||||
{
|
||||
// No system chosen, update status
|
||||
if (_system == null)
|
||||
if (_system is null)
|
||||
return ResultEventArgs.Failure("Please select a valid system");
|
||||
|
||||
#pragma warning disable IDE0072
|
||||
// If we're on an unsupported type, update the status accordingly
|
||||
return mediaType switch
|
||||
{
|
||||
@@ -381,12 +410,13 @@ namespace MPF.Frontend
|
||||
// Undumpable but recognized types
|
||||
_ => ResultEventArgs.Failure($"{mediaType.LongName()} media are not supported for dumping"),
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BaseExecutionContext.IsDumpingCommand()"/>
|
||||
public bool IsDumpingCommand()
|
||||
{
|
||||
if (_executionContext == null)
|
||||
if (_executionContext is null)
|
||||
return false;
|
||||
|
||||
return _executionContext.IsDumpingCommand();
|
||||
@@ -412,11 +442,11 @@ namespace MPF.Frontend
|
||||
public async Task<ResultEventArgs> Run(MediaType? mediaType, IProgress<ResultEventArgs>? progress = null)
|
||||
{
|
||||
// If we don't have parameters
|
||||
if (_executionContext == null)
|
||||
if (_executionContext is null)
|
||||
return ResultEventArgs.Failure("Error! Current configuration is not supported!");
|
||||
|
||||
// Build default console progress indicators if none exist
|
||||
if (progress == null)
|
||||
if (progress is null)
|
||||
{
|
||||
var temp = new Progress<ResultEventArgs>();
|
||||
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
|
||||
@@ -425,11 +455,11 @@ namespace MPF.Frontend
|
||||
|
||||
// Check that we have the basics for dumping
|
||||
ResultEventArgs result = IsValidForDump(mediaType);
|
||||
if (!result)
|
||||
if (result == false)
|
||||
return result;
|
||||
|
||||
// Execute internal tool
|
||||
progress?.Report(ResultEventArgs.Success($"Executing {_internalProgram}... please wait!"));
|
||||
progress?.Report(ResultEventArgs.Neutral($"Executing {_internalProgram}... please wait!"));
|
||||
|
||||
var directoryName = Path.GetDirectoryName(OutputPath);
|
||||
if (!string.IsNullOrEmpty(directoryName))
|
||||
@@ -459,24 +489,25 @@ namespace MPF.Frontend
|
||||
ProcessUserInfoDelegate? processUserInfo = null,
|
||||
SubmissionInfo? seedInfo = null)
|
||||
{
|
||||
if (_processor == null)
|
||||
if (_processor is null)
|
||||
return ResultEventArgs.Failure("Error! Current configuration is not supported!");
|
||||
|
||||
// Build default console progress indicators if none exist
|
||||
if (resultProgress == null)
|
||||
if (resultProgress is null)
|
||||
{
|
||||
var temp = new Progress<ResultEventArgs>();
|
||||
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
|
||||
resultProgress = temp;
|
||||
}
|
||||
if (protectionProgress == null)
|
||||
|
||||
if (protectionProgress is null)
|
||||
{
|
||||
var temp = new Progress<ProtectionProgress>();
|
||||
temp.ProgressChanged += ConsoleLogger.ProgressUpdated;
|
||||
protectionProgress = temp;
|
||||
}
|
||||
|
||||
resultProgress.Report(ResultEventArgs.Success("Gathering submission information... please wait!"));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Gathering submission information... please wait!"));
|
||||
|
||||
// Get the output directory and filename separately
|
||||
var outputDirectory = Path.GetDirectoryName(OutputPath);
|
||||
@@ -495,11 +526,11 @@ namespace MPF.Frontend
|
||||
|
||||
// Determine the media type from the processor
|
||||
MediaType? mediaType = _processor.DetermineMediaType(outputDirectory, outputFilename);
|
||||
if (mediaType == null)
|
||||
if (mediaType is null)
|
||||
return ResultEventArgs.Failure("Could not determine the media type from output files...");
|
||||
|
||||
// Extract the information from the output files
|
||||
resultProgress.Report(ResultEventArgs.Success("Extracting output information from output files..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Extracting output information from output files..."));
|
||||
var submissionInfo = await SubmissionGenerator.ExtractOutputInformation(
|
||||
OutputPath,
|
||||
_drive,
|
||||
@@ -509,23 +540,23 @@ namespace MPF.Frontend
|
||||
_processor,
|
||||
resultProgress,
|
||||
protectionProgress);
|
||||
if (submissionInfo == null)
|
||||
if (submissionInfo is null)
|
||||
return ResultEventArgs.Failure("There was an issue extracting information!");
|
||||
else
|
||||
resultProgress.Report(ResultEventArgs.Success("Extracting information complete!"));
|
||||
|
||||
// Inject seed submission info data, if necessary
|
||||
if (seedInfo != null)
|
||||
if (seedInfo is not null)
|
||||
{
|
||||
resultProgress.Report(ResultEventArgs.Success("Injecting user-supplied information..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Injecting user-supplied information..."));
|
||||
submissionInfo = Builder.InjectSubmissionInformation(submissionInfo, seedInfo);
|
||||
resultProgress.Report(ResultEventArgs.Success("Information injection complete!"));
|
||||
}
|
||||
|
||||
// Get user-modifiable information if configured to
|
||||
if (_options.PromptForDiscInformation && processUserInfo != null)
|
||||
if (_options.PromptForDiscInformation && processUserInfo is not null)
|
||||
{
|
||||
resultProgress.Report(ResultEventArgs.Success("Waiting for additional media information..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Waiting for additional media information..."));
|
||||
bool? filledInfo = processUserInfo.Invoke(_options, ref submissionInfo);
|
||||
if (filledInfo == true)
|
||||
resultProgress.Report(ResultEventArgs.Success("Additional media information added!"));
|
||||
@@ -534,14 +565,14 @@ namespace MPF.Frontend
|
||||
}
|
||||
|
||||
// Process special fields for site codes
|
||||
resultProgress.Report(ResultEventArgs.Success("Processing site codes..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Processing site codes..."));
|
||||
Formatter.ProcessSpecialFields(submissionInfo!);
|
||||
resultProgress.Report(ResultEventArgs.Success("Processing complete!"));
|
||||
|
||||
// Format the information for the text output
|
||||
resultProgress.Report(ResultEventArgs.Success("Formatting information..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Formatting information..."));
|
||||
var formattedValues = Formatter.FormatOutputData(submissionInfo, _options.EnableRedumpCompatibility, out string? formatResult);
|
||||
if (formattedValues == null)
|
||||
if (formattedValues is null)
|
||||
resultProgress.Report(ResultEventArgs.Failure(formatResult));
|
||||
else
|
||||
resultProgress.Report(ResultEventArgs.Success(formatResult));
|
||||
@@ -550,7 +581,7 @@ namespace MPF.Frontend
|
||||
var filenameSuffix = _options.AddFilenameSuffix ? Path.GetFileNameWithoutExtension(outputFilename) : null;
|
||||
|
||||
// Write the text output
|
||||
resultProgress.Report(ResultEventArgs.Success("Writing submission information file..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Writing submission information file..."));
|
||||
bool txtSuccess = WriteOutputData(outputDirectory, filenameSuffix, formattedValues, out string txtResult);
|
||||
if (txtSuccess)
|
||||
resultProgress.Report(ResultEventArgs.Success(txtResult));
|
||||
@@ -558,11 +589,11 @@ namespace MPF.Frontend
|
||||
resultProgress.Report(ResultEventArgs.Failure(txtResult));
|
||||
|
||||
// Write the copy protection output
|
||||
if (submissionInfo?.CopyProtection?.FullProtections != null && submissionInfo.CopyProtection.FullProtections.Count > 0)
|
||||
if (submissionInfo?.CopyProtection?.FullProtections is not null && submissionInfo.CopyProtection.FullProtections.Count > 0)
|
||||
{
|
||||
if (_options.ScanForProtection)
|
||||
{
|
||||
resultProgress.Report(ResultEventArgs.Success("Writing protection information file..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Writing protection information file..."));
|
||||
bool scanSuccess = WriteProtectionData(outputDirectory, filenameSuffix, submissionInfo, _options.HideDriveLetters);
|
||||
if (scanSuccess)
|
||||
resultProgress.Report(ResultEventArgs.Success("Writing complete!"));
|
||||
@@ -574,7 +605,7 @@ namespace MPF.Frontend
|
||||
// Write the JSON output, if required
|
||||
if (_options.OutputSubmissionJSON)
|
||||
{
|
||||
resultProgress.Report(ResultEventArgs.Success($"Writing submission information JSON file{(_options.IncludeArtifacts ? " with artifacts" : string.Empty)}..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral($"Writing submission information JSON file{(_options.IncludeArtifacts ? " with artifacts" : string.Empty)}..."));
|
||||
bool jsonSuccess = WriteOutputData(outputDirectory, filenameSuffix, submissionInfo, _options.IncludeArtifacts);
|
||||
if (jsonSuccess)
|
||||
resultProgress.Report(ResultEventArgs.Success("Writing complete!"));
|
||||
@@ -585,7 +616,7 @@ namespace MPF.Frontend
|
||||
// Compress the logs, if required
|
||||
if (_options.CompressLogFiles)
|
||||
{
|
||||
resultProgress.Report(ResultEventArgs.Success("Compressing log files..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Compressing log files..."));
|
||||
#if NET40
|
||||
await Task.Factory.StartNew(() =>
|
||||
#else
|
||||
@@ -605,7 +636,7 @@ namespace MPF.Frontend
|
||||
// Delete unnecessary files, if required
|
||||
if (_options.DeleteUnnecessaryFiles)
|
||||
{
|
||||
resultProgress.Report(ResultEventArgs.Success("Deleting unnecessary files..."));
|
||||
resultProgress.Report(ResultEventArgs.Neutral("Deleting unnecessary files..."));
|
||||
bool deleteSuccess = _processor.DeleteUnnecessaryFiles(mediaType, outputDirectory, outputFilename, out string deleteResult);
|
||||
if (deleteSuccess)
|
||||
resultProgress.Report(ResultEventArgs.Success(deleteResult));
|
||||
@@ -616,7 +647,7 @@ namespace MPF.Frontend
|
||||
// Create PS3 IRD, if required
|
||||
if (_options.CreateIRDAfterDumping && _system == RedumpSystem.SonyPlayStation3 && mediaType == MediaType.BluRay)
|
||||
{
|
||||
resultProgress.Report(ResultEventArgs.Success("Creating IRD... please wait!"));
|
||||
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);
|
||||
if (deleteSuccess)
|
||||
resultProgress.Report(ResultEventArgs.Success("IRD created!"));
|
||||
@@ -635,7 +666,7 @@ namespace MPF.Frontend
|
||||
internal bool ParametersValid(MediaType? mediaType)
|
||||
{
|
||||
// Missing drive means it can never be valid
|
||||
if (_drive == null)
|
||||
if (_drive is null)
|
||||
return false;
|
||||
|
||||
bool parametersValid = _executionContext?.IsValid() ?? false;
|
||||
@@ -655,14 +686,14 @@ namespace MPF.Frontend
|
||||
private ResultEventArgs IsValidForDump(MediaType? mediaType)
|
||||
{
|
||||
// Validate that everything is good
|
||||
if (_executionContext == null || !ParametersValid(mediaType))
|
||||
if (_executionContext is null || !ParametersValid(mediaType))
|
||||
return ResultEventArgs.Failure("Error! Current configuration is not supported!");
|
||||
|
||||
// Fix the output paths, just in case
|
||||
OutputPath = FrontendTool.NormalizeOutputPaths(OutputPath, false);
|
||||
|
||||
// Validate that the output path isn't on the dumping drive
|
||||
if (_drive?.Name != null && OutputPath.StartsWith(_drive.Name))
|
||||
if (_drive?.Name is not null && OutputPath.StartsWith(_drive.Name))
|
||||
return ResultEventArgs.Failure("Error! Cannot output to same drive that is being dumped!");
|
||||
|
||||
// Validate that the required program exists
|
||||
@@ -671,7 +702,7 @@ namespace MPF.Frontend
|
||||
|
||||
// Validate that the dumping drive doesn't contain the executable
|
||||
string fullExecutablePath = Path.GetFullPath(_executionContext.ExecutablePath!);
|
||||
if (_drive?.Name != null && fullExecutablePath.StartsWith(_drive.Name))
|
||||
if (_drive?.Name is not null && fullExecutablePath.StartsWith(_drive.Name))
|
||||
return ResultEventArgs.Failure("Error! Cannot dump same drive that executable resides on!");
|
||||
|
||||
// Validate that the current configuration is supported
|
||||
@@ -692,7 +723,7 @@ namespace MPF.Frontend
|
||||
private static bool WriteOutputData(string? outputDirectory, string? filenameSuffix, string? lines, out string status)
|
||||
{
|
||||
// Check to see if the inputs are valid
|
||||
if (lines == null)
|
||||
if (lines is null)
|
||||
{
|
||||
status = "No formatted data found to write!";
|
||||
return false;
|
||||
@@ -737,7 +768,7 @@ namespace MPF.Frontend
|
||||
private static bool WriteOutputData(string? outputDirectory, string? filenameSuffix, SubmissionInfo? info, bool includedArtifacts)
|
||||
{
|
||||
// Check to see if the input is valid
|
||||
if (info == null)
|
||||
if (info is null)
|
||||
return false;
|
||||
|
||||
try
|
||||
@@ -797,7 +828,7 @@ namespace MPF.Frontend
|
||||
private static bool WriteProtectionData(string? outputDirectory, string? filenameSuffix, SubmissionInfo? info, bool hideDriveLetters)
|
||||
{
|
||||
// Check to see if the inputs are valid
|
||||
if (info?.CopyProtection?.FullProtections == null || info.CopyProtection.FullProtections.Count == 0)
|
||||
if (info?.CopyProtection?.FullProtections is null || info.CopyProtection.FullProtections.Count == 0)
|
||||
return true;
|
||||
|
||||
// Now write out to a generic file
|
||||
@@ -830,7 +861,7 @@ namespace MPF.Frontend
|
||||
|
||||
List<string>? scanResult = info.CopyProtection.FullProtections[key];
|
||||
|
||||
if (scanResult == null)
|
||||
if (scanResult is null)
|
||||
sw.WriteLine($"{scanPath}: None");
|
||||
else
|
||||
sw.WriteLine($"{scanPath}: {string.Join(", ", [.. scanResult])}");
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using DreamdumpSectorOrder = MPF.ExecutionContexts.Dreamdump.SectorOrder;
|
||||
using LogCompression = MPF.Processors.LogCompression;
|
||||
using RedumperDriveType = MPF.ExecutionContexts.Redumper.DriveType;
|
||||
using RedumperReadMethod = MPF.ExecutionContexts.Redumper.ReadMethod;
|
||||
@@ -50,7 +51,7 @@ namespace MPF.Frontend
|
||||
#endif
|
||||
}
|
||||
|
||||
if (method != null)
|
||||
if (method is not null)
|
||||
return method.Invoke(null, [value]) as string ?? string.Empty;
|
||||
else
|
||||
return string.Empty;
|
||||
@@ -118,6 +119,7 @@ namespace MPF.Frontend
|
||||
|
||||
InternalProgram.Aaru => "Aaru",
|
||||
InternalProgram.DiscImageCreator => "DiscImageCreator",
|
||||
// InternalProgram.Dreamdump => "Dreamdump",
|
||||
InternalProgram.Redumper => "Redumper",
|
||||
|
||||
#endregion
|
||||
@@ -232,11 +234,11 @@ namespace MPF.Frontend
|
||||
{
|
||||
RedumperDriveType.GENERIC => "GENERIC",
|
||||
RedumperDriveType.PLEXTOR => "PLEXTOR",
|
||||
RedumperDriveType.LG_ASU8A => "LG_ASU8A",
|
||||
RedumperDriveType.LG_ASU8B => "LG_ASU8B",
|
||||
RedumperDriveType.LG_ASU8C => "LG_ASU8C",
|
||||
RedumperDriveType.LG_ASU3 => "LG_ASU3",
|
||||
RedumperDriveType.LG_ASU2 => "LG_ASU2",
|
||||
RedumperDriveType.MTK8A => "MTK8A",
|
||||
RedumperDriveType.MTK8B => "MTK8B",
|
||||
RedumperDriveType.MTK8C => "MTK8C",
|
||||
RedumperDriveType.MTK3 => "MTK3",
|
||||
RedumperDriveType.MTK2 => "MTK2",
|
||||
|
||||
RedumperDriveType.NONE => "Default",
|
||||
_ => "Unknown",
|
||||
@@ -295,6 +297,7 @@ namespace MPF.Frontend
|
||||
|
||||
InternalProgram.Aaru => "aaru",
|
||||
InternalProgram.DiscImageCreator => "dic",
|
||||
// InternalProgram.Dreamdump => "dreamdump",
|
||||
InternalProgram.Redumper => "redumper",
|
||||
|
||||
#endregion
|
||||
@@ -317,6 +320,36 @@ namespace MPF.Frontend
|
||||
|
||||
#region Convert from String
|
||||
|
||||
/// <summary>
|
||||
/// Get the DreamdumpSectorOrder enum value for a given string
|
||||
/// </summary>
|
||||
/// <param name="order">String value to convert</param>
|
||||
/// <returns>DreamdumpSectorOrder represented by the string, if possible</returns>
|
||||
public static DreamdumpSectorOrder ToDreamdumpSectorOrder(this string? order)
|
||||
{
|
||||
return (order?.ToLowerInvariant()) switch
|
||||
{
|
||||
"data_c2_sub"
|
||||
or "data c2 sub"
|
||||
or "data-c2-sub"
|
||||
or "datac2sub" => DreamdumpSectorOrder.DATA_C2_SUB,
|
||||
"data_sub_c2"
|
||||
or "data sub c2"
|
||||
or "data-sub-c2"
|
||||
or "datasubc2" => DreamdumpSectorOrder.DATA_SUB_C2,
|
||||
"data_sub"
|
||||
or "data sub"
|
||||
or "data-sub"
|
||||
or "datasub" => DreamdumpSectorOrder.DATA_SUB,
|
||||
"data_c2"
|
||||
or "data c2"
|
||||
or "data-c2"
|
||||
or "datac2" => DreamdumpSectorOrder.DATA_C2,
|
||||
|
||||
_ => DreamdumpSectorOrder.NONE,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the InterfaceLanguage enum value for a given string
|
||||
/// </summary>
|
||||
@@ -362,6 +395,7 @@ namespace MPF.Frontend
|
||||
or "dic"
|
||||
or "dicreator"
|
||||
or "discimagecreator" => InternalProgram.DiscImageCreator,
|
||||
// "dreamdump" => InternalProgram.Dreamdump,
|
||||
"rd"
|
||||
or "redumper" => InternalProgram.Redumper,
|
||||
|
||||
@@ -466,31 +500,66 @@ namespace MPF.Frontend
|
||||
{
|
||||
"generic" => RedumperDriveType.GENERIC,
|
||||
"plextor" => RedumperDriveType.PLEXTOR,
|
||||
"lg_asu8a"
|
||||
"mtk8a"
|
||||
or "mtk_8a"
|
||||
or "lg_asus8a"
|
||||
or "lg-asus8a"
|
||||
or "lgasus8a"
|
||||
or "lg_asus_8a"
|
||||
or "lg-asus-8a"
|
||||
or "lg_asu8a"
|
||||
or "lg-asu8a"
|
||||
or "lgasu8a"
|
||||
or "lg_asu_8a"
|
||||
or "lg-asu-8a" => RedumperDriveType.LG_ASU8A,
|
||||
"lg_asu8b"
|
||||
or "lg-asu-8a" => RedumperDriveType.MTK8A,
|
||||
"mtk8b"
|
||||
or "mtk_8b"
|
||||
or "lg_asus8b"
|
||||
or "lg-asus8b"
|
||||
or "lgasus8b"
|
||||
or "lg_asus_8b"
|
||||
or "lg-asus-8b"
|
||||
or "lg_asu8b"
|
||||
or "lg-asu8b"
|
||||
or "lgasu8b"
|
||||
or "lg_asu_8b"
|
||||
or "lg-asu-8b" => RedumperDriveType.LG_ASU8B,
|
||||
"lg_asu8c"
|
||||
or "lg-asu-8b" => RedumperDriveType.MTK8B,
|
||||
"mtk8c"
|
||||
or "mtk_8c"
|
||||
or "lg_asus8c"
|
||||
or "lg-asus8c"
|
||||
or "lgasus8c"
|
||||
or "lg_asus_8c"
|
||||
or "lg-asus-8c"
|
||||
or "lg_asu8c"
|
||||
or "lg-asu8c"
|
||||
or "lgasu8c"
|
||||
or "lg_asu_8c"
|
||||
or "lg-asu-8c" => RedumperDriveType.LG_ASU8C,
|
||||
"lg_asus3"
|
||||
or "lg-asu-8c" => RedumperDriveType.MTK8C,
|
||||
"mtk3"
|
||||
or "mtk3"
|
||||
or "lg_asus3"
|
||||
or "lg-asus3"
|
||||
or "lgasus3"
|
||||
or "lg_asus_3"
|
||||
or "lg-asus-3"
|
||||
or "lg_asu3"
|
||||
or "lg-asu3"
|
||||
or "lgasu3"
|
||||
or "lg_asu_3"
|
||||
or "lg-asu-3" => RedumperDriveType.LG_ASU3,
|
||||
"lg_asu2"
|
||||
or "lg-asu-3" => RedumperDriveType.MTK3,
|
||||
"mtk2"
|
||||
or "mtk2"
|
||||
or "lg_asus2"
|
||||
or "lg-asus2"
|
||||
or "lgasus2"
|
||||
or "lg_asus_2"
|
||||
or "lg-asus-2"
|
||||
or "lg_asu2"
|
||||
or "lg-asu2"
|
||||
or "lgasu2"
|
||||
or "lg_asu_2"
|
||||
or "lg-asu-2" => RedumperDriveType.LG_ASU2,
|
||||
or "lg-asu-2" => RedumperDriveType.MTK2,
|
||||
|
||||
_ => RedumperDriveType.NONE,
|
||||
};
|
||||
@@ -505,11 +574,13 @@ namespace MPF.Frontend
|
||||
/// </summary>
|
||||
public static bool SupportsAntiModchipScans(this RedumpSystem? system)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return system switch
|
||||
{
|
||||
RedumpSystem.SonyPlayStation => true,
|
||||
_ => false,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -517,6 +588,7 @@ namespace MPF.Frontend
|
||||
/// </summary>
|
||||
public static bool SupportsCopyProtectionScans(this RedumpSystem? system)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return system switch
|
||||
{
|
||||
RedumpSystem.AppleMacintosh => true,
|
||||
@@ -529,6 +601,7 @@ namespace MPF.Frontend
|
||||
RedumpSystem.SonyElectronicBook => true,
|
||||
_ => false,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace MPF.Frontend
|
||||
// Dumping support
|
||||
Aaru,
|
||||
DiscImageCreator,
|
||||
// Dreamdump,
|
||||
Redumper,
|
||||
|
||||
// Verification support only
|
||||
@@ -62,7 +63,8 @@ namespace MPF.Frontend
|
||||
/// </summary>
|
||||
public enum LogLevel
|
||||
{
|
||||
USER,
|
||||
USER_GENERIC,
|
||||
USER_SUCCESS,
|
||||
VERBOSE,
|
||||
ERROR,
|
||||
SECRET,
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace MPF.Frontend
|
||||
/// <returns>Read-only list of drive speeds</returns>
|
||||
public static List<int> GetSpeedsForMediaType(MediaType? type)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return type switch
|
||||
{
|
||||
MediaType.CDROM
|
||||
@@ -54,6 +55,7 @@ namespace MPF.Frontend
|
||||
// Default to CD speed range
|
||||
_ => CD,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<PackageReference Include="MinThreadingBridge" Version="0.11.4" Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`)) OR $(TargetFramework.StartsWith(`net40`))" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="SabreTools.CommandLine" Version="[1.4.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.IO;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using AaruSettings = MPF.ExecutionContexts.Aaru.SettingConstants;
|
||||
using DICSettings = MPF.ExecutionContexts.DiscImageCreator.SettingConstants;
|
||||
// using DreamdumpSectorOrder = MPF.ExecutionContexts.Dreamdump.SectorOrder;
|
||||
// using DreamdumpSettings = MPF.ExecutionContexts.Dreamdump.SettingConstants;
|
||||
using LogCompression = MPF.Processors.LogCompression;
|
||||
using RedumperDriveType = MPF.ExecutionContexts.Redumper.DriveType;
|
||||
using RedumperReadMethod = MPF.ExecutionContexts.Redumper.ReadMethod;
|
||||
@@ -23,12 +25,14 @@ namespace MPF.Frontend
|
||||
{
|
||||
get
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
string executableName = Environment.OSVersion.Platform switch
|
||||
{
|
||||
PlatformID.Unix => "aaru",
|
||||
PlatformID.MacOSX => "aaru",
|
||||
_ => "aaru.exe"
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
#if NET20 || NET35
|
||||
return Path.Combine("Programs", Path.Combine("Aaru", executableName));
|
||||
@@ -45,12 +49,14 @@ namespace MPF.Frontend
|
||||
{
|
||||
get
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
string executableName = Environment.OSVersion.Platform switch
|
||||
{
|
||||
PlatformID.Unix => "DiscImageCreator.out",
|
||||
PlatformID.MacOSX => "DiscImageCreator",
|
||||
_ => "DiscImageCreator.exe"
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
#if NET20 || NET35
|
||||
return Path.Combine("Programs", Path.Combine("Creator", executableName));
|
||||
@@ -60,6 +66,32 @@ namespace MPF.Frontend
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0051
|
||||
/// <summary>
|
||||
/// Default Dreamdump path
|
||||
/// </summary>
|
||||
private static string DefaultDreamdumpPath
|
||||
{
|
||||
get
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
string executableName = Environment.OSVersion.Platform switch
|
||||
{
|
||||
PlatformID.Unix => "dreamdump",
|
||||
PlatformID.MacOSX => "dreamdump",
|
||||
_ => "dreamdump.exe"
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
#if NET20 || NET35
|
||||
return Path.Combine("Programs", Path.Combine("Dreamdump", executableName));
|
||||
#else
|
||||
return Path.Combine("Programs", "Dreamdump", executableName);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE0051
|
||||
|
||||
/// <summary>
|
||||
/// Default Redumper path
|
||||
/// </summary>
|
||||
@@ -67,12 +99,14 @@ namespace MPF.Frontend
|
||||
{
|
||||
get
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
string executableName = Environment.OSVersion.Platform switch
|
||||
{
|
||||
PlatformID.Unix => "redumper",
|
||||
PlatformID.MacOSX => "redumper",
|
||||
_ => "redumper.exe"
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
#if NET20 || NET35
|
||||
return Path.Combine("Programs", Path.Combine("Redumper", executableName));
|
||||
@@ -118,6 +152,15 @@ namespace MPF.Frontend
|
||||
set { Settings["DiscImageCreatorPath"] = value; }
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Path to Dreamdump
|
||||
// /// </summary>
|
||||
// public string? DreamdumpPath
|
||||
// {
|
||||
// get { return GetStringSetting(Settings, "DreamdumpPath", DefaultDreamdumpPath); }
|
||||
// set { Settings["DreamdumpPath"] = value; }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Path to Redumper
|
||||
/// </summary>
|
||||
@@ -429,6 +472,44 @@ namespace MPF.Frontend
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dreamdump
|
||||
|
||||
// /// <summary>
|
||||
// /// Enable options incompatible with redump submissions
|
||||
// /// </summary>
|
||||
// public bool DreamdumpNonRedumpMode
|
||||
// {
|
||||
// get { return GetBooleanSetting(Settings, "DreamdumpNonRedumpMode", false); }
|
||||
// set { Settings["DreamdumpNonRedumpMode"] = value.ToString(); }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Currently selected default Dreamdump sector order
|
||||
// /// </summary>
|
||||
// public DreamdumpSectorOrder DreamdumpSectorOrder
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// var valueString = GetStringSetting(Settings, DreamdumpSettings.SectorOrder, DreamdumpSettings.SectorOrderDefault);
|
||||
// return valueString.ToDreamdumpSectorOrder();
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// Settings[DreamdumpSettings.SectorOrder] = value.ToString();
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Default number of rereads
|
||||
// /// </summary>
|
||||
// public int DreamdumpRereadCount
|
||||
// {
|
||||
// get { return GetInt32Setting(Settings, DreamdumpSettings.RereadCount, DreamdumpSettings.RereadCountDefault); }
|
||||
// set { Settings[DreamdumpSettings.RereadCount] = value.ToString(); }
|
||||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Redumper
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace MPF.Frontend
|
||||
// Capture the current synchronization context.
|
||||
// If there is no current context, we use a default instance targeting the ThreadPool.
|
||||
_synchronizationContext = SynchronizationContext.Current ?? ProgressStatics.DefaultContext;
|
||||
Debug.Assert(_synchronizationContext != null);
|
||||
Debug.Assert(_synchronizationContext is not null);
|
||||
_invokeHandlers = new SendOrPostCallback(InvokeHandlers);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace MPF.Frontend
|
||||
// an event handler is removed between now and then.
|
||||
Action<T>? handler = _handler;
|
||||
EventHandler<T>? changedEvent = ProgressChanged;
|
||||
if (handler != null || changedEvent != null)
|
||||
if (handler is not null || changedEvent is not null)
|
||||
{
|
||||
// Post the processing to the sync context.
|
||||
// (If T is a value type, it will get boxed here.)
|
||||
|
||||
@@ -10,19 +10,30 @@ namespace MPF.Frontend
|
||||
/// <summary>
|
||||
/// Internal representation of success
|
||||
/// </summary>
|
||||
private readonly bool _success;
|
||||
private readonly bool? _success;
|
||||
|
||||
/// <summary>
|
||||
/// Optional message for the result
|
||||
/// </summary>
|
||||
public string Message { get; }
|
||||
|
||||
private ResultEventArgs(bool success, string message)
|
||||
private ResultEventArgs(bool? success, string message)
|
||||
{
|
||||
_success = success;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a default neutral result with no message
|
||||
/// </summary>
|
||||
public static ResultEventArgs Neutral() => new(null, string.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Create a neutral result with a custom message
|
||||
/// </summary>
|
||||
/// <param name="message">String to add as a message</param>
|
||||
public static ResultEventArgs Neutral(string? message) => new(null, message ?? string.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Create a default success result with no message
|
||||
/// </summary>
|
||||
@@ -49,7 +60,7 @@ namespace MPF.Frontend
|
||||
/// <summary>
|
||||
/// Results can be compared to boolean values based on the success value
|
||||
/// </summary>
|
||||
public static implicit operator bool(ResultEventArgs result) => result._success;
|
||||
public static implicit operator bool?(ResultEventArgs result) => result._success;
|
||||
|
||||
/// <summary>
|
||||
/// Results can be compared to boolean values based on the success value
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace MPF.Frontend.Tools
|
||||
/// </summary>
|
||||
public static int GetDefaultSpeedForMediaType(MediaType? mediaType, Options options)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return mediaType switch
|
||||
{
|
||||
// CD dump speed
|
||||
@@ -37,6 +38,7 @@ namespace MPF.Frontend.Tools
|
||||
// Default
|
||||
_ => options.PreferredDumpSpeedCD,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,7 +119,7 @@ namespace MPF.Frontend.Tools
|
||||
public static string? NormalizeDiscTitle(string? title, Language?[]? languages)
|
||||
{
|
||||
// If we have no set languages, then assume English
|
||||
if (languages == null || languages.Length == 0)
|
||||
if (languages is null || languages.Length == 0)
|
||||
languages = [Language.English];
|
||||
|
||||
// Loop through all of the given languages
|
||||
@@ -591,7 +593,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
// Get current assembly version
|
||||
var assemblyVersion = Assembly.GetEntryAssembly()?.GetName()?.Version;
|
||||
if (assemblyVersion == null)
|
||||
if (assemblyVersion is null)
|
||||
{
|
||||
different = false;
|
||||
message = "Assembly version could not be determined";
|
||||
@@ -603,7 +605,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Get the latest tag from GitHub
|
||||
_ = GetRemoteVersionAndUrl(out string? tag, out url);
|
||||
different = version != tag && tag != null;
|
||||
different = version != tag && tag is not null;
|
||||
|
||||
message = $"Local version: {version}"
|
||||
+ $"{Environment.NewLine}Remote version: {tag}"
|
||||
@@ -627,7 +629,7 @@ namespace MPF.Frontend.Tools
|
||||
try
|
||||
{
|
||||
var assembly = Assembly.GetEntryAssembly();
|
||||
if (assembly == null)
|
||||
if (assembly is null)
|
||||
return null;
|
||||
|
||||
var assemblyVersion = Attribute.GetCustomAttribute(assembly, typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;
|
||||
@@ -660,11 +662,11 @@ namespace MPF.Frontend.Tools
|
||||
message.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0");
|
||||
var latestReleaseJsonString = hc.SendAsync(message)?.ConfigureAwait(false).GetAwaiter().GetResult()
|
||||
.Content?.ReadAsStringAsync().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
if (latestReleaseJsonString == null)
|
||||
if (latestReleaseJsonString is null)
|
||||
return false;
|
||||
|
||||
var latestReleaseJson = Newtonsoft.Json.Linq.JObject.Parse(latestReleaseJsonString);
|
||||
if (latestReleaseJson == null)
|
||||
if (latestReleaseJson is null)
|
||||
return false;
|
||||
|
||||
tag = latestReleaseJson["tag_name"]?.ToString();
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace MPF.Frontend.Tools
|
||||
try
|
||||
{
|
||||
// Fail on a missing disc key
|
||||
if (discKey == null)
|
||||
if (discKey is null)
|
||||
return false;
|
||||
|
||||
// Output IRD file path
|
||||
@@ -79,9 +79,9 @@ namespace MPF.Frontend.Tools
|
||||
new LibIRD.ReIRD(isoPath, discKey, layerbreak, uid));
|
||||
|
||||
// Set optional fields if valid
|
||||
if (pic != null)
|
||||
if (pic is not null)
|
||||
ird.PIC = pic;
|
||||
if (discID != null && ird.DiscID[15] != 0x00)
|
||||
if (discID is not null && ird.DiscID[15] != 0x00)
|
||||
ird.DiscID = discID;
|
||||
|
||||
// Write IRD to file
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_configPath != null)
|
||||
if (_configPath is not null)
|
||||
return _configPath;
|
||||
|
||||
_configPath = GetConfigurationPath();
|
||||
@@ -238,27 +238,17 @@ namespace MPF.Frontend.Tools
|
||||
/// </summary>
|
||||
private static string GetConfigurationPath()
|
||||
{
|
||||
// User home directory
|
||||
#if NET20 || NET35
|
||||
string homeDir = Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
|
||||
homeDir = Path.Combine(Path.Combine(homeDir, ".config"), "mpf");
|
||||
#else
|
||||
string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
homeDir = Path.Combine(homeDir, ".config", "mpf");
|
||||
#endif
|
||||
// User configuration
|
||||
string homeDir = GetUserConfigurationPath();
|
||||
if (File.Exists(Path.Combine(homeDir, ConfigurationFileName)))
|
||||
return Path.Combine(homeDir, ConfigurationFileName);
|
||||
|
||||
// Local folder
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
string runtimeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
#else
|
||||
string runtimeDir = AppContext.BaseDirectory;
|
||||
#endif
|
||||
// Portable configuration
|
||||
string runtimeDir = GetRuntimeConfigurationPath();
|
||||
if (File.Exists(Path.Combine(runtimeDir, ConfigurationFileName)))
|
||||
return Path.Combine(runtimeDir, ConfigurationFileName);
|
||||
|
||||
// Attempt to use local folder
|
||||
// Attempt portable configuration
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(runtimeDir);
|
||||
@@ -267,7 +257,7 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
catch { }
|
||||
|
||||
// Attempt to use home directory
|
||||
// Attempt user configuration
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(homeDir);
|
||||
@@ -280,6 +270,34 @@ namespace MPF.Frontend.Tools
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the runtime configuration path
|
||||
/// </summary>
|
||||
private static string GetRuntimeConfigurationPath()
|
||||
{
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
#else
|
||||
return AppContext.BaseDirectory;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the user configuration path
|
||||
/// </summary>
|
||||
/// <remarks>Typically this is located in the profile or home directory</remarks>
|
||||
private static string GetUserConfigurationPath()
|
||||
{
|
||||
#if NET20 || NET35
|
||||
string homeDir = Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
|
||||
homeDir = Path.Combine(Path.Combine(homeDir, ".config"), "mpf");
|
||||
#else
|
||||
string homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
homeDir = Path.Combine(homeDir, ".config", "mpf");
|
||||
#endif
|
||||
return homeDir;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Fix the Y2K timestamp issue, if required
|
||||
if (fixTwoDigitYear)
|
||||
year = year >= 1900 && year < 1920 ? 2000 + year % 100 : year;
|
||||
year = year >= 1900 && year < 1920 ? 2000 + (year % 100) : year;
|
||||
|
||||
// Format and return the string
|
||||
var dt = new DateTime(year, month, day);
|
||||
@@ -71,7 +71,7 @@ namespace MPF.Frontend.Tools
|
||||
/// <returns>Byte array of first sector of data, null on error</returns>
|
||||
public static byte[]? GetFirstBytes(Drive? drive, int numBytes)
|
||||
{
|
||||
if (drive == null || drive.Letter == null || drive.Letter == '\0')
|
||||
if (drive is null || drive.Letter is null || drive.Letter == '\0')
|
||||
return null;
|
||||
|
||||
// Must read between 1 and 2048 bytes
|
||||
@@ -549,7 +549,7 @@ namespace MPF.Frontend.Tools
|
||||
var appPkgHeaderDeserializer = new SabreTools.Serialization.Readers.AppPkgHeader();
|
||||
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);
|
||||
|
||||
if (appPkgHeader != null)
|
||||
if (appPkgHeader is not null)
|
||||
pkgInfo += $"{appPkgHeader.ContentID}{Environment.NewLine}";
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
// Attempt to get the param.json file
|
||||
var json = GetPlayStation5ParamsJsonFromDrive(drive);
|
||||
if (json == null)
|
||||
if (json is null)
|
||||
return null;
|
||||
|
||||
try
|
||||
@@ -597,7 +597,7 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
// Attempt to get the param.json file
|
||||
var json = GetPlayStation5ParamsJsonFromDrive(drive);
|
||||
if (json == null)
|
||||
if (json is null)
|
||||
return null;
|
||||
|
||||
try
|
||||
@@ -700,7 +700,7 @@ namespace MPF.Frontend.Tools
|
||||
var appPkgHeaderDeserializer = new SabreTools.Serialization.Readers.AppPkgHeader();
|
||||
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);
|
||||
|
||||
if (appPkgHeader != null)
|
||||
if (appPkgHeader is not null)
|
||||
pkgInfo += $"{appPkgHeader.ContentID}{Environment.NewLine}";
|
||||
}
|
||||
|
||||
@@ -782,17 +782,17 @@ namespace MPF.Frontend.Tools
|
||||
try
|
||||
{
|
||||
var catalog = new SabreTools.Serialization.Readers.Catalog().Deserialize(catalogjs);
|
||||
if (catalog == null)
|
||||
if (catalog is null)
|
||||
return null;
|
||||
if (!string.IsNullOrEmpty(catalog.TitleID))
|
||||
return catalog.TitleID;
|
||||
if (catalog.Packages == null)
|
||||
if (catalog.Packages is null)
|
||||
return null;
|
||||
|
||||
List<string> titleIDs = [];
|
||||
foreach (var package in catalog.Packages)
|
||||
{
|
||||
if (package?.TitleID != null)
|
||||
if (package?.TitleID is not null)
|
||||
titleIDs.Add(package.TitleID);
|
||||
}
|
||||
|
||||
@@ -816,11 +816,11 @@ namespace MPF.Frontend.Tools
|
||||
/// <returns>Detected RedumpSystem if detected, null otherwise</returns>
|
||||
public static RedumpSystem? DetectSegaSystem(Drive? drive)
|
||||
{
|
||||
if (drive == null)
|
||||
if (drive is null)
|
||||
return null;
|
||||
|
||||
byte[]? firstSector = GetFirstBytes(drive, 0x10);
|
||||
if (firstSector == null || firstSector.Length < 0x10)
|
||||
if (firstSector is null || firstSector.Length < 0x10)
|
||||
return null;
|
||||
|
||||
string systemType = Encoding.ASCII.GetString(firstSector, 0x00, 0x10);
|
||||
@@ -850,11 +850,11 @@ namespace MPF.Frontend.Tools
|
||||
/// <returns>RedumpSystem.Panasonic3DOInteractiveMultiplayer if detected, null otherwise</returns>
|
||||
public static RedumpSystem? Detect3DOSystem(Drive? drive)
|
||||
{
|
||||
if (drive == null)
|
||||
if (drive is null)
|
||||
return null;
|
||||
|
||||
byte[]? firstSector = GetFirstBytes(drive, 0xC0);
|
||||
if (firstSector == null || firstSector.Length < 0xC0)
|
||||
if (firstSector is null || firstSector.Length < 0xC0)
|
||||
return null;
|
||||
|
||||
string systemType = Encoding.ASCII.GetString(firstSector, 0xB0, 0x10);
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using BinaryObjectScanner;
|
||||
using SabreTools.IO.Extensions;
|
||||
|
||||
#pragma warning disable SYSLIB1045 // Convert to 'GeneratedRegexAttribute'
|
||||
namespace MPF.Frontend.Tools
|
||||
{
|
||||
public static class ProtectionTool
|
||||
@@ -42,6 +43,7 @@ namespace MPF.Frontend.Tools
|
||||
"Installer VISE",
|
||||
"Intel Installation Framework",
|
||||
"Microsoft CAB SFX",
|
||||
"MPRESS",
|
||||
"NeoLite",
|
||||
"NSIS",
|
||||
"PE Compact",
|
||||
@@ -73,7 +75,7 @@ namespace MPF.Frontend.Tools
|
||||
/// <param name="drive">Drive object representing the current drive</param>
|
||||
/// <param name="options">Options object that determines what to scan</param>
|
||||
/// <param name="progress">Optional progress callback</param>
|
||||
public async static Task<Dictionary<string, List<string>>> RunCombinedProtectionScans(string basePath,
|
||||
public static async Task<Dictionary<string, List<string>>> RunCombinedProtectionScans(string basePath,
|
||||
Drive? drive,
|
||||
Options options,
|
||||
IProgress<ProtectionProgress>? protectionProgress = null)
|
||||
@@ -122,7 +124,7 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
|
||||
// Scan the mounted drive path
|
||||
if (drive?.Name != null)
|
||||
if (drive?.Name is not null)
|
||||
{
|
||||
var driveProtections = await RunProtectionScanOnPath(drive.Name, options, protectionProgress);
|
||||
MergeDictionaries(protections, driveProtections);
|
||||
@@ -160,7 +162,7 @@ namespace MPF.Frontend.Tools
|
||||
});
|
||||
|
||||
// If nothing was returned, return
|
||||
if (found == null || found.Count == 0)
|
||||
if (found is null || found.Count == 0)
|
||||
return [];
|
||||
|
||||
// Return the filtered set of protections
|
||||
@@ -196,7 +198,7 @@ namespace MPF.Frontend.Tools
|
||||
});
|
||||
|
||||
// If nothing was returned, return
|
||||
if (found == null || found.Count == 0)
|
||||
if (found is null || found.Count == 0)
|
||||
return [];
|
||||
|
||||
// Return the filtered set of protections
|
||||
@@ -212,11 +214,11 @@ namespace MPF.Frontend.Tools
|
||||
public static string? FormatProtections(Dictionary<string, List<string>>? protections, Drive? drive)
|
||||
{
|
||||
// If the filtered list is empty in some way, return
|
||||
if (protections == null)
|
||||
if (protections is null)
|
||||
return "[EXTERNAL SCAN NEEDED]";
|
||||
else if (protections.Count == 0 && drive?.Name == null)
|
||||
else if (protections.Count == 0 && drive?.Name is null)
|
||||
return "Mounted disc path missing [EXTERNAL SCAN NEEDED]";
|
||||
else if (protections.Count == 0 && drive?.Name != null)
|
||||
else if (protections.Count == 0 && drive?.Name is not null)
|
||||
return "None found [OMIT FROM SUBMISSION]";
|
||||
|
||||
// Sanitize context-sensitive protections
|
||||
@@ -306,7 +308,7 @@ namespace MPF.Frontend.Tools
|
||||
string[] paths = [.. protections.Keys];
|
||||
foreach (var path in paths)
|
||||
{
|
||||
if (!protections.TryGetValue(path, out var values) || values == null || values.Count == 0)
|
||||
if (!protections.TryGetValue(path, out var values) || values is null || values.Count == 0)
|
||||
continue;
|
||||
|
||||
// Always copy the values if they're valid
|
||||
@@ -331,7 +333,7 @@ namespace MPF.Frontend.Tools
|
||||
// Loop through the matching paths
|
||||
foreach (var path in matchingPaths)
|
||||
{
|
||||
if (!filtered.TryGetValue(path, out var values) || values == null || values.Count == 0)
|
||||
if (!filtered.TryGetValue(path, out var values) || values is null || values.Count == 0)
|
||||
continue;
|
||||
|
||||
if (values.Exists(s => !s.Contains("GitHub") &&
|
||||
@@ -368,6 +370,7 @@ namespace MPF.Frontend.Tools
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("[Exception opening file") && !p.StartsWith("[Access issue when opening file"));
|
||||
foundProtections.Add("Exception occurred while scanning [RESCAN NEEDED]");
|
||||
}
|
||||
|
||||
if (foundProtections.Exists(p => p.StartsWith("[Access issue when opening file")))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("[Exception opening file") && !p.StartsWith("[Access issue when opening file"));
|
||||
@@ -546,8 +549,8 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
|
||||
// Next best case for SafeDisc 1: A SafeDisc version range is found from "SECDRV.SYS".
|
||||
else if (foundProtections.Exists(p => p.StartsWith("Macrovision Security Driver")
|
||||
&& Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}-[1-2]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)
|
||||
else if (foundProtections.Exists(p => (p.StartsWith("Macrovision Security Driver")
|
||||
&& Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}-[1-2]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled))
|
||||
|| Regex.IsMatch(p, @"SafeDisc 1\.[0-9]{2}\.[0-9]{3}$")))
|
||||
{
|
||||
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Add the volume label to comments, if possible or necessary
|
||||
string? volLabels = FormatVolumeLabels(drive?.VolumeLabel, processor.VolumeLabels);
|
||||
if (volLabels != null)
|
||||
if (volLabels is not null)
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.VolumeLabel] = volLabels;
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
@@ -119,9 +119,9 @@ namespace MPF.Frontend.Tools
|
||||
ProcessSystem(info, system, drive, options.AddPlaceholders, processor is DiscImageCreator, basePath);
|
||||
|
||||
// Run anti-modchip check, if necessary
|
||||
if (drive != null && system.SupportsAntiModchipScans() && info.CopyProtection.AntiModchip == YesNo.NULL)
|
||||
if (drive is not null && system.SupportsAntiModchipScans() && info.CopyProtection.AntiModchip == YesNo.NULL)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Success("Checking for anti-modchip strings... this might take a while!"));
|
||||
resultProgress?.Report(ResultEventArgs.Neutral("Checking for anti-modchip strings... this might take a while!"));
|
||||
info.CopyProtection.AntiModchip = await ProtectionTool.GetPlayStationAntiModchipDetected(drive?.Name) ? YesNo.Yes : YesNo.No;
|
||||
resultProgress?.Report(ResultEventArgs.Success("Anti-modchip string scan complete!"));
|
||||
}
|
||||
@@ -129,7 +129,7 @@ namespace MPF.Frontend.Tools
|
||||
// Run copy protection, if possible or necessary
|
||||
if (system.SupportsCopyProtectionScans())
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Success("Running copy protection scan... this might take a while!"));
|
||||
resultProgress?.Report(ResultEventArgs.Neutral("Running copy protection scan... this might take a while!"));
|
||||
|
||||
try
|
||||
{
|
||||
@@ -137,7 +137,7 @@ namespace MPF.Frontend.Tools
|
||||
if (options.ScanForProtection)
|
||||
{
|
||||
// Explicitly note missing/invalid device paths
|
||||
if (drive?.Name == null)
|
||||
if (drive?.Name is null)
|
||||
resultProgress?.Report(ResultEventArgs.Success("No mounted device path found, protection outputs may be incomplete!"));
|
||||
|
||||
protections = await ProtectionTool.RunCombinedProtectionScans(basePath, drive, options, protectionProgress);
|
||||
@@ -177,7 +177,7 @@ namespace MPF.Frontend.Tools
|
||||
/// <param name="options">Options object representing user-defined options</param>
|
||||
/// <param name="info">Existing SubmissionInfo object to fill</param>
|
||||
/// <param name="resultProgress">Optional result progress callback</param>
|
||||
public async static Task<bool> FillFromRedump(Options options,
|
||||
public static async Task<bool> FillFromRedump(Options options,
|
||||
SubmissionInfo info,
|
||||
IProgress<ResultEventArgs>? resultProgress = null)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ namespace MPF.Frontend.Tools
|
||||
if (!string.IsNullOrEmpty(options.RedumpUsername) && !string.IsNullOrEmpty(options.RedumpPassword))
|
||||
{
|
||||
bool? loggedIn = await wc.Login(options.RedumpUsername!, options.RedumpPassword!);
|
||||
if (loggedIn == null)
|
||||
if (loggedIn is null)
|
||||
{
|
||||
resultProgress?.Report(ResultEventArgs.Failure("There was an unknown error connecting to Redump, skipping..."));
|
||||
return false;
|
||||
@@ -210,7 +210,7 @@ namespace MPF.Frontend.Tools
|
||||
List<int[]> foundIdSets = [];
|
||||
|
||||
// Loop through all of the hashdata to find matching IDs
|
||||
resultProgress?.Report(ResultEventArgs.Success("Finding disc matches on Redump..."));
|
||||
resultProgress?.Report(ResultEventArgs.Neutral("Finding disc matches on Redump..."));
|
||||
var splitData = info.TracksAndWriteOffsets.ClrMameProData?.TrimEnd('\n')?.Split('\n');
|
||||
int trackCount = splitData?.Length ?? 0;
|
||||
foreach (string hashData in splitData ?? [])
|
||||
@@ -219,7 +219,7 @@ namespace MPF.Frontend.Tools
|
||||
if (string.IsNullOrEmpty(hashData))
|
||||
{
|
||||
trackCount--;
|
||||
resultProgress?.Report(ResultEventArgs.Success("Blank line found, skipping!"));
|
||||
resultProgress?.Report(ResultEventArgs.Neutral("Blank line found, skipping!"));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace MPF.Frontend.Tools
|
||||
|| hashData.Contains("(Track AA.5).bin"))
|
||||
{
|
||||
trackCount--;
|
||||
resultProgress?.Report(ResultEventArgs.Success("Extra track found, skipping!"));
|
||||
resultProgress?.Report(ResultEventArgs.Neutral("Extra track found, skipping!"));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -266,9 +266,9 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
|
||||
var foundIds = await Validator.ValidateSingleTrack(wc, info, sha1);
|
||||
if (foundIds != null && foundIds.Count == 1)
|
||||
if (foundIds is not null && foundIds.Count == 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Single match found for {sha1}"));
|
||||
else if (foundIds != null && foundIds.Count != 1)
|
||||
else if (foundIds is not null && foundIds.Count != 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for {sha1}"));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure($"No matches found for {sha1}"));
|
||||
@@ -277,7 +277,7 @@ namespace MPF.Frontend.Tools
|
||||
foundIdSets.Add(foundIds?.ToArray() ?? []);
|
||||
|
||||
// Ensure that all tracks are found
|
||||
allFound &= (foundIds != null && foundIds.Count >= 1);
|
||||
allFound &= foundIds is not null && foundIds.Count >= 1;
|
||||
}
|
||||
|
||||
// If all tracks were found, check if there are any fully-matched IDs
|
||||
@@ -288,7 +288,7 @@ namespace MPF.Frontend.Tools
|
||||
foreach (var set in foundIdSets)
|
||||
{
|
||||
// First track is always all IDs
|
||||
if (fullyMatchedIdsSet == null)
|
||||
if (fullyMatchedIdsSet is null)
|
||||
{
|
||||
fullyMatchedIdsSet = [.. set];
|
||||
continue;
|
||||
@@ -306,25 +306,25 @@ namespace MPF.Frontend.Tools
|
||||
{
|
||||
string sha1 = info.CommonDiscInfo.CommentsSpecialFields[SiteCode.UniversalHash];
|
||||
var foundIds = await Validator.ValidateUniversalHash(wc, info);
|
||||
if (foundIds != null && foundIds.Count == 1)
|
||||
if (foundIds is not null && foundIds.Count == 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Single match found for universal hash {sha1}"));
|
||||
else if (foundIds != null && foundIds.Count != 1)
|
||||
else if (foundIds is not null && foundIds.Count != 1)
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Multiple matches found for universal hash {sha1}"));
|
||||
else
|
||||
resultProgress?.Report(ResultEventArgs.Failure($"No matches found for universal hash {sha1}"));
|
||||
|
||||
// Ensure that the hash is found
|
||||
allFound = (foundIds != null && foundIds.Count == 1);
|
||||
allFound = foundIds is not null && foundIds.Count == 1;
|
||||
|
||||
// If we found a match, then the disc is a match
|
||||
if (foundIds != null && foundIds.Count == 1)
|
||||
if (foundIds is not null && foundIds.Count == 1)
|
||||
fullyMatchedIdsSet = [.. foundIds];
|
||||
else
|
||||
fullyMatchedIdsSet = [];
|
||||
}
|
||||
|
||||
// Get a list version of the fully matched IDs
|
||||
List<int> fullyMatchedIdsList = fullyMatchedIdsSet != null ? [.. fullyMatchedIdsSet] : [];
|
||||
List<int> fullyMatchedIdsList = fullyMatchedIdsSet is not null ? [.. fullyMatchedIdsSet] : [];
|
||||
|
||||
// Make sure we only have unique IDs
|
||||
var partiallyMatchedIds = new HashSet<int>();
|
||||
@@ -332,12 +332,12 @@ namespace MPF.Frontend.Tools
|
||||
info.PartiallyMatchedIDs = [.. partiallyMatchedIds];
|
||||
info.PartiallyMatchedIDs.Sort();
|
||||
|
||||
resultProgress?.Report(ResultEventArgs.Success("Match finding complete! " + (fullyMatchedIdsList != null && fullyMatchedIdsList.Count > 0
|
||||
resultProgress?.Report(ResultEventArgs.Success("Match finding complete! " + (fullyMatchedIdsList is not null && fullyMatchedIdsList.Count > 0
|
||||
? "Fully Matched IDs: " + string.Join(",", [.. fullyMatchedIdsList.ConvertAll(i => i.ToString())])
|
||||
: "No matches found")));
|
||||
|
||||
// Exit early if one failed or there are no matched IDs
|
||||
if (!allFound || fullyMatchedIdsList == null || fullyMatchedIdsList.Count == 0)
|
||||
if (!allFound || fullyMatchedIdsList is null || fullyMatchedIdsList.Count == 0)
|
||||
return false;
|
||||
|
||||
// Find the first matched ID where the track count matches, we can grab a bunch of info from it
|
||||
@@ -349,7 +349,7 @@ namespace MPF.Frontend.Tools
|
||||
continue;
|
||||
|
||||
// Fill in the fields from the existing ID
|
||||
resultProgress?.Report(ResultEventArgs.Success($"Filling fields from existing ID {fullyMatchedIdsList[i]}..."));
|
||||
resultProgress?.Report(ResultEventArgs.Neutral($"Filling fields from existing ID {fullyMatchedIdsList[i]}..."));
|
||||
_ = await Builder.FillFromId(wc, info, fullyMatchedIdsList[i], options.PullAllInformation);
|
||||
resultProgress?.Report(ResultEventArgs.Success("Information filling complete!"));
|
||||
|
||||
@@ -421,9 +421,10 @@ namespace MPF.Frontend.Tools
|
||||
// Map to the internal program
|
||||
InternalProgram? internalProgram = processor switch
|
||||
{
|
||||
Processors.Aaru => InternalProgram.Aaru,
|
||||
Aaru => InternalProgram.Aaru,
|
||||
CleanRip => InternalProgram.CleanRip,
|
||||
DiscImageCreator => InternalProgram.DiscImageCreator,
|
||||
// Dreamdump => InternalProgram.Dreamdump,
|
||||
PS3CFW => InternalProgram.PS3CFW,
|
||||
Redumper => InternalProgram.Redumper,
|
||||
UmdImageCreator => InternalProgram.UmdImageCreator,
|
||||
@@ -443,7 +444,7 @@ namespace MPF.Frontend.Tools
|
||||
private static string? SimplifyVolumeLabel(string? label)
|
||||
{
|
||||
// Ignore empty labels
|
||||
if (label == null || label.Length == 0)
|
||||
if (label is null || label.Length == 0)
|
||||
return null;
|
||||
|
||||
// Take only ASCII alphanumeric characters
|
||||
@@ -460,7 +461,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Ignore non-ASCII labels
|
||||
string? simpleLabel = labelBuilder.ToString();
|
||||
if (simpleLabel == null || simpleLabel.Length == 0)
|
||||
if (simpleLabel is null || simpleLabel.Length == 0)
|
||||
return null;
|
||||
|
||||
return simpleLabel;
|
||||
@@ -474,23 +475,23 @@ namespace MPF.Frontend.Tools
|
||||
private static string? FormatVolumeLabels(string? driveLabel, Dictionary<string, List<string>>? labels)
|
||||
{
|
||||
// Treat empty label as null
|
||||
if (driveLabel != null && driveLabel.Length == 0)
|
||||
if (driveLabel is not null && driveLabel.Length == 0)
|
||||
driveLabel = null;
|
||||
|
||||
// Treat "path" labels as null -- Indicates a mounted path
|
||||
// This can over-match if a label contains a directory separator somehow
|
||||
if (driveLabel != null && (driveLabel.Contains("/") || driveLabel.Contains("\\")))
|
||||
if (driveLabel is not null && (driveLabel.Contains("/") || driveLabel.Contains("\\")))
|
||||
driveLabel = null;
|
||||
|
||||
// Must have at least one label to format
|
||||
if (driveLabel == null && (labels == null || labels.Count == 0))
|
||||
if (driveLabel is null && (labels is null || labels.Count == 0))
|
||||
return null;
|
||||
|
||||
// If no labels given, use drive label
|
||||
if (labels == null || labels.Count == 0)
|
||||
if (labels is null || labels.Count == 0)
|
||||
{
|
||||
// Ignore common volume labels
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(driveLabel) != null)
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(driveLabel) is not null)
|
||||
return null;
|
||||
|
||||
return driveLabel;
|
||||
@@ -499,7 +500,7 @@ namespace MPF.Frontend.Tools
|
||||
// Get the default label to compare against
|
||||
// TODO: Full pairwise comparison of all labels, not just comparing against drive/UDF label.
|
||||
string? defaultLabel = null;
|
||||
if (driveLabel != null && driveLabel.Length != 0)
|
||||
if (driveLabel is not null && driveLabel.Length != 0)
|
||||
{
|
||||
defaultLabel = SimplifyVolumeLabel(driveLabel);
|
||||
}
|
||||
@@ -514,7 +515,7 @@ namespace MPF.Frontend.Tools
|
||||
#endif
|
||||
|
||||
// Remove duplicate/useless volume labels
|
||||
if (defaultLabel != null && defaultLabel.Length != 0)
|
||||
if (defaultLabel is not null && defaultLabel.Length != 0)
|
||||
{
|
||||
List<string> keys = [.. labels.Keys];
|
||||
foreach (var label in keys)
|
||||
@@ -528,7 +529,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Get upper-case ASCII variant of the label
|
||||
string? tempLabel = SimplifyVolumeLabel(label);
|
||||
if (tempLabel == null)
|
||||
if (tempLabel is null)
|
||||
continue;
|
||||
|
||||
// Remove duplicate volume labels
|
||||
@@ -538,10 +539,10 @@ namespace MPF.Frontend.Tools
|
||||
}
|
||||
|
||||
// If no labels are left, use drive label
|
||||
if (labels == null || labels.Count == 0)
|
||||
if (labels is null || labels.Count == 0)
|
||||
{
|
||||
// Ignore common volume labels
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(driveLabel) != null)
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(driveLabel) is not null)
|
||||
return null;
|
||||
|
||||
return driveLabel;
|
||||
@@ -554,10 +555,10 @@ namespace MPF.Frontend.Tools
|
||||
#else
|
||||
string firstLabel = labels.First().Key;
|
||||
#endif
|
||||
if (labels.Count == 1 && (firstLabel == driveLabel || driveLabel == null))
|
||||
if (labels.Count == 1 && (firstLabel == driveLabel || driveLabel is null))
|
||||
{
|
||||
// Ignore common volume labels
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(firstLabel) != null)
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(firstLabel) is not null)
|
||||
return null;
|
||||
|
||||
return firstLabel;
|
||||
@@ -567,14 +568,14 @@ namespace MPF.Frontend.Tools
|
||||
List<string> volLabels = [];
|
||||
|
||||
// Begin formatted output with the label from Windows, if it is unique and not a common volume label
|
||||
if (driveLabel != null && !labels.TryGetValue(driveLabel, out List<string>? value) && FrontendTool.GetRedumpSystemFromVolumeLabel(driveLabel) == null)
|
||||
if (driveLabel is not null && !labels.TryGetValue(driveLabel, out List<string>? value) && FrontendTool.GetRedumpSystemFromVolumeLabel(driveLabel) is null)
|
||||
volLabels.Add(driveLabel);
|
||||
|
||||
// Add remaining labels with their corresponding filesystems
|
||||
foreach (var kvp in labels)
|
||||
{
|
||||
// Ignore common volume labels
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(kvp.Key) == null)
|
||||
if (FrontendTool.GetRedumpSystemFromVolumeLabel(kvp.Key) is null)
|
||||
volLabels.Add($"{kvp.Key} ({string.Join(", ", [.. kvp.Value])})");
|
||||
}
|
||||
|
||||
@@ -593,6 +594,7 @@ namespace MPF.Frontend.Tools
|
||||
/// </summary>
|
||||
private static bool ProcessMediaType(SubmissionInfo info, MediaType? mediaType, bool addPlaceholders)
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
switch (mediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -736,6 +738,7 @@ namespace MPF.Frontend.Tools
|
||||
info.TracksAndWriteOffsets.ClrMameProData = null;
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -745,6 +748,7 @@ namespace MPF.Frontend.Tools
|
||||
/// </summary>
|
||||
private static bool ProcessSystem(SubmissionInfo info, RedumpSystem? system, Drive? drive, bool addPlaceholders, bool isDiscImageCreator, string basePath)
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
// Extract info based specifically on RedumpSystem
|
||||
switch (system)
|
||||
{
|
||||
@@ -984,6 +988,7 @@ namespace MPF.Frontend.Tools
|
||||
info.CopyProtection.Protection ??= addPlaceholders ? RequiredIfExistsValue : string.Empty;
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1006,7 +1011,7 @@ namespace MPF.Frontend.Tools
|
||||
private static bool CommentFieldExists(SubmissionInfo info, SiteCode key, out string? value)
|
||||
{
|
||||
// Ensure the comments fields exist
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields == null)
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields is null)
|
||||
info.CommonDiscInfo.CommentsSpecialFields = [];
|
||||
|
||||
// Check if the field exists
|
||||
@@ -1022,7 +1027,7 @@ namespace MPF.Frontend.Tools
|
||||
/// <summary>
|
||||
/// Set a comment field if it doesn't already have a value
|
||||
/// </summary>
|
||||
private static void SetCommentFieldIfNotExists(SubmissionInfo info, SiteCode key, Drive? drive, System.Func<Drive?, string?> valueFunc)
|
||||
private static void SetCommentFieldIfNotExists(SubmissionInfo info, SiteCode key, Drive? drive, Func<Drive?, string?> valueFunc)
|
||||
{
|
||||
// If the field has a valid value, skip
|
||||
if (CommentFieldExists(info, key, out _))
|
||||
@@ -1030,7 +1035,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Set the value
|
||||
string? value = valueFunc(drive);
|
||||
if (value != null)
|
||||
if (value is not null)
|
||||
info.CommonDiscInfo.CommentsSpecialFields[key] = value;
|
||||
}
|
||||
|
||||
@@ -1040,7 +1045,7 @@ namespace MPF.Frontend.Tools
|
||||
private static bool ContentFieldExists(SubmissionInfo info, SiteCode key, out string? value)
|
||||
{
|
||||
// Ensure the contents fields exist
|
||||
if (info.CommonDiscInfo.ContentsSpecialFields == null)
|
||||
if (info.CommonDiscInfo.ContentsSpecialFields is null)
|
||||
info.CommonDiscInfo.ContentsSpecialFields = [];
|
||||
|
||||
// Check if the field exists
|
||||
@@ -1064,7 +1069,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Set the value
|
||||
string? value = valueFunc(drive);
|
||||
if (value != null)
|
||||
if (value is not null)
|
||||
info.CommonDiscInfo.ContentsSpecialFields![key] = value;
|
||||
}
|
||||
|
||||
@@ -1089,7 +1094,7 @@ namespace MPF.Frontend.Tools
|
||||
private static Dictionary<string, List<string>?> ReformatProtectionDictionary(Dictionary<string, List<string>>? oldDict)
|
||||
{
|
||||
// Null or empty protections return empty
|
||||
if (oldDict == null || oldDict.Count == 0)
|
||||
if (oldDict is null || oldDict.Count == 0)
|
||||
return [];
|
||||
|
||||
// Reformat each set into a List
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
#if !(NET20 || NET35 || NET40)
|
||||
using System;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
@@ -349,12 +351,22 @@ namespace MPF.Frontend.ViewModels
|
||||
InternalProgram internalProgram = Options.InternalProgram;
|
||||
|
||||
// Create a static list of supported Check programs, not everything
|
||||
var internalPrograms = new List<InternalProgram> { InternalProgram.Redumper, InternalProgram.Aaru, InternalProgram.DiscImageCreator, InternalProgram.CleanRip, InternalProgram.PS3CFW, InternalProgram.UmdImageCreator, InternalProgram.XboxBackupCreator };
|
||||
var internalPrograms = new List<InternalProgram>
|
||||
{
|
||||
InternalProgram.Redumper,
|
||||
InternalProgram.Aaru,
|
||||
InternalProgram.DiscImageCreator,
|
||||
// InternalProgram.Dreamdump,
|
||||
InternalProgram.CleanRip,
|
||||
InternalProgram.PS3CFW,
|
||||
InternalProgram.UmdImageCreator,
|
||||
InternalProgram.XboxBackupCreator
|
||||
};
|
||||
InternalPrograms = internalPrograms.ConvertAll(ip => new Element<InternalProgram>(ip));
|
||||
|
||||
// Select the current default dumping program
|
||||
int currentIndex = InternalPrograms.FindIndex(m => m == internalProgram);
|
||||
CurrentProgram = (currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value);
|
||||
CurrentProgram = currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value;
|
||||
|
||||
// Reenable event handlers, if necessary
|
||||
if (cachedCanExecuteSelectionChanged) EnableEventHandlers();
|
||||
@@ -366,7 +378,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
private bool ShouldEnableCheckDumpButton()
|
||||
{
|
||||
return CurrentSystem != null && !string.IsNullOrEmpty(InputPath);
|
||||
return CurrentSystem is not null && !string.IsNullOrEmpty(InputPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -570,7 +570,7 @@ namespace MPF.Frontend.ViewModels
|
||||
&& string.IsNullOrEmpty(DiscIDString)
|
||||
&& string.IsNullOrEmpty(PICString)
|
||||
&& string.IsNullOrEmpty(PICPath)
|
||||
&& Layerbreak == null;
|
||||
&& Layerbreak is null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -677,7 +677,7 @@ namespace MPF.Frontend.ViewModels
|
||||
LogPathBrowseButtonEnabled = false;
|
||||
|
||||
byte[]? id = ProcessingTool.ParseDiscID(DiscIDString);
|
||||
if (id != null)
|
||||
if (id is not null)
|
||||
{
|
||||
DiscID = id;
|
||||
DiscIDStatus = $"Using provided ID: {DiscIDString}";
|
||||
@@ -716,7 +716,7 @@ namespace MPF.Frontend.ViewModels
|
||||
HexKeyTextBoxEnabled = false;
|
||||
|
||||
byte[]? key = ProcessingTool.ParseKeyFile(KeyPath);
|
||||
if (key != null)
|
||||
if (key is not null)
|
||||
{
|
||||
Key = key;
|
||||
KeyStatus = $"Using key from file: {Path.GetFileName(KeyPath)}";
|
||||
@@ -760,7 +760,7 @@ namespace MPF.Frontend.ViewModels
|
||||
KeyPathBrowseButtonEnabled = false;
|
||||
|
||||
byte[]? key = ProcessingTool.ParseHexKey(HexKey);
|
||||
if (key != null)
|
||||
if (key is not null)
|
||||
{
|
||||
Key = key;
|
||||
KeyStatus = $"Using provided Key: {HexKey}";
|
||||
@@ -800,7 +800,7 @@ namespace MPF.Frontend.ViewModels
|
||||
LayerbreakTextBoxEnabled = false;
|
||||
|
||||
PIC = ProcessingTool.ParsePICFile(PICPath);
|
||||
if (PIC != null)
|
||||
if (PIC is not null)
|
||||
{
|
||||
PICStatus = $"Using PIC from file: {Path.GetFileName(PICPath)}";
|
||||
CreateIRDButtonEnabled = ShouldEnableCreateIRDButton();
|
||||
@@ -843,7 +843,7 @@ namespace MPF.Frontend.ViewModels
|
||||
LayerbreakTextBoxEnabled = false;
|
||||
|
||||
PIC = ProcessingTool.ParsePIC(PICString);
|
||||
if (PIC != null)
|
||||
if (PIC is not null)
|
||||
{
|
||||
PICStatus = "Using provided PIC";
|
||||
CreateIRDButtonEnabled = ShouldEnableCreateIRDButton();
|
||||
@@ -883,7 +883,7 @@ namespace MPF.Frontend.ViewModels
|
||||
PICTextBoxEnabled = false;
|
||||
|
||||
Layerbreak = ProcessingTool.ParseLayerbreak(LayerbreakString);
|
||||
if (Layerbreak != null)
|
||||
if (Layerbreak is not null)
|
||||
{
|
||||
PICStatus = $"Will generate a PIC using a Layerbreak of {Layerbreak}";
|
||||
CreateIRDButtonEnabled = ShouldEnableCreateIRDButton();
|
||||
@@ -1042,16 +1042,16 @@ namespace MPF.Frontend.ViewModels
|
||||
return $"{InputPath!.Trim('"')} is not a valid ISO path.";
|
||||
|
||||
// TODO: Implement pulling key from redump.org
|
||||
if (Key == null)
|
||||
if (Key is null)
|
||||
return "Pulling key from redump.org is currently not implemented.";
|
||||
|
||||
try
|
||||
{
|
||||
// Create Redump-style reproducible IRD
|
||||
LibIRD.ReIRD ird = new(InputPath, Key, Layerbreak);
|
||||
if (PIC != null)
|
||||
if (PIC is not null)
|
||||
ird.PIC = PIC;
|
||||
if (DiscID != null && ird.DiscID[15] != 0x00)
|
||||
if (DiscID is not null && ird.DiscID[15] != 0x00)
|
||||
ird.DiscID = DiscID;
|
||||
ird.Write(outputPath);
|
||||
CreateIRDStatus = "IRD Created Successfully";
|
||||
|
||||
@@ -658,7 +658,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// Check for the last selected drive, if possible
|
||||
int index = -1;
|
||||
if (lastSelectedDrive != null)
|
||||
if (lastSelectedDrive is not null)
|
||||
index = Drives.FindIndex(d => d.MarkedActive && (d.Name?[0] ?? '\0') == lastSelectedDrive);
|
||||
|
||||
// Check for active optical drives
|
||||
@@ -674,7 +674,7 @@ namespace MPF.Frontend.ViewModels
|
||||
index = Drives.FindIndex(d => d.MarkedActive);
|
||||
|
||||
// Set the selected index
|
||||
CurrentDrive = (index != -1 ? Drives[index] : Drives[0]);
|
||||
CurrentDrive = index != -1 ? Drives[index] : Drives[0];
|
||||
Status = "Valid drive found!";
|
||||
CopyProtectScanButtonEnabled = true;
|
||||
|
||||
@@ -706,16 +706,16 @@ namespace MPF.Frontend.ViewModels
|
||||
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
|
||||
DisableEventHandlers();
|
||||
|
||||
if (CurrentSystem != null)
|
||||
if (CurrentSystem is not null)
|
||||
{
|
||||
var mediaTypeValues = CurrentSystem.MediaTypes();
|
||||
int index = mediaTypeValues.FindIndex(m => m == CurrentMediaType);
|
||||
if (CurrentMediaType != null && index == -1)
|
||||
if (CurrentMediaType is not null && index == -1)
|
||||
VerboseLogLn($"Disc of type '{CurrentMediaType.LongName()}' found, but the current system does not support it!");
|
||||
|
||||
MediaTypes = mediaTypeValues.ConvertAll(m => new Element<MediaType>(m ?? MediaType.NONE));
|
||||
MediaTypeComboBoxEnabled = MediaTypes.Count > 1;
|
||||
CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
CurrentMediaType = index > -1 ? MediaTypes[index] : MediaTypes[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -738,7 +738,11 @@ namespace MPF.Frontend.ViewModels
|
||||
DisableEventHandlers();
|
||||
|
||||
// Create a static list of supported programs, not everything
|
||||
#if NET5_0_OR_GREATER
|
||||
var ipArr = Enum.GetValues<InternalProgram>();
|
||||
#else
|
||||
var ipArr = (InternalProgram[])Enum.GetValues(typeof(InternalProgram));
|
||||
#endif
|
||||
ipArr = Array.FindAll(ipArr, ip => InternalProgramExists(ip));
|
||||
InternalPrograms = [.. Array.ConvertAll(ipArr, ip => new Element<InternalProgram>(ip))];
|
||||
|
||||
@@ -754,7 +758,7 @@ namespace MPF.Frontend.ViewModels
|
||||
else
|
||||
{
|
||||
int currentIndex = InternalPrograms.FindIndex(m => m == internalProgram);
|
||||
CurrentProgram = (currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value);
|
||||
CurrentProgram = currentIndex > -1 ? InternalPrograms[currentIndex].Value : InternalPrograms[0].Value;
|
||||
}
|
||||
|
||||
// Reenable event handlers, if necessary
|
||||
@@ -784,7 +788,7 @@ namespace MPF.Frontend.ViewModels
|
||||
public void ChangeMediaType(System.Collections.IList removedItems, System.Collections.IList addedItems)
|
||||
{
|
||||
// Only change the media type if the selection and not the list has changed
|
||||
if ((removedItems == null || removedItems.Count == 1) && (addedItems == null || addedItems.Count == 1))
|
||||
if ((removedItems is null || removedItems.Count == 1) && (addedItems is null || addedItems.Count == 1))
|
||||
SetSupportedDriveSpeed();
|
||||
|
||||
GetOutputNames(false);
|
||||
@@ -810,7 +814,7 @@ namespace MPF.Frontend.ViewModels
|
||||
FrontendTool.CheckForNewVersion(out different, out message, out url);
|
||||
|
||||
SecretLogLn(message);
|
||||
if (url == null)
|
||||
if (url is null)
|
||||
message = "An exception occurred while checking for versions, please try again later. See the log window for more details.";
|
||||
}
|
||||
|
||||
@@ -829,7 +833,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
CommonDiscInfo = new CommonDiscInfoSection()
|
||||
{
|
||||
System = SabreTools.RedumpLib.Data.RedumpSystem.IBMPCcompatible,
|
||||
System = RedumpSystem.IBMPCcompatible,
|
||||
Media = DiscType.BD128,
|
||||
Title = "Game Title",
|
||||
ForeignTitleNonLatin = "Foreign Game Title",
|
||||
@@ -962,11 +966,11 @@ namespace MPF.Frontend.ViewModels
|
||||
public void ToggleStartStop()
|
||||
{
|
||||
// Dump or stop the dump
|
||||
if (StartStopButtonText as string == StartDumpingValue)
|
||||
if ((StartStopButtonText as string) == StartDumpingValue)
|
||||
{
|
||||
StartDumping();
|
||||
}
|
||||
else if (StartStopButtonText as string == StopDumpingValue)
|
||||
else if ((StartStopButtonText as string) == StopDumpingValue)
|
||||
{
|
||||
VerboseLogLn("Canceling dumping process...");
|
||||
_environment?.CancelDumping();
|
||||
@@ -1009,7 +1013,7 @@ namespace MPF.Frontend.ViewModels
|
||||
StartStopButtonEnabled = false;
|
||||
|
||||
// Safely check the parameters box, just in case
|
||||
if (ParametersCheckBoxEnabled == false)
|
||||
if (!ParametersCheckBoxEnabled)
|
||||
{
|
||||
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
|
||||
DisableEventHandlers();
|
||||
@@ -1064,7 +1068,7 @@ namespace MPF.Frontend.ViewModels
|
||||
StartStopButtonEnabled = false;
|
||||
|
||||
// Safely check the parameters box, just in case
|
||||
if (ParametersCheckBoxEnabled == false)
|
||||
if (!ParametersCheckBoxEnabled)
|
||||
{
|
||||
bool cachedCanExecuteSelectionChanged = CanExecuteSelectionChanged;
|
||||
DisableEventHandlers();
|
||||
@@ -1117,7 +1121,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <param name="text">Text to write to the log</param>
|
||||
private void Log(string text)
|
||||
{
|
||||
_logger?.Invoke(LogLevel.USER, text);
|
||||
_logger?.Invoke(LogLevel.USER_GENERIC, text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1156,13 +1160,28 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <param name="text">Text to write to the log</param>
|
||||
private void SecretLogLn(string text) => SecretLog(text + "\n");
|
||||
|
||||
/// <summary>
|
||||
/// Enqueue success text to the log
|
||||
/// </summary>
|
||||
/// <param name="text">Text to write to the log</param>
|
||||
private void SuccessLog(string text)
|
||||
{
|
||||
_logger?.Invoke(LogLevel.USER_SUCCESS, text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enqueue text with a newline to the log
|
||||
/// </summary>
|
||||
/// <param name="text">Text to write to the log</param>
|
||||
private void SuccessLogLn(string text) => SuccessLog(text + "\n");
|
||||
|
||||
/// <summary>
|
||||
/// Enqueue verbose text to the log
|
||||
/// </summary>
|
||||
/// <param name="text">Text to write to the log</param>
|
||||
private void VerboseLog(string text)
|
||||
{
|
||||
if (_logger != null && Options.VerboseLogging)
|
||||
if (_logger is not null && Options.VerboseLogging)
|
||||
_logger(LogLevel.VERBOSE, text);
|
||||
}
|
||||
|
||||
@@ -1186,7 +1205,7 @@ namespace MPF.Frontend.ViewModels
|
||||
private void CacheCurrentDiscType()
|
||||
{
|
||||
// If the selected item is invalid, we just skip
|
||||
if (CurrentDrive == null)
|
||||
if (CurrentDrive is null)
|
||||
return;
|
||||
|
||||
// Get reasonable default values based on the current system
|
||||
@@ -1202,7 +1221,7 @@ namespace MPF.Frontend.ViewModels
|
||||
MediaType? detectedMediaType = CurrentDrive.GetMediaType(CurrentSystem);
|
||||
|
||||
// If we got either an error or no media, default to the current System default
|
||||
if (detectedMediaType == null)
|
||||
if (detectedMediaType is null)
|
||||
{
|
||||
VerboseLogLn($"Could not detect media type, defaulting to {defaultMediaType.LongName()}.");
|
||||
CurrentMediaType = defaultMediaType;
|
||||
@@ -1244,7 +1263,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
private void DetermineSystemType()
|
||||
{
|
||||
if (Drives == null || Drives.Count == 0 || CurrentDrive == null)
|
||||
if (Drives is null || Drives.Count == 0 || CurrentDrive is null)
|
||||
{
|
||||
VerboseLogLn("Skipping system type detection because no valid drives found!");
|
||||
}
|
||||
@@ -1252,16 +1271,16 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
VerboseLog($"Trying to detect system for drive {CurrentDrive.Name}.. ");
|
||||
var currentSystem = GetRedumpSystem(CurrentDrive);
|
||||
if (currentSystem != null)
|
||||
if (currentSystem is not null)
|
||||
VerboseLogLn($"detected {currentSystem.LongName()}.");
|
||||
|
||||
// If undetected system on inactive drive, and PC is the default system, check for potential Mac disc
|
||||
if (currentSystem == null && CurrentDrive.MarkedActive == false && Options.DefaultSystem == RedumpSystem.IBMPCcompatible)
|
||||
if (currentSystem is null && !CurrentDrive.MarkedActive && Options.DefaultSystem == RedumpSystem.IBMPCcompatible)
|
||||
{
|
||||
try
|
||||
{
|
||||
// If disc is readable on inactive drive, assume it is a Mac disc
|
||||
if (PhysicalTool.GetFirstBytes(CurrentDrive, 1) != null)
|
||||
if (PhysicalTool.GetFirstBytes(CurrentDrive, 1) is not null)
|
||||
{
|
||||
currentSystem = RedumpSystem.AppleMacintosh;
|
||||
VerboseLogLn($"unable to detect, defaulting to {currentSystem.LongName()}.");
|
||||
@@ -1271,19 +1290,19 @@ namespace MPF.Frontend.ViewModels
|
||||
}
|
||||
|
||||
// Fallback to default system only if drive is active
|
||||
if (currentSystem == null && CurrentDrive.MarkedActive)
|
||||
if (currentSystem is null && CurrentDrive.MarkedActive)
|
||||
{
|
||||
currentSystem = Options.DefaultSystem;
|
||||
VerboseLogLn($"unable to detect, defaulting to {currentSystem.LongName()}.");
|
||||
}
|
||||
|
||||
if (currentSystem != null)
|
||||
if (currentSystem is not null)
|
||||
{
|
||||
int sysIndex = Systems.FindIndex(s => s == currentSystem);
|
||||
CurrentSystem = Systems[sysIndex];
|
||||
}
|
||||
}
|
||||
else if (Options.SkipSystemDetection && Options.DefaultSystem != null)
|
||||
else if (Options.SkipSystemDetection && Options.DefaultSystem is not null)
|
||||
{
|
||||
var currentSystem = Options.DefaultSystem;
|
||||
VerboseLogLn($"System detection disabled, defaulting to {currentSystem.LongName()}.");
|
||||
@@ -1356,7 +1375,7 @@ namespace MPF.Frontend.ViewModels
|
||||
Status = result.Message;
|
||||
|
||||
// Enable or disable the button
|
||||
StartStopButtonEnabled = result && ShouldEnableDumpingButton();
|
||||
StartStopButtonEnabled = result == true && ShouldEnableDumpingButton();
|
||||
|
||||
// If we're in a type that doesn't support drive speeds
|
||||
DriveSpeedComboBoxEnabled = DumpEnvironment.DoesSupportDriveSpeed(CurrentMediaType);
|
||||
@@ -1365,7 +1384,7 @@ namespace MPF.Frontend.ViewModels
|
||||
if (ParametersCheckBoxEnabled)
|
||||
{
|
||||
var generated = _environment.GetFullParameters(CurrentMediaType, DriveSpeed);
|
||||
if (generated != null)
|
||||
if (generated is not null)
|
||||
Parameters = generated;
|
||||
}
|
||||
}
|
||||
@@ -1420,7 +1439,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <param name="driveChanged">Force an updated name if the drive letter changes</param>
|
||||
public void GetOutputNames(bool driveChanged)
|
||||
{
|
||||
if (Drives == null || Drives.Count == 0 || CurrentDrive == null)
|
||||
if (Drives is null || Drives.Count == 0 || CurrentDrive is null)
|
||||
{
|
||||
VerboseLogLn("Skipping output name building because no valid drives found!");
|
||||
return;
|
||||
@@ -1480,24 +1499,24 @@ namespace MPF.Frontend.ViewModels
|
||||
private static RedumpSystem? GetRedumpSystem(Drive? drive)
|
||||
{
|
||||
// If the drive does not exist, we can't do anything
|
||||
if (drive == null || string.IsNullOrEmpty(drive.Name))
|
||||
if (drive is null || string.IsNullOrEmpty(drive.Name))
|
||||
return null;
|
||||
|
||||
// If we can't read the files in the drive, we can only perform physical checks
|
||||
if (drive.MarkedActive == false || !Directory.Exists(drive.Name))
|
||||
if (!drive.MarkedActive || !Directory.Exists(drive.Name))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check for Panasonic 3DO - filesystem not readable on Windows
|
||||
RedumpSystem? detected3DOSystem = PhysicalTool.Detect3DOSystem(drive);
|
||||
if (detected3DOSystem != null)
|
||||
if (detected3DOSystem is not null)
|
||||
{
|
||||
return detected3DOSystem;
|
||||
}
|
||||
|
||||
// Sega Saturn / Sega Dreamcast / Sega Mega-CD / Sega-CD
|
||||
RedumpSystem? detectedSegaSystem = PhysicalTool.DetectSegaSystem(drive);
|
||||
if (detectedSegaSystem != null)
|
||||
if (detectedSegaSystem is not null)
|
||||
{
|
||||
return detectedSegaSystem;
|
||||
}
|
||||
@@ -1514,7 +1533,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// Check volume labels first
|
||||
RedumpSystem? systemFromLabel = FrontendTool.GetRedumpSystemFromVolumeLabel(drive.VolumeLabel);
|
||||
if (systemFromLabel != null)
|
||||
if (systemFromLabel is not null)
|
||||
return systemFromLabel;
|
||||
|
||||
// Get a list of files for quicker checking
|
||||
@@ -1619,7 +1638,7 @@ namespace MPF.Frontend.ViewModels
|
||||
return RedumpSystem.MicrosoftXboxOne;
|
||||
|
||||
var catalog = new SabreTools.Serialization.Readers.Catalog().Deserialize(catalogjs);
|
||||
if (catalog != null && catalog.Version != null && catalog.Packages != null)
|
||||
if (catalog is not null && catalog.Version is not null && catalog.Packages is not null)
|
||||
{
|
||||
if (!double.TryParse(catalog.Version, out double version))
|
||||
return RedumpSystem.MicrosoftXboxOne;
|
||||
@@ -1654,7 +1673,7 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
// Sega Saturn / Sega Dreamcast / Sega Mega-CD / Sega-CD
|
||||
RedumpSystem? segaSystem = PhysicalTool.DetectSegaSystem(drive);
|
||||
if (segaSystem != null)
|
||||
if (segaSystem is not null)
|
||||
{
|
||||
return segaSystem;
|
||||
}
|
||||
@@ -1886,7 +1905,7 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
int driveIndex = Drives.ConvertAll(d => d.Name?[0] ?? '\0')
|
||||
.IndexOf(_environment.ContextInputPath?[0] ?? default);
|
||||
CurrentDrive = (driveIndex != -1 ? Drives[driveIndex] : Drives[0]);
|
||||
CurrentDrive = driveIndex != -1 ? Drives[driveIndex] : Drives[0];
|
||||
}
|
||||
catch { }
|
||||
|
||||
@@ -1901,13 +1920,13 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
OutputPath = FrontendTool.NormalizeOutputPaths(_environment.ContextOutputPath, false);
|
||||
|
||||
if (MediaTypes != null)
|
||||
if (MediaTypes is not null)
|
||||
{
|
||||
MediaType? mediaType = _environment.GetMediaType();
|
||||
if (mediaType != null)
|
||||
if (mediaType is not null)
|
||||
{
|
||||
int mediaTypeIndex = MediaTypes.FindIndex(m => m == mediaType);
|
||||
CurrentMediaType = (mediaTypeIndex > -1 ? MediaTypes[mediaTypeIndex] : MediaTypes[0]);
|
||||
CurrentMediaType = mediaTypeIndex > -1 ? MediaTypes[mediaTypeIndex] : MediaTypes[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1924,7 +1943,7 @@ namespace MPF.Frontend.ViewModels
|
||||
_environment ??= DetermineEnvironment();
|
||||
|
||||
// If we don't have a valid drive
|
||||
if (CurrentDrive?.Name == null)
|
||||
if (CurrentDrive?.Name is null)
|
||||
{
|
||||
ErrorLogLn("No valid drive found!");
|
||||
return null;
|
||||
@@ -2002,7 +2021,7 @@ namespace MPF.Frontend.ViewModels
|
||||
private static string? GetFormattedVolumeLabel(Drive? drive)
|
||||
{
|
||||
// If the drive is invalid
|
||||
if (drive == null)
|
||||
if (drive is null)
|
||||
return null;
|
||||
|
||||
// If the drive is marked as inactive
|
||||
@@ -2011,6 +2030,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// Use internal serials where appropriate
|
||||
string? volumeLabel = string.IsNullOrEmpty(drive.VolumeLabel) ? null : drive.VolumeLabel!.Trim();
|
||||
#pragma warning disable IDE0010
|
||||
switch (GetRedumpSystem(drive))
|
||||
{
|
||||
case RedumpSystem.SonyPlayStation:
|
||||
@@ -2047,6 +2067,7 @@ namespace MPF.Frontend.ViewModels
|
||||
volumeLabel ??= $"track_{DateTime.Now:yyyyMMdd-HHmm}";
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
foreach (char c in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
@@ -2062,11 +2083,11 @@ namespace MPF.Frontend.ViewModels
|
||||
private void SetCurrentDiscType()
|
||||
{
|
||||
// If we don't have any selected media types, we don't care and return
|
||||
if (MediaTypes == null)
|
||||
if (MediaTypes is null)
|
||||
return;
|
||||
|
||||
// If we have a detected media type, use that first
|
||||
if (_detectedMediaType != null)
|
||||
if (_detectedMediaType is not null)
|
||||
{
|
||||
int detectedIndex = MediaTypes.FindIndex(kvp => kvp.Value == _detectedMediaType);
|
||||
if (detectedIndex > -1)
|
||||
@@ -2077,15 +2098,15 @@ namespace MPF.Frontend.ViewModels
|
||||
}
|
||||
|
||||
// If we have an invalid current type, we don't care and return
|
||||
if (CurrentMediaType == null || CurrentMediaType == MediaType.NONE)
|
||||
if (CurrentMediaType is null || CurrentMediaType == MediaType.NONE)
|
||||
return;
|
||||
|
||||
// Now set the selected item, if possible
|
||||
int index = MediaTypes.FindIndex(kvp => kvp.Value == CurrentMediaType);
|
||||
if (CurrentMediaType != null && index == -1)
|
||||
if (CurrentMediaType is not null && index == -1)
|
||||
VerboseLogLn($"Disc of type '{CurrentMediaType.LongName()}' found, but the current system does not support it!");
|
||||
|
||||
CurrentMediaType = (index > -1 ? MediaTypes[index] : MediaTypes[0]);
|
||||
CurrentMediaType = index > -1 ? MediaTypes[index] : MediaTypes[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2111,8 +2132,8 @@ namespace MPF.Frontend.ViewModels
|
||||
private bool ShouldEnableDumpingButton()
|
||||
{
|
||||
return Drives.Count > 0
|
||||
&& CurrentSystem != null
|
||||
&& CurrentMediaType != null
|
||||
&& CurrentSystem is not null
|
||||
&& CurrentMediaType is not null
|
||||
&& ProgramSupportsMedia();
|
||||
}
|
||||
|
||||
@@ -2122,9 +2143,10 @@ namespace MPF.Frontend.ViewModels
|
||||
private bool ProgramSupportsMedia()
|
||||
{
|
||||
// If the media type is not set, return false
|
||||
if (CurrentMediaType == null || CurrentMediaType == MediaType.NONE)
|
||||
if (CurrentMediaType is null || CurrentMediaType == MediaType.NONE)
|
||||
return false;
|
||||
|
||||
#pragma warning disable IDE0072
|
||||
return CurrentProgram switch
|
||||
{
|
||||
// Aaru
|
||||
@@ -2157,6 +2179,9 @@ namespace MPF.Frontend.ViewModels
|
||||
InternalProgram.DiscImageCreator when CurrentMediaType == MediaType.NintendoWiiUOpticalDisc => true,
|
||||
InternalProgram.DiscImageCreator when CurrentMediaType == MediaType.SDCard => true,
|
||||
|
||||
// Dreamdump
|
||||
// InternalProgram.Dreamdump when CurrentMediaType == MediaType.GDROM => true,
|
||||
|
||||
// Redumper
|
||||
InternalProgram.Redumper when CurrentMediaType == MediaType.BluRay => true,
|
||||
InternalProgram.Redumper when CurrentMediaType == MediaType.CDROM => true,
|
||||
@@ -2170,6 +2195,7 @@ namespace MPF.Frontend.ViewModels
|
||||
// Default
|
||||
_ => false,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2220,7 +2246,7 @@ namespace MPF.Frontend.ViewModels
|
||||
// If we didn't execute a dumping command we cannot get submission output
|
||||
if (!_environment.IsDumpingCommand())
|
||||
{
|
||||
LogLn("No dumping command was run, submission information will not be gathered.");
|
||||
SuccessLogLn("No dumping command was run, submission information will not be gathered.");
|
||||
Status = "Execution complete!";
|
||||
|
||||
// Re-allow quick exiting
|
||||
@@ -2232,14 +2258,14 @@ namespace MPF.Frontend.ViewModels
|
||||
}
|
||||
|
||||
// Verify dump output and save it
|
||||
if (result)
|
||||
if (result == true)
|
||||
{
|
||||
result = await _environment.VerifyAndSaveDumpOutput(
|
||||
resultProgress: resultProgress,
|
||||
protectionProgress: protectionProgress,
|
||||
processUserInfo: _processUserInfo);
|
||||
|
||||
if (!result)
|
||||
if (result == false)
|
||||
ErrorLogLn(result.Message);
|
||||
}
|
||||
else
|
||||
@@ -2268,7 +2294,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
public void ToggleParameters()
|
||||
{
|
||||
if (ParametersCheckBoxEnabled == false)
|
||||
if (!ParametersCheckBoxEnabled)
|
||||
{
|
||||
OptionsMenuItemEnabled = false;
|
||||
|
||||
@@ -2316,20 +2342,20 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <returns>True if dumping should start, false otherwise</returns>
|
||||
private bool ValidateBeforeDumping()
|
||||
{
|
||||
if (Parameters == null || _environment == null)
|
||||
if (Parameters is null || _environment is null)
|
||||
return false;
|
||||
|
||||
// Validate that we have an output path of any sort
|
||||
if (string.IsNullOrEmpty(_environment.OutputPath))
|
||||
{
|
||||
if (_displayUserMessage != null)
|
||||
if (_displayUserMessage is not null)
|
||||
_ = _displayUserMessage("Missing Path", "No output path was provided so dumping cannot continue.", 1, false);
|
||||
LogLn("Dumping aborted!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate that the user explicitly wants an inactive drive to be considered for dumping
|
||||
if (!_environment.DriveMarkedActive && _displayUserMessage != null)
|
||||
if (!_environment.DriveMarkedActive && _displayUserMessage is not null)
|
||||
{
|
||||
string message = "The currently selected drive does not appear to contain a disc! "
|
||||
+ (!_environment!.DetectedByWindows() ? $"This is normal for {_environment.SystemName} as the discs may not be readable on Windows. " : string.Empty)
|
||||
@@ -2349,7 +2375,7 @@ namespace MPF.Frontend.ViewModels
|
||||
|
||||
// If a complete or partial dump already exists
|
||||
bool foundAllFiles = _environment.FoundAllFiles(CurrentMediaType, outputDirectory, outputFilename);
|
||||
if (foundAllFiles && _displayUserMessage != null)
|
||||
if (foundAllFiles && _displayUserMessage is not null)
|
||||
{
|
||||
bool? mbresult = _displayUserMessage("Overwrite?", "A complete dump already exists! Are you sure you want to overwrite?", 2, true);
|
||||
if (mbresult != true)
|
||||
@@ -2362,7 +2388,7 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
// If a partial dump exists
|
||||
bool foundAnyFiles = _environment.FoundAnyFiles(CurrentMediaType, outputDirectory, outputFilename);
|
||||
if (foundAnyFiles && _displayUserMessage != null)
|
||||
if (foundAnyFiles && _displayUserMessage is not null)
|
||||
{
|
||||
bool? mbresult = _displayUserMessage("Overwrite?", $"A partial dump already exists! Dumping here may cause issues. Are you sure you want to overwrite?", 2, true);
|
||||
if (mbresult != true)
|
||||
@@ -2375,7 +2401,7 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
// If a complete dump exists from a different program
|
||||
InternalProgram? completeProgramFound = _environment.CheckForMatchingProgram(CurrentMediaType, outputDirectory, outputFilename);
|
||||
if (completeProgramFound != null && _displayUserMessage != null)
|
||||
if (completeProgramFound is not null && _displayUserMessage is not null)
|
||||
{
|
||||
bool? mbresult = _displayUserMessage("Overwrite?", $"A complete dump from {completeProgramFound} already exists! Dumping here may cause issues. Are you sure you want to overwrite?", 2, true);
|
||||
if (mbresult != true)
|
||||
@@ -2388,7 +2414,7 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
// If a partial dump exists from a different program
|
||||
InternalProgram? partialProgramFound = _environment.CheckForPartialProgram(CurrentMediaType, outputDirectory, outputFilename);
|
||||
if (partialProgramFound != null && _displayUserMessage != null)
|
||||
if (partialProgramFound is not null && _displayUserMessage is not null)
|
||||
{
|
||||
bool? mbresult = _displayUserMessage("Overwrite?", $"A partial dump from {partialProgramFound} already exists! Dumping here may cause issues. Are you sure you want to overwrite?", 2, true);
|
||||
if (mbresult != true)
|
||||
@@ -2410,7 +2436,7 @@ namespace MPF.Frontend.ViewModels
|
||||
fullPath = Path.GetFullPath(outputDirectory);
|
||||
|
||||
var driveInfo = new DriveInfo(Path.GetPathRoot(fullPath) ?? string.Empty);
|
||||
if (driveInfo.AvailableFreeSpace < Math.Pow(2, 30) && _displayUserMessage != null)
|
||||
if (driveInfo.AvailableFreeSpace < Math.Pow(2, 30) && _displayUserMessage is not null)
|
||||
{
|
||||
bool? mbresult = _displayUserMessage("Low Space", "There is less than 1gb of space left on the target drive. Are you sure you want to continue?", 2, true);
|
||||
if (mbresult != true)
|
||||
@@ -2433,13 +2459,16 @@ namespace MPF.Frontend.ViewModels
|
||||
{
|
||||
try
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return program switch
|
||||
{
|
||||
InternalProgram.Redumper => File.Exists(Options.RedumperPath),
|
||||
InternalProgram.Aaru => File.Exists(Options.AaruPath),
|
||||
InternalProgram.DiscImageCreator => File.Exists(Options.DiscImageCreatorPath),
|
||||
// InternalProgram.Dreamdump => File.Exists(Options.DreamdumpPath),
|
||||
InternalProgram.Redumper => File.Exists(Options.RedumperPath),
|
||||
_ => false,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -2453,7 +2482,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// <param name="translationStrings">Dictionary of keys and their translated string</param>
|
||||
public void TranslateStrings(Dictionary<string, string>? translationStrings)
|
||||
{
|
||||
if (translationStrings != null)
|
||||
if (translationStrings is not null)
|
||||
{
|
||||
// Cache current start dumping string
|
||||
var oldStartDumpingValue = StartDumpingValue;
|
||||
@@ -2465,7 +2494,7 @@ namespace MPF.Frontend.ViewModels
|
||||
StopDumpingValue = stopDumpingValue ?? StopDumpingValue;
|
||||
|
||||
// Set button text
|
||||
if (StartStopButtonText as string == oldStartDumpingValue)
|
||||
if ((StartStopButtonText as string) == oldStartDumpingValue)
|
||||
StartStopButtonText = StartDumpingValue;
|
||||
else
|
||||
StartStopButtonText = StopDumpingValue;
|
||||
@@ -2493,18 +2522,24 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
private void ProgressUpdated(object? sender, ResultEventArgs value)
|
||||
{
|
||||
var message = value?.Message;
|
||||
var message = value.Message;
|
||||
|
||||
// Update the label with only the first line of output
|
||||
if (message != null && message.Contains("\n"))
|
||||
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
|
||||
if (message is not null && message.Contains('\n'))
|
||||
#else
|
||||
if (message is not null && message.Contains("\n"))
|
||||
#endif
|
||||
Status = message.Split('\n')[0] + " (See log output)";
|
||||
else
|
||||
Status = message ?? string.Empty;
|
||||
|
||||
// Log based on success or failure
|
||||
if (value != null && value)
|
||||
VerboseLogLn(message ?? string.Empty);
|
||||
else if (value != null && !value)
|
||||
if ((bool?)value is null)
|
||||
LogLn(message ?? string.Empty);
|
||||
else if (value == true)
|
||||
SuccessLogLn(message ?? string.Empty);
|
||||
else if (value == false)
|
||||
ErrorLogLn(message ?? string.Empty);
|
||||
}
|
||||
|
||||
|
||||
@@ -209,9 +209,9 @@ namespace MPF.Frontend.ViewModels
|
||||
/// TODO: Convert selected list item to binding
|
||||
public void Load()
|
||||
{
|
||||
if (SubmissionInfo.CommonDiscInfo?.Languages != null)
|
||||
if (SubmissionInfo.CommonDiscInfo?.Languages is not null)
|
||||
Languages.ForEach(l => l.IsChecked = Array.IndexOf(SubmissionInfo.CommonDiscInfo.Languages, l) > -1);
|
||||
if (SubmissionInfo.CommonDiscInfo?.LanguageSelection != null)
|
||||
if (SubmissionInfo.CommonDiscInfo?.LanguageSelection is not null)
|
||||
LanguageSelections.ForEach(ls => ls.IsChecked = Array.IndexOf(SubmissionInfo.CommonDiscInfo.LanguageSelection, ls) > -1);
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace MPF.Frontend.ViewModels
|
||||
/// TODO: Convert selected list item to binding
|
||||
public void Save()
|
||||
{
|
||||
if (SubmissionInfo.CommonDiscInfo == null)
|
||||
if (SubmissionInfo.CommonDiscInfo is null)
|
||||
SubmissionInfo.CommonDiscInfo = new CommonDiscInfoSection();
|
||||
SubmissionInfo.CommonDiscInfo.Languages = [.. Languages.FindAll(l => l.IsChecked).ConvertAll(l => l?.Value)];
|
||||
if (SubmissionInfo.CommonDiscInfo.Languages.Length == 0)
|
||||
|
||||
@@ -106,7 +106,13 @@ namespace MPF.Frontend.ViewModels
|
||||
/// </summary>
|
||||
private static List<Element<InternalProgram>> PopulateInternalPrograms()
|
||||
{
|
||||
var internalPrograms = new List<InternalProgram> { InternalProgram.Redumper, InternalProgram.DiscImageCreator, InternalProgram.Aaru };
|
||||
var internalPrograms = new List<InternalProgram>
|
||||
{
|
||||
InternalProgram.Redumper,
|
||||
InternalProgram.DiscImageCreator,
|
||||
InternalProgram.Aaru,
|
||||
// InternalProgram.Dreamdump,
|
||||
};
|
||||
return internalPrograms.ConvertAll(ip => new Element<InternalProgram>(ip));
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace MPF.Processors.Test
|
||||
var processor = new DiscImageCreator(RedumpSystem.IBMPCcompatible);
|
||||
|
||||
var actual = processor.GetOutputFiles(MediaType.CDROM, outputDirectory, outputFilename);
|
||||
Assert.Equal(26, actual.Count);
|
||||
Assert.Equal(28, actual.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -276,7 +276,7 @@ namespace MPF.Processors.Test
|
||||
string outputFilename = "test.cue";
|
||||
var processor = new DiscImageCreator(RedumpSystem.IBMPCcompatible);
|
||||
var actual = processor.GenerateArtifacts(MediaType.CDROM, outputDirectory, outputFilename);
|
||||
Assert.Equal(21, actual.Count);
|
||||
Assert.Equal(23, actual.Count);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -324,7 +324,7 @@ namespace MPF.Processors.Test
|
||||
string outputFilename = "test.cue";
|
||||
var processor = new DiscImageCreator(RedumpSystem.IBMPCcompatible);
|
||||
var actual = processor.GetZippableFilePaths(MediaType.CDROM, outputDirectory, outputFilename);
|
||||
Assert.Equal(24, actual.Count);
|
||||
Assert.Equal(26, actual.Count);
|
||||
}
|
||||
|
||||
#region GetPreservedFilePaths
|
||||
@@ -1242,15 +1242,13 @@ namespace MPF.Processors.Test
|
||||
out string? dmihash,
|
||||
out string? pfihash,
|
||||
out string? sshash,
|
||||
out string? ss,
|
||||
out string? ssver);
|
||||
out string? ss);
|
||||
|
||||
Assert.False(actual);
|
||||
Assert.Null(dmihash);
|
||||
Assert.Null(pfihash);
|
||||
Assert.Null(sshash);
|
||||
Assert.Null(ss);
|
||||
Assert.Null(ssver);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -1261,36 +1259,31 @@ namespace MPF.Processors.Test
|
||||
out string? dmihash,
|
||||
out string? pfihash,
|
||||
out string? sshash,
|
||||
out string? ss,
|
||||
out string? ssver);
|
||||
out string? ss);
|
||||
|
||||
Assert.False(actual);
|
||||
Assert.Null(dmihash);
|
||||
Assert.Null(pfihash);
|
||||
Assert.Null(sshash);
|
||||
Assert.Null(ss);
|
||||
Assert.Null(ssver);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetXGDAuxInfo_Valid_Filled()
|
||||
{
|
||||
string? expectedSs = "0-12345";
|
||||
string? expectedSsver = "01";
|
||||
string disc = Path.Combine(Environment.CurrentDirectory, "TestData", "DiscImageCreator", "CDROM", "test_disc.txt");
|
||||
bool actual = DiscImageCreator.GetXGDAuxInfo(disc,
|
||||
out string? dmihash,
|
||||
out string? pfihash,
|
||||
out string? sshash,
|
||||
out string? ss,
|
||||
out string? ssver);
|
||||
out string? ss);
|
||||
|
||||
Assert.True(actual);
|
||||
Assert.Equal("00000000", dmihash);
|
||||
Assert.Equal("00000000", pfihash);
|
||||
Assert.Equal("00000000", sshash);
|
||||
Assert.Equal(expectedSs, ss);
|
||||
Assert.Equal(expectedSsver, ssver);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="18.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="18.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
||||
<PackageReference Include="xunit.analyzers" Version="1.25.0" />
|
||||
<PackageReference Include="xunit.analyzers" Version="1.27.0" />
|
||||
<PackageReference Include="xunit.assert" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.core" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.extensibility.core" Version="2.9.3" />
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
TEST DATA
|
||||
@@ -0,0 +1 @@
|
||||
TEST DATA
|
||||
@@ -60,6 +60,7 @@ namespace MPF.Processors
|
||||
sidecarEntry?.WriteToFile(sidecarPath, new ExtractionOptions { ExtractFullPath = false, Overwrite = true });
|
||||
}
|
||||
catch { }
|
||||
|
||||
logArchive?.Dispose();
|
||||
}
|
||||
#endif
|
||||
@@ -119,7 +120,7 @@ namespace MPF.Processors
|
||||
|
||||
// Get the error count
|
||||
long errorCount = GetErrorCount($"{basePath}.resume.xml");
|
||||
info.CommonDiscInfo.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString());
|
||||
info.CommonDiscInfo.ErrorsCount = errorCount == -1 ? "Error retrieving error count" : errorCount.ToString();
|
||||
|
||||
// Get the write offset, if it exists
|
||||
string? writeOffset = GetWriteOffset(sidecar);
|
||||
@@ -127,6 +128,7 @@ namespace MPF.Processors
|
||||
info.TracksAndWriteOffsets.OtherWriteOffsets = writeOffset;
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
#pragma warning disable IDE0010
|
||||
switch (mediaType)
|
||||
{
|
||||
// TODO: Can this do GD-ROM?
|
||||
@@ -221,8 +223,10 @@ namespace MPF.Processors
|
||||
info.VersionAndEditions.Version = version360 ?? string.Empty;
|
||||
info.CommonDiscInfo.Region = region360;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -231,6 +235,7 @@ namespace MPF.Processors
|
||||
// Remove the extension by default
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
|
||||
#pragma warning disable IDE0010
|
||||
switch (mediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -295,6 +300,7 @@ namespace MPF.Processors
|
||||
"resume"),
|
||||
];
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
return [];
|
||||
}
|
||||
@@ -312,7 +318,7 @@ namespace MPF.Processors
|
||||
internal static string? GenerateCuesheet(CICMMetadataType? cicmSidecar, string basePath)
|
||||
{
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return null;
|
||||
|
||||
// Required variables
|
||||
@@ -324,18 +330,18 @@ namespace MPF.Processors
|
||||
};
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return null;
|
||||
|
||||
// Loop through each OpticalDisc in the metadata
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// Only capture the first total track count
|
||||
if (opticalDisc.Tracks != null && opticalDisc.Tracks.Length > 0)
|
||||
if (opticalDisc.Tracks is not null && opticalDisc.Tracks.Length > 0)
|
||||
totalTracks = opticalDisc.Tracks[0];
|
||||
|
||||
// If there are no tracks, we can't get a cuesheet
|
||||
if (opticalDisc.Track == null || opticalDisc.Track.Length == 0)
|
||||
if (opticalDisc.Track is null || opticalDisc.Track.Length == 0)
|
||||
continue;
|
||||
|
||||
// Get cuesheet-level information
|
||||
@@ -362,7 +368,7 @@ namespace MPF.Processors
|
||||
|
||||
// Add index data
|
||||
var cueTracks = new List<CueTrack>();
|
||||
if (track.Indexes != null && track.Indexes.Length > 0)
|
||||
if (track.Indexes is not null && track.Indexes.Length > 0)
|
||||
{
|
||||
var cueIndicies = new List<CueIndex>();
|
||||
|
||||
@@ -372,8 +378,8 @@ namespace MPF.Processors
|
||||
// Get timestamp from frame count
|
||||
int absoluteLength = Math.Abs(trackIndex.Value);
|
||||
int frames = absoluteLength % 75;
|
||||
int seconds = (absoluteLength / 75) % 60;
|
||||
int minutes = (absoluteLength / 75 / 60);
|
||||
int seconds = absoluteLength / 75 % 60;
|
||||
int minutes = absoluteLength / 75 / 60;
|
||||
string timeString = $"{minutes:D2}:{seconds:D2}:{frames:D2}";
|
||||
|
||||
// Pregap information
|
||||
@@ -430,10 +436,10 @@ namespace MPF.Processors
|
||||
|
||||
// If we have a cuesheet to write out, do so
|
||||
cueSheet.Files = [.. cueFiles];
|
||||
if (cueSheet != null && cueSheet != default)
|
||||
if (cueSheet is not null && cueSheet != default)
|
||||
{
|
||||
var ms = new SabreTools.Serialization.Writers.CueSheet().SerializeStream(cueSheet);
|
||||
if (ms == null)
|
||||
if (ms is null)
|
||||
return null;
|
||||
|
||||
using var sr = new StreamReader(ms);
|
||||
@@ -451,6 +457,7 @@ namespace MPF.Processors
|
||||
/// <returns>CueTrackDataType representing the input data</returns>
|
||||
private static CueTrackDataType ConvertToDataType(TrackTypeTrackType trackType, uint bytesPerSector)
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
switch (trackType)
|
||||
{
|
||||
case TrackTypeTrackType.audio:
|
||||
@@ -473,6 +480,7 @@ namespace MPF.Processors
|
||||
default:
|
||||
return CueTrackDataType.MODE1_2352;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -482,7 +490,7 @@ namespace MPF.Processors
|
||||
/// <returns>CueTrackFlag representing the flags</returns>
|
||||
private static CueTrackFlag ConvertToTrackFlag(TrackFlagsType trackFlagsType)
|
||||
{
|
||||
if (trackFlagsType == null)
|
||||
if (trackFlagsType is null)
|
||||
return 0;
|
||||
|
||||
CueTrackFlag flag = 0;
|
||||
@@ -512,25 +520,25 @@ namespace MPF.Processors
|
||||
internal static Datafile? GenerateDatafile(CICMMetadataType? cicmSidecar, string basePath)
|
||||
{
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return null;
|
||||
|
||||
// Required variables
|
||||
var roms = new List<Rom>();
|
||||
|
||||
// Process OpticalDisc, if possible
|
||||
if (cicmSidecar.OpticalDisc != null && cicmSidecar.OpticalDisc.Length > 0)
|
||||
if (cicmSidecar.OpticalDisc is not null && cicmSidecar.OpticalDisc.Length > 0)
|
||||
{
|
||||
// Loop through each OpticalDisc in the metadata
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// Only capture the first total track count
|
||||
uint totalTracks = 0;
|
||||
if (opticalDisc.Tracks != null && opticalDisc.Tracks.Length > 0)
|
||||
if (opticalDisc.Tracks is not null && opticalDisc.Tracks.Length > 0)
|
||||
totalTracks = opticalDisc.Tracks[0];
|
||||
|
||||
// If there are no tracks, we can't get a datfile
|
||||
if (opticalDisc.Track == null || opticalDisc.Track.Length == 0)
|
||||
if (opticalDisc.Track is null || opticalDisc.Track.Length == 0)
|
||||
continue;
|
||||
|
||||
// Loop through each track
|
||||
@@ -543,12 +551,13 @@ namespace MPF.Processors
|
||||
string sha1 = string.Empty;
|
||||
|
||||
// If we don't have any checksums, we can't get a DAT for this track
|
||||
if (track.Checksums == null || track.Checksums.Length == 0)
|
||||
if (track.Checksums is null || track.Checksums.Length == 0)
|
||||
continue;
|
||||
|
||||
// Extract only relevant checksums
|
||||
foreach (ChecksumType checksum in track.Checksums)
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
switch (checksum.type)
|
||||
{
|
||||
case ChecksumTypeType.crc32:
|
||||
@@ -561,6 +570,7 @@ namespace MPF.Processors
|
||||
sha1 = checksum.Value;
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
// Build the track datfile data and append
|
||||
@@ -571,7 +581,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// Process BlockMedia, if possible
|
||||
if (cicmSidecar.BlockMedia != null && cicmSidecar.BlockMedia.Length > 0)
|
||||
if (cicmSidecar.BlockMedia is not null && cicmSidecar.BlockMedia.Length > 0)
|
||||
{
|
||||
// Loop through each BlockMedia in the metadata
|
||||
foreach (BlockMediaType blockMedia in cicmSidecar.BlockMedia)
|
||||
@@ -582,12 +592,13 @@ namespace MPF.Processors
|
||||
string sha1 = string.Empty;
|
||||
|
||||
// If we don't have any checksums, we can't get a DAT for this track
|
||||
if (blockMedia.Checksums == null || blockMedia.Checksums.Length == 0)
|
||||
if (blockMedia.Checksums is null || blockMedia.Checksums.Length == 0)
|
||||
continue;
|
||||
|
||||
// Extract only relevant checksums
|
||||
foreach (ChecksumType checksum in blockMedia.Checksums)
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
switch (checksum.type)
|
||||
{
|
||||
case ChecksumTypeType.crc32:
|
||||
@@ -600,6 +611,7 @@ namespace MPF.Processors
|
||||
sha1 = checksum.Value;
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
// Build the track datfile data and append
|
||||
@@ -658,11 +670,11 @@ namespace MPF.Processors
|
||||
internal static string? GeneratePVD(CICMMetadataType? cicmSidecar)
|
||||
{
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return null;
|
||||
|
||||
// Process OpticalDisc, if possible
|
||||
if (cicmSidecar.OpticalDisc != null && cicmSidecar.OpticalDisc.Length > 0)
|
||||
if (cicmSidecar.OpticalDisc is not null && cicmSidecar.OpticalDisc.Length > 0)
|
||||
{
|
||||
// Loop through each OpticalDisc in the metadata
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
@@ -670,7 +682,7 @@ namespace MPF.Processors
|
||||
var pvdData = GeneratePVDData(opticalDisc);
|
||||
|
||||
// If we got a null value, we skip this disc
|
||||
if (pvdData == null)
|
||||
if (pvdData is null)
|
||||
continue;
|
||||
|
||||
// Build each row in consecutive order
|
||||
@@ -704,21 +716,21 @@ namespace MPF.Processors
|
||||
DateTime effective = DateTime.MinValue;
|
||||
|
||||
// If there are no tracks, we can't get a PVD
|
||||
if (opticalDisc?.Track == null || opticalDisc.Track.Length == 0)
|
||||
if (opticalDisc?.Track is null || opticalDisc.Track.Length == 0)
|
||||
return null;
|
||||
|
||||
// Take the first track only
|
||||
TrackType track = opticalDisc.Track[0];
|
||||
|
||||
// If there are no partitions, we can't get a PVD
|
||||
if (track.FileSystemInformation == null || track.FileSystemInformation.Length == 0)
|
||||
if (track.FileSystemInformation is null || track.FileSystemInformation.Length == 0)
|
||||
return null;
|
||||
|
||||
// Loop through each Partition
|
||||
foreach (PartitionType partition in track.FileSystemInformation)
|
||||
{
|
||||
// If the partition has no file systems, we can't get a PVD
|
||||
if (partition.FileSystems == null || partition.FileSystems.Length == 0)
|
||||
if (partition.FileSystems is null || partition.FileSystems.Length == 0)
|
||||
continue;
|
||||
|
||||
// Loop through each FileSystem until we find a PVD
|
||||
@@ -837,7 +849,7 @@ namespace MPF.Processors
|
||||
private static string? GenerateSectorOutputLine(string row, byte[] bytes, int offset)
|
||||
{
|
||||
// If the data isn't correct, return null
|
||||
if (bytes == null || offset < 0 || offset >= bytes.Length || bytes.Length - offset < 16)
|
||||
if (bytes is null || offset < 0 || offset >= bytes.Length || bytes.Length - offset < 16)
|
||||
return null;
|
||||
|
||||
var pvdLine = new StringBuilder();
|
||||
@@ -886,7 +898,7 @@ namespace MPF.Processors
|
||||
});
|
||||
|
||||
// If the reader is null for some reason, we can't do anything
|
||||
if (xtr == null)
|
||||
if (xtr is null)
|
||||
return null;
|
||||
|
||||
var serializer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
@@ -910,11 +922,11 @@ namespace MPF.Processors
|
||||
discType = null; discSubType = null;
|
||||
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return false;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return false;
|
||||
|
||||
// Find and return the hardware info, if possible
|
||||
@@ -1088,11 +1100,11 @@ namespace MPF.Processors
|
||||
private static string? GetDVDProtection(CICMMetadataType? cicmSidecar)
|
||||
{
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return null;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return null;
|
||||
|
||||
// Get an output for the copyright protection
|
||||
@@ -1161,7 +1173,7 @@ namespace MPF.Processors
|
||||
totalErrors = 0;
|
||||
else if (line.StartsWith("</BadBlocks>"))
|
||||
return totalErrors ?? -1;
|
||||
else if (line.StartsWith("<Block>") && totalErrors != null)
|
||||
else if (line.StartsWith("<Block>") && totalErrors is not null)
|
||||
totalErrors++;
|
||||
}
|
||||
|
||||
@@ -1186,24 +1198,24 @@ namespace MPF.Processors
|
||||
manufacturer = null; model = null; firmware = null;
|
||||
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return false;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return false;
|
||||
|
||||
// Find and return the hardware info, if possible
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// If there's no hardware information, skip
|
||||
if (opticalDisc.DumpHardwareArray == null || opticalDisc.DumpHardwareArray.Length == 0)
|
||||
if (opticalDisc.DumpHardwareArray is null || opticalDisc.DumpHardwareArray.Length == 0)
|
||||
continue;
|
||||
|
||||
foreach (DumpHardwareType hardware in opticalDisc.DumpHardwareArray)
|
||||
{
|
||||
// If the hardware information is invalid, skip
|
||||
if (hardware == null)
|
||||
if (hardware is null)
|
||||
continue;
|
||||
|
||||
// Store the first instance of each value
|
||||
@@ -1227,11 +1239,11 @@ namespace MPF.Processors
|
||||
private static string? GetLayerbreak(CICMMetadataType? cicmSidecar)
|
||||
{
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return null;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return null;
|
||||
|
||||
// Setup the layerbreak
|
||||
@@ -1241,7 +1253,7 @@ namespace MPF.Processors
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// If there's no layer information, skip
|
||||
if (opticalDisc.Layers == null)
|
||||
if (opticalDisc.Layers is null)
|
||||
continue;
|
||||
|
||||
// TODO: Determine how to find the layerbreak from the CICM or other outputs
|
||||
@@ -1258,11 +1270,11 @@ namespace MPF.Processors
|
||||
private static string? GetWriteOffset(CICMMetadataType? cicmSidecar)
|
||||
{
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return null;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return null;
|
||||
|
||||
// Loop through each OpticalDisc in the metadata
|
||||
@@ -1288,28 +1300,28 @@ namespace MPF.Processors
|
||||
dmihash = null; pfihash = null; sshash = null; ss = null; ssver = null;
|
||||
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return false;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return false;
|
||||
|
||||
// Loop through each OpticalDisc in the metadata
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// If the Xbox type isn't set, we can't extract information
|
||||
if (opticalDisc.Xbox == null)
|
||||
if (opticalDisc.Xbox is null)
|
||||
continue;
|
||||
|
||||
// Get the Xbox information
|
||||
XboxType xbox = opticalDisc.Xbox;
|
||||
|
||||
// DMI
|
||||
if (xbox.DMI != null)
|
||||
if (xbox.DMI is not null)
|
||||
{
|
||||
DumpType dmi = xbox.DMI;
|
||||
if (dmi.Checksums != null && dmi.Checksums.Length != 0)
|
||||
if (dmi.Checksums is not null && dmi.Checksums.Length != 0)
|
||||
{
|
||||
foreach (ChecksumType checksum in dmi.Checksums)
|
||||
{
|
||||
@@ -1324,10 +1336,10 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// PFI
|
||||
if (xbox.PFI != null)
|
||||
if (xbox.PFI is not null)
|
||||
{
|
||||
DumpType pfi = xbox.PFI;
|
||||
if (pfi.Checksums != null && pfi.Checksums.Length != 0)
|
||||
if (pfi.Checksums is not null && pfi.Checksums.Length != 0)
|
||||
{
|
||||
foreach (ChecksumType checksum in pfi.Checksums)
|
||||
{
|
||||
@@ -1342,12 +1354,12 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// SS
|
||||
if (xbox.SecuritySectors != null && xbox.SecuritySectors.Length > 0)
|
||||
if (xbox.SecuritySectors is not null && xbox.SecuritySectors.Length > 0)
|
||||
{
|
||||
foreach (XboxSecuritySectorsType securitySector in xbox.SecuritySectors)
|
||||
{
|
||||
DumpType security = securitySector.SecuritySectors;
|
||||
if (security.Checksums != null && security.Checksums.Length != 0)
|
||||
if (security.Checksums is not null && security.Checksums.Length != 0)
|
||||
{
|
||||
foreach (ChecksumType checksum in security.Checksums)
|
||||
{
|
||||
@@ -1364,7 +1376,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// If we got a hash, we can break
|
||||
if (sshash != null)
|
||||
if (sshash is not null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1383,25 +1395,25 @@ namespace MPF.Processors
|
||||
serial = null; version = null; region = Region.World;
|
||||
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return false;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return false;
|
||||
|
||||
// Loop through each OpticalDisc in the metadata
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// If the Xbox type isn't set, we can't extract information
|
||||
if (opticalDisc.Xbox == null)
|
||||
if (opticalDisc.Xbox is null)
|
||||
continue;
|
||||
|
||||
// Get the Xbox information
|
||||
XboxType xbox = opticalDisc.Xbox;
|
||||
|
||||
// DMI
|
||||
if (xbox.DMI != null)
|
||||
if (xbox.DMI is not null)
|
||||
{
|
||||
DumpType dmi = xbox.DMI;
|
||||
string image = dmi.Image;
|
||||
@@ -1431,25 +1443,25 @@ namespace MPF.Processors
|
||||
serial = null; version = null; region = Region.World;
|
||||
|
||||
// If the object is null, we can't get information from it
|
||||
if (cicmSidecar == null)
|
||||
if (cicmSidecar is null)
|
||||
return false;
|
||||
|
||||
// Only care about OpticalDisc types
|
||||
if (cicmSidecar.OpticalDisc == null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
if (cicmSidecar.OpticalDisc is null || cicmSidecar.OpticalDisc.Length == 0)
|
||||
return false;
|
||||
|
||||
// Loop through each OpticalDisc in the metadata
|
||||
foreach (OpticalDiscType opticalDisc in cicmSidecar.OpticalDisc)
|
||||
{
|
||||
// If the Xbox type isn't set, we can't extract information
|
||||
if (opticalDisc.Xbox == null)
|
||||
if (opticalDisc.Xbox is null)
|
||||
continue;
|
||||
|
||||
// Get the Xbox information
|
||||
XboxType xbox = opticalDisc.Xbox;
|
||||
|
||||
// DMI
|
||||
if (xbox.DMI != null)
|
||||
if (xbox.DMI is not null)
|
||||
{
|
||||
DumpType dmi = xbox.DMI;
|
||||
string image = dmi.Image;
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace MPF.Processors
|
||||
foreach (var outputFile in outputFiles)
|
||||
{
|
||||
// Skip non-artifact files
|
||||
if (!outputFile.IsArtifact || outputFile.ArtifactKey == null)
|
||||
if (!outputFile.IsArtifact || outputFile.ArtifactKey is null)
|
||||
continue;
|
||||
|
||||
// Skip non-existent files
|
||||
@@ -744,7 +744,7 @@ namespace MPF.Processors
|
||||
internal static string? GetPIC(string? picPath, int trimLength = -1)
|
||||
{
|
||||
// If the file is invalid
|
||||
if (picPath == null)
|
||||
if (picPath is null)
|
||||
return null;
|
||||
|
||||
// If the file doesn't exist, we can't get the info
|
||||
@@ -758,7 +758,7 @@ namespace MPF.Processors
|
||||
try
|
||||
{
|
||||
var hex = ProcessingTool.GetFullFile(picPath, true);
|
||||
if (hex == null)
|
||||
if (hex is null)
|
||||
return null;
|
||||
|
||||
if (trimLength > -1 && trimLength < hex.Length)
|
||||
@@ -820,7 +820,7 @@ namespace MPF.Processors
|
||||
pvd = string.Empty;
|
||||
for (int i = 0; i < 96; i += 16)
|
||||
{
|
||||
pvd += $"{(0x0320 + i):X4} : {buf[i]:X2} {buf[i + 1]:X2} {buf[i + 2]:X2} {buf[i + 3]:X2} {buf[i + 4]:X2} {buf[i + 5]:X2} {buf[i + 6]:X2} {buf[i + 7]:X2} " +
|
||||
pvd += $"{0x0320 + i:X4} : {buf[i]:X2} {buf[i + 1]:X2} {buf[i + 2]:X2} {buf[i + 3]:X2} {buf[i + 4]:X2} {buf[i + 5]:X2} {buf[i + 6]:X2} {buf[i + 7]:X2} " +
|
||||
$"{buf[i + 8]:X2} {buf[i + 9]:X2} {buf[i + 10]:X2} {buf[i + 11]:X2} {buf[i + 12]:X2} {buf[i + 13]:X2} {buf[i + 14]:X2} {buf[i + 15]:X2} {pvdASCII.Substring(i, 16)}\n";
|
||||
}
|
||||
|
||||
@@ -869,7 +869,7 @@ namespace MPF.Processors
|
||||
internal static string SplitString(string? str, int count, bool trim = false)
|
||||
{
|
||||
// Ignore invalid inputs
|
||||
if (str == null || str.Length == 0)
|
||||
if (str is null || str.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
// Handle non-modifying counts
|
||||
|
||||
@@ -21,12 +21,14 @@ namespace MPF.Processors
|
||||
/// <inheritdoc/>
|
||||
public override MediaType? DetermineMediaType(string? outputDirectory, string outputFilename)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return System switch
|
||||
{
|
||||
RedumpSystem.NintendoGameCube => MediaType.NintendoGameCubeGameDisc,
|
||||
RedumpSystem.NintendoWii => MediaType.NintendoWiiOpticalDisc,
|
||||
_ => null,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -255,7 +257,7 @@ namespace MPF.Processors
|
||||
try
|
||||
{
|
||||
var hex = ProcessingTool.GetFullFile(bcaPath, true);
|
||||
if (hex == null)
|
||||
if (hex is null)
|
||||
return null;
|
||||
|
||||
// Separate into blocks of 4 hex digits and newlines
|
||||
@@ -342,6 +344,7 @@ namespace MPF.Processors
|
||||
// string gameid = serial[1] + serial[2];
|
||||
// string version = serial[4] + serial[5]
|
||||
|
||||
#pragma warning disable IDE0010
|
||||
switch (serial[3])
|
||||
{
|
||||
case 'A':
|
||||
@@ -393,6 +396,7 @@ namespace MPF.Processors
|
||||
region = null; // Not a real region code
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ Here are some notes about the various output files and what they represent:
|
||||
- toc - Binary representation of the table of contents
|
||||
- volDesc - Volume descriptor information
|
||||
*/
|
||||
|
||||
namespace MPF.Processors
|
||||
{
|
||||
/// <summary>
|
||||
@@ -98,12 +99,13 @@ namespace MPF.Processors
|
||||
discEntry?.WriteToFile(discPath, new ExtractionOptions { ExtractFullPath = false, Overwrite = true });
|
||||
}
|
||||
catch { }
|
||||
|
||||
logArchive?.Dispose();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the comma-separated list of values
|
||||
if (GetDiscType($"{basePath}_disc.txt", out var discType) && discType != null)
|
||||
if (GetDiscType($"{basePath}_disc.txt", out var discType) && discType is not null)
|
||||
{
|
||||
// CD-ROM
|
||||
if (discType.Contains("CD-DA or CD-ROM Disc"))
|
||||
@@ -213,6 +215,7 @@ namespace MPF.Processors
|
||||
VolumeLabels = volLabels;
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
#pragma warning disable IDE0010
|
||||
switch (mediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -232,7 +235,7 @@ namespace MPF.Processors
|
||||
else if (File.Exists($"{basePath}.img_EccEdc.txt"))
|
||||
errorCount = GetErrorCount($"{basePath}.img_EccEdc.txt");
|
||||
|
||||
info.CommonDiscInfo.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString());
|
||||
info.CommonDiscInfo.ErrorsCount = errorCount == -1 ? "Error retrieving error count" : errorCount.ToString();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -262,13 +265,13 @@ namespace MPF.Processors
|
||||
info.SizeAndChecksums.PICIdentifier = ProcessingTool.GetPICIdentifier(di);
|
||||
if (ProcessingTool.GetLayerbreaks(di, out long? layerbreak1, out long? layerbreak2, out long? layerbreak3))
|
||||
{
|
||||
if (layerbreak1 != null && layerbreak1 * 2048 < info.SizeAndChecksums.Size)
|
||||
if (layerbreak1 is not null && layerbreak1 * 2048 < info.SizeAndChecksums.Size)
|
||||
info.SizeAndChecksums.Layerbreak = layerbreak1.Value;
|
||||
|
||||
if (layerbreak2 != null && layerbreak2 * 2048 < info.SizeAndChecksums.Size)
|
||||
if (layerbreak2 is not null && layerbreak2 * 2048 < info.SizeAndChecksums.Size)
|
||||
info.SizeAndChecksums.Layerbreak2 = layerbreak2.Value;
|
||||
|
||||
if (layerbreak3 != null && layerbreak3 * 2048 < info.SizeAndChecksums.Size)
|
||||
if (layerbreak3 is not null && layerbreak3 * 2048 < info.SizeAndChecksums.Size)
|
||||
info.SizeAndChecksums.Layerbreak3 = layerbreak3.Value;
|
||||
}
|
||||
}
|
||||
@@ -323,7 +326,7 @@ namespace MPF.Processors
|
||||
case RedumpSystem.MicrosoftXbox:
|
||||
string xmidString = ProcessingTool.GetXMID($"{basePath}_DMI.bin");
|
||||
var xmid = SabreTools.Serialization.Wrappers.XMID.Create(xmidString);
|
||||
if (xmid != null)
|
||||
if (xmid is not null)
|
||||
{
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.XMID] = xmidString?.TrimEnd('\0') ?? string.Empty;
|
||||
info.CommonDiscInfo.Serial = xmid.Serial ?? string.Empty;
|
||||
@@ -345,22 +348,18 @@ namespace MPF.Processors
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash ?? string.Empty;
|
||||
}
|
||||
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out _, out _, out _, out var xgd1SS, out _))
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out _, out _, out _, out var xgd1SS))
|
||||
{
|
||||
// SS Version from DIC is ignored now
|
||||
//info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer ?? string.Empty;
|
||||
info.Extras.SecuritySectorRanges = xgd1SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd1DMIHash, out var xgd1PFIHash, out var xgd1SSHash, out var xgd1SS, out _))
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd1DMIHash, out var xgd1PFIHash, out var xgd1SSHash, out var xgd1SS))
|
||||
{
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd1DMIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd1PFIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd1SSHash ?? string.Empty;
|
||||
// SS Version from DIC is ignored now
|
||||
//info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd1SSVer ?? string.Empty;
|
||||
info.Extras.SecuritySectorRanges = xgd1SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -370,7 +369,7 @@ namespace MPF.Processors
|
||||
case RedumpSystem.MicrosoftXbox360:
|
||||
string xemidString = ProcessingTool.GetXeMID($"{basePath}_DMI.bin");
|
||||
var xemid = SabreTools.Serialization.Wrappers.XeMID.Create(xemidString);
|
||||
if (xemid != null)
|
||||
if (xemid is not null)
|
||||
{
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.XeMID] = xemidString?.TrimEnd('\0') ?? string.Empty;
|
||||
info.CommonDiscInfo.Serial = xemid.Serial ?? string.Empty;
|
||||
@@ -391,22 +390,18 @@ namespace MPF.Processors
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash ?? string.Empty;
|
||||
}
|
||||
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out _, out _, out _, out var xgd23SS, out _))
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out _, out _, out _, out var xgd23SS))
|
||||
{
|
||||
// SS Version from DIC is ignored now
|
||||
//info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer ?? string.Empty;
|
||||
info.Extras.SecuritySectorRanges = xgd23SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd23DMIHash, out var xgd23PFIHash, out var xgd23SSHash, out var xgd23SS, out _))
|
||||
if (GetXGDAuxInfo($"{basePath}_disc.txt", out var xgd23DMIHash, out var xgd23PFIHash, out var xgd23SSHash, out var xgd23SS))
|
||||
{
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = xgd23DMIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = xgd23PFIHash ?? string.Empty;
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = xgd23SSHash ?? string.Empty;
|
||||
// SS Version from DIC is ignored now
|
||||
//info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSVersion] = xgd23SSVer ?? string.Empty;
|
||||
info.Extras.SecuritySectorRanges = xgd23SS ?? string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -580,7 +575,7 @@ namespace MPF.Processors
|
||||
{
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.InternalSerialName] = ps3Serial ?? string.Empty;
|
||||
info.VersionAndEditions.Version = ps3Version ?? string.Empty;
|
||||
if (ps3FirmwareVersion != null)
|
||||
if (ps3FirmwareVersion is not null)
|
||||
info.CommonDiscInfo.ContentsSpecialFields![SiteCode.Patches] = $"PS3 Firmware {ps3FirmwareVersion}";
|
||||
}
|
||||
|
||||
@@ -644,6 +639,9 @@ namespace MPF.Processors
|
||||
| OutputFileFlags.Artifact
|
||||
| OutputFileFlags.Zippable,
|
||||
"img_cue"),
|
||||
new($"{outputFilename}_interleave.sub", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"interleave_sub"),
|
||||
new($"{outputFilename}_mainError.txt", OutputFileFlags.Required
|
||||
| OutputFileFlags.Artifact
|
||||
| OutputFileFlags.Zippable,
|
||||
@@ -674,6 +672,9 @@ namespace MPF.Processors
|
||||
| OutputFileFlags.Artifact
|
||||
| OutputFileFlags.Zippable,
|
||||
"vol_desc"),
|
||||
new($"{outputFilename}_with_cdg.bin", OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
"with_cdg_bin"),
|
||||
|
||||
new([$"{outputFilename} (Track 0).sub", $"{outputFilename} (Track 00).sub"], OutputFileFlags.Binary
|
||||
| OutputFileFlags.Zippable,
|
||||
@@ -959,7 +960,7 @@ namespace MPF.Processors
|
||||
string? exeDate = null;
|
||||
using var sr = File.OpenText(volDesc);
|
||||
var line = sr.ReadLine();
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -975,16 +976,16 @@ namespace MPF.Processors
|
||||
{
|
||||
// Account for Y2K date problem
|
||||
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
|
||||
if (exeDate != null && exeDate[..2] == "19")
|
||||
if (exeDate is not null && exeDate[..2] == "19")
|
||||
#else
|
||||
if (exeDate != null && exeDate.Substring(0, 2) == "19")
|
||||
if (exeDate is not null && exeDate.Substring(0, 2) == "19")
|
||||
#endif
|
||||
{
|
||||
string decade = exeDate!.Substring(2, 1);
|
||||
|
||||
// Does only PSX need to account for 1920s-60s?
|
||||
if (decade == "0" || decade == "1" ||
|
||||
psx && (decade == "2" || decade == "3" || decade == "4" || decade == "5" || decade == "6"))
|
||||
(psx && (decade == "2" || decade == "3" || decade == "4" || decade == "5" || decade == "6")))
|
||||
{
|
||||
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
|
||||
exeDate = $"20{exeDate[2..]}";
|
||||
@@ -1046,7 +1047,7 @@ namespace MPF.Processors
|
||||
|
||||
using var sr = File.OpenText(disc);
|
||||
var line = sr.ReadLine();
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -1144,7 +1145,7 @@ namespace MPF.Processors
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
while (line?.StartsWith("========== ManufacturingInformation ==========") == false)
|
||||
{
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("CopyrightProtectionType"))
|
||||
@@ -1176,7 +1177,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("DecryptedDiscKey"))
|
||||
@@ -1276,7 +1277,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("[NO ERROR]"))
|
||||
@@ -1376,7 +1377,7 @@ namespace MPF.Processors
|
||||
{
|
||||
using var sr = File.OpenText(drive);
|
||||
var line = sr.ReadLine();
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -1440,7 +1441,7 @@ namespace MPF.Processors
|
||||
{
|
||||
using var sr = File.OpenText(disc);
|
||||
var line = sr.ReadLine();
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -1540,12 +1541,12 @@ namespace MPF.Processors
|
||||
// Seek to the TOC data
|
||||
using var sr = File.OpenText(disc);
|
||||
var line = sr.ReadLine();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
if (!line.StartsWith("========== TOC"))
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== TOC") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Create the required regex
|
||||
@@ -1560,12 +1561,12 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// Seek to the FULL TOC data
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
if (!line.StartsWith("========== FULL TOC"))
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== FULL TOC") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Create the required regex
|
||||
@@ -1576,7 +1577,7 @@ namespace MPF.Processors
|
||||
var trackSessionMapping = new Dictionary<string, string>();
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== OpCode") == false)
|
||||
{
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
var match = trackSessionRegex.Match(line);
|
||||
@@ -1596,7 +1597,7 @@ namespace MPF.Processors
|
||||
|
||||
// Seek to the multisession data
|
||||
line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
if (!line.StartsWith("Lead-out length"))
|
||||
@@ -1611,7 +1612,7 @@ namespace MPF.Processors
|
||||
var firstSessionLeadOutLengthString = line?.Substring("Lead-out length of 1st session: ".Length);
|
||||
#endif
|
||||
line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Read the second session lead-in, if it exists
|
||||
@@ -1693,7 +1694,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return false;
|
||||
|
||||
if (line.StartsWith("Detected anti-mod string"))
|
||||
@@ -1734,7 +1735,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return false;
|
||||
|
||||
// Determine the section we are in
|
||||
@@ -1849,7 +1850,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.Contains("mode 2 form 2"))
|
||||
@@ -1900,7 +1901,7 @@ namespace MPF.Processors
|
||||
// If we're in a new mainInfo, the location of the header changed
|
||||
using var sr = File.OpenText(mainInfo);
|
||||
var line = sr.ReadLine();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
if (line.StartsWith("========== OpCode")
|
||||
@@ -1914,25 +1915,25 @@ namespace MPF.Processors
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Make sure we're in the area
|
||||
if (line.StartsWith("========== LBA") == false)
|
||||
if (!line.StartsWith("========== LBA"))
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== LBA") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// If we have a Sega disc, skip sector 0
|
||||
if (line.StartsWith("========== LBA[000000, 0000000]: Main Channel =========="))
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== LBA") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// If we have a PlayStation disc, skip sector 4
|
||||
if (line.StartsWith("========== LBA[000004, 0x00004]: Main Channel =========="))
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== LBA") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Assume the first non-LBA0/4 sector listed is the proper one
|
||||
@@ -2132,7 +2133,7 @@ namespace MPF.Processors
|
||||
// If we're in a new mainInfo, the location of the header changed
|
||||
using var sr = File.OpenText(mainInfo);
|
||||
var line = sr.ReadLine();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
if (line.StartsWith("========== OpCode")
|
||||
@@ -2141,31 +2142,31 @@ namespace MPF.Processors
|
||||
{
|
||||
// Seek to unscrambled data
|
||||
while ((line = sr.ReadLine())?.Contains("Check MCN and/or ISRC") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Read the next line so the search goes properly
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Make sure we're in the area
|
||||
if (!line.StartsWith("========== LBA"))
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== LBA") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Make sure we're in the right sector
|
||||
if (!line.StartsWith("========== LBA[000000, 0000000]: Main Channel =========="))
|
||||
while ((line = sr.ReadLine())?.StartsWith("========== LBA[000000, 0000000]: Main Channel ==========") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Fast forward to the header
|
||||
while ((line = sr.ReadLine())?.Trim()?.StartsWith("+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F") == false) ;
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
// Now that we're at the Header, read each line in and concatenate
|
||||
@@ -2203,7 +2204,7 @@ namespace MPF.Processors
|
||||
|
||||
string volType = "UNKNOWN";
|
||||
string label;
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -2249,7 +2250,7 @@ namespace MPF.Processors
|
||||
#endif
|
||||
|
||||
// Skip if label is blank, and skip Joliet (DIC Joliet parsing is broken?)
|
||||
if (label == null || label.Length <= 0 || volType == "Joliet")
|
||||
if (label is null || label.Length <= 0 || volType == "Joliet")
|
||||
{
|
||||
volType = "UNKNOWN";
|
||||
line = sr.ReadLine();
|
||||
@@ -2314,9 +2315,9 @@ namespace MPF.Processors
|
||||
// Now that we're at the offsets, attempt to get the sample offset
|
||||
var offsetLine = sr.ReadLine()?.Split(' ');
|
||||
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
|
||||
string offset = offsetLine != null ? offsetLine[^1] : string.Empty;
|
||||
string offset = offsetLine is not null ? offsetLine[^1] : string.Empty;
|
||||
#else
|
||||
string offset = offsetLine != null ? offsetLine[offsetLine.Length - 1] : string.Empty;
|
||||
string offset = offsetLine is not null ? offsetLine[offsetLine.Length - 1] : string.Empty;
|
||||
#endif
|
||||
offsets.Add(offset);
|
||||
}
|
||||
@@ -2326,7 +2327,7 @@ namespace MPF.Processors
|
||||
var temp = new List<string>();
|
||||
foreach (var offset in offsets)
|
||||
{
|
||||
if (offset == null || offset.Length == 0)
|
||||
if (offset is null || offset.Length == 0)
|
||||
continue;
|
||||
if (!temp.Contains(offset))
|
||||
temp.Add(offset);
|
||||
@@ -2364,12 +2365,12 @@ namespace MPF.Processors
|
||||
dmihash = null; pfihash = null; sshash = null;
|
||||
|
||||
// If we don't have a valid datafile, we can't do anything
|
||||
if (suppl?.Game == null || suppl.Game.Length == 0)
|
||||
if (suppl?.Game is null || suppl.Game.Length == 0)
|
||||
return false;
|
||||
|
||||
// Try to extract the hash information
|
||||
var roms = suppl.Game[0].Rom;
|
||||
if (roms == null || roms.Length == 0)
|
||||
if (roms is null || roms.Length == 0)
|
||||
return false;
|
||||
|
||||
dmihash = Array.Find(roms, r => r.Name?.EndsWith("DMI.bin") == true)?.CRC?.ToUpperInvariant();
|
||||
@@ -2387,11 +2388,10 @@ namespace MPF.Processors
|
||||
/// <param name="pfihash">Extracted PFI.bin CRC32 hash (upper-cased)</param>
|
||||
/// <param name="sshash">Extracted SS.bin CRC32 hash (upper-cased)</param>
|
||||
/// <param name="ss">Extracted security sector data</param>
|
||||
/// <param name="ssver">Extracted security sector version</param>
|
||||
/// <returns>True on successful extraction of info, false otherwise</returns>
|
||||
internal static bool GetXGDAuxInfo(string disc, out string? dmihash, out string? pfihash, out string? sshash, out string? ss, out string? ssver)
|
||||
internal static bool GetXGDAuxInfo(string disc, out string? dmihash, out string? pfihash, out string? sshash, out string? ss)
|
||||
{
|
||||
dmihash = null; pfihash = null; sshash = null; ss = null; ssver = null;
|
||||
dmihash = null; pfihash = null; sshash = null; ss = null;
|
||||
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (string.IsNullOrEmpty(disc))
|
||||
@@ -2402,16 +2402,13 @@ namespace MPF.Processors
|
||||
// This flag is needed because recent versions of DIC include security data twice
|
||||
bool foundSecuritySectors = false;
|
||||
|
||||
// SS version for all Kreon DIC dumps is v1
|
||||
ssver = "01";
|
||||
|
||||
try
|
||||
{
|
||||
using var sr = File.OpenText(disc);
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
// XGD version (1 = Xbox, 2 = Xbox360)
|
||||
@@ -2433,7 +2430,7 @@ namespace MPF.Processors
|
||||
&& !line.StartsWith("========== Unlock 2 state(wxripper) =========="))
|
||||
{
|
||||
line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
// If we have a recognized line format, parse it
|
||||
@@ -2444,7 +2441,7 @@ namespace MPF.Processors
|
||||
}
|
||||
}
|
||||
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
namespace MPF.Processors
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates the type of compression used for logs
|
||||
/// </summary>
|
||||
public enum LogCompression
|
||||
{
|
||||
/// <summary>
|
||||
/// PKZIP using DEFLATE level 5
|
||||
/// </summary>
|
||||
DeflateDefault,
|
||||
|
||||
/// <summary>
|
||||
/// PKZIP using DEFLATE level 9
|
||||
/// </summary>
|
||||
DeflateMaximum,
|
||||
|
||||
/// <summary>
|
||||
/// PKZIP using Zstd level 19
|
||||
/// </summary>
|
||||
Zstd19,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum for SecuROM scheme type
|
||||
/// </summary>
|
||||
internal enum SecuROMScheme
|
||||
{
|
||||
Unknown,
|
||||
|
||||
/// <summary>
|
||||
/// No SecuROM, 0 Sectors
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 1-2, 216 Sectors
|
||||
/// </summary>
|
||||
PreV3,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 3, 90 Sectors
|
||||
/// </summary>
|
||||
V3,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 4, 99 Sectors
|
||||
/// </summary>
|
||||
V4,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 4+, 11 Sectors
|
||||
/// </summary>
|
||||
V4Plus,
|
||||
}
|
||||
}
|
||||
namespace MPF.Processors
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates the type of compression used for logs
|
||||
/// </summary>
|
||||
public enum LogCompression
|
||||
{
|
||||
/// <summary>
|
||||
/// PKZIP using DEFLATE level 5
|
||||
/// </summary>
|
||||
DeflateDefault,
|
||||
|
||||
/// <summary>
|
||||
/// PKZIP using DEFLATE level 9
|
||||
/// </summary>
|
||||
DeflateMaximum,
|
||||
|
||||
/// <summary>
|
||||
/// PKZIP using Zstd level 19
|
||||
/// </summary>
|
||||
Zstd19,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum for SecuROM scheme type
|
||||
/// </summary>
|
||||
internal enum SecuROMScheme
|
||||
{
|
||||
Unknown,
|
||||
|
||||
/// <summary>
|
||||
/// No SecuROM, 0 Sectors
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 1-2, 216 Sectors
|
||||
/// </summary>
|
||||
PreV3,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 3, 90 Sectors
|
||||
/// </summary>
|
||||
V3,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 4, 99 Sectors
|
||||
/// </summary>
|
||||
V4,
|
||||
|
||||
/// <summary>
|
||||
/// SecuROM 4+, 11 Sectors
|
||||
/// </summary>
|
||||
V4Plus,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,11 @@ namespace MPF.Processors
|
||||
|
||||
// Get the Datafile information
|
||||
var datafile = GetDatafile(basePath);
|
||||
if (datafile != null)
|
||||
if (datafile is not null)
|
||||
info.TracksAndWriteOffsets.ClrMameProData = ProcessingTool.GenerateDatfile(datafile);
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
#pragma warning disable IDE0010
|
||||
switch (mediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -52,7 +53,7 @@ namespace MPF.Processors
|
||||
case MediaType.BluRay:
|
||||
case MediaType.UMD:
|
||||
var firstRom = datafile?.Game?[0]?.Rom?[0];
|
||||
if (firstRom != null)
|
||||
if (firstRom is not null)
|
||||
{
|
||||
info.SizeAndChecksums.Size = long.Parse(firstRom.Size ?? "0");
|
||||
info.SizeAndChecksums.CRC32 = firstRom.CRC;
|
||||
@@ -62,6 +63,7 @@ namespace MPF.Processors
|
||||
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -115,31 +117,31 @@ namespace MPF.Processors
|
||||
if (File.Exists($"{basePath}.bin"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.bin");
|
||||
if (rom != null)
|
||||
if (rom is not null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.ima"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.ima");
|
||||
if (rom != null)
|
||||
if (rom is not null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.img"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.img");
|
||||
if (rom != null)
|
||||
if (rom is not null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.iso"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.iso");
|
||||
if (rom != null)
|
||||
if (rom is not null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
else if (File.Exists($"{basePath}.mdf"))
|
||||
{
|
||||
var rom = GetRom($"{basePath}.mdf");
|
||||
if (rom != null)
|
||||
if (rom is not null)
|
||||
return GetDatafile(basePath, rom);
|
||||
}
|
||||
|
||||
@@ -150,7 +152,7 @@ namespace MPF.Processors
|
||||
|
||||
// Try Track 0
|
||||
var track0rom = GetRom($"{basePath} (Track 0).bin");
|
||||
if (track0rom != null)
|
||||
if (track0rom is not null)
|
||||
roms.Add(track0rom);
|
||||
|
||||
// Hash all found tracks
|
||||
@@ -158,7 +160,7 @@ namespace MPF.Processors
|
||||
{
|
||||
// Get the rom for the track
|
||||
var rom = GetRom($"{basePath} (Track {i}).bin");
|
||||
if (rom == null)
|
||||
if (rom is null)
|
||||
break;
|
||||
|
||||
// Add the track to the output
|
||||
@@ -167,7 +169,7 @@ namespace MPF.Processors
|
||||
|
||||
// Try Track A
|
||||
var trackArom = GetRom($"{basePath} (Track A).bin");
|
||||
if (trackArom != null)
|
||||
if (trackArom is not null)
|
||||
roms.Add(trackArom);
|
||||
|
||||
// Create and return if there are any tracks
|
||||
@@ -180,7 +182,7 @@ namespace MPF.Processors
|
||||
|
||||
// Try Track 00
|
||||
var track00rom = GetRom($"{basePath} (Track 00).bin");
|
||||
if (track00rom != null)
|
||||
if (track00rom is not null)
|
||||
roms.Add(track00rom);
|
||||
|
||||
// Hash all found tracks
|
||||
@@ -188,7 +190,7 @@ namespace MPF.Processors
|
||||
{
|
||||
// Get the rom for the track
|
||||
var rom = GetRom($"{basePath} (Track {i:D2}).bin");
|
||||
if (rom == null)
|
||||
if (rom is null)
|
||||
break;
|
||||
|
||||
// Add the track to the output
|
||||
@@ -197,7 +199,7 @@ namespace MPF.Processors
|
||||
|
||||
// Try Track AA
|
||||
var trackAArom = GetRom($"{basePath} (Track AA).bin");
|
||||
if (trackAArom != null)
|
||||
if (trackAArom is not null)
|
||||
roms.Add(trackAArom);
|
||||
|
||||
// Create and return if there are any tracks
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<PackageReference Include="GrindCore.SharpCompress" Version="0.41.1" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
|
||||
<PackageReference Include="SabreTools.Hashing" Version="[1.6.0]" />
|
||||
<PackageReference Include="SabreTools.IO" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="[2.2.1]" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -206,13 +206,13 @@ namespace MPF.Processors.OutputFiles
|
||||
public virtual bool Exists(ZipArchive? archive)
|
||||
{
|
||||
// If the archive is invalid
|
||||
if (archive == null)
|
||||
if (archive is null)
|
||||
return false;
|
||||
|
||||
// Get list of all files in archive
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
if (entry.Key == null)
|
||||
if (entry.Key is null)
|
||||
continue;
|
||||
|
||||
if (Array.Exists(Filenames, filename => entry.Key == filename))
|
||||
@@ -231,13 +231,13 @@ namespace MPF.Processors.OutputFiles
|
||||
public virtual bool Extract(ZipArchive? archive, string outputDirectory)
|
||||
{
|
||||
// If the archive is invalid
|
||||
if (archive == null)
|
||||
if (archive is null)
|
||||
return false;
|
||||
|
||||
// Get list of all files in archive
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
if (entry.Key == null)
|
||||
if (entry.Key is null)
|
||||
continue;
|
||||
|
||||
var matches = Array.FindAll(Filenames, filename => entry.Key == filename);
|
||||
|
||||
@@ -69,13 +69,13 @@ namespace MPF.Processors.OutputFiles
|
||||
public override bool Exists(ZipArchive? archive)
|
||||
{
|
||||
// If the archive is invalid
|
||||
if (archive == null)
|
||||
if (archive is null)
|
||||
return false;
|
||||
|
||||
// Get list of all files in archive
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
if (entry.Key == null)
|
||||
if (entry.Key is null)
|
||||
continue;
|
||||
|
||||
if (Array.Exists(Filenames, pattern => Regex.IsMatch(entry.Key, pattern)))
|
||||
@@ -89,13 +89,13 @@ namespace MPF.Processors.OutputFiles
|
||||
public override bool Extract(ZipArchive? archive, string outputDirectory)
|
||||
{
|
||||
// If the archive is invalid
|
||||
if (archive == null)
|
||||
if (archive is null)
|
||||
return false;
|
||||
|
||||
// Get list of all files in archive
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
if (entry.Key == null)
|
||||
if (entry.Key is null)
|
||||
continue;
|
||||
|
||||
var matches = Array.FindAll(Filenames, pattern => Regex.IsMatch(entry.Key, pattern));
|
||||
@@ -128,7 +128,7 @@ namespace MPF.Processors.OutputFiles
|
||||
foreach (string file in directoryFiles)
|
||||
{
|
||||
var matches = Array.FindAll(Filenames, pattern => Regex.IsMatch(file, pattern));
|
||||
if (matches != null && matches.Length > 0)
|
||||
if (matches is not null && matches.Length > 0)
|
||||
paths.Add(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,13 +96,13 @@ namespace MPF.Processors
|
||||
info.SizeAndChecksums.PICIdentifier = ProcessingTool.GetPICIdentifier(di);
|
||||
if (ProcessingTool.GetLayerbreaks(di, out long? layerbreak1, out long? layerbreak2, out long? layerbreak3))
|
||||
{
|
||||
if (layerbreak1 != null && layerbreak1 * 2048 < info.SizeAndChecksums.Size)
|
||||
if (layerbreak1 is not null && layerbreak1 * 2048 < info.SizeAndChecksums.Size)
|
||||
info.SizeAndChecksums.Layerbreak = layerbreak1.Value;
|
||||
|
||||
if (layerbreak2 != null && layerbreak2 * 2048 < info.SizeAndChecksums.Size)
|
||||
if (layerbreak2 is not null && layerbreak2 * 2048 < info.SizeAndChecksums.Size)
|
||||
info.SizeAndChecksums.Layerbreak2 = layerbreak2.Value;
|
||||
|
||||
if (layerbreak3 != null && layerbreak3 * 2048 < info.SizeAndChecksums.Size)
|
||||
if (layerbreak3 is not null && layerbreak3 * 2048 < info.SizeAndChecksums.Size)
|
||||
info.SizeAndChecksums.Layerbreak3 = layerbreak3.Value;
|
||||
}
|
||||
|
||||
@@ -121,9 +121,9 @@ namespace MPF.Processors
|
||||
// Parse Disc Key, Disc ID, and PIC from the getkey.log file
|
||||
if (ProcessingTool.ParseGetKeyLog(getKeyPath, out string? key, out string? id, out string? pic))
|
||||
{
|
||||
if (key != null)
|
||||
if (key is not null)
|
||||
info.Extras.DiscKey = key.ToUpperInvariant();
|
||||
if (id != null)
|
||||
if (id is not null)
|
||||
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
|
||||
info.Extras.DiscID = $"{id.ToUpperInvariant()[..24]}XXXXXXXX";
|
||||
#else
|
||||
|
||||
@@ -40,11 +40,11 @@ namespace MPF.Processors
|
||||
public static string? GenerateDatfile(Datafile? datafile)
|
||||
{
|
||||
// If we don't have a valid datafile, we can't do anything
|
||||
if (datafile?.Game == null || datafile.Game.Length == 0)
|
||||
if (datafile?.Game is null || datafile.Game.Length == 0)
|
||||
return null;
|
||||
|
||||
var roms = datafile.Game[0].Rom;
|
||||
if (roms == null || roms.Length == 0)
|
||||
if (roms is null || roms.Length == 0)
|
||||
return null;
|
||||
|
||||
// Otherwise, reconstruct the hash data with only the required info
|
||||
@@ -109,7 +109,7 @@ namespace MPF.Processors
|
||||
});
|
||||
|
||||
// If the reader is null for some reason, we can't do anything
|
||||
if (xtr == null)
|
||||
if (xtr is null)
|
||||
return null;
|
||||
|
||||
var serializer = new XmlSerializer(typeof(Datafile));
|
||||
@@ -191,11 +191,11 @@ namespace MPF.Processors
|
||||
{
|
||||
size = -1; crc32 = null; md5 = null; sha1 = null;
|
||||
|
||||
if (datafile?.Game == null || datafile.Game.Length == 0)
|
||||
if (datafile?.Game is null || datafile.Game.Length == 0)
|
||||
return false;
|
||||
|
||||
var roms = datafile.Game[0].Rom;
|
||||
if (roms == null || roms.Length == 0)
|
||||
if (roms is null || roms.Length == 0)
|
||||
return false;
|
||||
|
||||
var rom = roms[0];
|
||||
@@ -247,13 +247,13 @@ namespace MPF.Processors
|
||||
layerbreak1 = null; layerbreak2 = null; layerbreak3 = null;
|
||||
|
||||
// If we don't have valid disc information, we can't do anything
|
||||
if (di?.Units == null || di.Units.Length <= 1)
|
||||
if (di?.Units is null || di.Units.Length <= 1)
|
||||
return false;
|
||||
|
||||
// Wrap big-endian reading
|
||||
static int ReadFromArrayBigEndian(byte[]? bytes, int offset)
|
||||
{
|
||||
if (bytes == null)
|
||||
if (bytes is null || bytes.Length < offset + 4)
|
||||
return default;
|
||||
|
||||
return bytes.ReadInt32BigEndian(ref offset);
|
||||
@@ -294,7 +294,7 @@ namespace MPF.Processors
|
||||
public static string? GetPICIdentifier(DiscInformation? di)
|
||||
{
|
||||
// If we don't have valid disc information, we can't do anything
|
||||
if (di?.Units == null || di.Units.Length < 1)
|
||||
if (di?.Units is null || di.Units.Length < 1)
|
||||
return null;
|
||||
|
||||
// Assume the identifier is consistent across all units
|
||||
@@ -309,7 +309,7 @@ namespace MPF.Processors
|
||||
public static string NormalizeShiftJIS(byte[]? contents)
|
||||
{
|
||||
// Invalid arrays are passed as-is
|
||||
if (contents == null || contents.Length == 0)
|
||||
if (contents is null || contents.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
#if NET462_OR_GREATER || NETCOREAPP
|
||||
@@ -332,7 +332,7 @@ namespace MPF.Processors
|
||||
internal static bool BytesContainsShiftJIS(byte[] bytes)
|
||||
{
|
||||
// Invalid arrays do not count
|
||||
if (bytes == null || bytes.Length == 0)
|
||||
if (bytes is null || bytes.Length == 0)
|
||||
return false;
|
||||
|
||||
// Loop through and check each pair of bytes
|
||||
@@ -401,6 +401,7 @@ namespace MPF.Processors
|
||||
{
|
||||
// string publisher = serial[0] + serial[1];
|
||||
// char secondRegion = serial[3];
|
||||
#pragma warning disable IDE0010
|
||||
switch (serial[2])
|
||||
{
|
||||
case 'A': return Region.Asia;
|
||||
@@ -433,6 +434,7 @@ namespace MPF.Processors
|
||||
_ => (Region?)Region.Japan,
|
||||
};
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
// Japan-only special serial
|
||||
@@ -505,8 +507,8 @@ namespace MPF.Processors
|
||||
return false;
|
||||
|
||||
// Create conversion delegates
|
||||
byte _btoi(byte b) => (byte)(b / 16 * 10 + b % 16);
|
||||
byte _itob(byte i) => (byte)(i / 10 * 16 + i % 10);
|
||||
byte _btoi(byte b) => (byte)((b / 16 * 10) + (b % 16));
|
||||
byte _itob(byte i) => (byte)((i / 10 * 16) + (i % 10));
|
||||
|
||||
try
|
||||
{
|
||||
@@ -558,7 +560,7 @@ namespace MPF.Processors
|
||||
time++;
|
||||
|
||||
expected[3] = _itob((byte)(time / 60 / 75));
|
||||
expected[4] = _itob((byte)((time / 75) % 60));
|
||||
expected[4] = _itob((byte)(time / 75 % 60));
|
||||
expected[5] = _itob((byte)(time % 75));
|
||||
}
|
||||
|
||||
@@ -567,7 +569,7 @@ namespace MPF.Processors
|
||||
|
||||
// MSF2 [7-9]
|
||||
expected[7] = _itob((byte)(sector / 60 / 75));
|
||||
expected[8] = _itob((byte)((sector / 75) % 60));
|
||||
expected[8] = _itob((byte)(sector / 75 % 60));
|
||||
expected[9] = _itob((byte)(sector % 75));
|
||||
|
||||
// CRC-16 [10-11] -- TODO: Ensure byte order is correct
|
||||
@@ -625,15 +627,15 @@ namespace MPF.Processors
|
||||
|
||||
// Determine whether GetKey was successful
|
||||
string? line;
|
||||
while ((line = sr.ReadLine()) != null && line.Trim().StartsWith("get_dec_key succeeded!") == false) ;
|
||||
if (line == null)
|
||||
while ((line = sr.ReadLine()) is not null && !line.Trim().StartsWith("get_dec_key succeeded!")) ;
|
||||
if (line is null)
|
||||
return false;
|
||||
|
||||
// Look for Disc Key in log
|
||||
while ((line = sr.ReadLine()) != null && line.Trim().StartsWith("disc_key = ") == false) ;
|
||||
while ((line = sr.ReadLine()) is not null && !line.Trim().StartsWith("disc_key = ")) ;
|
||||
|
||||
// If end of file reached, no key found
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return false;
|
||||
|
||||
// Get Disc Key from log
|
||||
@@ -649,14 +651,14 @@ namespace MPF.Processors
|
||||
|
||||
// Convert Disc Key to byte array
|
||||
key = discKeyStr;
|
||||
if (key == null)
|
||||
if (key is null)
|
||||
return false;
|
||||
|
||||
// Read Disc ID
|
||||
while ((line = sr.ReadLine()) != null && line.Trim().StartsWith("disc_id = ") == false) ;
|
||||
while ((line = sr.ReadLine()) is not null && !line.Trim().StartsWith("disc_id = ")) ;
|
||||
|
||||
// If end of file reached, no ID found
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return false;
|
||||
|
||||
// Get Disc ID from log
|
||||
@@ -679,21 +681,21 @@ namespace MPF.Processors
|
||||
|
||||
// Convert Disc ID to byte array
|
||||
id = discIDStr;
|
||||
if (id == null)
|
||||
if (id is null)
|
||||
return false;
|
||||
|
||||
// Look for PIC in log
|
||||
while ((line = sr.ReadLine()) != null && line.Trim().StartsWith("PIC:") == false) ;
|
||||
while ((line = sr.ReadLine()) is not null && !line.Trim().StartsWith("PIC:")) ;
|
||||
|
||||
// If end of file reached, no PIC found
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return false;
|
||||
|
||||
// Get PIC from log
|
||||
string discPICStr = "";
|
||||
for (int i = 0; i < 9; i++)
|
||||
discPICStr += sr.ReadLine();
|
||||
if (discPICStr == null)
|
||||
if (discPICStr is null)
|
||||
return false;
|
||||
|
||||
// Validate PIC from log
|
||||
@@ -702,11 +704,11 @@ namespace MPF.Processors
|
||||
|
||||
// Convert PIC to byte array
|
||||
pic = discPICStr;
|
||||
if (pic == null)
|
||||
if (pic is null)
|
||||
return false;
|
||||
|
||||
// Double check for warnings in .getkey.log
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
while ((line = sr.ReadLine()) is not null)
|
||||
{
|
||||
string t = line.Trim();
|
||||
if (t.StartsWith("WARNING"))
|
||||
@@ -952,10 +954,10 @@ namespace MPF.Processors
|
||||
return null;
|
||||
|
||||
byte[]? crc32 = inputCRC32.FromHexString();
|
||||
if (crc32 == null || crc32.Length != 4)
|
||||
if (crc32 is null || crc32.Length != 4)
|
||||
return null;
|
||||
|
||||
return (uint)(0x01000000 * crc32[0] + 0x00010000 * crc32[1] + 0x00000100 * crc32[2] + 0x00000001 * crc32[3]);
|
||||
return (uint)((0x01000000 * crc32[0]) + (0x00010000 * crc32[1]) + (0x00000100 * crc32[2]) + (0x00000001 * crc32[3]));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1162,6 +1164,7 @@ namespace MPF.Processors
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (emptyResponse)
|
||||
return true;
|
||||
}
|
||||
@@ -1439,33 +1442,32 @@ namespace MPF.Processors
|
||||
else
|
||||
numRanges = 4;
|
||||
|
||||
|
||||
uint[] startLBA = new uint[numRanges];
|
||||
uint[] endLBA = new uint[numRanges];
|
||||
for (uint i = 0; i < numRanges; i++)
|
||||
{
|
||||
// Determine range Physical Sector Number
|
||||
uint startPSN = (uint)((((ss[i * 9 + 1636] << 8) | ss[i * 9 + 1637]) << 8) | ss[i * 9 + 1638]);
|
||||
uint endPSN = (uint)((((ss[i * 9 + 1639] << 8) | ss[i * 9 + 1640]) << 8) | ss[i * 9 + 1641]);
|
||||
uint startPSN = (uint)((((ss[(i * 9) + 1636] << 8) | ss[(i * 9) + 1637]) << 8) | ss[(i * 9) + 1638]);
|
||||
uint endPSN = (uint)((((ss[(i * 9) + 1639] << 8) | ss[(i * 9) + 1640]) << 8) | ss[(i * 9) + 1641]);
|
||||
|
||||
// Determine range Logical Sector Number
|
||||
if (xgdType == 1 && startPSN >= (1913776 + 0x030000))
|
||||
{
|
||||
// Layer 1 of XGD1
|
||||
startLBA[i] = (1913776 + 0x030000) * 2 - (startPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
endLBA[i] = (1913776 + 0x030000) * 2 - (endPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
startLBA[i] = ((1913776 + 0x030000) * 2) - (startPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
endLBA[i] = ((1913776 + 0x030000) * 2) - (endPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
}
|
||||
else if (xgdType == 2 && startPSN >= (1913760 + 0x030000))
|
||||
{
|
||||
// Layer 1 of XGD2
|
||||
startLBA[i] = (1913760 + 0x030000) * 2 - (startPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
endLBA[i] = (1913760 + 0x030000) * 2 - (endPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
startLBA[i] = ((1913760 + 0x030000) * 2) - (startPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
endLBA[i] = ((1913760 + 0x030000) * 2) - (endPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
}
|
||||
else if (xgdType == 3 && startPSN >= (2133520 + 0x030000))
|
||||
{
|
||||
// Layer 1 of XGD3
|
||||
startLBA[i] = (2133520 + 0x030000) * 2 - (startPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
endLBA[i] = (2133520 + 0x030000) * 2 - (endPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
startLBA[i] = ((2133520 + 0x030000) * 2) - (startPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
endLBA[i] = ((2133520 + 0x030000) * 2) - (endPSN ^ 0xFFFFFF) - 0x030000 - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace MPF.Processors
|
||||
logEntry?.WriteToFile(logPath, new ExtractionOptions { ExtractFullPath = false, Overwrite = true });
|
||||
}
|
||||
catch { }
|
||||
|
||||
logArchive?.Dispose();
|
||||
}
|
||||
#endif
|
||||
@@ -152,6 +153,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
#pragma warning disable IDE0010
|
||||
switch (mediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -161,8 +163,8 @@ namespace MPF.Processors
|
||||
// Attempt to get the error count
|
||||
if (GetErrorCount($"{basePath}.log", out long redumpErrors, out long c2Errors))
|
||||
{
|
||||
info.CommonDiscInfo.ErrorsCount = (redumpErrors == -1 ? "Error retrieving error count" : redumpErrors.ToString());
|
||||
info.DumpingInfo.C2ErrorsCount = (c2Errors == -1 ? "Error retrieving error count" : c2Errors.ToString());
|
||||
info.CommonDiscInfo.ErrorsCount = redumpErrors == -1 ? "Error retrieving error count" : redumpErrors.ToString();
|
||||
info.DumpingInfo.C2ErrorsCount = c2Errors == -1 ? "Error retrieving error count" : c2Errors.ToString();
|
||||
}
|
||||
|
||||
// Attempt to get extra metadata if it's an audio disc
|
||||
@@ -205,7 +207,7 @@ namespace MPF.Processors
|
||||
|
||||
// Attempt to get the error count
|
||||
long scsiErrors = GetSCSIErrorCount($"{basePath}.log");
|
||||
info.CommonDiscInfo.ErrorsCount = (scsiErrors == -1 ? "Error retrieving error count" : scsiErrors.ToString());
|
||||
info.CommonDiscInfo.ErrorsCount = scsiErrors == -1 ? "Error retrieving error count" : scsiErrors.ToString();
|
||||
|
||||
// Bluray-specific options
|
||||
if (mediaType == MediaType.BluRay || mediaType == MediaType.NintendoWiiUOpticalDisc)
|
||||
@@ -309,15 +311,15 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
string? dmiCrc = HashTool.GetFileHash($"{basePath}.dmi", HashType.CRC32);
|
||||
if (dmiCrc != null)
|
||||
if (dmiCrc is not null)
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.DMIHash] = dmiCrc.ToUpperInvariant();
|
||||
string? pfiCrc = HashTool.GetFileHash($"{basePath}.pfi", HashType.CRC32);
|
||||
if (pfiCrc != null)
|
||||
if (pfiCrc is not null)
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.PFIHash] = pfiCrc.ToUpperInvariant();
|
||||
if (ProcessingTool.IsValidSS($"{basePath}.ss") && !ProcessingTool.IsValidPartialSS($"{basePath}.ss"))
|
||||
{
|
||||
string? ssCrc = HashTool.GetFileHash($"{basePath}.ss", HashType.CRC32);
|
||||
if (ssCrc != null)
|
||||
if (ssCrc is not null)
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.SSHash] = ssCrc.ToUpperInvariant();
|
||||
}
|
||||
|
||||
@@ -340,6 +342,7 @@ namespace MPF.Processors
|
||||
// TODO: Support region setting from parsed value
|
||||
info.VersionAndEditions.Version = version ?? string.Empty;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaMegaCDSegaCD:
|
||||
@@ -362,6 +365,7 @@ namespace MPF.Processors
|
||||
// TODO: Support region setting from parsed value
|
||||
info.VersionAndEditions.Version = version ?? string.Empty;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaDreamcast:
|
||||
@@ -377,6 +381,7 @@ namespace MPF.Processors
|
||||
// TODO: Support region setting from parsed value
|
||||
info.VersionAndEditions.Version = version ?? string.Empty;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaNaomi:
|
||||
@@ -392,6 +397,7 @@ namespace MPF.Processors
|
||||
// TODO: Support region setting from parsed value
|
||||
info.VersionAndEditions.Version = version ?? string.Empty;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaNaomi2:
|
||||
@@ -407,6 +413,7 @@ namespace MPF.Processors
|
||||
// TODO: Support region setting from parsed value
|
||||
info.VersionAndEditions.Version = version ?? string.Empty;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RedumpSystem.SegaSaturn:
|
||||
@@ -443,7 +450,7 @@ namespace MPF.Processors
|
||||
}
|
||||
|
||||
string? ps2Protection = GetPlayStation2Protection($"{basePath}.log");
|
||||
if (ps2Protection != null)
|
||||
if (ps2Protection is not null)
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.Protection] = ps2Protection;
|
||||
|
||||
break;
|
||||
@@ -475,6 +482,7 @@ namespace MPF.Processors
|
||||
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -488,6 +496,7 @@ namespace MPF.Processors
|
||||
if (!string.IsNullOrEmpty(outputDirectory))
|
||||
basePath = Path.Combine(outputDirectory, basePath);
|
||||
|
||||
#pragma warning disable IDE0010
|
||||
switch (mediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
@@ -696,6 +705,7 @@ namespace MPF.Processors
|
||||
"state_zst"),
|
||||
];
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
return [];
|
||||
}
|
||||
@@ -711,7 +721,7 @@ namespace MPF.Processors
|
||||
private static bool DatfileExists(string log)
|
||||
{
|
||||
// Uncompressed outputs
|
||||
if (GetDatfile(log) != null)
|
||||
if (GetDatfile(log) is not null)
|
||||
return true;
|
||||
|
||||
// Check for the log file
|
||||
@@ -745,11 +755,11 @@ namespace MPF.Processors
|
||||
}
|
||||
}
|
||||
|
||||
if (logEntry == null)
|
||||
if (logEntry is null)
|
||||
return false;
|
||||
|
||||
using var sr = new StreamReader(logEntry.OpenEntryStream());
|
||||
return GetDatfile(sr) != null;
|
||||
return GetDatfile(sr) is not null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -967,7 +977,7 @@ namespace MPF.Processors
|
||||
{
|
||||
using var sr = File.OpenText(log);
|
||||
var line = sr.ReadLine();
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -1016,7 +1026,7 @@ namespace MPF.Processors
|
||||
{
|
||||
using var sr = File.OpenText(log);
|
||||
var line = sr.ReadLine()?.TrimEnd();
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// If the line isn't the non-embedded disc type, skip
|
||||
if (!line.StartsWith("disc type:"))
|
||||
@@ -1042,7 +1052,7 @@ namespace MPF.Processors
|
||||
"HD-DVD" => MediaType.HDDVD,
|
||||
_ => null,
|
||||
};
|
||||
return discType != null;
|
||||
return discType is not null;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1135,7 +1145,7 @@ namespace MPF.Processors
|
||||
|
||||
// Now read until we hit the manufacturing information
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
while (line != null && !sr.EndOfStream)
|
||||
while (line is not null && !sr.EndOfStream)
|
||||
{
|
||||
if (line.StartsWith("protection system type"))
|
||||
{
|
||||
@@ -1249,7 +1259,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
// C2: <error count>
|
||||
@@ -1357,7 +1367,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("build date:"))
|
||||
@@ -1451,7 +1461,7 @@ namespace MPF.Processors
|
||||
var regex = new Regex(@"drive: (.+) - (.+) \(revision level: (.+), vendor specific: (.+)\)", RegexOptions.Compiled);
|
||||
|
||||
string? line;
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
while ((line = sr.ReadLine()) is not null)
|
||||
{
|
||||
var match = regex.Match(line.Trim());
|
||||
if (match.Success)
|
||||
@@ -1499,7 +1509,7 @@ namespace MPF.Processors
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
|
||||
// If we have a null line, just break
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
// Single-layer discs have no layerbreak
|
||||
@@ -1595,7 +1605,7 @@ namespace MPF.Processors
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
|
||||
// If we have a null line, just break
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
// Store the first session range
|
||||
@@ -1651,7 +1661,7 @@ namespace MPF.Processors
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
|
||||
// If we have a null line, just break
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("anti-modchip: no"))
|
||||
@@ -1691,7 +1701,7 @@ namespace MPF.Processors
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
|
||||
// If we have a null line, just break
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.Contains("EDC: no"))
|
||||
@@ -1740,13 +1750,14 @@ namespace MPF.Processors
|
||||
line?.StartsWith("PS5 [") == true)
|
||||
break;
|
||||
}
|
||||
|
||||
if (sr.EndOfStream)
|
||||
return false;
|
||||
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("anti-modchip:"))
|
||||
@@ -1862,7 +1873,7 @@ namespace MPF.Processors
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return false;
|
||||
|
||||
if (line.StartsWith("libcrypt: no"))
|
||||
@@ -1902,7 +1913,7 @@ namespace MPF.Processors
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
return null;
|
||||
|
||||
if (line.StartsWith("protection: PS2"))
|
||||
@@ -2151,7 +2162,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("build date:"))
|
||||
@@ -2252,7 +2263,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
var line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
// SCSI: <error count>
|
||||
@@ -2392,7 +2403,7 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
line = sr.ReadLine()?.TrimStart();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("build date:"))
|
||||
@@ -2595,7 +2606,7 @@ namespace MPF.Processors
|
||||
using var sr = File.OpenText(log);
|
||||
var line = sr.ReadLine();
|
||||
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -2610,7 +2621,7 @@ namespace MPF.Processors
|
||||
#endif
|
||||
|
||||
// Skip if label is blank
|
||||
if (label == null || label.Length <= 0)
|
||||
if (label is null || label.Length <= 0)
|
||||
break;
|
||||
|
||||
if (volLabels.ContainsKey(label))
|
||||
|
||||
@@ -177,18 +177,18 @@ namespace MPF.Processors
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string? line = sr.ReadLine()?.Trim();
|
||||
if (line == null)
|
||||
if (line is null)
|
||||
break;
|
||||
|
||||
if (line.StartsWith("TITLE") && title == null)
|
||||
if (line.StartsWith("TITLE") && title is null)
|
||||
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
|
||||
title = line["TITLE: ".Length..];
|
||||
#else
|
||||
title = line.Substring("TITLE: ".Length);
|
||||
#endif
|
||||
else if (line.StartsWith("DISC_ID") && version == null)
|
||||
else if (line.StartsWith("DISC_ID") && version is null)
|
||||
serial = line.Split(' ')[1];
|
||||
else if (line.StartsWith("DISC_VERSION") && version == null)
|
||||
else if (line.StartsWith("DISC_VERSION") && version is null)
|
||||
version = line.Split(' ')[1];
|
||||
else if (line.StartsWith("pspUmdTypes"))
|
||||
category = ProcessingTool.GetUMDCategory(line.Split(' ')[2]);
|
||||
@@ -239,7 +239,7 @@ namespace MPF.Processors
|
||||
|
||||
string volType = "UNKNOWN";
|
||||
string label;
|
||||
while (line != null)
|
||||
while (line is not null)
|
||||
{
|
||||
// Trim the line for later use
|
||||
line = line.Trim();
|
||||
@@ -285,7 +285,7 @@ namespace MPF.Processors
|
||||
#endif
|
||||
|
||||
// Skip if label is blank
|
||||
if (label == null || label.Length <= 0)
|
||||
if (label is null || label.Length <= 0)
|
||||
{
|
||||
volType = "UNKNOWN";
|
||||
line = sr.ReadLine();
|
||||
|
||||
@@ -60,12 +60,13 @@ namespace MPF.Processors
|
||||
if (GetReadErrors(logPath, out long readErrors))
|
||||
info.CommonDiscInfo.ErrorsCount = readErrors == -1 ? "Error retrieving error count" : readErrors.ToString();
|
||||
|
||||
#pragma warning disable IDE0010
|
||||
switch (System)
|
||||
{
|
||||
case RedumpSystem.MicrosoftXbox:
|
||||
string xmidString = ProcessingTool.GetXMID(Path.Combine(outputDirectory, "DMI.bin"));
|
||||
var xmid = SabreTools.Serialization.Wrappers.XMID.Create(xmidString);
|
||||
if (xmid != null)
|
||||
if (xmid is not null)
|
||||
{
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.XMID] = xmidString?.TrimEnd('\0') ?? string.Empty;
|
||||
info.CommonDiscInfo.Serial = xmid.Serial ?? string.Empty;
|
||||
@@ -90,7 +91,7 @@ namespace MPF.Processors
|
||||
// Parse DMI.bin
|
||||
string xemidString = ProcessingTool.GetXeMID(Path.Combine(outputDirectory, "DMI.bin"));
|
||||
var xemid = SabreTools.Serialization.Wrappers.XeMID.Create(xemidString);
|
||||
if (xemid != null)
|
||||
if (xemid is not null)
|
||||
{
|
||||
info.CommonDiscInfo.CommentsSpecialFields[SiteCode.XeMID] = xemidString?.TrimEnd('\0') ?? string.Empty;
|
||||
info.CommonDiscInfo.Serial = xemid.Serial ?? string.Empty;
|
||||
@@ -102,6 +103,7 @@ namespace MPF.Processors
|
||||
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
|
||||
// Get the output file paths
|
||||
string dmiPath = Path.Combine(outputDirectory, "DMI.bin");
|
||||
@@ -600,7 +602,7 @@ namespace MPF.Processors
|
||||
if (i >= 4 && i <= 7)
|
||||
{
|
||||
byte[]? angles = line!.Substring(34, 10).FromHexString();
|
||||
if (angles == null || angles.Length != 5)
|
||||
if (angles is null || angles.Length != 5)
|
||||
return false;
|
||||
responses[i - 4] = angles!;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Markup;
|
||||
|
||||
#pragma warning disable IDE0051 // Remove unused private members
|
||||
namespace MPF.UI
|
||||
{
|
||||
/// <summary>
|
||||
@@ -10,7 +11,6 @@ namespace MPF.UI
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
|
||||
#if NET35_OR_GREATER || NETCOREAPP
|
||||
|
||||
#region ControlTemplates
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace WPFCustomMessageBox
|
||||
/// <returns>A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user.</returns>
|
||||
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return button switch
|
||||
{
|
||||
MessageBoxButton.YesNo
|
||||
@@ -106,6 +107,7 @@ namespace WPFCustomMessageBox
|
||||
|
||||
_ => ShowOKMessage(null, messageBoxText, caption, null, null, null, timeout, timeoutResult),
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -123,6 +125,7 @@ namespace WPFCustomMessageBox
|
||||
/// <returns>A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user.</returns>
|
||||
public static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return button switch
|
||||
{
|
||||
MessageBoxButton.YesNo
|
||||
@@ -130,6 +133,7 @@ namespace WPFCustomMessageBox
|
||||
|
||||
_ => ShowOKMessage(owner, messageBoxText, caption, null, null, null, timeout, timeoutResult),
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,6 +151,7 @@ namespace WPFCustomMessageBox
|
||||
/// <returns>A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user.</returns>
|
||||
public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return button switch
|
||||
{
|
||||
MessageBoxButton.YesNo
|
||||
@@ -154,6 +159,7 @@ namespace WPFCustomMessageBox
|
||||
|
||||
_ => ShowOKMessage(null, messageBoxText, caption, null, null, icon, timeout, timeoutResult),
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -172,6 +178,7 @@ namespace WPFCustomMessageBox
|
||||
/// <returns>A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user.</returns>
|
||||
public static MessageBoxResult Show(Window owner, string? messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, int? timeout = null, MessageBoxResult timeoutResult = MessageBoxResult.None)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
return button switch
|
||||
{
|
||||
MessageBoxButton.YesNo
|
||||
@@ -179,6 +186,7 @@ namespace WPFCustomMessageBox
|
||||
|
||||
_ => ShowOKMessage(owner, messageBoxText, caption, null, null, icon, timeout, timeoutResult),
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -497,7 +505,6 @@ namespace WPFCustomMessageBox
|
||||
return ShowYesNoMessage(owner, messageBoxText, caption, yesButtonText, noButtonText, cancelButtonText, icon, timeout, timeoutResult);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Displays a message box that has a message, caption, OK/Cancel buttons with custom System.String values for the buttons' text, and icon;
|
||||
/// and that returns a result.
|
||||
@@ -526,7 +533,6 @@ namespace WPFCustomMessageBox
|
||||
return msg.Result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Displays a message box that has a message, caption, Yes/No/Cancel buttons with custom System.String values for the buttons' text, and icon;
|
||||
/// and that returns a result.
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace WPFCustomMessageBox
|
||||
ShowActivated = true;
|
||||
ShowInTaskbar = true;
|
||||
|
||||
if (owner != null && owner.IsLoaded)
|
||||
if (owner is not null && owner.IsLoaded)
|
||||
{
|
||||
Owner = owner;
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
@@ -154,6 +154,7 @@ namespace WPFCustomMessageBox
|
||||
|
||||
private void DisplayButtons(MessageBoxButton button)
|
||||
{
|
||||
#pragma warning disable IDE0010
|
||||
switch (button)
|
||||
{
|
||||
case MessageBoxButton.OKCancel:
|
||||
@@ -193,10 +194,12 @@ namespace WPFCustomMessageBox
|
||||
Button_Cancel!.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
#pragma warning restore IDE0010
|
||||
}
|
||||
|
||||
private void DisplayImage(MessageBoxImage image)
|
||||
{
|
||||
#pragma warning disable IDE0072
|
||||
Icon icon = image switch
|
||||
{
|
||||
// Enumeration value 48 - also covers "Warning"
|
||||
@@ -211,6 +214,7 @@ namespace WPFCustomMessageBox
|
||||
MessageBoxImage.Question => SystemIcons.Question,
|
||||
_ => SystemIcons.Information,
|
||||
};
|
||||
#pragma warning restore IDE0072
|
||||
|
||||
Image_MessageBox!.Source = icon.ToImageSource();
|
||||
Image_MessageBox.Visibility = Visibility.Visible;
|
||||
|
||||
23
MPF.UI/External/WPFCustomMessageBox/Util.cs
vendored
23
MPF.UI/External/WPFCustomMessageBox/Util.cs
vendored
@@ -20,26 +20,25 @@ namespace WPFCustomMessageBox
|
||||
internal static class Util
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
static extern int GetWindowLong(IntPtr hwnd, int index);
|
||||
public static extern int GetWindowLong(IntPtr hwnd, int index);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle);
|
||||
public static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, int x, int y, int width, int height, uint flags);
|
||||
public static extern bool SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, int x, int y, int width, int height, uint flags);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);
|
||||
public static extern IntPtr SendMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
const int GWL_EXSTYLE = -20;
|
||||
const int WS_EX_DLGMODALFRAME = 0x0001;
|
||||
const int SWP_NOSIZE = 0x0001;
|
||||
const int SWP_NOMOVE = 0x0002;
|
||||
const int SWP_NOZORDER = 0x0004;
|
||||
const int SWP_FRAMECHANGED = 0x0020;
|
||||
private const int GWL_EXSTYLE = -20;
|
||||
private const int WS_EX_DLGMODALFRAME = 0x0001;
|
||||
private const int SWP_NOSIZE = 0x0001;
|
||||
private const int SWP_NOMOVE = 0x0002;
|
||||
private const int SWP_NOZORDER = 0x0004;
|
||||
private const int SWP_FRAMECHANGED = 0x0020;
|
||||
//const uint WM_SETICON = 0x0080;
|
||||
|
||||
|
||||
internal static ImageSource ToImageSource(this Icon icon)
|
||||
{
|
||||
ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon(
|
||||
@@ -62,7 +61,7 @@ namespace WPFCustomMessageBox
|
||||
/// <returns></returns>
|
||||
internal static string? TryAddKeyboardAccellerator(this string? input)
|
||||
{
|
||||
if (input == null)
|
||||
if (input is null)
|
||||
return input;
|
||||
|
||||
const string accellerator = "_"; // This is the default WPF accellerator symbol - used to be & in WinForms
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace MPF.UI
|
||||
public static TDependencyObject? FindChild<TDependencyObject>(DependencyObject? parent, string childName) where TDependencyObject : DependencyObject
|
||||
{
|
||||
// Confirm parent and childName are valid.
|
||||
if (parent == null) return null;
|
||||
if (parent is null) return null;
|
||||
|
||||
TDependencyObject? foundChild = null;
|
||||
|
||||
if (parent is ItemsControl itemsControl && itemsControl.Items != null)
|
||||
if (parent is ItemsControl itemsControl && itemsControl.Items is not null)
|
||||
{
|
||||
int childrenCount = itemsControl.Items.Count;
|
||||
for (int i = 0; i < childrenCount; i++)
|
||||
@@ -36,7 +36,7 @@ namespace MPF.UI
|
||||
foundChild = FindChild<TDependencyObject>(child, childName);
|
||||
|
||||
// If the child is found, break so we do not overwrite the found child.
|
||||
if (foundChild != null)
|
||||
if (foundChild is not null)
|
||||
break;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(childName))
|
||||
@@ -57,7 +57,7 @@ namespace MPF.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (parent is ContentControl contentControl && contentControl.Content != null)
|
||||
else if (parent is ContentControl contentControl && contentControl.Content is not null)
|
||||
{
|
||||
var child = contentControl.Content as DependencyObject;
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace MPF.UI
|
||||
foundChild = FindChild<TDependencyObject>(child, childName);
|
||||
|
||||
// If the child is found, break so we do not overwrite the found child.
|
||||
if (foundChild != null)
|
||||
if (foundChild is not null)
|
||||
break;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(childName))
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.0]" />
|
||||
<PackageReference Include="SabreTools.RedumpLib" Version="[1.9.1]" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<system:String x:Key="EnableDarkModeCheckBoxString">Activer le mode sombre</system:String>
|
||||
<system:String x:Key="CheckForUpdatesCheckBoxString">Vérifier les mises à jour au démarrage</system:String>
|
||||
<system:String x:Key="CopyURLToClipboardCheckBoxString">Copier l’URL de mise à jour</system:String>
|
||||
<system:String x:Key="FastUpdateLabelCheckBoxString">Étiquette de mise à jour rapide</system:String>
|
||||
<system:String x:Key="FastUpdateLabelCheckBoxString">Mise à jour rapide du titre du disque</system:String>
|
||||
<system:String x:Key="DefaultUILanguageLabelString">Langue par défaut de l’interface :</system:String>
|
||||
<system:String x:Key="DetectionGroupBoxString">Détection</system:String>
|
||||
<system:String x:Key="SkipSystemDetectCheckBoxString">Ignorer la détection du système</system:String>
|
||||
@@ -81,7 +81,7 @@
|
||||
<system:String x:Key="DumpingGroupBoxString">Dumping</system:String>
|
||||
<system:String x:Key="ShowDiscInfoCheckBoxString">Afficher les infos du disque</system:String>
|
||||
<system:String x:Key="PullAllInformationCheckBoxString">Récupérer toutes les informations</system:String>
|
||||
<system:String x:Key="EnableTabInputCheckBoxString">Activer la saisie par tabulation</system:String>
|
||||
<system:String x:Key="EnableTabInputCheckBoxString">Activer la saisie des tabulations</system:String>
|
||||
<system:String x:Key="EnableRedumpCompatibilityCheckBoxString">Activer la compatibilité Redump</system:String>
|
||||
<system:String x:Key="ShowEjectReminderCheckBoxString">Afficher le rappel d’éjection</system:String>
|
||||
<system:String x:Key="AddPlaceholdersCheckBoxString">Ajouter des espaces réservés</system:String>
|
||||
@@ -212,7 +212,7 @@
|
||||
|
||||
<!-- Eject Window -->
|
||||
<system:String x:Key="EjectTitleString">Éjecter</system:String>
|
||||
<system:String x:Key="EjectMessageString">Il est maintenant sûr d’éjecter le disque</system:String>
|
||||
<system:String x:Key="EjectMessageString">Vous pouvez maintenant éjecter le disque en toute sécurité</system:String>
|
||||
|
||||
<!-- Ask Before Quit Window -->
|
||||
<system:String x:Key="QuitTitleString">Quitter</system:String>
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace MPF.UI.UserControls
|
||||
public void EnqueueLog(LogLevel logLevel, string text)
|
||||
{
|
||||
// Null text gets ignored
|
||||
if (text == null)
|
||||
if (text is null)
|
||||
return;
|
||||
|
||||
// Create a new log line
|
||||
@@ -114,7 +114,11 @@ namespace MPF.UI.UserControls
|
||||
LogLevel.SECRET => Brushes.DarkGray,
|
||||
LogLevel.ERROR => Brushes.Red,
|
||||
LogLevel.VERBOSE => Brushes.Yellow,
|
||||
_ => Brushes.White,
|
||||
LogLevel.USER_SUCCESS => Brushes.ForestGreen,
|
||||
LogLevel.USER_GENERIC => Brushes.White,
|
||||
|
||||
// Make unmatched log levels obvious
|
||||
_ => Brushes.Pink,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace MPF.UI.Windows
|
||||
private async void OnCheckDumpClick(object sender, EventArgs e)
|
||||
{
|
||||
var result = await CheckDumpViewModel.CheckDump(ShowMediaInformationWindow);
|
||||
if (result)
|
||||
if (result == true)
|
||||
{
|
||||
bool? checkAgain = DisplayUserMessage("Check Complete", "The dump has been processed successfully! Would you like to check another dump?", 2, false);
|
||||
if (checkAgain == false)
|
||||
|
||||
@@ -279,10 +279,11 @@ namespace MPF.UI.Windows
|
||||
CreateIRDViewModel.CreateIRDStatus = "Creating IRD... Please Wait";
|
||||
string? outputPath = BrowseOutputFile();
|
||||
string? errorMessage = "Please provide an output path";
|
||||
if (outputPath != null)
|
||||
if (outputPath is not null)
|
||||
{
|
||||
errorMessage = CreateIRDViewModel.CreateIRD(outputPath);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(errorMessage))
|
||||
{
|
||||
bool? checkAgain = DisplayUserMessage("IRD Create", "An IRD has been created successfully! Would you like to create another IRD?", 2, false);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user