Hello,
i wrote a program that uses J# to unzip fiile.
It works just fine.
but when i'm trying to unzip a zip file that inside the zip there are 2 files to unzip and each of them is n diffrent directory it dosnt unzip anything.
code: this function unzip(uncompress) the file.
ThanksCode:Public Shared Function Uncompress(ByVal strZipFileName As String, ByVal strLocation As String) As Boolean Try Dim oFileInputStream As New java.io.FileInputStream(strZipFileName) Dim oZipInputStream As New java.util.zip.ZipInputStream(oFileInputStream) Dim bTrue As Boolean = True Dim sbBuf(1024) As SByte Dim First As Integer = 0 While 1 = 1 Dim oZipEntry As java.util.zip.ZipEntry = oZipInputStream.getNextEntry() If oZipEntry Is Nothing Then Exit While If oZipEntry.isDirectory Then If Not My.Computer.FileSystem.DirectoryExists(strLocation & oZipEntry.getName) Then My.Computer.FileSystem.CreateDirectory(strLocation & oZipEntry.getName) End If Else Dim oFileOutputStream As New java.io.FileOutputStream(strLocation.Replace("\", "/") & oZipEntry.getName()) While 1 = 1 Dim iLen As Integer = oZipInputStream.read(sbBuf) If iLen < 0 Then Exit While oFileOutputStream.write(sbBuf, 0, iLen) End While oFileOutputStream.close() End If End While oZipInputStream.close() oFileInputStream.close() Catch ex As Exception Throw New Exception(ex.Message) End Try End Function




Reply With Quote