Compare commits

...

17 Commits
3.4.0 ... 3.4.1

Author SHA1 Message Date
Matt Nadareski
79716ea0b5 Bump version 2025-09-29 17:54:03 -04:00
Matt Nadareski
43477a133f Update BinaryObjectScanner to 3.4.3 2025-09-29 14:30:52 -04:00
Matt Nadareski
8889beef1d Reduction in media type use for dumping 2025-09-29 11:25:57 -04:00
Matt Nadareski
ac4be751b3 Make media type a named parameter for CLI 2025-09-29 10:56:56 -04:00
Matt Nadareski
69f855fc93 Fix tests 2025-09-29 10:45:53 -04:00
Matt Nadareski
cf01095623 Skip trying to set speeds if no drives 2025-09-29 10:43:12 -04:00
Matt Nadareski
3236223e3f Default to CD speed range 2025-09-29 10:40:59 -04:00
Matt Nadareski
36450cd22b Minor tweaks to frontend code 2025-09-29 10:25:24 -04:00
Deterous
6a9b6748d2 Remove SkipMediaTypeDetection option, cleanup options window (#895)
* Remove SkipMediaTypeDetection option, cleanup options window

* Shrink detection section in options

* always try to guess media type
2025-09-26 10:56:25 -04:00
Matt Nadareski
3bf83378a2 Fix logic from around Macrovision security driver filtering (fixes #811) 2025-09-25 11:38:03 -04:00
Matt Nadareski
bc938fd58c Return full result from dump checks 2025-09-25 10:54:29 -04:00
Matt Nadareski
f50a110acd Update media type visibility on system change 2025-09-25 09:26:11 -04:00
Matt Nadareski
fcda2a6e3b Change label with media type visibility 2025-09-25 09:07:41 -04:00
Matt Nadareski
d33526b27e Set media type visibility when options changed 2025-09-25 08:56:06 -04:00
Matt Nadareski
0b0427e9c1 Limit media type visibility further 2025-09-25 08:54:33 -04:00
Matt Nadareski
c34b92bad8 Default media type box to hidden to avoid visual issues 2025-09-25 08:49:04 -04:00
Matt Nadareski
89145df0fa Experiment with only showing media type box for DIC 2025-09-25 08:32:06 -04:00
40 changed files with 244 additions and 256 deletions

View File

@@ -1,3 +1,22 @@
### 3.4.1 (2025-09-29)
- Experiment with only showing media type box for DIC
- Default media type box to hidden to avoid visual issues
- Limit media type visibility further
- Set media type visibility when options changed
- Change label with media type visibility
- Update media type visibility on system change
- Return full result from dump checks
- Fix logic from around Macrovision security driver filtering
- Remove SkipMediaTypeDetection option, cleanup options window
- Minor tweaks to frontend code
- Default to CD speed range
- Skip trying to set speeds if no drives
- Fix tests
- Make media type a named parameter for CLI
- Reduction in media type use for dumping
- Update BinaryObjectScanner to 3.4.3
### 3.4.0 (2025-09-25)
- Remove media type from Check Dump UI

View File

@@ -12,7 +12,7 @@
<Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.4.1</VersionPrefix>
<!-- Package Properties -->
<Title>MPF CLI</Title>

View File

@@ -44,20 +44,19 @@ namespace MPF.CLI
// Setup common outputs
CommandOptions opts;
MediaType mediaType;
RedumpSystem? knownSystem;
// Use interactive mode
if (args.Length > 0 && (args[0] == "-i" || args[0] == "--interactive"))
{
opts = InteractiveMode(options, out mediaType, out knownSystem);
opts = InteractiveMode(options, out knownSystem);
}
// Use normal commandline parameters
else
{
// Try processing the common arguments
bool success = OptionsLoader.ProcessCommonArguments(args, out mediaType, out knownSystem, out var error);
bool success = OptionsLoader.ProcessCommonArguments(args, out knownSystem, out var error);
if (!success)
{
DisplayHelp(error);
@@ -123,13 +122,20 @@ namespace MPF.CLI
DisplayHelp("Both a device path and file path need to be supplied, exiting...");
return;
}
if (options.InternalProgram == InternalProgram.DiscImageCreator
&& opts.CustomParams == null
&& (opts.MediaType == null || opts.MediaType == MediaType.NONE))
{
DisplayHelp("Media type is required for DiscImageCreator, exiting...");
return;
}
// Normalize the file path
if (opts.FilePath != null)
opts.FilePath = FrontendTool.NormalizeOutputPaths(opts.FilePath, getFullPath: true);
if (opts.FilePath != null)
opts.FilePath = FrontendTool.NormalizeOutputPaths(opts.FilePath, getFullPath: true);
// Get the speed from the options
int speed = opts.DriveSpeed ?? FrontendTool.GetDefaultSpeedForMediaType(mediaType, options);
int speed = opts.DriveSpeed ?? FrontendTool.GetDefaultSpeedForMediaType(opts.MediaType, options);
// Populate an environment
var drive = Drive.Create(null, opts.DevicePath ?? string.Empty);
@@ -138,22 +144,22 @@ namespace MPF.CLI
drive,
knownSystem,
options.InternalProgram);
env.SetExecutionContext(mediaType, null);
env.SetExecutionContext(opts.MediaType, null);
env.SetProcessor();
// Process the parameters
string? paramStr = opts.CustomParams ?? env.GetFullParameters(mediaType, speed);
string? paramStr = opts.CustomParams ?? env.GetFullParameters(opts.MediaType, speed);
if (string.IsNullOrEmpty(paramStr))
{
DisplayHelp("No valid environment could be created, exiting...");
return;
}
env.SetExecutionContext(mediaType, paramStr);
env.SetExecutionContext(opts.MediaType, paramStr);
// Invoke the dumping program
Console.WriteLine($"Invoking {options.InternalProgram} using '{paramStr}'");
var dumpResult = env.Run(mediaType).GetAwaiter().GetResult();
var dumpResult = env.Run(opts.MediaType).GetAwaiter().GetResult();
Console.WriteLine(dumpResult.Message);
if (!dumpResult)
return;
@@ -174,7 +180,7 @@ namespace MPF.CLI
drive,
knownSystem,
internalProgram: null);
env.SetExecutionContext(mediaType, null);
env.SetExecutionContext(opts.MediaType, null);
env.SetProcessor();
}
@@ -194,7 +200,7 @@ namespace MPF.CLI
Console.WriteLine(error);
Console.WriteLine("Usage:");
Console.WriteLine("MPF.CLI <mediatype> <system> [options]");
Console.WriteLine("MPF.CLI <system> [options]");
Console.WriteLine();
Console.WriteLine("Standalone Options:");
Console.WriteLine("-h, -?, --help Show this help text");
@@ -208,6 +214,7 @@ namespace MPF.CLI
Console.WriteLine("CLI Options:");
Console.WriteLine("-u, --use <program> Override configured dumping program name");
Console.WriteLine("-t, --mediatype <mediatype> Set media type for dumping (Required for DIC)");
Console.WriteLine("-d, --device <devicepath> Physical drive path (Required if no custom parameters set)");
Console.WriteLine("-m, --mounted <dirpath> Mounted filesystem path for additional checks");
Console.WriteLine("-f, --file \"<filepath>\" Output file path (Required if no custom parameters set)");
@@ -233,14 +240,14 @@ namespace MPF.CLI
/// <summary>
/// Enable interactive mode for entering information
/// </summary>
private static CommandOptions InteractiveMode(Options options, out MediaType mediaType, out RedumpSystem? system)
private static CommandOptions InteractiveMode(Options options, out RedumpSystem? system)
{
// Create return values
var opts = new CommandOptions
{
MediaType = MediaType.NONE,
FilePath = Path.Combine(options.DefaultOutputPath ?? "ISO", "track.bin"),
};
mediaType = MediaType.NONE;
system = options.DefaultSystem;
// Create state values
@@ -251,9 +258,9 @@ namespace MPF.CLI
Console.WriteLine("MPF.CLI Interactive Mode - Main Menu");
Console.WriteLine("-------------------------");
Console.WriteLine();
Console.WriteLine($"1) Set media type (Currently '{mediaType}')");
Console.WriteLine($"2) Set system (Currently '{system}')");
Console.WriteLine($"3) Set dumping program (Currently '{options.InternalProgram}')");
Console.WriteLine($"1) Set system (Currently '{system}')");
Console.WriteLine($"2) Set dumping program (Currently '{options.InternalProgram}')");
Console.WriteLine($"3) Set media type (Currently '{opts.MediaType}')");
Console.WriteLine($"4) Set device path (Currently '{opts.DevicePath}')");
Console.WriteLine($"5) Set mounted path (Currently '{opts.MountedPath}')");
Console.WriteLine($"6) Set file path (Currently '{opts.FilePath}')");
@@ -268,11 +275,11 @@ namespace MPF.CLI
switch (result)
{
case "1":
goto mediaType;
case "2":
goto system;
case "3":
case "2":
goto dumpingProgram;
case "3":
goto mediaType;
case "4":
goto devicePath;
case "5":
@@ -304,14 +311,6 @@ namespace MPF.CLI
goto root;
}
mediaType:
Console.WriteLine();
Console.WriteLine("Input the media type and press Enter:");
Console.Write("> ");
result = Console.ReadLine();
mediaType = OptionsLoader.ToMediaType(result);
goto root;
system:
Console.WriteLine();
Console.WriteLine("Input the system and press Enter:");
@@ -328,6 +327,14 @@ namespace MPF.CLI
options.InternalProgram = result.ToInternalProgram();
goto root;
mediaType:
Console.WriteLine();
Console.WriteLine("Input the media type and press Enter:");
Console.Write("> ");
result = Console.ReadLine();
opts.MediaType = OptionsLoader.ToMediaType(result);
goto root;
devicePath:
Console.WriteLine();
Console.WriteLine("Input the device path and press Enter:");
@@ -412,6 +419,17 @@ namespace MPF.CLI
startIndex++;
}
// Use a device path
else if (args[startIndex].StartsWith("-t=") || args[startIndex].StartsWith("--mediatype="))
{
opts.MediaType = OptionsLoader.ToMediaType(args[startIndex].Split('=')[1].Trim('"'));
}
else if (args[startIndex] == "-t" || args[startIndex] == "--mediatype")
{
opts.MediaType = OptionsLoader.ToMediaType(args[startIndex + 1].Trim('"'));
startIndex++;
}
// Use a device path
else if (args[startIndex].StartsWith("-d=") || args[startIndex].StartsWith("--device="))
{
@@ -488,6 +506,12 @@ namespace MPF.CLI
/// </summary>
private class CommandOptions
{
/// <summary>
/// Media type to dump
/// </summary>
/// <remarks>Required for DIC and if custom parameters not set</remarks>
public MediaType? MediaType { get; set; } = null;
/// <summary>
/// Path to the device to dump
/// </summary>

View File

@@ -12,7 +12,7 @@
<Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.4.1</VersionPrefix>
<!-- Package Properties -->
<Title>MPF Check</Title>

View File

@@ -40,15 +40,15 @@ namespace MPF.ExecutionContexts.Test
[Theory]
[InlineData(null, null, null, "filename.bin", null, null)]
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.CDROM, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.CDROM, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.DVD, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.SegaDreamcast, MediaType.GDROM, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.SegaDreamcast, MediaType.GDROM, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.HDDVDVideo, MediaType.HDDVD, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.BDVideo, MediaType.BluRay, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.NintendoWii, MediaType.NintendoWiiOpticalDisc, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.NintendoWiiU, MediaType.NintendoWiiUOpticalDisc, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.FloppyDisk, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.NintendoWii, MediaType.NintendoWiiOpticalDisc, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.NintendoWiiU, MediaType.NintendoWiiUOpticalDisc, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.FloppyDisk, "/dev/sr0", "filename.bin", 2, "--debug True --verbose True media dump --force True --private True --store-encrypted True --title-keys False --trim True --speed 2 --retry-passes 1000 /dev/sr0 \"filename.bin\"")]
public void DefaultValueTest(RedumpSystem? system,
MediaType? type,
string? drivePath,

View File

@@ -29,7 +29,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@@ -41,7 +41,7 @@ namespace MPF.ExecutionContexts.Test
};
[Theory]
[InlineData(null, null, null, "filename.bin", null, "")]
[InlineData(null, null, null, "filename.bin", null, "disc --verbose --retries=1000 --image-name=\"filename\" --drive-type=GENERIC --drive-read-method=BE --drive-sector-order=DATA_C2_SUB --plextor-leadin-retries=1000")]
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.CDROM, "/dev/sr0", "path/filename.bin", 2, "disc --verbose --skeleton --drive=/dev/sr0 --speed=2 --retries=1000 --image-path=\"path\" --image-name=\"filename\" --drive-type=GENERIC --drive-read-method=BE --drive-sector-order=DATA_C2_SUB --plextor-leadin-retries=1000")]
[InlineData(RedumpSystem.IBMPCcompatible, MediaType.DVD, "/dev/sr0", "path/filename.bin", 2, "disc --verbose --drive=/dev/sr0 --speed=2 --retries=1000 --image-path=\"path\" --image-name=\"filename\" --drive-type=GENERIC --drive-read-method=BE --drive-sector-order=DATA_C2_SUB --plextor-leadin-retries=1000")]
[InlineData(RedumpSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc, "/dev/sr0", "path/filename.bin", 2, "disc --verbose --drive=/dev/sr0 --speed=2 --retries=1000 --image-path=\"path\" --image-name=\"filename\" --drive-type=GENERIC --drive-read-method=BE --drive-sector-order=DATA_C2_SUB --plextor-leadin-retries=1000")]

View File

@@ -638,11 +638,6 @@ namespace MPF.ExecutionContexts.Aaru
(_inputs[FlagStrings.SpeedLong] as Int8Input)?.SetValue((sbyte)driveSpeed);
}
// First check to see if the combination of system and MediaType is valid
var validTypes = RedumpSystem.MediaTypes();
if (!validTypes.Contains(MediaType))
return;
// Set retry count
int rereadCount = GetInt32Setting(options, SettingConstants.RereadCount, SettingConstants.RereadCountDefault);
if (rereadCount > 0)
@@ -673,57 +668,13 @@ namespace MPF.ExecutionContexts.Aaru
(_inputs[FlagStrings.PrivateLong] as BooleanInput)?.SetValue(true);
}
// TODO: Look at dump-media formats and the like and see what options there are there to fill in defaults
// Now sort based on disc type
switch (MediaType)
{
case SabreTools.RedumpLib.Data.MediaType.CDROM:
// Currently no defaults set
break;
case SabreTools.RedumpLib.Data.MediaType.DVD:
this[FlagStrings.StoreEncryptedLong] = true; // TODO: Make this configurable
(_inputs[FlagStrings.StoreEncryptedLong] as BooleanInput)?.SetValue(true);
this[FlagStrings.TitleKeysLong] = false; // TODO: Make this configurable
(_inputs[FlagStrings.TitleKeysLong] as BooleanInput)?.SetValue(false);
this[FlagStrings.TrimLong] = true; // TODO: Make this configurable
(_inputs[FlagStrings.TrimLong] as BooleanInput)?.SetValue(true);
break;
case SabreTools.RedumpLib.Data.MediaType.GDROM:
// Currently no defaults set
break;
case SabreTools.RedumpLib.Data.MediaType.HDDVD:
this[FlagStrings.StoreEncryptedLong] = true; // TODO: Make this configurable
(_inputs[FlagStrings.StoreEncryptedLong] as BooleanInput)?.SetValue(true);
this[FlagStrings.TitleKeysLong] = false; // TODO: Make this configurable
(_inputs[FlagStrings.TitleKeysLong] as BooleanInput)?.SetValue(false);
this[FlagStrings.TrimLong] = true; // TODO: Make this configurable
(_inputs[FlagStrings.TrimLong] as BooleanInput)?.SetValue(true);
break;
case SabreTools.RedumpLib.Data.MediaType.BluRay:
this[FlagStrings.StoreEncryptedLong] = true; // TODO: Make this configurable
(_inputs[FlagStrings.StoreEncryptedLong] as BooleanInput)?.SetValue(true);
this[FlagStrings.TitleKeysLong] = false; // TODO: Make this configurable
(_inputs[FlagStrings.TitleKeysLong] as BooleanInput)?.SetValue(false);
this[FlagStrings.TrimLong] = true; // TODO: Make this configurable
(_inputs[FlagStrings.TrimLong] as BooleanInput)?.SetValue(true);
break;
// Special Formats
case SabreTools.RedumpLib.Data.MediaType.NintendoGameCubeGameDisc:
// Currently no defaults set
break;
case SabreTools.RedumpLib.Data.MediaType.NintendoWiiOpticalDisc:
// Currently no defaults set
break;
case SabreTools.RedumpLib.Data.MediaType.NintendoWiiUOpticalDisc:
// Currently no defaults set
break;
// Non-optical
case SabreTools.RedumpLib.Data.MediaType.FloppyDisk:
// Currently no defaults set
break;
}
// Set generic, sane defaults to cover all bases
this[FlagStrings.StoreEncryptedLong] = true;
(_inputs[FlagStrings.StoreEncryptedLong] as BooleanInput)?.SetValue(true);
this[FlagStrings.TitleKeysLong] = false;
(_inputs[FlagStrings.TitleKeysLong] as BooleanInput)?.SetValue(false);
this[FlagStrings.TrimLong] = true;
(_inputs[FlagStrings.TrimLong] as BooleanInput)?.SetValue(true);
}
/// <inheritdoc/>

View File

@@ -11,7 +11,7 @@
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.4.1</VersionPrefix>
<WarningsNotAsErrors>NU5104</WarningsNotAsErrors>
<!-- Package Properties -->

View File

@@ -49,11 +49,6 @@ namespace MPF.ExecutionContexts.Redumper
#region Flag Values
/// <summary>
/// Mode being run
/// </summary>
public string? ModeValue { get; set; }
/// <summary>
/// Set of all command flags
/// </summary>
@@ -241,9 +236,9 @@ namespace MPF.ExecutionContexts.Redumper
var parameters = new StringBuilder();
// Command Mode
ModeValue ??= CommandStrings.NONE;
if (ModeValue != CommandStrings.NONE)
parameters.Append($"{ModeValue} ");
BaseCommand ??= CommandStrings.NONE;
if (BaseCommand != CommandStrings.NONE)
parameters.Append($"{BaseCommand} ");
// Loop though and append all existing
foreach (var kvp in _inputs)
@@ -270,8 +265,8 @@ namespace MPF.ExecutionContexts.Redumper
public override bool IsDumpingCommand()
{
// `dump` command does not provide hashes so will error out after dump if run via MPF
return ModeValue == CommandStrings.NONE
|| ModeValue == CommandStrings.Disc;
return BaseCommand == CommandStrings.NONE
|| BaseCommand == CommandStrings.Disc;
}
/// <inheritdoc/>
@@ -291,25 +286,13 @@ namespace MPF.ExecutionContexts.Redumper
int? driveSpeed,
Dictionary<string, string?> options)
{
BaseCommand = CommandStrings.NONE;
switch (MediaType)
{
case SabreTools.RedumpLib.Data.MediaType.CDROM:
case SabreTools.RedumpLib.Data.MediaType.DVD:
case SabreTools.RedumpLib.Data.MediaType.NintendoGameCubeGameDisc:
case SabreTools.RedumpLib.Data.MediaType.NintendoWiiOpticalDisc:
case SabreTools.RedumpLib.Data.MediaType.HDDVD:
case SabreTools.RedumpLib.Data.MediaType.BluRay:
case SabreTools.RedumpLib.Data.MediaType.NintendoWiiUOpticalDisc:
ModeValue = CommandStrings.Disc;
break;
default:
BaseCommand = null;
return;
}
BaseCommand = CommandStrings.Disc;
this[FlagStrings.Drive] = true;
(_inputs[FlagStrings.Drive] as StringInput)?.SetValue(drivePath ?? string.Empty);
if (drivePath != null)
{
this[FlagStrings.Drive] = true;
(_inputs[FlagStrings.Drive] as StringInput)?.SetValue(drivePath);
}
if (driveSpeed != null && driveSpeed > 0)
{
@@ -412,8 +395,6 @@ namespace MPF.ExecutionContexts.Redumper
/// <inheritdoc/>
protected override bool ValidateAndSetParameters(string? parameters)
{
BaseCommand = CommandStrings.NONE;
// The string has to be valid by itself first
if (string.IsNullOrEmpty(parameters))
return false;
@@ -422,7 +403,7 @@ namespace MPF.ExecutionContexts.Redumper
string[] parts = SplitParameterString(parameters!);
// Setup the modes
ModeValue = null;
BaseCommand = null;
// All modes should be cached separately
int index = 0;
@@ -457,10 +438,10 @@ namespace MPF.ExecutionContexts.Redumper
case CommandStrings.DebugFlip:
case CommandStrings.DriveTest:
// Only allow one mode per command
if (ModeValue != null)
if (BaseCommand != null)
continue;
ModeValue = part;
BaseCommand = part;
break;
// Default is either a flag or an invalid mode

View File

@@ -13,8 +13,8 @@ namespace MPF.Frontend.Test
[InlineData(MediaType.HDDVD, 24)]
[InlineData(MediaType.BluRay, 16)]
[InlineData(MediaType.NintendoWiiUOpticalDisc, 16)]
[InlineData(MediaType.LaserDisc, 1)]
[InlineData(null, 1)]
[InlineData(MediaType.LaserDisc, 72)]
[InlineData(null, 72)]
public void GetAllowedDriveSpeedForMediaTypeTest(MediaType? mediaType, int maxExpected)
{
var actual = InterfaceConstants.GetSpeedsForMediaType(mediaType);

View File

@@ -29,7 +29,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@@ -683,9 +683,9 @@ namespace MPF.Frontend.Test.Tools
[Theory]
[InlineData(0, "Macrovision Protected Application [SafeDisc 0.00.000], SafeDisc 0.00.000, SafeDisc Lite")]
[InlineData(1, "Macrovision Protected Application [SafeDisc 0.00.000 / SRV Tool APP], SafeDisc 0.00.000, SafeDisc Lite")]
[InlineData(2, "Macrovision Security Driver, Macrovision Security Driver [SafeDisc 1.11.111], SafeDisc 0.00.000, SafeDisc 0.00.000-1.11.111, SafeDisc Lite")]
[InlineData(3, "Macrovision Security Driver, Macrovision Security Driver [SafeDisc 1.11.111], SafeDisc 0.00.000, SafeDisc Lite")]
[InlineData(4, "Macrovision Security Driver, Macrovision Security Driver [SafeDisc 1.11.111], SafeDisc Lite")]
[InlineData(2, "SafeDisc 0.00.000, SafeDisc 0.00.000-1.11.111, SafeDisc 3+ (DVD), SafeDisc Lite")]
[InlineData(3, "SafeDisc 0.00.000, SafeDisc 3+ (DVD), SafeDisc Lite")]
[InlineData(4, "SafeDisc 3+ (DVD), SafeDisc Lite")]
[InlineData(5, "Macrovision Security Driver, SafeDisc Lite")]
[InlineData(6, "Macrovision Protection File, SafeDisc 2+, SafeDisc 3+ (DVD), SafeDisc Lite")]
[InlineData(7, "SafeDisc 3+ (DVD)")]
@@ -694,11 +694,11 @@ namespace MPF.Frontend.Test.Tools
{
List<string> protections =
[
"Macrovision Protected Application [SafeDisc 0.00.000]",
"Macrovision Protected Application [SafeDisc 0.00.000]",
"Macrovision Protected Application [SafeDisc 0.00.000 / SRV Tool APP]",
"SafeDisc 0.00.000-1.11.111",
"SafeDisc 0.00.000",
"Macrovision Security Driver [SafeDisc 1.11.111]",
"Macrovision Security Driver 1.11.111 / SafeDisc 1.11.111",
"Macrovision Security Driver",
"SafeDisc Lite",
"SafeDisc 3+ (DVD)",
@@ -717,6 +717,23 @@ namespace MPF.Frontend.Test.Tools
Assert.Equal(expected, sanitized);
}
[Fact]
public void SanitizeFoundProtectsion_SafeDisc_MacrovisionSecurityDriver()
{
List<string> protections =
[
"Macrovision Protection File [Likely indicates either SafeDisc 1.45.011+ (CD) or CDS-300]",
"Macrovision Security Driver 4.00.060 / SafeDisc 4.00.000-4.70.000",
"SafeDisc 4.00.000-4.00.003",
"SafeDisc 4.00.002, Macrovision Protected Application"
];
string expected = "SafeDisc 4.00.002";
string sanitized = ProtectionTool.SanitizeFoundProtections(protections);
Assert.Equal(expected, sanitized);
}
[Fact]
public void SanitizeFoundProtections_SecuROM()
{

View File

@@ -33,11 +33,6 @@ namespace MPF.Frontend
/// </summary>
public static List<int> BD => _speedValues.FindAll(s => s <= 16);
/// <summary>
/// Set of accepted speeds for all other media
/// </summary>
public static List<int> Unknown => [1];
/// <summary>
/// Get list of all drive speeds for a given MediaType
/// </summary>
@@ -55,7 +50,9 @@ namespace MPF.Frontend
MediaType.HDDVD => HDDVD,
MediaType.BluRay
or MediaType.NintendoWiiUOpticalDisc => BD,
_ => Unknown,
// Default to CD speed range
_ => CD,
};
}
}

View File

@@ -10,7 +10,7 @@
<Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.4.1</VersionPrefix>
<!-- Package Properties -->
<Authors>Matt Nadareski;ReignStumble;Jakz</Authors>

View File

@@ -579,15 +579,6 @@ namespace MPF.Frontend
#region Skip Options
/// <summary>
/// Skip detecting media type on disc scan
/// </summary>
public bool SkipMediaTypeDetection
{
get { return GetBooleanSetting(Settings, "SkipMediaTypeDetection", false); }
set { Settings["SkipMediaTypeDetection"] = value.ToString(); }
}
/// <summary>
/// Skip detecting known system on disc scan
/// </summary>

View File

@@ -119,42 +119,6 @@ namespace MPF.Frontend.Tools
return true;
}
/// <summary>
/// Process common arguments for all functionality
/// </summary>
/// <returns>True if all arguments pass, false otherwise</returns>
public static bool ProcessCommonArguments(string[] args, out MediaType mediaType, out RedumpSystem? system, out string? message)
{
// All other use requires at least 3 arguments
if (args.Length < 3)
{
mediaType = MediaType.NONE;
system = null;
message = "Invalid number of arguments";
return false;
}
// Check the MediaType
mediaType = ToMediaType(args[0].Trim('"'));
if (mediaType == MediaType.NONE)
{
system = null;
message = $"{args[0]} is not a recognized media type";
return false;
}
// Check the RedumpSystem
system = Extensions.ToRedumpSystem(args[1].Trim('"'));
if (system == null)
{
message = $"{args[1]} is not a recognized system";
return false;
}
message = null;
return true;
}
/// <summary>
/// Get the MediaType enum value for a given string
/// </summary>

View File

@@ -545,7 +545,7 @@ namespace MPF.Frontend.Tools
// Read the app.pkg header
using var fileStream = new FileStream(appPkgPath, FileMode.Open, FileAccess.Read);
var appPkgHeaderDeserializer = new SabreTools.Serialization.Deserializers.AppPkgHeader();
var appPkgHeaderDeserializer = new SabreTools.Serialization.Readers.AppPkgHeader();
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);
if (appPkgHeader != null)
@@ -696,7 +696,7 @@ namespace MPF.Frontend.Tools
// Read the app_sc.pkg header
using var fileStream = new FileStream(appPkgPath, FileMode.Open, FileAccess.Read);
var appPkgHeaderDeserializer = new SabreTools.Serialization.Deserializers.AppPkgHeader();
var appPkgHeaderDeserializer = new SabreTools.Serialization.Readers.AppPkgHeader();
var appPkgHeader = appPkgHeaderDeserializer.Deserialize(fileStream);
if (appPkgHeader != null)

View File

@@ -375,9 +375,8 @@ namespace MPF.Frontend.Tools
// Best case scenario for SafeDisc 2+: A full SafeDisc version is found in a line starting with "Macrovision Protected Application".
// All other SafeDisc detections can be safely scrubbed.
// TODO: Scrub "Macrovision Protected Application, " from before the SafeDisc version.
if (foundProtections.Exists(p => Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)
&& p.StartsWith("Macrovision Protected Application")
&& p.Contains("Macrovision Protected Application")
&& !p.Contains("SRV Tool APP")))
{
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
@@ -391,11 +390,14 @@ namespace MPF.Frontend.Tools
.FindAll(p => p != "SafeDisc 1/Lite")
.FindAll(p => p != "SafeDisc 2+")
.FindAll(p => p != "SafeDisc 3+ (DVD)");
foundProtections = foundProtections.ConvertAll(p => p
.Replace("Macrovision Protected Application, ", string.Empty)
.Replace(", Macrovision Protected Application", string.Empty));
}
// Next best case for SafeDisc 2+: A full SafeDisc version is found from the "SafeDisc SRV Tool APP".
else if (foundProtections.Exists(p => Regex.IsMatch(p, @"SafeDisc [0-9]\.[0-9]{2}\.[0-9]{3}", RegexOptions.Compiled)
&& p.StartsWith("Macrovision Protected Application")
&& p.Contains("Macrovision Protected Application")
&& p.Contains("SRV Tool APP")))
{
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
@@ -439,7 +441,6 @@ namespace MPF.Frontend.Tools
}
// Next best case for SafeDisc 1: A SafeDisc version range is found from "SECDRV.SYS".
// TODO: Scrub "Macrovision Security Driver {Version}" from before the SafeDisc version.
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}$")))
@@ -451,10 +452,12 @@ namespace MPF.Frontend.Tools
.FindAll(p => p != "SafeDisc")
.FindAll(p => p != "SafeDisc 1")
.FindAll(p => p != "SafeDisc 1/Lite");
foundProtections = foundProtections.ConvertAll(p => p.StartsWith("Macrovision Security Driver") && p.Split('/').Length > 1
? p.Split('/')[1].TrimStart()
: p);
}
// Next best case for SafeDisc 2+: A SafeDisc version range is found from "SECDRV.SYS".
// TODO: Scrub "Macrovision Security Driver {Version}" from before the SafeDisc version.
else if (foundProtections.Exists(p => p.StartsWith("Macrovision Security Driver")))
{
foundProtections = foundProtections.FindAll(p => !p.StartsWith("Macrovision Protection File"))
@@ -466,6 +469,9 @@ namespace MPF.Frontend.Tools
.FindAll(p => p != "SafeDisc 1/Lite")
.FindAll(p => p != "SafeDisc 2+")
.FindAll(p => p != "SafeDisc 3+ (DVD)");
foundProtections = foundProtections.ConvertAll(p => p.StartsWith("Macrovision Security Driver") && p.Split('/').Length > 1
? p.Split('/')[1].TrimStart()
: p);
}
// Only SafeDisc Lite is found.

View File

@@ -393,13 +393,13 @@ namespace MPF.Frontend.ViewModels
/// Performs MPF.Check functionality
/// </summary>
/// <returns>An error message if failed, otherwise string.Empty/null</returns>
public async Task<string?> CheckDump(ProcessUserInfoDelegate processUserInfo)
public async Task<ResultEventArgs> CheckDump(ProcessUserInfoDelegate processUserInfo)
{
if (string.IsNullOrEmpty(InputPath))
return "Invalid Input path";
return ResultEventArgs.Failure("Invalid Input path");
if (!File.Exists(InputPath!.Trim('"')))
return "Input Path is not a valid file";
return ResultEventArgs.Failure("Input Path is not a valid file");
// Disable UI while Check is running
DisableUIElements();
@@ -431,7 +431,7 @@ namespace MPF.Frontend.ViewModels
if (cachedCanExecuteSelectionChanged)
EnableEventHandlers();
return result.Message;
return result;
}
/// <summary>

View File

@@ -674,7 +674,7 @@ namespace MPF.Frontend.ViewModels
// Set the selected index
CurrentDrive = (index != -1 ? Drives[index] : Drives[0]);
Status = "Valid drive found! Choose your Media Type";
Status = "Valid drive found!";
CopyProtectScanButtonEnabled = true;
// Get the current system type
@@ -1213,14 +1213,8 @@ namespace MPF.Frontend.ViewModels
if (defaultMediaType == MediaType.NONE)
defaultMediaType = MediaType.CDROM;
// If we're skipping detection, set the default value
if (Options.SkipMediaTypeDetection)
{
VerboseLogLn($"Media type detection disabled, defaulting to {defaultMediaType.LongName()}.");
CurrentMediaType = defaultMediaType;
}
// If the drive is marked active, try to read from it
else if (CurrentDrive.MarkedActive)
if (CurrentDrive.MarkedActive)
{
VerboseLog($"Trying to detect media type for drive {CurrentDrive.Name} [{CurrentDrive.DriveFormat}] using size and filesystem.. ");
MediaType? detectedMediaType = CurrentDrive.GetMediaType(CurrentSystem);
@@ -1238,8 +1232,7 @@ namespace MPF.Frontend.ViewModels
CurrentMediaType = detectedMediaType;
}
}
// All other cases, just use the default
// Otherwise just use the default
else
{
VerboseLogLn($"Drive marked as empty, defaulting to {defaultMediaType.LongName()}.");
@@ -1366,6 +1359,10 @@ namespace MPF.Frontend.ViewModels
/// </summary>
public void EnsureMediaInformation()
{
// If the drive list is empty, ignore updates
if (Drives.Count == 0)
return;
// Get the current environment information
_environment = DetermineEnvironment();
@@ -1639,7 +1636,7 @@ namespace MPF.Frontend.ViewModels
if (!File.Exists(catalogjs))
return RedumpSystem.MicrosoftXboxOne;
SabreTools.Models.Xbox.Catalog? catalog = new SabreTools.Serialization.Deserializers.Catalog().Deserialize(catalogjs);
SabreTools.Data.Models.Xbox.Catalog? catalog = new SabreTools.Serialization.Readers.Catalog().Deserialize(catalogjs);
if (catalog != null && catalog.Version != null && catalog.Packages != null)
{
if (!double.TryParse(catalog.Version, out double version))
@@ -2106,6 +2103,10 @@ namespace MPF.Frontend.ViewModels
/// </summary>
public void SetSupportedDriveSpeed()
{
// Skip trying to set speeds if no drives
if (Drives.Count == 0)
return;
// Set the drive speed list that's appropriate
DriveSpeeds = InterfaceConstants.GetSpeedsForMediaType(CurrentMediaType);
VerboseLogLn($"Supported media speeds: {string.Join(", ", [.. DriveSpeeds.ConvertAll(ds => ds.ToString())])}");
@@ -2119,8 +2120,7 @@ namespace MPF.Frontend.ViewModels
/// </summary>
private bool ShouldEnableDumpingButton()
{
return Drives != null
&& Drives.Count > 0
return Drives.Count > 0
&& CurrentSystem != null
&& CurrentMediaType != null
&& ProgramSupportsMedia();

View File

@@ -1,6 +1,6 @@
using System;
using System.IO;
using SabreTools.Models.Logiqx;
using SabreTools.Data.Models.Logiqx;
using Xunit;
namespace MPF.Processors.Test

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using SabreTools.Models.Logiqx;
using SabreTools.Data.Models.Logiqx;
using SabreTools.RedumpLib.Data;
using Xunit;

View File

@@ -39,7 +39,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@@ -1,7 +1,7 @@
using System;
using System.IO;
using SabreTools.Models.Logiqx;
using SabreTools.Models.PIC;
using SabreTools.Data.Models.Logiqx;
using SabreTools.Data.Models.PIC;
using SabreTools.RedumpLib.Data;
using Xunit;

View File

@@ -5,8 +5,8 @@ using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using SabreTools.Models.CueSheets;
using SabreTools.Models.Logiqx;
using SabreTools.Data.Models.CueSheets;
using SabreTools.Data.Models.Logiqx;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;
using Schemas;
@@ -409,7 +409,7 @@ namespace MPF.Processors
cueSheet.Files = [.. cueFiles];
if (cueSheet != null && cueSheet != default)
{
var ms = new SabreTools.Serialization.Serializers.CueSheet().Serialize(cueSheet);
var ms = new SabreTools.Serialization.Writers.CueSheet().SerializeStream(cueSheet);
if (ms == null)
return null;

View File

@@ -6,7 +6,7 @@ using System.IO.Compression;
#endif
using System.Text;
using SabreTools.Hashing;
using SabreTools.Models.Logiqx;
using SabreTools.Data.Models.Logiqx;
using SabreTools.RedumpLib.Data;
namespace MPF.Processors

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using SabreTools.Data.Models.Logiqx;
using SabreTools.Hashing;
using SabreTools.Models.Logiqx;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;

View File

@@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
#endif
using System.Text.RegularExpressions;
using SabreTools.Models.Logiqx;
using SabreTools.Data.Models.Logiqx;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using SabreTools.Data.Models.Logiqx;
using SabreTools.Hashing;
using SabreTools.Models.Logiqx;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;

View File

@@ -12,7 +12,7 @@
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.4.1</VersionPrefix>
<WarningsNotAsErrors>NU5104</WarningsNotAsErrors>
<!-- Package Properties -->
@@ -35,9 +35,8 @@
<ItemGroup>
<PackageReference Include="SabreTools.Hashing" Version="1.5.0" />
<PackageReference Include="SabreTools.IO" Version="1.7.5" />
<PackageReference Include="SabreTools.Models" Version="1.7.2" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.7.4" />
<PackageReference Include="SabreTools.Serialization" Version="1.9.6" />
<PackageReference Include="SabreTools.Serialization" Version="2.0.0" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`))" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="9.0.9" Condition="!$(TargetFramework.StartsWith(`net2`)) AND !$(TargetFramework.StartsWith(`net3`)) AND !$(TargetFramework.StartsWith(`net40`)) AND !$(TargetFramework.StartsWith(`net452`))" />

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.IO;
using SabreTools.Models.Logiqx;
using SabreTools.Data.Models.Logiqx;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;

View File

@@ -10,8 +10,8 @@ using System.Xml.Schema;
using System.Xml.Serialization;
using SabreTools.Hashing;
using SabreTools.IO.Extensions;
using SabreTools.Models.Logiqx;
using SabreTools.Models.PIC;
using SabreTools.Data.Models.Logiqx;
using SabreTools.Data.Models.PIC;
using SabreTools.RedumpLib.Data;
namespace MPF.Processors
@@ -132,7 +132,7 @@ namespace MPF.Processors
{
try
{
return new SabreTools.Serialization.Deserializers.PIC().Deserialize(pic);
return new SabreTools.Serialization.Readers.PIC().Deserialize(pic);
}
catch
{

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using SabreTools.Data.Models.Logiqx;
using SabreTools.Hashing;
using SabreTools.Models.Logiqx;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.IO;
using SabreTools.Data.Models.Logiqx;
using SabreTools.Hashing;
using SabreTools.IO.Extensions;
using SabreTools.Models.Logiqx;
using SabreTools.RedumpLib;
using SabreTools.RedumpLib.Data;

View File

@@ -18,7 +18,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<VersionPrefix>3.4.0</VersionPrefix>
<VersionPrefix>3.4.1</VersionPrefix>
<!-- Package Properties -->
<AssemblyName>MPF</AssemblyName>

View File

@@ -158,8 +158,8 @@ namespace MPF.UI.Windows
/// </summary>
private async void OnCheckDumpClick(object sender, EventArgs e)
{
string? errorMessage = await CheckDumpViewModel.CheckDump(ShowMediaInformationWindow);
if (string.IsNullOrEmpty(errorMessage))
var result = await CheckDumpViewModel.CheckDump(ShowMediaInformationWindow);
if (result)
{
bool? checkAgain = DisplayUserMessage("Check Complete", "The dump has been processed successfully! Would you like to check another dump?", 2, false);
if (checkAgain == false)
@@ -169,7 +169,8 @@ namespace MPF.UI.Windows
}
else
{
DisplayUserMessage("Check Failed", errorMessage!, 1, false);
string? message = result.Message ?? "Please check all files exist and try again!";
DisplayUserMessage("Check Failed", message, 1, false);
}
}

View File

@@ -134,7 +134,7 @@
<RowDefinition/>
</Grid.RowDefinitions>
<Label x:Name="SystemMediaTypeLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="System/Media Type" />
<Label x:Name="SystemMediaTypeLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="System" />
<ComboBox x:Name="SystemTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="Left"
ItemsSource="{Binding Systems}" SelectedItem="{Binding Path=CurrentSystem, Converter={StaticResource ElementConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding SystemTypeComboBoxEnabled}" Style="{DynamicResource CustomComboBoxStyle}">
@@ -150,7 +150,8 @@
</ComboBox>
<ComboBox x:Name="MediaTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="Right"
ItemsSource="{Binding MediaTypes}" SelectedItem="{Binding Path=CurrentMediaType, Converter={StaticResource ElementConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding MediaTypeComboBoxEnabled}" Style="{DynamicResource CustomComboBoxStyle}" />
IsEnabled="{Binding MediaTypeComboBoxEnabled}" Style="{DynamicResource CustomComboBoxStyle}"
Visibility="Hidden" />
<Label x:Name="OutputPathLabel" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Content="Output Path"/>
<TextBox x:Name="OutputPathTextBox" Grid.Row="1" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="Left" VerticalContentAlignment="Center"

View File

@@ -47,6 +47,7 @@ namespace MPF.UI.Windows
private ComboBox? MediaTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "MediaTypeComboBox");
private Button? OutputPathBrowseButton => ItemHelper.FindChild<Button>(this, "OutputPathBrowseButton");
private TextBox? OutputPathTextBox => ItemHelper.FindChild<TextBox>(this, "OutputPathTextBox");
private Label? SystemMediaTypeLabel => ItemHelper.FindChild<Label>(this, "SystemMediaTypeLabel");
private ComboBox? SystemTypeComboBox => ItemHelper.FindChild<ComboBox>(this, "SystemTypeComboBox");
#endregion
@@ -113,6 +114,9 @@ namespace MPF.UI.Windows
// Set the UI color scheme according to the options
ApplyTheme();
// Hide or show the media type box based on program
SetMediaTypeVisibility();
// Check for updates, if necessary
if (MainViewModel.Options.CheckForUpdatesOnStartup)
CheckForUpdates(showIfSame: false);
@@ -343,6 +347,37 @@ namespace MPF.UI.Windows
optionsWindow.Show();
}
/// <summary>
/// Set media type combo box visibility based on current program
/// </summary>
public void SetMediaTypeVisibility()
{
// Only DiscImageCreator uses the media type box
if (MainViewModel.CurrentProgram != InternalProgram.DiscImageCreator)
{
SystemMediaTypeLabel!.Content = "System";
MediaTypeComboBox!.Visibility = Visibility.Hidden;
return;
}
// If there are no media types defined
if (MainViewModel.MediaTypes == null)
{
SystemMediaTypeLabel!.Content = "System";
MediaTypeComboBox!.Visibility = Visibility.Hidden;
return;
}
// Only systems with more than one media type should show the box
bool visible = MainViewModel.MediaTypes.Count > 1;
SystemMediaTypeLabel!.Content = visible
? "System/Media Type"
: "System";
MediaTypeComboBox!.Visibility = visible
? Visibility.Visible
: Visibility.Hidden;
}
/// <summary>
/// Set the UI color scheme according to the options
/// </summary>
@@ -437,6 +472,9 @@ namespace MPF.UI.Windows
// Set the UI color scheme according to the options
ApplyTheme();
// Hide or show the media type box based on program
SetMediaTypeVisibility();
}
#region Menu Bar
@@ -530,7 +568,10 @@ namespace MPF.UI.Windows
public void DumpingProgramComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (MainViewModel.CanExecuteSelectionChanged)
{
MainViewModel.ChangeDumpingProgram();
SetMediaTypeVisibility();
}
}
/// <summary>
@@ -587,7 +628,10 @@ namespace MPF.UI.Windows
public void SystemTypeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (MainViewModel.CanExecuteSelectionChanged)
{
MainViewModel.ChangeSystem();
SetMediaTypeVisibility();
}
}
/// <summary>

View File

@@ -95,22 +95,16 @@
</GroupBox>
<GroupBox Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Detection">
<UniformGrid Columns="2" Rows="3">
<CheckBox x:Name="SkipMediaTypeDetectionCheckBox" VerticalAlignment="Center" Content="Skip Type Detect"
IsChecked="{Binding Options.SkipMediaTypeDetection}"
ToolTip="Disable trying to guess media type inserted (may improve performance at startup)" Margin="0,4"
/>
<UniformGrid Columns="2" Rows="2">
<CheckBox VerticalAlignment="Center" Content="Skip System Detect"
IsChecked="{Binding Options.SkipSystemDetection}"
ToolTip="Disable trying to guess system (may improve performance at startup)" Margin="0,4"
/>
<CheckBox VerticalAlignment="Center" Content="No Fixed Drives"
IsChecked="{Binding Options.IgnoreFixedDrives}"
ToolTip="Ignore hard drives and other fixed drives" Margin="0,4"
IsChecked="{Binding Options.IgnoreFixedDrives}"
ToolTip="Ignore hard drives and other fixed drives" Margin="0,4"
/>
<Label/> <!-- Empty label for padding -->
<Label VerticalAlignment="Center" Content="Default System:" HorizontalAlignment="Right" />
<ComboBox x:Name="DefaultSystemComboBox" Height="22" Width="200" HorizontalAlignment="Left"
@@ -413,7 +407,11 @@
IsChecked="{Binding Options.RedumperEnableVerbose}"
ToolTip="Enable verbose output in logs" Margin="0,4"
/>
<Label/> <!-- Empty label for padding -->
<CheckBox VerticalAlignment="Center" Content="Enable Refine Sector Mode Flag"
IsChecked="{Binding Options.RedumperRefineSectorMode}"
ToolTip="Enable the refine sector mode flag by default" Margin="0,4"
/>
<Label Content="Reread Tries:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<TextBox VerticalAlignment="Center" VerticalContentAlignment="Center" Width="200" HorizontalAlignment="Left"
@@ -428,12 +426,6 @@
ToolTipService.ShowOnDisabled="True"
/>
<CheckBox VerticalAlignment="Center" Content="Enable Refine Sector Mode Flag"
IsChecked="{Binding Options.RedumperRefineSectorMode}"
ToolTip="Enable the refine sector mode flag by default" Margin="0,4"
/>
<Label/> <!-- Empty label for padding -->
<CheckBox VerticalAlignment="Center" Content="Non-Redump Options" Click="NonRedumpModeClicked"
IsChecked="{Binding Options.RedumperNonRedumpMode}"
ToolTip="Enable non-redump options" Margin="0,4"
@@ -483,7 +475,8 @@
IsEnabled="{Binding Options.RetrieveMatchInformation}" />
<Label VerticalAlignment="Center" HorizontalAlignment="Right" Content="Password" />
<PasswordBox x:Name="RedumpPasswordBox" Height="22" HorizontalAlignment="Stretch" PasswordChar="*" />
<PasswordBox x:Name="RedumpPasswordBox" Height="22" HorizontalAlignment="Stretch" PasswordChar="*"
IsEnabled="{Binding Options.RetrieveMatchInformation}"/>
<Button x:Name="RedumpLoginTestButton" Height="22" Width="80" Content="Test Login"
Style="{DynamicResource CustomButtonStyle}"