Fix something that doesn't work for giant files

This commit is contained in:
Matt Nadareski
2024-07-03 15:28:25 -04:00
parent d146b6f589
commit 81c32ef08f

View File

@@ -93,16 +93,12 @@ namespace SabreTools.FileTypes.Archives
var gz = new gZip(); var gz = new gZip();
ZipReturn ret = gz.ZipFileOpen(this.Filename); ZipReturn ret = gz.ZipFileOpen(this.Filename);
ret = gz.ZipFileOpenReadStream(0, out Stream? gzstream, out ulong streamSize); ret = gz.ZipFileOpenReadStream(0, out Stream? gzstream, out ulong streamSize);
#if NET20 || NET35
byte[] buffer = new byte[32768]; byte[] buffer = new byte[32768];
int read; int read;
while ((read = gzstream!.Read(buffer, 0, buffer.Length)) > 0) while ((read = gzstream!.Read(buffer, 0, buffer.Length)) > 0)
{ {
outstream.Write(buffer, 0, read); outstream.Write(buffer, 0, read);
} }
#else
gzstream!.CopyTo(outstream);
#endif
// Dispose of the streams // Dispose of the streams
outstream.Dispose(); outstream.Dispose();