Need to show what file is being extracted when extracting an archive.

Dec 8, 2012 at 9:05 PM

Hi. I'm using vb.net and was wondering how to show what file is being extracted when extracting an archive.

Dec 8, 2012 at 9:26 PM
Edited Dec 8, 2012 at 9:30 PM

Nevermind I got it:

 

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

Edit: It's actually kind of a workaround. I would love to see some sort of direct approach.

Dec 9, 2012 at 6:14 PM
Edited Dec 9, 2012 at 6:15 PM

Got it. (Finally) Just wish there were more documentation on this sort of thing.

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