PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Zip files without ANY 3rd party controls (.NET 2.0)-VBForums
Results 1 to 18 of 18

Thread: Zip files without ANY 3rd party controls (.NET 2.0)

Threaded View

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,383

    Zip files without ANY 3rd party controls (.NET 2.0)

    Lots of people have asked about zipping files up via code. There are solutions that involve 3rd party components, running winzip or winrar in a command line silently, etc...

    some of these work just fine, but what if you want to do it from with the framework itself, without leaving the .NET framework.

    Well if VB had a ZIP class, we would all know about it already... but how about JAVA? J# is a built in part of the .NET framework, and it also has ZIP capabilities built right in. So by adding a reference to one of the .NET java libraries (vjslib.dll) you can add zip support.

    I have created a class in VB.NET that will do just this. Attached is a sample project to show you how it is done.

    I plan to add more functionality to the class when I have time, but most of the time, people are just looking to ZIP files up, and this will do just that.

    the method takes only 2 params, one is a string array of the files you want to zip, and the other is the name of the zip file.

    You should pass full paths (not just file names) for both params. The sample project will demonstrate how to use it. I hope this is useful to other people.


    REMARKS:
    I have not tested this on older .NET framework versions, and I have heard there might be issues if used on .NET 1.0 or 1.1, when zipping exe files. I can not confirm this just yet.

    The sample project has a test.doc and test.txt in the debug bin folder. These are the files that the sample project zips up. They are simply docs that contain the alphabet a whole bunch of times (to give the file some substance so it can be compacted)

    Thanks for looking!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width