Class TLZHBatch (unit Lzh_btch)

Inherits from

TCustomLZHCompressor

Constructors


constructor Create(AOwner : TComponent);

Public method overrides

TLZHBatch



Functions

procedure Compress;

New public functions (methods)

procedure Decompress;


procedure DecompressSelected;

Collect total compressed size

procedure DeleteSelected;


destructor Destroy;


function AppendSlash(const sDir : String): String;

Protected (utility) functions

Add the file information to the stringlist.


procedure CatenateFiles(sDirFile, sArchiveFile : String);

if we've got the green light, go ahead an compress the collected batch of files

function CheckForExistingFile(const sFile : String; const bCompress : Boolean): Boolean;


procedure ClearList(FList : TStringList);


procedure CloseArchive;


function CollectFileTotals: Longint;

Find all files that satisfy sWild

function CollectWildCards(const sWild : String): Longint;


function ContainsWildCard(const sFile : String): Boolean;

for truly relative paths.

function CopyCurrentArchive(var FDir : TWriter): LongInt;


procedure DecompressFileNumber(iIndex : Integer);

Seek to the correct position in the archive file

procedure DoCompress;

Write all files in the current archive to the new archive

procedure DoDecompress(const sFile : String; const lSize, lCompSize, lDate : Longint; const iAttrs : Integer; const lOffset : Longint);


function FileInfo(const sFile : String; var lSize : Longint): String;


function FullPath(const sFile : String; const bMustExist : Boolean): String;


procedure GetSelfExtractorOffset;


function IsDirectory(const sDir : String): Boolean;

relative to root

function IsTempFile(const sFile : String): Boolean;


procedure Loaded;

Protected method overrides

function MakePath(const sPath, sFile : String): String;

Have to delete old archive before renaming

function NextSlash(var sDir : String): String;

if directory found, then process that directory with the original wildcard

procedure OpenArchive;


procedure ReadArchiveDirectory;


function RecurseDir(const sDir, sMask: String): Longint;


function ToDirectoryInfo(const sRoot, sFile : String): String;


procedure WriteFile(const sFile: String; const lOffset, lSize : LongInt; const bProgress: Boolean);

Collect total compressed size

procedure CompressGetBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Got : Word);

Really private functions

procedure CompressPutBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Put : Word);


procedure DecompressGetBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Got : Word);

CloseFile(FInputFile);

procedure DecompressPutBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Put : Word);


function GetSelected(Index: Integer): Boolean;


procedure SetArchiveDir(Value : TStrings);


procedure SetFileName(Value : TString);


procedure SetInputFiles(Value : TStrings);

Property get/set functions

procedure SetRootDir(Value : TString);


procedure SetSelected(Index: Integer; const Value: Boolean);


Properties

property ArchiveFileName : TString


property ArchiveMode : TArchiveMode


property DirectoryInfo : TDirectoryInfo

Properties

property InputFiles : TStrings


property OutputDirectory : TString


property OverwriteExisting : Boolean


property RecurseDirectories : Boolean


property RestoreAttributes : Boolean


property RestoreFileDate : Boolean


property RootDirectory : TString


property UseDirectoryNames : Boolean


property ValidArchive : Boolean


property ArchiveDirectory : TStrings

Public properties (run-time only)

property CompressedSize : LongInt


property Selected : Boolean


property TotalSize : LongInt


Events

event OnCollectError : TCollectErrorEvent


event OnCollecting : TCollectingEvent

Events

event OnDoneCollecting : TDoneCollectingEvent


event OnFileExist : TFileExistEvent


event OnProgress : TProgressEvent


Variables

FArchiveDir : TStrings;

Property variables

FArchiveMode : TArchiveMode;


FArchiveRefCount : Integer;

Private variables

FBusy : Boolean;


FCancel : Boolean;


FCompressedSize : LongInt;


FCompSize : Longint;


FCurrentFile : String;


FDirectory : TString;


FDirectoryInfo : TDirectoryInfo;


FDirectoryNames : Boolean;


FFileName : TString;


FFiles : TStringList;


FFileSize : Longint;


FFileTotal : Longint;


FGrandTotal : Longint;


FInputFile : THandle;


FInputFiles : TStrings;


FOnCollectError : TCollectErrorEvent;

Event variables

FOnCollecting : TCollectingEvent;


FOnDoneCollect : TDoneCollectingEvent;


FOnFileExist : TFileExistEvent;


FOnProgress : TProgressEvent;


FOutputFile : THandle;


FOverwrite : Boolean;


FRecurse : Boolean;


FRestoreAttr : Boolean;


FRestoreFDate : Boolean;


FRootDirectory : TString;


FSEOffset : Longint;


FStartOffset : Longint;


FTotalBytes : Longint;


FTotalSize : LongInt;


FValidArchive : Boolean;



Constructors


constructor Create(AOwner : TComponent);

Public method overrides

TLZHBatch


Functions


procedure Compress;

New public functions (methods)


procedure Decompress;


procedure DecompressSelected;

Collect total compressed size


procedure DeleteSelected;


destructor Destroy;


function AppendSlash(const sDir : String): String;

Protected (utility) functions

Add the file information to the stringlist. } { The file offset is added as an object so the user doesn't } { see it


procedure CatenateFiles(sDirFile, sArchiveFile : String);

if we've got the green light, go ahead an compress the collected batch of files


function CheckForExistingFile(const sFile : String; const bCompress : Boolean): Boolean;


procedure ClearList(FList : TStringList);


procedure CloseArchive;


function CollectFileTotals: Longint;

Find all files that satisfy sWild


function CollectWildCards(const sWild : String): Longint;


function ContainsWildCard(const sFile : String): Boolean;

for truly relative paths.... } {while NextSlash(s3) do Result := '..\'+Result;


function CopyCurrentArchive(var FDir : TWriter): LongInt;


procedure DecompressFileNumber(iIndex : Integer);

Seek to the correct position in the archive file


procedure DoCompress;

Write all files in the current archive to the new archive


procedure DoDecompress(const sFile : String; const lSize, lCompSize, lDate : Longint; const iAttrs : Integer; const lOffset : Longint);


function FileInfo(const sFile : String; var lSize : Longint): String;


function FullPath(const sFile : String; const bMustExist : Boolean): String;


procedure GetSelfExtractorOffset;


function IsDirectory(const sDir : String): Boolean;

relative to root


function IsTempFile(const sFile : String): Boolean;


procedure Loaded;

Protected method overrides


function MakePath(const sPath, sFile : String): String;

Have to delete old archive before renaming


function NextSlash(var sDir : String): String;

if directory found, then process that directory with the original wildcard


procedure OpenArchive;


procedure ReadArchiveDirectory;


function RecurseDir(const sDir, sMask: String): Longint;


function ToDirectoryInfo(const sRoot, sFile : String): String;


procedure WriteFile(const sFile: String; const lOffset, lSize : LongInt; const bProgress: Boolean);

Collect total compressed size


procedure CompressGetBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Got : Word);

Really private functions


procedure CompressPutBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Put : Word);


procedure DecompressGetBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Got : Word);

CloseFile(FInputFile);


procedure DecompressPutBytes(Sender : TObject; var DTA: BufType; NBytes : Word; var Bytes_Put : Word);


function GetSelected(Index: Integer): Boolean;


procedure SetArchiveDir(Value : TStrings);


procedure SetFileName(Value : TString);


procedure SetInputFiles(Value : TStrings);

Property get/set functions


procedure SetRootDir(Value : TString);


procedure SetSelected(Index: Integer; const Value: Boolean);


Properties


property ArchiveFileName : TString


property ArchiveMode : TArchiveMode


property DirectoryInfo : TDirectoryInfo

Properties


property InputFiles : TStrings


property OutputDirectory : TString


property OverwriteExisting : Boolean


property RecurseDirectories : Boolean


property RestoreAttributes : Boolean


property RestoreFileDate : Boolean


property RootDirectory : TString


property UseDirectoryNames : Boolean


property ValidArchive : Boolean


property ArchiveDirectory : TStrings

Public properties (run-time only)


property CompressedSize : LongInt


property Selected : Boolean


property TotalSize : LongInt


Events


event OnCollectError : TCollectErrorEvent


event OnCollecting : TCollectingEvent

Events


event OnDoneCollecting : TDoneCollectingEvent


event OnFileExist : TFileExistEvent


event OnProgress : TProgressEvent


Variables


FArchiveDir : TStrings;

Property variables


FArchiveMode : TArchiveMode;


FArchiveRefCount : Integer;

Private variables


FBusy : Boolean;


FCancel : Boolean;


FCompressedSize : LongInt;


FCompSize : Longint;


FCurrentFile : String;


FDirectory : TString;


FDirectoryInfo : TDirectoryInfo;


FDirectoryNames : Boolean;


FFileName : TString;


FFiles : TStringList;


FFileSize : Longint;


FFileTotal : Longint;


FGrandTotal : Longint;


FInputFile : THandle;


FInputFiles : TStrings;


FOnCollectError : TCollectErrorEvent;

Event variables


FOnCollecting : TCollectingEvent;


FOnDoneCollect : TDoneCollectingEvent;


FOnFileExist : TFileExistEvent;


FOnProgress : TProgressEvent;


FOutputFile : THandle;


FOverwrite : Boolean;


FRecurse : Boolean;


FRestoreAttr : Boolean;


FRestoreFDate : Boolean;


FRootDirectory : TString;


FSEOffset : Longint;


FStartOffset : Longint;


FTotalBytes : Longint;


FTotalSize : LongInt;


FValidArchive : Boolean;