This is first public release of Buddy ZIP - an Xtra and U32 for use in Director and Authorware.

This contains two Xtras - budzip.x32 and budunzip.x32. To use these in versions of Authorware earlier than 4.0, rename the files to budzip.u32 and budunzip.u32. Each Xtra contains just one function. The function descriptions are listed below. Better documentation will be produced later.

BudZip:

bzZip string File, string ZipFile, string Mode, integer Level, integer Recurse, integer Debug

File is the name of the file to zip. Can include wildcards.
ZipFile is the name of the zip file to create.
Mode can be 'Add' - adds all files
                  'Update' - updates newer files, and adds files that don't exist
                  'Freshen' - only updates existing files that are newer.
Level is level of compression from 0 - 9. Large numbers give more compression.
If Recurse is true, then sub-directories will also be zipped.
If Debug is true, a series of debug messages will appear.

Returns the number of files zipped, or -1 for error.

Example:

set NumZipped = bzZip( "c:\temp\tozip\*.*", "c:\temp\thezip.zip", "add", 9, false, false ) -- Director
NumZipped := bzZip( "c:\\temp\\tozip\\*.*", "c:\\temp\\thezip.zip", "add", 9, false, false )  -- Authorware



BudUnZip:

bzUnZip string ZipFile, string OutFolder, string Mode, integer Overwrite, integer Directories, integer Debug

ZipFile is the name of the file to unzip.
OutFolder is the directory the files will be unzipped to.
Mode can be 'Add' - unzips all files
                  'Update' - unzips newer files, and files that don't exist
	        'Freshen' - only unzips existing files that are newer.
If Overwrite is true. existing files will be overwritten.
If Directories is true, then the directory structure in the zip file will be recreated.
If Debug is true, a series of debug messages will appear.

Returns the number of files unzipped, or -1 for error.

Example:

set NumUnZipped = bzUnZip( "c:\temp\test.zip", "c:\temp\unzipped", "add", true, false, false ) -- Director
NumUnZipped := bzUnZip( "c:\\temp\\test.zip", "c:\\temp\\unzipped", "add", true, false, false ) - -Authorware



The zip code used in this Xtra comes from the public-domain InfoZip project. As such, I have no understanding of how the zip code actually works. If there are problems with the zip code, there is probably very little I can do about it. However, if you find problems with the the code interfacing to the zip, then let me know.

In keeping with the InfoZip tradition, I intend to make this Xtra/U32 available for free. I haven't as yet tried making a 16 bit version, so I don't know if this is possible. It depends on whether or not the zip code compiles correctly with my compiler.

At the moment, there is only one error code defined: -1 which means that the zip directory couldn't be created. The functions actually return the number of files zipped or unzipped. If the zip code encounters an error - like the disk is full, then no error code will be returned.

I want to add a ZipList function, which will return a list of all the files inside a zip file, but this hasn't been looked into yet.

If you have any comments, suggestions or bugs to report, please send them to gsmith@gil.com.au

Gary Smith
21st September, 1997
