Is this possible?

Hi, quick questions to the devs. First - I thank you for your hard work! I'm working on an application that cleans up your computer and I have an algorithm that does something like the following:

for(loop)
{
open zip
add file to zip
save zip
delete file
}

Rinse and repeat a hundred thousand times and it appears to progressively get slower and slower. Is there a method that will allow me to add a file to a zip while maintaining the zip open and ready to accept another file WHILE allowing me to delete the
file just added? What I'm finding is that the file cannot be deleted until the save. If I call save then it appears that the stream to the zip is closed out yielding performance problems.

Yes, it should get slower and slower each cycle through that loop. Every time you call ZipFile.Save(), the library writes out all the content in the ZipFile - every ZipEntry needs to be written to the disk. If you open a zipfile with 10000 entries and
add an entry to it, then call Save(), you will write out 10001 entries to the disk. So obviously, that takes longer and longer. There is an optiization where it does not re-compress the entries that are already compressed. I'm thinking about it now... I'm
not sure if that optimization is being taken in the case where you repeatedly Add() an entry and then Save(). I think it may not, in which case, in your scenario, it's actually worse - because you are recompressing each of the 10000 entries. As I said I
am not sure that this is the case, I would have to inspect the code closely. But if it were, then you it would be better for you to re-read the Zip file each time through the loop. In other words, instead of this: