Providing an alternative extraction path in case of overwrites

Oct 24, 2011 at 10:30 AM

Hi there,

First of all, really awesome library! 

Had a small problem I was trying to tackle and was wondering what the best approach is.

I was attempting to use the library to extract files in a folder. Now this folder might already contain the files being extracted. In such cases I would like to provide an alternative FileName and extract the file with the new name. Now I know about using ExtractProgress and I tried to do this in two ways:

1. Handle  e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite by setting the current entry's filename to a new unique name. This still seems to be throwing the exception without extracting the file.

2. Handle e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry by setting the current entry's filename to a new unique name. This causes an exception after the file has been extracted because the collection has been changed.

The only 2 alternatives I can see is to either check the entire zip file before extraction and update it accordingly, or by making use of a temporary folder and then copying the files.

Is there anything else I might attempt which I might be missing?

Thanks and regards,

A