Convert Rom size field to long?

This commit is contained in:
Matt Nadareski
2020-09-04 23:03:27 -07:00
parent 5e47d511bc
commit 9fd8a48874
22 changed files with 101 additions and 262 deletions

View File

@@ -478,7 +478,7 @@ namespace SabreTools.Library.FileTypes
.Concat(Utilities.StringToByteArray(rom.CRC)) // CRC
.ToArray();
sw.Write(data);
sw.Write((ulong)rom.Size); // Long size (Unsigned, Mirrored)
sw.Write((ulong)(rom.Size ?? 0)); // Long size (Unsigned, Mirrored)
// Now create a deflatestream from the input file
ZlibBaseStream ds = new ZlibBaseStream(outputStream, CompressionMode.Compress, CompressionLevel.BestCompression, ZlibStreamFlavor.DEFLATE, true);
@@ -496,7 +496,7 @@ namespace SabreTools.Library.FileTypes
// Now write the standard footer
sw.Write(Utilities.StringToByteArray(rom.CRC).Reverse().ToArray());
sw.Write((uint)rom.Size);
sw.Write((uint)(rom.Size ?? 0));
// Dispose of everything
sw.Dispose();

View File

@@ -342,7 +342,7 @@ namespace SabreTools.Library.FileTypes
// Copy the input stream to the output
inputStream.Seek(0, SeekOrigin.Begin);
tarFile.AddEntry(rom.Name, inputStream, size: rom.Size, modified: usableDate);
tarFile.AddEntry(rom.Name, inputStream, size: rom.Size ?? 0, modified: usableDate);
}
// Otherwise, sort the input files and write out in the correct order
@@ -394,7 +394,7 @@ namespace SabreTools.Library.FileTypes
{
// Copy the input file to the output
inputStream.Seek(0, SeekOrigin.Begin);
tarFile.AddEntry(rom.Name, inputStream, size: rom.Size, modified: usableDate);
tarFile.AddEntry(rom.Name, inputStream, size: rom.Size ?? 0, modified: usableDate);
}
// Otherwise, copy the file from the old archive
@@ -514,7 +514,7 @@ namespace SabreTools.Library.FileTypes
}
// Copy the input stream to the output
tarFile.AddEntry(roms[index].Name, FileExtensions.TryOpenRead(inputFiles[index]), size: roms[index].Size, modified: usableDate);
tarFile.AddEntry(roms[index].Name, FileExtensions.TryOpenRead(inputFiles[index]), size: roms[index].Size ?? 0, modified: usableDate);
}
}
@@ -574,7 +574,7 @@ namespace SabreTools.Library.FileTypes
}
// Copy the input file to the output
tarFile.AddEntry(roms[-index - 1].Name, FileExtensions.TryOpenRead(inputFiles[-index - 1]), size: roms[-index - 1].Size, modified: usableDate);
tarFile.AddEntry(roms[-index - 1].Name, FileExtensions.TryOpenRead(inputFiles[-index - 1]), size: roms[-index - 1].Size ?? 0, modified: usableDate);
}
// Otherwise, copy the file from the old archive