From 735d5d89b79ee0b81f83a5c167b686d6a7db8c29 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 31 Mar 2017 16:53:52 -0700 Subject: [PATCH] [DatFile] Rebuild should be consistent --- .../Dats/Partials/DatFile.Rebuild.cs | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs index 5ffc31c6..e631a9b2 100644 --- a/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs +++ b/SabreTools.Helper/Dats/Partials/DatFile.Rebuild.cs @@ -772,44 +772,42 @@ namespace SabreTools.Helper.Dats rom.Machine = item.Machine; rom.Name += "_" + rom.CRC; + // If either copy succeeds, then we want to set rebuilt to true + bool eitherSuccess = false; switch (outputFormat) { 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(fileStream, outDir, rom, date: date, overwrite: true); - - // Now add the success of either rebuild - rebuilt &= eitherSuccess; - break; case OutputFormat.TapeArchive: - rebuilt &= ArchiveTools.WriteTAR(transformStream, outDir, item, date: date); - rebuilt &= ArchiveTools.WriteTAR(fileStream, outDir, rom, date: date); + eitherSuccess |= ArchiveTools.WriteTAR(transformStream, outDir, item, date: date); + eitherSuccess |= ArchiveTools.WriteTAR(fileStream, outDir, rom, date: date); break; case OutputFormat.Torrent7Zip: - rebuilt &= ArchiveTools.WriteTorrent7Zip(transformStream, outDir, item, date: date); - rebuilt &= ArchiveTools.WriteTorrent7Zip(fileStream, outDir, rom, date: date); + eitherSuccess |= ArchiveTools.WriteTorrent7Zip(transformStream, outDir, item, date: date); + eitherSuccess |= ArchiveTools.WriteTorrent7Zip(fileStream, outDir, rom, date: date); break; case OutputFormat.TorrentGzip: - rebuilt &= ArchiveTools.WriteTorrentGZ(transformStream, outDir, romba); - rebuilt &= ArchiveTools.WriteTorrentGZ(fileStream, outDir, romba); + eitherSuccess |= ArchiveTools.WriteTorrentGZ(transformStream, outDir, romba); + eitherSuccess |= ArchiveTools.WriteTorrentGZ(fileStream, outDir, romba); break; case OutputFormat.TorrentLrzip: break; case OutputFormat.TorrentRar: break; case OutputFormat.TorrentXZ: - rebuilt &= ArchiveTools.WriteTorrentXZ(transformStream, outDir, item, date: date); - rebuilt &= ArchiveTools.WriteTorrentXZ(fileStream, outDir, rom, date: date); + eitherSuccess |= ArchiveTools.WriteTorrentXZ(transformStream, outDir, item, date: date); + eitherSuccess |= ArchiveTools.WriteTorrentXZ(fileStream, outDir, rom, date: date); break; case OutputFormat.TorrentZip: - rebuilt &= ArchiveTools.WriteTorrentZip(transformStream, outDir, item, date: date); - rebuilt &= ArchiveTools.WriteTorrentZip(fileStream, outDir, rom, date: date); + eitherSuccess |= ArchiveTools.WriteTorrentZip(transformStream, outDir, item, date: date); + eitherSuccess |= ArchiveTools.WriteTorrentZip(fileStream, outDir, rom, date: date); break; } + + // Now add the success of either rebuild + rebuilt &= eitherSuccess; } } }