Allows the loading and saving of files to and from a Quake II PAK file. If LZH is installed in Delphi then compression is possible. Once the Pak file has been loaded then files can be loaded and saved as though it were a local directory with no extra code. For example in the following code 'potato.smd' is loaded from the 'potato.pak' file :
var
Pak: TGLVfsPak;
begin
Pak.loadfromfile('potato.pak',fmOpenReadWrite or fmShareDenyWrite);
glfreeform1.loadfromfile('potato.smd');
end;
Important
TGLVfsPak properties and methods include:
procedure
loadfromfile(filename: string; Mode: word)
Loads the pak file. Mode is the stream flag specifying whether the pak file can be written to or accessed by other programs
function
fileexists(filename: string): boolean
Whether not a file exists in the pak file
function
getfile(filename: string):
TStream
Gets a file from the pak file as a stream. Useful when loading non GLScene files. For example to load a bitmap from a pak file:
bitmap.loadfromstream(pak.getfile('water2.bmp'));
files:
TStringlist
List of all the files in the pak file
procedure
addfromfile(filename, Path: string)
Adds a file to the pak file
Demo:
CVS/AdvDemos/PakEdit∞
Unit:
GLVfsPAK∞
Descends from
TComponent.