2
Vote

Compressing event not fired

description

When compressing more than one file, Compressing event is not fired

tried at least with the following:

BeginCompressFiles(string archiveName, params string[] fileFullNames);
CompressFiles(string archiveName, params string[] fileFullNames);

comments

bethnull wrote Jun 1, 2014 at 10:11 AM

Hi!

For me even when compressing just one file the event Compressing isn't fired. FileCompressionStarted is fired as expected.

This is the code I'm using:
        private void Compress()
        {    

                // some code removed (dict filling)

                SevenZipCompressor compressor = new SevenZipCompressor
                {
                    CompressionMethod = CompressionMethod.Lzma,
                    CompressionLevel = CompressionLevel.Normal,
                    CompressionMode = CompressionMode.Create,
                    DirectoryStructure = true,
                    PreserveDirectoryRoot = false,
                    ArchiveFormat = OutArchiveFormat.SevenZip
                };

                compressor.FastCompression = false;
                compressor.Compressing += compressor_Compressing;
                compressor.FileCompressionStarted += compressor_FileCompressionStarted;

                compressor.CompressFileDictionary(dict, compress_to);
        }

        void compressor_Compressing(object sender, ProgressEventArgs e)
        {
            progress.Value = e.PercentDone;
        }

        void compressor_FileCompressionStarted(object sender, FileNameEventArgs e)
        {
            status.Text = e.FileName;
            progress.Value = e.PercentDone;
        }
Thanks in advance.

wrote Aug 13, 2014 at 1:29 PM

quazi_node wrote Dec 26, 2014 at 12:01 PM

var zip = new SevenZipCompressor
{
    ArchiveFormat = OutArchiveFormat.Zip,
    FastCompression = true,
};
zip.Compressing += (sender, args) =>
{
    // BUG: Never fired!
    m_ti.PercentValueSet(args.PercentDone);
};
zip.CompressDirectory(targetDirectory, zipFilepath);
in debug mode I see

This is fired normally
private void CommonUpdateCallbackInit(ArchiveUpdateCallback auc)
{
    ...
    auc.Compressing += CompressingEventProxy;
    ...
}
Never fired
private void CompressingEventProxy(object sender, ProgressEventArgs e)
{
    OnEvent(Compressing, e, false);
}