using ZipFile, Update() after Save()

Sep 29, 2010 at 4:03 PM

Here is the idea of what I need to do:

            using(ZipFile zip = new ZipFile())
            {
                zip.AddEntry("file1.txt", "line1");
                zip.Save(@"c:\temp\test.zip");
                zip.UpdateEntry("file1.txt", "line2");
                zip.Save(@"c:\temp\test.zip");
            }

What I would expect is having a "c:\temp\test.zip"   with  "file1.txt"  with content  "line2". What I actually get is a zip file with  "file1.txt"  corrupted.

I need to keep all the information compressed in memory, and from time to time save it to disk. Something that works but that I dont like  is  after saving  the zip to create a new zip file by reading the just saved file, then update and then save again. 

Any help will be greatly appreciated.

 

 

 

 

Coordinator
Sep 30, 2010 at 1:13 PM
Edited Sep 30, 2010 at 1:15 PM
What you want to do should work. I'll have to take a closer look to see the source of the problem. In the meantime, you have your workaround.