Using .85
The following code creates a corrupt zip file. It works fine if the line setting the password is removed.
public static void CreateZip(string zipFileName, string password, params string[] inputFiles)
{
using (ZipOutputStream zipOutputStream = new ZipOutputStream(File.Create(zipFileName)))
{
zipOutputStream.SetLevel(9); // 0 - store only to 9 - means best compression
// comment out the following line to make the code work
if (password != null) zipOutputStream.Password = password;
byte[] buffer = new byte[4096];
foreach (string file in inputFiles) {
ZipEntry entry = new ZipEntry(Path.GetFileName(file));
entry.DateTime = DateTime.Now;
zipOutputStream.PutNextEntry(entry);
using ( FileStream fs = File.OpenRead(file) ) {
int sourceBytes;
do {
sourceBytes = fs.Read(buffer, 0, buffer.Length);
zipOutputStream.Write(buffer, 0, sourceBytes);
} while (sourceBytes > 0);
}
}
}
Thanks.