Reputation: 333
I have a winform app the uses the sevenzip.dll and implements it's abilities in order to compress an extract files and directories. My problem is that I want to use the compressing event of the sevenzip.compressor class in order to track the compression progress and display it with progressBar . The thing is , the event never fires (checked in debug mode) , while all other events are working, such as CompressionFinished event . I found that other developers encountered the same problem , but no one provided answers. Note : the extractor class of the dll also work as expected and all events are firing including the extractor.extracting event. Any help on how to overcome the issue will be appriciated. Here is some of the code I am using :
SevenZipCompressor compressor = new SevenZipCompressor();
// NOT FIRING
compressor.Compressing += new EventHandler<ProgressEventArgs>(compressor_Compressing);
// Firing as expected
compressor.CompressionFinished += new EventHandler<EventArgs>(compressor_CompressionFinished);
compressor.ArchiveFormat = OutArchiveFormat.Zip;
// if this value is true - then no events are fired
compressor.FastCompression = false;
compressor.CompressionMethod = CompressionMethod.Default;
compressor.TempFolderPath = System.IO.Path.GetTempPath();
compressor.EventSynchronization = EventSynchronizationStrategy.AlwaysAsynchronous;
compressor.CompressDirectory(source, output, GeneratePassword(backupID, customerID));
Upvotes: 0
Views: 922
Reputation: 333
Found an answer to all of you who encountered the same problem.
Compressing event fires ONLY if the compressing method is lzma .
just changing one line to :
compressor.CompressionMethod = CompressionMethod.Lzma;
Upvotes: 2