Canceling Zip/unzip operations?

Sep 10, 2009 at 9:01 AM

 

what is the chance of having something added that can help with cleanly canceling zip operations like

1) zip1.Save(someDir)

2)zip1.ExtractAll(destPath, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently)

 

i need to be able to cancel them if needed, but i want to do it quickly and cleanly. i want to avoid aborting the thread because it "may" have unforeseen consequences... not really sure what could happen.

 

Coordinator
Sep 10, 2009 at 10:06 AM

You can cancel from within a SaveProgress or ExtractProgress method.

The System.EventArgs that gets passed - it has a Cancel property.  Set it to true within the progress event, and the Extract or Save will be canceled cleanly.

 

Sep 10, 2009 at 5:08 PM
Edited Sep 10, 2009 at 6:10 PM

WOW thanks! this Library seems to have everything i need. the zip canceled immediately!

'in progress event

If MyZip.CancelZipOperation Then
            e.Cancel = True
        End If

'after zip operation

If MyZip.CancelZipOperation Then
            RaiseEvent zipCancel()
            MyZip.CancelZipOperation = False
            Exit Function
        End If

'in form

Private Sub zipCancel() Handles zip1.zipCancel
        Dim args() As Object = {ProgressState.Close}
        ThreadSafe.randomInvoke(Me, ProgressBarToggleDelegate, args)
        MsgBox("your zip operation has been successfully canceled")
    End Sub

EDIT:

MOVED INTO NEW DISCUSSION!

 

 

Coordinator
Sep 10, 2009 at 6:09 PM

Are you reporting a problem? 

I'm not clear on whether its working for you or not.

 

Sep 10, 2009 at 6:11 PM

yes, im moving it to a new discussion. sorry about that.