|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unzipping in Visual Basic .NetI'm getting an error. I do get the destination directory and I do get the first extracted file, but then it stops and I get an wrong local header signature error. I've added the SharpZipLib.dll library to my project, so that's what I'm using. The zip files contains 9 text files. This is the error I get: An unhandled exception of type 'ICSharpCode.SharpZipLib.ZipException' occurred in sharpziplib.dll Additional information: Wrong Local header signature-1826153501 I have the following in the top of my code: Imports System Imports System.IO Imports ICSharpCode.SharpZipLib.Zip This is what I have in my button: Private Sub btnUnzip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnzip.Click Dim fileName As String = Path.GetFullPath("c:\testing.zip") Dim destPath As String = Path.GetFullPath("c:\unzipped\") If Not Directory.Exists(destPath) Then Directory.CreateDirectory(destPath) Else For Each s As String In Directory.GetFiles(destPath) File.Delete(s) Next End If Dim inStream As New ZipInputStream(File.OpenRead(fileName)) Dim outStream As FileStream Dim entry As ZipEntry Dim buff(2047) As Byte Dim bytes As Integer Do While True entry = inStream.GetNextEntry() <==== This is where the error occurs! If entry Is Nothing Then Exit Do End If outStream = File.Create(destPath + entry.Name, 2048) Do While True bytes = inStream.Read(buff, 0, 2048) If bytes = 0 Then Exit Do End If outStream.Write(buff, 0, bytes) MsgBox("writing") Loop outStream.Close() Loop inStream.Close() End Sub Any help would be greatly appreciated. Thanks. Hello again, I just want to point out that I created a new zip file
with Winzip with 2 text files in it and tested the code and it worked. However, when I tested again the Zip file I actually need to unzip, I still get the Wrong Local header signature-1826153501 error.
To use a combo ornot
Error: Login failed for user ???? How to retrive Outlook 2003 style gradient color schemes? Dataset Problem Example of encryption Printing the contents of a textbox Copy List(Of type) to another List(Of type) How to detect when ShowDialog object has closed? (2003) Base Class Method to use Shadow'ed member variable of Derived Class? rich text maximum number of lines |
|||||||||||||||||||||||