Move GetSupportStatus to DumpEnvironment

This commit is contained in:
Matt Nadareski
2024-05-28 00:19:34 -04:00
parent ac072618c4
commit 63e6ce121a
3 changed files with 40 additions and 42 deletions

View File

@@ -120,6 +120,7 @@
- Move LogLevel enum to Frontend
- Create ProcessingTool and move some methods
- Remove unused byte array helper methods
- Move GetSupportStatus to DumpEnvironment
### 3.1.9a (2024-05-21)

View File

@@ -44,45 +44,6 @@ namespace MPF.Core.Utilities
#region Support
/// <summary>
/// Verify that, given a system and a media type, they are correct
/// </summary>
public static ResultEventArgs GetSupportStatus(RedumpSystem? system, MediaType? type)
{
// No system chosen, update status
if (system == null)
return ResultEventArgs.Failure("Please select a valid system");
// If we're on an unsupported type, update the status accordingly
return type switch
{
// Fully supported types
MediaType.BluRay
or MediaType.CDROM
or MediaType.DVD
or MediaType.FloppyDisk
or MediaType.HardDisk
or MediaType.CompactFlash
or MediaType.SDCard
or MediaType.FlashDrive
or MediaType.HDDVD => ResultEventArgs.Success($"{type.LongName()} ready to dump"),
// Partially supported types
MediaType.GDROM
or MediaType.NintendoGameCubeGameDisc
or MediaType.NintendoWiiOpticalDisc => ResultEventArgs.Success($"{type.LongName()} partially supported for dumping"),
// Special case for other supported tools
MediaType.UMD => ResultEventArgs.Failure($"{type.LongName()} supported for submission info parsing"),
// Specifically unknown type
MediaType.NONE => ResultEventArgs.Failure($"Please select a valid media type"),
// Undumpable but recognized types
_ => ResultEventArgs.Failure($"{type.LongName()} media are not supported for dumping"),
};
}
/// <summary>
/// Returns false if a given InternalProgram does not support a given MediaType
/// </summary>

View File

@@ -294,8 +294,44 @@ namespace MPF.Frontend
return _executionContext.GetMediaType();
}
/// <inheritdoc cref="Tools.GetSupportStatus(RedumpSystem?, MediaType?)"/>
public ResultEventArgs GetSupportStatus() => Tools.GetSupportStatus(_system, _type);
/// <summary>
/// Verify that, given a system and a media type, they are correct
/// </summary>
public ResultEventArgs GetSupportStatus()
{
// No system chosen, update status
if (_system == null)
return ResultEventArgs.Failure("Please select a valid system");
// If we're on an unsupported type, update the status accordingly
return _type switch
{
// Fully supported types
MediaType.BluRay
or MediaType.CDROM
or MediaType.DVD
or MediaType.FloppyDisk
or MediaType.HardDisk
or MediaType.CompactFlash
or MediaType.SDCard
or MediaType.FlashDrive
or MediaType.HDDVD => ResultEventArgs.Success($"{_type.LongName()} ready to dump"),
// Partially supported types
MediaType.GDROM
or MediaType.NintendoGameCubeGameDisc
or MediaType.NintendoWiiOpticalDisc => ResultEventArgs.Success($"{_type.LongName()} partially supported for dumping"),
// Special case for other supported tools
MediaType.UMD => ResultEventArgs.Failure($"{_type.LongName()} supported for submission info parsing"),
// Specifically unknown type
MediaType.NONE => ResultEventArgs.Failure($"Please select a valid media type"),
// Undumpable but recognized types
_ => ResultEventArgs.Failure($"{_type.LongName()} media are not supported for dumping"),
};
}
/// <inheritdoc cref="BaseExecutionContext.IsDumpingCommand()"/>
public bool IsDumpingCommand()
@@ -554,7 +590,7 @@ namespace MPF.Frontend
return ResultEventArgs.Failure("Error! Cannot dump same drive that executable resides on!");
// Validate that the current configuration is supported
return Tools.GetSupportStatus(_system, _type);
return GetSupportStatus();
}
#endregion