我正在使用vb.net,并想知道如何在提取存档时显示正在提取的文件。我已经有一个解决方法,但它是“cheaty”,并没有真正显示正在提取的当前文件。
Public Class Form1
Private listItemIndex As Integer = 0
Public Sub ext_Extracting(ByVal sender As Object, ByVal e As SevenZip.ProgressEventArgs)
Dim ext As SevenZipExtractor = New SevenZipExtractor("C:\Test.7z")
If listItemIndex < ext.ArchiveFileNames.Count Then
Label1.Text = ext.ArchiveFileNames.Item(listItemIndex).ToString()
listItemIndex += 1
End If
End Sub
End Class
答案 0 :(得分:0)
这个答案是由OP写的,但不正确edited into the question:
好的我明白了。我不得不将“FileInfo.FileName”添加到“SevenZip.FileInfoEventArgs”中,然后在提取时对其进行引用。
Public Sub FileExtractionStarted(ByVal sender As Object, ByVal e As SevenZip.FileInfoEventArgs) Label1.Text = e.FileInfo.FileName End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SevenZipExtractor.SetLibraryPath("C:\7z.dll") Dim ext As SevenZipExtractor = New SevenZipExtractor("C:\test.7z") ext.BeginExtractArchive("C:\Test") AddHandler ext.ExtractionFinished, AddressOf ext_ExtractionFinished AddHandler ext.Extracting, AddressOf ext_Extracting AddHandler ext.FileExtractionStarted, AddressOf FileExtractionStarted '<--- End Sub