SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Is there any VB sample of what it takes to unzip a file

Last post 08-13-2007 4:50 AM by rizzwan. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 08-25-2005 6:01 PM

    Is there any VB sample of what it takes to unzip a file

    All I have done so far is added the \zip folder to my VB project. I just want to know if there are samples of the code out there.
    Thanks.
  • 08-25-2005 10:35 PM In reply to

    Re: Is there any VB sample of what it takes to unzip a file

    Hi,

    There are some simple samples in the 084SharpZipLib_SourceSamples.zip available on the download page.

    hth,

    -jr-

  • 09-05-2005 9:37 AM In reply to

    Re: Is there any VB sample of what it takes to unzip a file

    It appears that there is no VB sample to unzip in the source samples.  So, after some work (I know very little C#) here is the C# version converted to VB.Net

    Dim s As New ZipInputStream(File.OpenRead(ZipPath))
    Dim theEntry As ZipEntry
    theEntry = s.GetNextEntry()
    Do Until theEntry Is Nothing
       
    Dim directoryName As String = Path.GetDirectoryName(theEntry.Name)
       
    Dim fileName As String = Path.GetFileName(theEntry.Name)

       '// create directory
       
    Directory.CreateDirectory(directoryName)

       If (fileName <> String.Empty) Then
          
    Dim StreamWriter As FileStream = File.Create(theEntry.Name)
          
    Dim Size As Integer = 2048
          
    Dim data(2048) As Byte

          While (True)
             Size = s.Read(data, 0, data.Length)
             
    If (Size > 0) Then
                
    StreamWriter.Write(data, 0, Size)
             
    Else
                
    Exit While
             
    End If
          
    End While

          StreamWriter.Close()
       
    End If
       
    theEntry = s.GetNextEntry()
    Loop

    s.Close()

  • 09-12-2005 5:53 AM In reply to

    • tmofield
    • Top 50 Contributor
    • Joined on 08-22-2005
    • Tennessee
    • Posts 53

    Re: Is there any VB sample of what it takes to unzip a file

    I found 101 VB.NET code samples available for download on the MSDN website.  Follow this link to download:

    http://www.microsoft.com/downloads/details.aspx?FamilyId=08E3D5F8-033D-420B-A3B1-3074505C03F3&displaylang=en

    The work in #dev when you select import project under the file menu.

    Pentium IV- 2.53MHz,
    1 Gb Ram,
    SuSE Linux 9.3/WinXP Home
    Mono/VB.Net
  • 11-01-2006 10:19 PM In reply to

    • Juba
    • Not Ranked
    • Joined on 11-01-2006
    • Posts 1

    Re: Is there any VB sample of what it takes to unzip a file

    Thanks, Blindlizard... you'd saved my day! :)
  • 11-02-2006 10:38 AM In reply to

    • BadBoy
    • Not Ranked
    • Joined on 11-02-2006
    • Posts 2

    Re: Is there any VB sample of what it takes to unzip a file

    which of the sample projects contains the code?  I'm trying to do something similar although I want to be able to zip up a number of files at directory level and include all the files within.  I'm hoping this is possible with SharpLib.  Thanks
  • 11-05-2006 2:59 AM In reply to

    • JAL
    • Top 150 Contributor
    • Joined on 11-04-2006
    • Posts 15

    Re: Is there any VB sample of what it takes to unzip a file

    I just posted my desire to share my sample code with others.  See my other post, or go straight to my download:

     

    http://geocities.com/thistrom/ZipWrapper.zip

     

    Good luck.  

  • 08-13-2007 4:50 AM In reply to

    Re: Is there any VB sample of what it takes to unzip a file

    Hi Could you please tell me how do i give the ZipPath , for my testing purpose iam hotcoding the value as "C:\zipps\one.zip", it is not returning any value to the variable S

     

    Dim s As New ZipInputStream(File.OpenRead(ZipPath))

    Dim theEntry As ZipEntry

    theEntry = s.GetNextEntry()

    Do Until theEntry Is Nothing

    Dim directoryName As String = Path.GetDirectoryName(theEntry.Name)

    Dim fileName As String = Path.GetFileName(theEntry.Name)

    '// create directory

    Directory.CreateDirectory("C:\zipps\")

    If (fileName <> String.Empty) Then

    Dim StreamWriter As FileStream = File.Create(theEntry.Name)

    Dim Size As Integer = 2048

    Dim data(2048) As Byte

    While (True)

    Size = s.Read(data, 0, data.Length)

    If (Size > 0) Then

    StreamWriter.Write(data, 0, Size)

    Else

    Exit While

    End If

    End While

    StreamWriter.Close()

    End If

    theEntry = s.GetNextEntry()

    Loop

    s.Close()

     

     

     

    could you please help me in this.

     

    thanks and regards

    rizwan

    Filed under:
Page 1 of 1 (8 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.