使用Sewenzipsharp包装器是否有人成功地流产了进来的压缩?我用过:
FileCompressionStarted(ByVal sender As Object, ByVal e As SevenZip.FileNameEventArgs)
看到一些活动并尝试了:
e.cancel = true
但是什么也没发生。压缩继续工作,直到包装所有文件为止。有什么想法吗?
在其他论坛上解决并解释了,请参阅链接,谢谢大家
http://www.vbforums.com/showthread.php?697661- resolved-sevenzipsharp-aborting-compression&p = 4272389#post4272389
ps。只是在这里有解决方案,以防任何人需要
e.cancel 在库中不太对待,因为(就像我预期的那样)当我设置 e.Cancel = true 一次时,库可能不会捕获此请求。我不确定这是七Zipsharp.dll问题或7z.dll,但在发布的代码中,当许多单击命中我的流产按钮时,库中库中止压缩!!!
因此,实施必须为:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
abort = True
console.addLine("Abort requested...")
End Sub
Private Sub fFileCompressionStarted(ByVal sender As Object, ByVal e As SevenZip.FileNameEventArgs)
Dim s As String = ""
If abort Then
e.Cancel = True
s = " aborted"
End If
console.addLine("[CompressionStarted event] e.Filename = " + e.FileName + ", e.PercentDone = " + e.PercentDone.ToString + s)
End Sub
Public Sub fCompressionFinished(ByVal sender As Object, ByVal e As System.EventArgs)
console.addLine("[CompressionFinished event]")
abort = False
End Sub
最好的问候,Edouard Gora,YO3HCV