Hook up GetOutputFiles in debug way

This commit is contained in:
Matt Nadareski
2024-08-22 14:22:37 -04:00
parent bc4fe17fab
commit 22a6b77d27
9 changed files with 74 additions and 75 deletions

View File

@@ -34,6 +34,7 @@
- Create currently-unused helper class
- Make helper class more robust
- Add unused GetOutputFiles method
- Hook up GetOutputFiles in debug way
### 3.2.1 (2024-08-05)

View File

@@ -34,6 +34,11 @@ namespace MPF.Processors
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return (false, ["Media and system combination not supported for Aaru"]);
var missingFiles = new List<string>();
switch (Type)
{

View File

@@ -83,17 +83,6 @@ namespace MPF.Processors
#endregion
#region Virtual Methods
/// <summary>
/// Generate a list of all deleteable files generated
/// </summary>
/// <param name="basePath">Base filename and path to use for checking</param>
/// <returns>List of all deleteable file paths, empty otherwise</returns>
public virtual List<string> GetDeleteableFilePaths(string basePath) => [];
#endregion
#region Shared Methods
/// <summary>
@@ -254,6 +243,44 @@ namespace MPF.Processors
return CheckAllOutputFilesExist(basePath, preCheck);
}
/// <summary>
/// Generate a list of all deleteable files generated
/// </summary>
/// <param name="basePath">Base filename and path to use for checking</param>
/// <returns>List of all deleteable file paths, empty otherwise</returns>
public List<string> GetDeleteableFilePaths(string basePath)
{
// Get the base filename and directory from the base path
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return [];
// Return only files that exist
var deleteableFiles = new List<string>();
foreach (var outputFile in outputFiles)
{
// Skip undeleteable files
if (!outputFile.IsDeleteable)
continue;
// Skip non-existent files
foreach (string filename in outputFile.Filenames)
{
string outputFilePath = Path.Combine(baseDirectory, filename);
if (!File.Exists(outputFilePath))
continue;
deleteableFiles.Add(outputFilePath);
}
}
return deleteableFiles;
}
/// <summary>
/// Get the hex contents of the PIC file
/// </summary>

View File

@@ -26,6 +26,11 @@ namespace MPF.Processors
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return (false, ["Media and system combination not supported for CleanRip"]);
var missingFiles = new List<string>();
switch (Type)
{

View File

@@ -74,6 +74,11 @@ namespace MPF.Processors
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return (false, ["Media and system combination not supported for DiscImageCreator"]);
var missingFiles = new List<string>();
switch (Type)
{
@@ -700,57 +705,6 @@ namespace MPF.Processors
}
}
/// <inheritdoc/>
public override List<string> GetDeleteableFilePaths(string basePath)
{
var deleteableFiles = new List<string>();
switch (Type)
{
// TODO: Handle (Pregap) files -- need examples
case MediaType.CDROM:
case MediaType.GDROM:
if (File.Exists($"{basePath}.img"))
deleteableFiles.Add($"{basePath}.img");
if (File.Exists($"{basePath} (Track 0).img"))
deleteableFiles.Add($"{basePath} (Track 0).img");
if (File.Exists($"{basePath} (Track 00).img"))
deleteableFiles.Add($"{basePath} (Track 00).img");
if (File.Exists($"{basePath} (Track 1)(-LBA).img"))
deleteableFiles.Add($"{basePath} (Track 1)(-LBA).img");
if (File.Exists($"{basePath} (Track 01)(-LBA).img"))
deleteableFiles.Add($"{basePath} (Track 01)(-LBA).img");
if (File.Exists($"{basePath} (Track AA).img"))
deleteableFiles.Add($"{basePath} (Track AA).img");
if (File.Exists($"{basePath}.scm"))
deleteableFiles.Add($"{basePath}.scm");
if (File.Exists($"{basePath} (Track 0).scm"))
deleteableFiles.Add($"{basePath} (Track 0).scm");
if (File.Exists($"{basePath} (Track 00).scm"))
deleteableFiles.Add($"{basePath} (Track 00).scm");
if (File.Exists($"{basePath} (Track 1)(-LBA).scm"))
deleteableFiles.Add($"{basePath} (Track 1)(-LBA).scm");
if (File.Exists($"{basePath} (Track 01)(-LBA).scm"))
deleteableFiles.Add($"{basePath} (Track 01)(-LBA).scm");
if (File.Exists($"{basePath} (Track AA).scm"))
deleteableFiles.Add($"{basePath} (Track AA).scm");
break;
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.BluRay:
case MediaType.NintendoGameCubeGameDisc:
case MediaType.NintendoWiiOpticalDisc:
if (File.Exists($"{basePath}.raw"))
deleteableFiles.Add($"{basePath}.raw");
break;
}
return deleteableFiles;
}
/// <inheritdoc/>
public override List<string> GetLogFilePaths(string basePath)
{

View File

@@ -25,6 +25,11 @@ namespace MPF.Processors
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return (false, ["Media and system combination not supported for PS3 CFW"]);
var missingFiles = new List<string>();
if (Type != MediaType.BluRay || System != RedumpSystem.SonyPlayStation3)

View File

@@ -27,6 +27,11 @@ namespace MPF.Processors
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return (false, ["Media and system combination not supported for Redumper"]);
var missingFiles = new List<string>();
switch (Type)
@@ -530,19 +535,6 @@ namespace MPF.Processors
}
}
/// <inheritdoc/>
public override List<string> GetDeleteableFilePaths(string basePath)
{
var deleteableFiles = new List<string>();
if (File.Exists($"{basePath}.scram"))
deleteableFiles.Add($"{basePath}.scram");
if (File.Exists($"{basePath}.scrap"))
deleteableFiles.Add($"{basePath}.scrap");
return deleteableFiles;
}
/// <inheritdoc/>
public override List<string> GetLogFilePaths(string basePath)
{

View File

@@ -26,6 +26,11 @@ namespace MPF.Processors
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return (false, ["Media and system combination not supported for UmdImageCreator"]);
var missingFiles = new List<string>();
switch (Type)
{

View File

@@ -25,6 +25,11 @@ namespace MPF.Processors
string baseFilename = Path.GetFileName(basePath);
string baseDirectory = Path.GetDirectoryName(basePath) ?? string.Empty;
// Get the list of output files
var outputFiles = GetOutputFiles(baseFilename);
if (outputFiles.Count == 0)
return (false, ["Media and system combination not supported for XboxBackupCreator"]);
var missingFiles = new List<string>();
switch (Type)
{