Better error checking; more DICUI.Check updates

This commit is contained in:
Matt Nadareski
2019-03-30 21:44:57 -07:00
parent d8ed7d6ad7
commit 28f6d50e5a
2 changed files with 16 additions and 9 deletions

View File

@@ -30,19 +30,18 @@ namespace DICUI.Check
// Loop through all the rest of the args
for (int i = 1; i < args.Length; i++)
{
// Check for a directory
if (!Directory.Exists(args[i]))
// Check for a file
if (!File.Exists(args[i]))
{
DisplayHelp($"{args[i]} is not a directory");
DisplayHelp($"{args[i]} does not exist");
return;
}
// Now populate an environment
string procPath = args[i].TrimEnd(Path.DirectorySeparatorChar);
var env = new DumpEnvironment
{
OutputDirectory = procPath + Path.DirectorySeparatorChar,
OutputFilename = Path.GetFileName(procPath) + ".bin",
OutputDirectory = "",
OutputFilename = args[i],
System = knownSystem,
Type = mediaType,
ScanForProtection = false,
@@ -61,7 +60,7 @@ namespace DICUI.Check
Console.WriteLine(error);
Console.WriteLine("Usage:");
Console.WriteLine("DICUI.Check.exe <mediatype> </path/to/output> ...");
Console.WriteLine("DICUI.Check.exe <mediatype> </path/to/output.bin> ...");
Console.WriteLine();
Console.WriteLine(@"Media Types:\r\n
cd / cdrom - CD-ROM

View File

@@ -460,7 +460,15 @@ namespace DICUI.Utilities
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? "Disc has no PVD";
mappings[Template.ErrorCountField] = GetErrorCount(combinedBase + ".img_EdcEcc.txt").ToString();
long errorCount = -1;
if (File.Exists(combinedBase + ".img_EdcEcc.txt"))
errorCount = GetErrorCount(combinedBase + ".img_EdcEcc.txt");
else if (File.Exists(combinedBase + ".img_EccEdc.txt"))
errorCount = GetErrorCount(combinedBase + ".img_EccEdc.txt");
mappings[Template.ErrorCountField] = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString());
mappings[Template.CuesheetField] = GetFullFile(combinedBase + ".cue") ?? "";
mappings[Template.WriteOffsetField] = GetWriteOffset(combinedBase + "_disc.txt") ?? "";
@@ -1030,7 +1038,7 @@ namespace DICUI.Utilities
/// <summary>
/// Get the detected error count from the input files, if possible
/// </summary>
/// <param name="edcecc">.img_EdcEcc.txt file location</param>
/// <param name="edcecc">.img_EdcEcc.txt/.img_EccEdc.txt file location</param>
/// <returns>Error count if possible, -1 on error</returns>
private long GetErrorCount(string edcecc)
{