You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the current library from Nuget (1.2), I get a corrupt archive, if I use this code:
If I dont have CompressionMethod.Stored, then the archive works, but the uncompressed files are always few bytes bigger than the original files. I need the files to be exactly the same (original size = size of file in ZIP archive).
I have fixed this whole thing for myself before (see my older issue), but in 1.2, this still seems to be flawed.
Best
Martin
publicZipWriter(string filename){_sziFilename=filename;FileStreamfsOut= File.Create(_sziFilename);_zipStream=new ZipOutputStream(fsOut);
_zipStream.SetLevel(0);//0-9, 9 being the highest level of compression}publicvoidAddFileToZip(stringfilenameInZip,MemoryStreammemTile){
memTile.Position =0;DateTimecreationTimeUtc= DateTime.Now;stringentryName= filenameInZip;entryName= ZipEntry.CleanName(entryName);// Removes drive from name and fixes slash directionvarnewEntry=new ZipEntry(entryName){DateTime=creationTimeUtc,CompressionMethod= CompressionMethod.Stored,Size= memTile.Length,};
_zipStream.PutNextEntry(newEntry);// Zip the file in buffered chunks// the "using" will close the stream even if an exception occursbyte[]buffer=newbyte[4096];
StreamUtils.Copy(memTile, _zipStream, buffer);
_zipStream.CloseEntry();
Expected behavior
ZIP archive should be OK
Actual behavior
ZIP archive corrupt
Version of SharpZipLib
1.2.0
Obtained from (only keep the relevant lines)
Package installed using NuGet
The text was updated successfully, but these errors were encountered:
Steps to reproduce
With the current library from Nuget (1.2), I get a corrupt archive, if I use this code:
If I dont have CompressionMethod.Stored, then the archive works, but the uncompressed files are always few bytes bigger than the original files. I need the files to be exactly the same (original size = size of file in ZIP archive).
I have fixed this whole thing for myself before (see my older issue), but in 1.2, this still seems to be flawed.
Best
Martin
Expected behavior
ZIP archive should be OK
Actual behavior
ZIP archive corrupt
Version of SharpZipLib
1.2.0
Obtained from (only keep the relevant lines)
The text was updated successfully, but these errors were encountered: