SevenZipSharp stop extracting

1k views Asked by At

I have a problem. I'm using SevenZipSharp to extracting 7z directory and everything is working great, but during extraction I would like to have posibility to stop extracting but I can't do it.

Extracting is doing in BusinessLogicProject, and after click button in View project I wont to stop it.

SevenZipExtractor has 5 events: FileExtractionStarted, FileExtractionStarted, Extracting, ExtractionFinished and ExtractionStarted. I am using two of them to progressbarvalue changing and deleting zip file after extracting:

        extr.Extracting += (s, e) =>
        {       
             package.ProgresBarValue = e.PercentDone;
        };

        extr.ExtractionFinished += (s, e) =>
        {                
            if(File.Exists(fileName))
                File.Delete(fileName);

            Thread.Sleep(1000);
            var sevenZipExtractor = s as SevenZipExtractor;
            if (sevenZipExtractor != null) sevenZipExtractor.Dispose();
        };

Thanks in advance for your help.

0

There are 0 answers