如何使用sevenzipsharp异步解压缩归档列表并正确处理它们?

时间:2014-07-11 01:20:23

标签: vb.net asynchronous sevenzipsharp

如何使用SevenZipSharp异步解压缩档案列表并正确处理它们?

以下是我正在看的内容:

Public Class SevenZipVB

Private Shared extractors As New List(Of SevenZipVB)

Private WithEvents _extractor As SevenZip.SevenZipExtractor


''' <summary>
''' Extracts list of archives to their current directory always overwriting
''' </summary>
''' <param name="archives">List of full path names to archives</param>
Public Shared Sub BeginExtraction(ByVal archives As List(Of String))

    For Each archive In archives
        Dim ext = New SevenZipVB(archive)
        extractors.Add(ext)
    Next

    'magically wait for all extraction to finish but allow the calling thread to continue

End Sub

Private Sub New(ByVal archive As String)
    _extractor = New SevenZip.SevenZipExtractor(archive)
    _extractor.BeginExtractArchive(Path.GetDirectoryName(archive))
End Sub

Private Sub extractfinished() Handles _extractor.ExtractionFinished
    _extractor.Dispose()
End Sub

End Class

我想我必须添加某种异步方法,但我不知道它应该是什么样子。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

不要打扰,不再支持该库,只需使用命令行7za或7zr