PakFile: Packs Multiple Files To and Extracts From Single File
Category:
MiscellaneousType:
ClassesDifficulty:
IntermediateAuthor:
Arjen BalfoortVersion Compatibility: Visual Basic 6
More information:
Pak File ActiveX Component. Packs files into one single file (no compression) and extracts files from packed files. Includes demo client application
Author: Arjen Balfoort (balfoort@forbiddencolours.com)
Loadpak and ExtractFile functions loosly based on Sylvain Dupont 's VB pak code: (http://francis.dupont.free.fr/coindev/english/direct3d/pak.htm)
LShift and RShift code from Nathan Moschkin (http://www.freevbcode.com/ShowCode.Asp?ID=2045)
=============================================================== Methods: =============================================================== SavePak Creates pak file from a list of files added by Add Parameters: FullPakPath (full path to new pak file) Returns: Boolean (whether or not creation was successful) Loadpak Loads a pak file Parameters: PakPath (full path to existing pak file) Returns: Variant (array with list of files in pak file) ClosePak Closes a pak file that has been loaded by LoadPak ExtractFile Extracts a file from a pak file loaded by LoadPak Parameters: ExtractFolder (full path to the folder you want the file to be extracted to) FileName (file name to be extracted e.g.: wav/grunt.wav) NewFileName (optional new name for file e.g.: wav/grunt2.wav) ExtractAll Extracts all files from a pak file returned by LoadPak Parameters: ExtractFolder (full path to the folder you want the file to be extracted to) DeleteFile Deletes a file (from pak file or from new files list added by Add) Parameters: FileName (file name to be deleted e.g. wav/grunt.wav) Returns: Boolean (whether or not the file has been deleted) Add Adds a file or folder (with subfolders) to the new files list Parameters: Path (full path to the file or folder) Returns: Variant (array with list of files that has been added) ReadableSize Returns a readable string of a given file size Parameters: TotalBytes (number of bytes of file size (Long)) Returns: readable file size String (e.g.: 1.2 KB) IsPak Checks if a file is a pak file (checks for property Header) Set Header property if not using the default Header for pak files Parameters: PakFilePath (full path to pak file) Returns: Boolean (whether or not the file is a pak file) ExtractTemp Extracts file from pak file to the system temp directory Parameters: FileName (name of the file or full path to a file) OpenFile (optional boolean whether or not to open the file after extraction) Returns: String with full path to extracted file =============================================================== Properties =============================================================== SearchFileName Sets or returns the file name (String) you want to search for in a pak file Set fltFile as filter before calling LoadPak when setting this property PakFileFilter Sets or returns the current file filter (PakFilter enumerator) Default = fltNone which returns all files in the LoadPak array NrFilesInPak Returns the number of files in a pak file (Integer) loaded by LoadPak NrFilesReturned Returns the number of returned files in a pak file (Integer) loaded by LoadPak NrFilesAdded Returns the number of added files (Integer) added by Add CurrentFiles Returns a 2-dimensional array (Variant) with all current files: 0 = file path, 1 = file name Header Sets or returns the header identifier string Default = "PACK" for Q1, Q2, H2 and HL game pak files FileSize Returns the file size in number of bytes (Long) Parameters: FileName (sets the file name in a pak file or the full path to an existing file: can be a string or array with files (Variant)) ...
Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.
Download pak.zip