[DatFile] Make sure that error shows in correct place

This commit is contained in:
Matt Nadareski
2017-02-03 12:32:31 -08:00
parent 1bb485c938
commit b52e057d8b
3 changed files with 18 additions and 64 deletions

View File

@@ -292,13 +292,10 @@ namespace SabreTools.Helper.Dats
? Path.GetFileName(split[0])
: (Path.GetDirectoryName(split[0]).Remove(0, split[1].Length)));
// If we have more than 0 roms, output
if (outDats[j].Count > 0)
{
// Try to output the file
outDats[j].WriteToFile(path, logger);
}
}
}
logger.User("Outputting complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
}
@@ -394,12 +391,9 @@ namespace SabreTools.Helper.Dats
: (Path.GetDirectoryName(split[0]).Remove(0, split[1].Length))); ;
}
// If we have more than 0 roms, output
if (outDats[j].Count > 0)
{
// Try to output the file
outDats[j].WriteToFile(path, logger);
}
}
logger.User("Outputting complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
}
@@ -436,12 +430,9 @@ namespace SabreTools.Helper.Dats
}
}
// Output a DAT only if there are roms
if (Count != 0)
{
// Try to output the file
WriteToFile(outDir, logger);
}
}
/// <summary>
/// Convert, update, and filter a DAT file or set of files using a base
@@ -483,12 +474,9 @@ namespace SabreTools.Helper.Dats
root, logger, true, clean, softlist,
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
// If we have roms, output them
if (innerDatdata.Count != 0)
{
// Try to output the file
innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(inputFileName) : outDir), logger, overwrite: (outDir != ""));
}
}
else if (Directory.Exists(inputFileName))
{
inputFileName = Path.GetFullPath(inputFileName) + Path.DirectorySeparatorChar;
@@ -503,11 +491,8 @@ namespace SabreTools.Helper.Dats
trim, single, root, logger, true, clean, softlist,
keepext: ((innerDatdata.DatFormat & DatFormat.TSV) != 0 || (innerDatdata.DatFormat & DatFormat.CSV) != 0));
// If we have roms, output them
if (innerDatdata.Count > 0)
{
// Try to output the file
innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(file) : outDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outDir != ""));
}
});
}
else

View File

@@ -901,7 +901,6 @@ namespace SabreTools.Helper.Dats
matched.DatFormat = DatFormat.Logiqx;
// If we are checking hashes only, essentially diff the inputs
bool found = false;
if (hashOnly)
{
// First we need to sort by hash to get duplicates
@@ -915,7 +914,6 @@ namespace SabreTools.Helper.Dats
{
if (rom.SourceID == 99)
{
found = true;
if (rom.Type == ItemType.Disk || rom.Type == ItemType.Rom)
{
matched.Add(((Disk)rom).SHA1, rom);
@@ -935,7 +933,6 @@ namespace SabreTools.Helper.Dats
{
if (rom.SourceID == 99)
{
found = true;
matched.Add(rom.Size + "-" + rom.CRC, rom);
}
}
@@ -943,14 +940,7 @@ namespace SabreTools.Helper.Dats
}
// Now output the fixdat to the main folder
if (found)
{
matched.WriteToFile("", logger, stats: true);
}
else
{
logger.User("No fixDat needed");
}
success &= matched.WriteToFile("", logger, stats: true);
return success;
}

View File

@@ -299,22 +299,10 @@ namespace SabreTools.Helper.Dats
// Now, output all of the files to the output directory
logger.User("DAT information created, outputting new files");
bool success = true;
if (nodump.Count > 0)
{
success &= nodump.WriteToFile(outDir, logger);
}
if (sha1.Count > 0)
{
success &= sha1.WriteToFile(outDir, logger);
}
if (md5.Count > 0)
{
success &= md5.WriteToFile(outDir, logger);
}
if (crc.Count > 0)
{
success &= crc.WriteToFile(outDir, logger);
}
return success;
}
@@ -547,18 +535,9 @@ namespace SabreTools.Helper.Dats
// Now, output all of the files to the output directory
logger.User("DAT information created, outputting new files");
bool success = true;
if (romdat.Count > 0)
{
success &= romdat.WriteToFile(outDir, logger);
}
if (diskdat.Count > 0)
{
success &= diskdat.WriteToFile(outDir, logger);
}
if (sampledat.Count > 0)
{
success &= sampledat.WriteToFile(outDir, logger);
}
return success;
}