[2005] SharpZipLibrary Help
I've found this: http://www.componentspot.com/doccenter/SharpZipLib/
I've looked at what it supports and other things, but would anyone be so helpful to get me on the right tracks of extracting a file, it's for my Updater once again, everything is in PERFECT working order now, I just need to get the files in a ZIP file, delete them from the current directory and extract the ZIP ( or override the current files ). I'm stumped as how to do this though, where would I start?
Re: [2005] SharpZipLibrary Help
I wrote a wrapper for #ZipLib many months ago in VB.NET 2003. I believe they've made some improvements since then but the old code may still work as is. If not it will at least give you a very good starting point to write your own code. Apparently some people had some issues extracting files under certain circumstances but I never did get around to looking at the issue. Like I said, it's a very good starting point if nothing else.
http://www.vbforums.com/showthread.php?t=360169
Re: [2005] SharpZipLibrary Help
unzip using sharpziplib
Code:
dim extractDir as string = "c:\program files\unzip\"
' Using
Dim s As ZipInputStream = New ZipInputStream(File.OpenRead(zipfile path))
Try
Dim entry As ZipEntry = s.GetNextEntry
While Not entry Is Nothing
Dim directoryName As String = Path.GetDirectoryName(extractDir & entry.Name)
Dim fileName As String = Path.GetFileName(extractDir & entry.Name)
If directoryName.Length > 0 Then
Directory.CreateDirectory(directoryName)
End If
If Not (fileName = String.Empty) Then
' Using
Dim streamWriter As FileStream = File.Create(extractDir & entry.Name)
Try
Dim size As Long = entry.Size
Dim data(size - 1) As Byte
Dim tgl As Boolean = True
While tgl = True
size = s.Read(data, 0, data.Length)
If size > 0 Then
streamWriter.Write(data, 0, size)
tgl = False
Else
' break
tgl = False
End If
End While
Finally
CType(streamWriter, IDisposable).Dispose()
End Try
End If
entry = s.GetNextEntry
End While
Finally
CType(s, IDisposable).Dispose()
End Try
Re: [2005] SharpZipLibrary Help
I just installed SharpZipLib today and tried to execute this code on a .gz file and I get an error that says:
Wrong Local header signature: 0x88B1F
I can open up the file with WinZip no problem. Any ideas why this would be happening?
Thanks in advance!
Re: [2005] SharpZipLibrary Help
What type of compression is used by the GZ file? Winzip supports more compression formats than does SharpZipLib, so just because you can open it in winzip does not mean SharpZipLib can open it.
Re: [2005] SharpZipLibrary Help
A GZ file is a GZIP file, not a ZIP file. They are two different compression formats. Did you tell #ZipLib that it was a GZIP file when you tried to extract it or did you just treat it like a ZIP file?