Unit ZipDir |
ZIPDIR.PAS - This is a VCL to get you the "Table of Contents" of a Zip File. TZipDir (this VCL) should NOT be used if you will be using TZipMaster. TZipDir is a subset of TZipMaster that only has the List method. This VCL is used in Demo3, which shows how to use the Zip DLLs without using TZipMaster. This Delphi/CBuilder VCL is public domain by Eric W. Engler. This is based on two similar components: TZip by Pier Carlo Chiodi, pc.chiodi@mbox.thunder.it TZReader by Dennis Passmore, CIS: 71640,2464 (* Simple Usage Instructions: 1. Install this VCL into a directory in your VCL search path 2. drop this on a form, or create it dynamically. 3. At runtime or design time, assign a filename to ZipDir1.Filename. 4. At runtime, ZipDir1.Count tells you how many files are contained im the zip file. Note: the entry numbers are zero-based, so if the ZipDir1.Count is 4, then the entry numbers will be: 0, 1, 2, 3. 5. At runtime, get the contents of the Zip file. Examine the "ZipContents" TList, which contains a bunch of ZipDirEntry records. Here's an example that assumes you have a form with a TMemo and a TZipDir component: var i: Integer; begin ZipDir1.Filename:='C:\MYSTUFF\TEST.ZIP'; { List method auto-execs } for i:=0 to ZipDir1.Count-1 do begin with ZipDirEntry(ZipDir1.ZipContents[i]^) do begin Memo1.Lines.Add('Entry #' + IntToStr(i) + ': ' + 'Filename is ' + FileName); Memo1.Lines.Add('Filename is ' + FileName); Memo1.Lines.Add('Compr size is ' + IntToStr(CompressedSize)); Memo1.Lines.Add('DateTime stamp is ' + FormatDateTime('ddddd t',FileDateToDateTime(DateTime))); Memo1.Lines.Add(' '); // blank line end; // end with end; // end for end; 6. The List method manually forces the TList to be rebuilt. Note, however, it gets automatically executed whenever you set the filename.
Classes |
TZipDir - 'PK56'
Functions |
Register - end of try.
Types |
Constants |
CentralFileHeaderSig
EndCentralDirSig
LocalFileHeaderSig
Variables |
Functions |
Types |
PZipDirEntry = ^ZipDirEntry
ZipDirEntry = record
Version : WORD;
Flag : WORD;
CompressionMethod : WORD;
DateTime : Longint;
CRC32 : Longint;
CompressedSize : Longint;
UncompressedSize : Longint;
FileNameLength : WORD;
ExtraFieldLength : WORD;
FileName : String;
end;
Constants |
Variables |