Delphi Database, Delphi Components from ComponentAce
Products Download Order Contact us
Search Example
Top 


The following example shows how to search files stored within the archive:

procedure TForm1.FormCreate(Sender: TObject);
var
ArchiveItem: TZFArchiveItem;
NewColumn: TListColumn;
ListItem:     TListItem;
ListView:     TListView;
FileDate:    Integer;
begin
// Prepare list view for storing archive files
ListView := TListView.Create(Self);
ListView.Parent := Self;
ListView.Align := alClient;
ListView.ViewStyle := vsReport;
NewColumn := ListView.Columns.Add;
NewColumn.Caption := 'Name';
NewColumn := ListView.Columns.Add;
NewColumn.Caption := 'Modified';
NewColumn := ListView.Columns.Add;
NewColumn.Caption := 'Size';
NewColumn := ListView.Columns.Add;
NewColumn.Caption := 'Rate';
NewColumn := ListView.Columns.Add;
NewColumn.Caption := 'Packed';
NewColumn := ListView.Columns.Add;
NewColumn.Caption := 'Path';
with Archiver do
begin
FileName := 'C:\TEST\test.zip';

// Open existing archive file
OpenArchive(fmOpenRead);

// Search text files stored inside the archive
if (FindFirst('*.*',ArchiveItem,faAnyFile-faDirectory)) then
repeat
    // Add file name

    ListItem := ListView.Items.Add;
    ListItem.Caption := ArchiveItem.FileName;

    // Add modification date
    FileDate := ArchiveItem.LastModFileDate shl 16 +
    ArchiveItem.LastModFileTime;
    ListItem.SubItems.Add(DateToStr(
    FileDateToDateTime(FileDate)));

    // Add file size
    ListItem.SubItems.Add(IntToStr(ArchiveItem.UncompressedSize));

    // Add compression rate
    ListItem.SubItems.Add(FloatToStr(ArchiveItem.CompressionRate));

    // Add compressed file size
    ListItem.SubItems.Add(IntToStr(ArchiveItem.CompressedSize));

    // Add file path
    ListItem.SubItems.Add(ArchiveItem.StoredPath));
until (not FindNext(ArchiveItem));

// Close the archive
CloseArchive;
end;
end;
        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Nov 21, 2024 
        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Nov 21, 2024