08-15-2011, 16:26
Code:
Imports System.IO
Public Class Form1
Private Sub KryptonButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton1.Click
Using ofd As New OpenFileDialog
ofd.Filter = "ZipFile|*.zip"
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim file As String = ofd.FileName
Dim cu As New ClassUnzip(file, Path.Combine(Path.GetDirectoryName(file), "test_unzip_folder"))
AddHandler cu.UnzipFinishd, AddressOf Unziped
cu.UnzipNow()
End If
End Using
End Sub
Private Sub Unziped()
MessageBox.Show("Unzipping finished")
End Sub
End Class
Classe:
Imports System
Imports System.IO
Public Class ClassUnzip
Private _file As String
Private _folder As String
Private _towhere As String
Private _shell As Shell32.IShellDispatch2
''' <summary></summary>
''' <remarks></remarks>
Public Event Unzipstart()
''' <summary></summary>
''' <remarks></remarks>
Public Event UnzipFinishd()
''' <summary></summary>
''' <param name="file"></param>
''' <param name="towhere"></param>
''' <remarks></remarks>
Public Sub New(ByVal file As String, ByVal towhere As String)
_file = file
_towhere = towhere
_folder = Path.Combine(Path.GetDirectoryName(_file), _towhere)
_shell = CreateObject("Shell.Application")
End Sub
''' <summary></summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function UnzipNow() As Boolean
If Directory.Exists(_folder) = False Then
Directory.CreateDirectory(_folder)
End If
RaiseEvent Unzipstart()
Dim temp As Shell32.Folder = _shell.NameSpace((_folder))
If temp IsNot Nothing Then
temp.CopyHere(_shell.NameSpace((_file)).Items)
End If
RaiseEvent UnzipFinishd()
Return True
End Function
''' <summary></summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property UnZipFile() As String
Get
Return _file
End Get
Set(ByVal value As String)
_file = value
End Set
End Property
''' <summary></summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property UnzipTo() As String
Get
Return _towhere
End Get
Set(ByVal value As String)
_towhere = value
End Set
End Property
End Class![[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]](http://roflsaurus.com/users/public/r212360a129ce9b84444093b6cd2699013a1fbn155.png)



hocked:
nobody figured out my way yet.