[DatFile] Rebuild should be consistent

This commit is contained in:
Matt Nadareski
2017-03-31 16:53:52 -07:00
parent 36cf8e35f7
commit 735d5d89b7

View File

@@ -772,44 +772,42 @@ namespace SabreTools.Helper.Dats
rom.Machine = item.Machine; rom.Machine = item.Machine;
rom.Name += "_" + rom.CRC; rom.Name += "_" + rom.CRC;
// If either copy succeeds, then we want to set rebuilt to true
bool eitherSuccess = false;
switch (outputFormat) switch (outputFormat)
{ {
case OutputFormat.Folder: case OutputFormat.Folder:
// If either copy succeeds, then we want to set rebuilt to true
bool eitherSuccess = false;
eitherSuccess |= ArchiveTools.WriteFile(transformStream, outDir, item, date: date, overwrite: true); eitherSuccess |= ArchiveTools.WriteFile(transformStream, outDir, item, date: date, overwrite: true);
eitherSuccess |= ArchiveTools.WriteFile(fileStream, outDir, rom, date: date, overwrite: true); eitherSuccess |= ArchiveTools.WriteFile(fileStream, outDir, rom, date: date, overwrite: true);
// Now add the success of either rebuild
rebuilt &= eitherSuccess;
break; break;
case OutputFormat.TapeArchive: case OutputFormat.TapeArchive:
rebuilt &= ArchiveTools.WriteTAR(transformStream, outDir, item, date: date); eitherSuccess |= ArchiveTools.WriteTAR(transformStream, outDir, item, date: date);
rebuilt &= ArchiveTools.WriteTAR(fileStream, outDir, rom, date: date); eitherSuccess |= ArchiveTools.WriteTAR(fileStream, outDir, rom, date: date);
break; break;
case OutputFormat.Torrent7Zip: case OutputFormat.Torrent7Zip:
rebuilt &= ArchiveTools.WriteTorrent7Zip(transformStream, outDir, item, date: date); eitherSuccess |= ArchiveTools.WriteTorrent7Zip(transformStream, outDir, item, date: date);
rebuilt &= ArchiveTools.WriteTorrent7Zip(fileStream, outDir, rom, date: date); eitherSuccess |= ArchiveTools.WriteTorrent7Zip(fileStream, outDir, rom, date: date);
break; break;
case OutputFormat.TorrentGzip: case OutputFormat.TorrentGzip:
rebuilt &= ArchiveTools.WriteTorrentGZ(transformStream, outDir, romba); eitherSuccess |= ArchiveTools.WriteTorrentGZ(transformStream, outDir, romba);
rebuilt &= ArchiveTools.WriteTorrentGZ(fileStream, outDir, romba); eitherSuccess |= ArchiveTools.WriteTorrentGZ(fileStream, outDir, romba);
break; break;
case OutputFormat.TorrentLrzip: case OutputFormat.TorrentLrzip:
break; break;
case OutputFormat.TorrentRar: case OutputFormat.TorrentRar:
break; break;
case OutputFormat.TorrentXZ: case OutputFormat.TorrentXZ:
rebuilt &= ArchiveTools.WriteTorrentXZ(transformStream, outDir, item, date: date); eitherSuccess |= ArchiveTools.WriteTorrentXZ(transformStream, outDir, item, date: date);
rebuilt &= ArchiveTools.WriteTorrentXZ(fileStream, outDir, rom, date: date); eitherSuccess |= ArchiveTools.WriteTorrentXZ(fileStream, outDir, rom, date: date);
break; break;
case OutputFormat.TorrentZip: case OutputFormat.TorrentZip:
rebuilt &= ArchiveTools.WriteTorrentZip(transformStream, outDir, item, date: date); eitherSuccess |= ArchiveTools.WriteTorrentZip(transformStream, outDir, item, date: date);
rebuilt &= ArchiveTools.WriteTorrentZip(fileStream, outDir, rom, date: date); eitherSuccess |= ArchiveTools.WriteTorrentZip(fileStream, outDir, rom, date: date);
break; break;
} }
// Now add the success of either rebuild
rebuilt &= eitherSuccess;
} }
} }
} }