Hi

I have the following error on the code, am working with Vb.Net 2005;
am trying to unzip zip files within a folder..

Any help please..

Many thanks

The errors state:

- Type 'Package' is not defined
- Name 'ZipPacakage' is not defined
- Type 'ZipPackagePart' is not defined
- Type 'ZipPackagePage' is not defined


Code:
Public Sub UnzipArchive(ByVal zipFile As String, ByVal UnzipLocation As String)

        If (Not zipFile Is Nothing And Not UnzipLocation Is Nothing) Then

            Dim zipFilePackage As Package
            zipFilePackage = ZipPackage.Open(zipFile, FileMode.Open, FileAccess.ReadWrite)

            ' Iterate through all the files in the collection 
            For Each contentFile As ZipPackagePart In zipFilePackage.GetParts()

                CreateFile(UnzipLocation, contentFile)

            Next

            zipFilePackage.Close()

            MessageBox.Show("Unzip Complete")

        End If

    End Sub
Code:
   Private Sub CreateFile(ByVal UnzipLocation As String, ByVal contentFile As ZipPackagePage)

        Dim ContentFilePath As String = String.Empty
        ContentFilePath = contentFile.Uri.OriginalString.Replace("/", Path.DirectorySeparatorChar)

        If (ContentFilePath.StartsWith(Path.DirectorySeparatorChar.ToString())) Then

            ContentFilePath = ContentFilePath.TrimStart(Path.DirectorySeparatorChar)
        End If

        ContentFilePath = Path.Combine(UnzipLocation, ContentFilePath)

        ' Check if folder already exists. If it does, delete it and create it. Otherwise, just create it 
        ' If directory exists = true 
        If (Directory.Exists(Path.GetDirectoryName(ContentFilePath)) = True) Then
            ' Delete directory and all files in it. Second parameter is a boolean for a recursive delete 
            ' It will delete all files in the folder and the folder. 
            Directory.Delete(Path.GetDirectoryName(ContentFilePath), True)
            Directory.CreateDirectory(Path.GetDirectoryName(ContentFilePath)) ' re-create the folder with no files in it 
        Else
            Directory.CreateDirectory(Path.GetDirectoryName(ContentFilePath))
        End If

        Dim NewFileStream As FileStream = File.Create(ContentFilePath)
        NewFileStream.Close()

        Dim content As Byte() = New Byte(contentFile.GetStream().Length - 1) {}

        contentFile.GetStream().Read(content, 0, content.Length)
        File.WriteAllBytes(ContentFilePath, content)

    End Sub