• Recent Posts

  • Meta

  • Tags

    autocomplete benchmark data cpu cycles directory exists disable beep on enter doevents ebook excel extensions file exists getinputstate gzip high cpu usage intensive task left edge linq mcisendstring microsoft msdn no doevents office open webpage play mp3 play wave right edge scroll textbox shell show icon show notify icon source stop beep on enter system tray text tar textbox text in system tray time consuming tutorials vb 2008 video visual basic.net visual basic 2005 visual studio visual studio 2005 ehancements vs 2005 IDE extensions windows mci
  • « Sending eMail using SMTP in Visual Basic.NET & Visual Basic 2005/2008 | Home | SharpDevelop: Free VB.NET/C# IDE alternative to Microsofts Express Edition IDE’s. »

    Add - Zip, GZip, BZip2 and Tar; Compression/DeCompression support to your .NET Apps

    By Jason | October 14, 2007

    Click Star to Rate Post
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...


       
    Bookmark and Share

     


     

      

      There is a library for DotNet that has been around for awhile and thought maybe someone would be looking to wanting to do Zip/Unzipping type support in .NET applications. It is a OpenSource library named: #ziplib or pronounced Sharp Zip Library. It is written in C# and you can get the source code for the entire library and/or simply download the compiled assembly. The library has assemblies compatible with ALL versions of the DotNET framework including v2.0 and VB. I tried out the FastZip method and it worked perfectly fine and made fully compatible zip files that even Windows could unzip. Below is some simple code I used.

      First, you will obviously want to add a reference to the library. You can do that from the Project menu and click on the Add Reference item. Then Browse for the reference and when you find the compiled zip library, open that .dll as the reference. I selected v2.0 since I am using Visual Basic 2005. Then create a zip object from the library...

          

            

    '

    Dim zLib As New ICSharpCode.SharpZipLib.Zip.FastZip

           

             

    I then simply put the following code in a button...

       

    '

    'The last parameter can be used if you only want certain files with the specified extensions will be zipped up.

    zLib.CreateZip("c:\zipFileToAddFilesTo.zip", "c:\whereToGetFilesFrom", False, ".exe")

                    

    MsgBox("Done!")

               

                

      That is all I did and was able to zip up all of the .exe based files from a specific directory and had them all in a single *.zip file.

       

      Anyways, I only wanted to mention the existence of this library if you need/want a variety of compression methods. This library supports most of the popular formats and has many options and features you can use. Click this Link to go and read about and get the library if your interested.     

        

                    Jason

     


     

    Popularity: 11% [?]

    Topics: - (.NET All + 05/08), - (.NET All + 05/08), .All VB (Related to All) |

    2 Responses to “Add - Zip, GZip, BZip2 and Tar; Compression/DeCompression support to your .NET Apps”

    1. unai Says:
      February 14th, 2008 at 5:45 am

      thats really work. Forget using ZipOutputStream of ICSharpCode.SharpZipLib because I found many problems with windows zipExtract

    2. unai Says:
      February 14th, 2008 at 5:48 am

      other example with password:

      Dim zLib As New ICSharpCode.SharpZipLib.Zip.FastZip

      'add a Psswd
      zLib.Password = "unai"

      zLib.CreateZip("C:\prueba2.zip", "C:\Documents and Settings\Docs", Nothing, Nothing)

    Comments