zip & unzip library (with source)

Discussion in 'Additional Libraries' started by dzt, Jun 1, 2007.

  1. dzt

    dzt Active Member Licensed User

    Two functions (currently only for desktop, requires .NET 2.0).
    CreateZip(zipFileName, sourceDirectory, recurseDirectories, fileFilter)
    ExtractZip(zipFileName, targetDirectory, fileFilter)

    Implements (wraps is a better word) part of #developZipLib class FastZip

    Attached are:, VB source code and #develop project., B4PPC source.

    You also need to download ICSharpCode.SharpZipLib.dll from

    I ask for your understanding because of the very very early development stage.

    Attached Files:

  2. Louis

    Louis Active Member Licensed User

    Hi. Can you please explain what goes in to each parameter, what types of arguments and what they are for? BTW, you've done an awesome job! I am thrilled this exists! Take care.
  3. dzt

    dzt Active Member Licensed User


    CreateZip(zipFileName as String, sourceDirectory as String, recurseDirectories as Boolean, fileFilter as String)

    zipFileName: The zip file to be ceated. Ex. AppPath & "\"
    sourceDirectory: Where the files to zip are. Ex. AppPath or \Temp
    recurseDirectories: Add directoriies Info or not. Ex. true
    fileFilter: Files with what extension to add. Ex. .txt or .sbp

    ExtractZip(zipFileName as string, targetDirectory as String, fileFilter as String)

    zipFileName: The zip file to be unzipped. Ex. AppPath & "\"
    targetDirectory: In which folder should put the files. Ex. AppPath or \Temp
    fileFilter: Files with what extension to unzip. Ex. .txt or .sbp
  4. Erel

    Erel Administrator Staff Member Licensed User

    :sign0098: Thank you dzt, you are doing a great job.
  5. dzt

    dzt Active Member Licensed User

    new version

    Zip and Unzip Library for Basic4PPC. Targets .NET 1.1 (desktop) and .NET 1.0 (device) and needs ICSharpCode.SharpZipLib.dll (open source zip library)
    Has 4 functions. All of them works for desktop, but 3 of them works for the device.
    For CreateZip (desktop only) and ExtractZip (device and desktop) see previous post.

    Short description for 2 new functions:

    ZipFiles(FilesToZip, ZipFile)
    FilesToZip an array of string containing full path filenames to zip
    ZipFile a string containing full path of zip file to be created

    UnzipFiles(TargetDirectory, ZipFile)
    TargetDirectory a string containing full path to folder where zipped files will exists after unzip. If the folder doesn't exists it will be created by the library.
    ZipFile a string containing full path of zip file to be unzipped.

    For how to use this library see attached b4ppc sample file.
    To download compiled DLLs press here
    To download dzZipLib source press here
    To download ICSharpCode.SharpZipLib c# source code go to


    Attached Files:

  6. adukes

    adukes Member Licensed User

    When I unzip and load the ZipTest1 app in the Basic4ppc editor to test with, I get this Basic4ppc message: An error occured. The format of the 'dzZipLib.dll' is invalid. I also get this when I click OK on the Components dialog box with dzZipLib.dll loaded. Any ideas anyone?
  7. dzt

    dzt Active Member Licensed User

    use ICSharpCode.SharpZipLib.dll and dzZipLib.dll from the second version I've posted. They are both compiled for .NET 1.0.
    In the first post they are compiled for .NET 2.0 and I think that this is the problem. Do you have .NET 2.0 installed?
  8. adukes

    adukes Member Licensed User

    I downloaded the second version and it worked. But I do have .Net 2.0 installed. To be specific I have version 2.0.50727. I got this from Visual Studio 2005..Help..About. I would think either version should work. If I look in Add and Remove Programs it shows I have .Net 1.1 and 2.0 installed. Should I remove version 1.1? Maybe there is a .Net 2.0 service pack I do not have.
  9. Louis

    Louis Active Member Licensed User

    When I load the library into the IDE on the Pocket PC I get this error when using the .net 1.0 version:
    Could not load type IPCSharpCode.SharpZipLib.Zip.FastZip from assembly Version=, Culture=neutral, PublicKeyToken=1B03E6ACF116
    Am I missing something? I have both the DZTZipLib.dll and the ICSharpCode .dll you provided. Any help would be cool! Thanks, and I am still excited about this library. BTW, you have any plans on doing sound libraries, like being able to play and control multiple sounds? Thanks, and keep up the great work!
    Last edited: Jul 5, 2007
  10. dzt

    dzt Active Member Licensed User


    I'll try to make some things clear.

    Basic4ppc (desktop and device version is a .NET 1 application (desktop 1.1 and device 1.0 SP3).
    The same .NET version targets EXEs that it produces.

    To run Basic4ppc and/or produced EXEs under .NET 2.0 (especially when they are using .NET 2.0 DLLs) needs some additional care.

    Look here and for additional informatiocn I suggest you to take a look here

    Now I'll try to be more specific.

    adukes, that is why you take an error message when you are trying to open ziptest1.sbp with the .NET 2.0 dzZipLib.dll I've posted at the beginning of this thread. You need a config file. See the first link in this post and download config file for desktop. But I suggest you to use DLLs from the second version I've posted. You loose nothing and you have some benefits (two more functions, PPC compatibility).

    Louis, for the same reason you need a config file for your device. Download it from the first link.

    Be careful, what Basic4PPC needs to run under .NET 2.0, needs your compiled application too. A config file. Try to rename dBasic.exe.config or Basic4ppc.exe.config to YourApp.exe.config and put it in the same folder as YourApp.exe.

    I hope I helped,

  11. Louis

    Louis Active Member Licensed User

    Hi. My device does NOT support .net framework 2.0 at all, it will only run the .net framework 1.0 SP3. The dlls I downloaded were from your second post, not the post at the beginning and that is the error I got. Should I try a config file anyway? Thanks. .net 1.0 SP3 is installed on my Pocket PC by default and it cannot be removed. Tell Freedom Scientific thanks when you get the chance, LOL. They made it!
  12. dzt

    dzt Active Member Licensed User

    Hi Louis,

    You are right. I confirmed the error, I didn't tested it previously that way.
    It is a strange behaviour.

    I did a hard reset to a Windows Mobile 5.0 device, I installed B4PPC and I tryed to load ziptest1.sbp. It failed with the error you noticed. In a Windows Mobile 5.0 device with .NETCF 2.0 all is OK!

    But on the other hand when I compile ziptest1.sbp on a desktop computer and copy ziptest1.exe (don't forget it is also a .NETCF 1.0 app like b4ppc) to the previous hardreseted device, it is working fine!

    You can download from the following link compiled EXEs for desktop and device.

    I don't know why is this happening. Maybe Erel can help.

  13. adukes

    adukes Member Licensed User

    Hi dzt,
    Thanks for shedding light on this. I was totally confused. Now I know why my first attempt at a "Hello World" library I wrote in Visual Studio 2005 would not load in Basic4ppc. This has been a great learning experience for me thanks to guys like you.
  14. skipper

    skipper Member Licensed User

    Adding files to .ZIP

    Hello DZT,

    I don't know it it would be possible, but i'll try.... ;)

    It would be great if the ZipFile(arr(),zipName) function would add the arr() file names to the zipName instead of creating a new one. It would be great to have



    bool=True --> add the file array to the existent .ZIP (if the zip does not exist, creates a new one)
    bool=False --> creates/overwrite the .ZIP

  15. GK01

    GK01 New Member Licensed User

    Zip file library

    Hi, I am new in the forum, thanks for all good work that is found on the forum. :)

    Regardig ZIP file : The examples works fine however i get errors adding files with .dat extentions (some works and some gives error). Looking into the links to the DLL library there are a large number of unresolved issued, have anyone used an alternative library making ZIP files ?
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice