gman.zipengine: Constants Functions Types Modinfo Source  

Zip Engine

Constants Summary

APPEND_STATUS_CREATE , UNZ_CASE_CHECK , UNZ_OK , Z_DEFLATED , Z_NO_COMPRESSION

Functions Summary

unzClose Close unzip zip file.
unzCloseCurrentFile Close current file.
unzGetCurrentFileSize Gets info about the current file.
unzLocateFile Return status of desired file and sets the unzipped focus to it.
unzOpen Open a zip file for unzip.
unzOpenCurrentFile Opens the currently focused file.
unzOpenCurrentFilePassword Opens the currently focused file using a password.
unzReadCurrentFile Read current file, returns number of bytes.
zipClose Closes an open zip file.
zipOpen Open new zip file (returns zipFile pointer)
zipOpenNewFileInZip Open a file inside the zip file.
zipOpenNewFileWithPassword Open a file inside the zip file using a password.
zipWriteInFileInZip Write into a zip file.

Types Summary

tm_zip  
TZipEStream ZipEngine stream type.
TZipFileList  
ZipFile  
ZipReader  
ZipWriter  

Constants

Const APPEND_STATUS_CREATE:Int
DescriptionAppend Modes.

Const UNZ_CASE_CHECK:Int
DescriptionCompare modes.

Const UNZ_OK:Int
DescriptionResult Codes.

Const Z_DEFLATED:Int
DescriptionCompression methods.

Const Z_NO_COMPRESSION:Int
DescriptionCompression levels.

Functions

Function unzClose( zipFilePtr:Byte Ptr )
DescriptionClose unzip zip file.

Function unzCloseCurrentFile( zipFilePtr:Byte Ptr )
DescriptionClose current file.

Function unzGetCurrentFileSize:Int( zipFilePtr:Byte Ptr )
DescriptionGets info about the current file.

Function unzLocateFile:Int( zipFilePtr:Byte Ptr, fileName$z, caseCheck:Int )
DescriptionReturn status of desired file and sets the unzipped focus to it.

Function unzOpen:Byte Ptr( zipFileName$z )
DescriptionOpen a zip file for unzip.

Function unzOpenCurrentFile:Int( zipFilePtr:Byte Ptr )
DescriptionOpens the currently focused file.

Function unzOpenCurrentFilePassword:Int(file:Byte Ptr, password$z)
DescriptionOpens the currently focused file using a password.

Function unzReadCurrentFile:Int( zipFilePtr:Byte Ptr, buffer:Byte Ptr, size:Int )
DescriptionRead current file, returns number of bytes.

Function zipClose( zipFilePtr:Byte Ptr, archiveName$z )
DescriptionCloses an open zip file.

Function zipOpen:Byte Ptr( fileName$z, append:Int )
DescriptionOpen new zip file (returns zipFile pointer)

Function zipOpenNewFileInZip( zipFilePtr:Byte Ptr, fileName$z, zip_fileinfo:Byte Ptr, extrafield_local:Byte Ptr, size_extrafield_local:Int, extrafield_global:Byte Ptr, size_extrafield_global:Int, comment$z, compressionMethod:Int, level:Int )
DescriptionOpen a file inside the zip file.

Function zipOpenNewFileWithPassword( zipFilePtr:Byte Ptr, fileName$z, zip_fileinfo:Byte Ptr, extrafield_local:Byte Ptr, size_extrafield_local:Int, extrafield_global:Byte Ptr, size_extrafield_global:Int, comment$z, compressionMethod:Int, level:Int, password$z )
DescriptionOpen a file inside the zip file using a password.

Function zipWriteInFileInZip( zipFilePtr:Byte Ptr, buffer:Byte Ptr, bufferLength:Int )
DescriptionWrite into a zip file.

Types

Type tm_zip

Type TZipEStream Extends TStream
DescriptionZipEngine stream type.
InformationZipEngine has as stream wrapper so that files within the ZIP can be opened using OpenStream(). The format for the url is: zipe::zipfilename::file_in_zip::password The ::password portion is only required if the ZIP has a password.

Type TZipFileList
Methods Summary
deletePathFromFilename Deletes the path from a filename.
extractFilename Splits filename from zip file into useful filenames And paths.
findFile Locates a file entry by name and returns its SZipFileEntry.
getFileCount Returns count of files in archive.
getFileInfo Returns information about a file entry in the ZIP.
ScanCentralHeader Scans the central header for files. Returns true if successful.
Functions Summary
Create Creates a new TZipFileList object.
Method deletePathFromFilename(filename:String Var)
DescriptionDeletes the path from a filename.
Method extractFilename(entry:SZipFileEntry)
DescriptionSplits filename from zip file into useful filenames And paths.
Method findFile:SZipFileEntry(simpleFilename:String)
DescriptionLocates a file entry by name and returns its SZipFileEntry.
Method getFileCount:Int()
DescriptionReturns count of files in archive.
Method getFileInfo:SZipFileEntry(index:Int)
DescriptionReturns information about a file entry in the ZIP.
Method ScanCentralHeader:Int()
DescriptionScans the central header for files. Returns true if successful.
Function Create:TZipFileList(file:TStream,bIgnoreCase:Int,bIgnorePaths:Int)
DescriptionCreates a new TZipFileList object.

Type ZipFile Abstract
Methods Summary
clearFileList Clears the stored list of file information.
getFileCount Returns the of files contained in the zip file.
getFileInfo Returns the SZipFileEntry object information for a file entry in the ZIP.
getFileInfoByName Locates a file entry by name and returns its SZipFileEntry.
getName Returns the name of the name of the zip.
readFileList Stores information about the files in a zip file into a list.
setName Stores the name of the current zip file.
Method clearFileList()
DescriptionClears the stored list of file information.
Method getFileCount:Int()
DescriptionReturns the of files contained in the zip file.
Method getFileInfo:SZipFileEntry(index:Int)
DescriptionReturns the SZipFileEntry object information for a file entry in the ZIP.
Method getFileInfoByName:SZipFileEntry(simpleFilename:String)
DescriptionLocates a file entry by name and returns its SZipFileEntry.
Method getName:String()
DescriptionReturns the name of the name of the zip.
Method readFileList()
DescriptionStores information about the files in a zip file into a list.
Method setName(zipName:String)
DescriptionStores the name of the current zip file.

Type ZipReader Extends ZipFile
Methods Summary
CloseZip Closes a zip file.
ExtractFile Extracts a file from the zip to RAM.
ExtractFileToDisk Extracts a file from the zip to disk.
OpenZip Opens a zip file for reading.
Method CloseZip()
DescriptionCloses a zip file.
Method ExtractFile:TRamStream( fileName:String, caseSensitive:Int = False, password:String="" )
DescriptionExtracts a file from the zip to RAM.
Method ExtractFileToDisk( fileName:String, outputFileName:String, caseSensitive:Int = False, password:String="" )
DescriptionExtracts a file from the zip to disk.
Method OpenZip:Int( name:String )
DescriptionOpens a zip file for reading.

Type ZipWriter Extends ZipFile
Methods Summary
AddFile Adds a file to the zip.
AddStream Adds a file to the zip from a stream.
CloseZip Closes a zip file.
OpenZip Opens a zip file for writing.
SetCompressionLevel Set level of compression.
Method AddFile( fileName:String, password:String="" )
DescriptionAdds a file to the zip.
Method AddStream( data:TStream, fileName:String, password:String="" )
DescriptionAdds a file to the zip from a stream.
Method CloseZip( description:String = "" )
DescriptionCloses a zip file.
Method OpenZip:Int( name:String, append:Int )
DescriptionOpens a zip file for writing.
Method SetCompressionLevel( level:Int )
DescriptionSet level of compression.

Module Information

Version2.10
Authorgman
LicensePublic Domain
CreditThis mod makes use if the ZLib C functions by Gilles Vollant (http://www.winimage.com/zLibDll/unzip.html)
CreditThis mod was initially created by Thomas Mayer
CreditSmurftra for his DateTime functions (http://www.blitzbasic.com/codearcs/codearcs.php?code=1726)
History2005/11/14 GG - updated to be compatible with BMAX v1.12
History2005/12/05 GG - updated to be compatible with BMAX v1.14
History2005/12/07 GG - created new ZipRamStream and updated extractfile() to use new stream
History2005/12/14 GG - fixed bug in readFileList() where it was trying to read from an empty (new) file
History2005/12/14 GG - changed to SuperStrict and fixed all missing declarations
History2005/12/17 GG - added clearing of filename and filelist in closezip()
History2006/07/15 GG - added datetime stamps to zipped file information (reported by Grisu)
History2006/07/15 GG - fixed filecount not counting added files (reported by Lomat)
History2006/07/15 GG - added AddStream() method to allow adding a stream as a file
History2007/07/17 GG - changed to gman.ZipEngine
History2009/02/10 GG - fixed AddStream() bug found by peterigz
History2009/02/15 GG - converted to scan central headers instead of local headers
History2009/02/15 GG - Added stream wrapper for ZipEngine
History2009/02/27 GG - Updated central directory scan routine to be faster