I have the following problem with SevenZipSharp. I want to compress a list(of String) containing filenames with full path. My code works fine, but only the last event(zip.CompressionFinished) is firing. Neither fFileCompressionStarted nor fCompressing is firing. What am I doing wrong?
Even if I set breakpoints in the event-subs or type "Stop", nothing happens.
Here is my code:
Dim working As Boolean
Private Sub start()
Dim zip As New SevenZipCompressor
zip.ArchiveFormat = OutArchiveFormat.SevenZip
zip.CompressionMode = CompressionMode.Create
zip.CompressionLevel = CompressionLevel.Fast
zip.CompressionMethod = CompressionMethod.Lzma2
zip.DirectoryStructure = True
zip.FastCompression = True
zip.IncludeEmptyDirectories = True
zip.PreserveDirectoryRoot = True
zip.TempFolderPath = System.IO.Path.GetTempPath()
AddHandler zip.FileCompressionStarted, AddressOf fFileCompressionStarted
AddHandler zip.Compressing, AddressOf fCompressing
AddHandler zip.CompressionFinished, AddressOf Compress_Finished
working = True
Label10.Text = "Startup..."
Application.DoEvents()
zip.BeginCompressFiles(filename, flist.ToArray)
While working = True
Threading.Thread.Sleep(250)
Application.DoEvents()
End While
End Sub
Private Sub fFileCompressionStarted(ByVal sender As Object, ByVal e As SevenZip.FileNameEventArgs)
Debug.Print(("Compressing " + e.FileName + e.PercentDone.ToString))
Label10.Text = e.FileName
MsVistaProgressBar1.Value = e.PercentDone
Application.DoEvents()
End Sub
Private Sub fCompressing(sender As Object, e As SevenZip.ProgressEventArgs)
MsVistaProgressBar1.Value = e.PercentDone
Application.DoEvents()
End Sub
Private Sub Compress_Finished(sender As Object, e As EventArgs)
MsVistaProgressBar1.Value = 0
Label10.Text = "Ready."
working = False
Application.DoEvents()
End Sub