This project is read-only.

Compressing event never fired

Jun 7, 2012 at 9:35 AM
Edited Jun 7, 2012 at 9:37 AM

Hi,

i'm using sevenzipsharp for the first time and i'm having issue with the compressing event, not being fired when i call beginCompressDirectory. I already searched on Google, and on the discussion board but i didn't found anything that fix this issue.
From what i can see, i also downloaded the TestForm from source section and it has the same issue: while the extraction progress works fine, the compression progress doesn't works since, as i already said, compressing event never get fired.

public void(){
SevenZipExtractor.SetLibraryPath("7z.dll");
            SevenZipCompressor zip = new SevenZipCompressor();
            zip.ArchiveFormat = OutArchiveFormat.Zip;
            zip.FastCompression = false;
            zip.CompressionLevel = CompressionLevel.Normal;
            zip.TempFolderPath = ConfigurationManager.AppSettings["ZIPTempPath"];
            //zip.Compressing += new EventHandler<ProgressEventArgs>(CreateZIPFile_Compressing);
            zip.Compressing += CreateZIPFile_Compressing;
            zip.FileCompressionStarted += new EventHandler<FileNameEventArgs>(CreateZIPFile_FileCompressionStarted);
            zip.CompressionFinished += new EventHandler<EventArgs>(CreateZIPFile_CompressionFinished);

            zip.BeginCompressDirectory(@"c:\temp", @"C:\test.zip");

        }

        public void CreateZIPFile_Compressing(object sender, ProgressEventArgs e)
        {
            loading.progressbar.Increment(e.PercentDelta);
            loading.lblpercentage.Text = loading.progressbar.Value.ToString() + "%";
        }

        void CreateZIPFile_FileCompressionStarted(object sender, FileNameEventArgs e)
        {
            loading.Show();
            loading.lblpercentage.Visible = true;
            loading.progressbar.Visible = true;
            loading.Refresh();
        }

        void CreateZIPFile_CompressionFinished(object sender, EventArgs e)
        {
            loading.Hide();
        }

The compression works fine since i have a working test.zip file in my home dir, and both CompressionStarted and Finished got fired, while compressing doesn't.

How can i fix this?
Thanks. 
Jun 20, 2012 at 7:40 PM
Edited Jun 20, 2012 at 7:41 PM

I've noticed issues with SevenZipSharp when using it with non-modal Forms. Try changing your loading.Show() to loading.ShowDialog().