diff --git a/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs b/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs index 9883327b..dd660f78 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.ConvertUpdate.cs @@ -292,11 +292,8 @@ 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) - { - outDats[j].WriteToFile(path, logger); - } + // 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,11 +391,8 @@ 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) - { - outDats[j].WriteToFile(path, logger); - } + // 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,11 +430,8 @@ namespace SabreTools.Helper.Dats } } - // Output a DAT only if there are roms - if (Count != 0) - { - WriteToFile(outDir, logger); - } + // Try to output the file + WriteToFile(outDir, logger); } /// @@ -483,11 +474,8 @@ 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) - { - innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(inputFileName) : outDir), logger, overwrite: (outDir != "")); - } + // Try to output the file + innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(inputFileName) : outDir), logger, overwrite: (outDir != "")); } else if (Directory.Exists(inputFileName)) { @@ -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) - { - innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(file) : outDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outDir != "")); - } + // Try to output the file + innerDatdata.WriteToFile((outDir == "" ? Path.GetDirectoryName(file) : outDir + Path.GetDirectoryName(file).Remove(0, inputFileName.Length - 1)), logger, overwrite: (outDir != "")); }); } else diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs index 2faab23d..d23b5d4e 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs @@ -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; } diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs b/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs index b26799cc..55055f90 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Splitters.cs @@ -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); - } + success &= nodump.WriteToFile(outDir, logger); + success &= sha1.WriteToFile(outDir, logger); + success &= md5.WriteToFile(outDir, logger); + 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); - } + success &= romdat.WriteToFile(outDir, logger); + success &= diskdat.WriteToFile(outDir, logger); + success &= sampledat.WriteToFile(outDir, logger); return success; }