This example gets information for the zip file named "C:\test\My zip file.zip", and puts the data in various variables that you can use. The example assumes you have placed a button, a listbox and an Xceed Zip control on a form, named Button1, List1 and XceedZip1 respectively.
Delphi |
Copy Code |
procedure TForm1.Button1Click(Sender: TObject);
var
TotalFiles : Integer; CompressedBytes : Integer; UncompressedBytes : Integer; CompressionRatio : SmallInt; IsZipFileSpanned : WordBool; ResultCode : xcdError;
begin
XceedZip1.License( 'your license key' );
' Set the zip file name (the only property required to be set here) XceedZip1.ZipFilename := 'c:\test\My zip file.zip';
' Get the information ResultCode := XceedZip1.GetZipFileInformation(TotalFiles, CompressedBytes, UncompressedBytes, CompressionRatio, IsZipFileSpanned);
' Check the return value If ResultCode <> xerSuccess Then ListBox1.Items.Add("Unsuccessful. Error #" + Str(ResultCode) else begin ListBox1.Items.Add("Successfully got the zip file's info"); ListBox1.Items.Add("Total files: " + IntToStr(TotalFiles)); ListBox1.Items.Add("Comp. size: " + IntToStr(CompressedBytes)); ListBox1.Items.Add("Size: " + IntToStr(UncompressedBytes)); ListBox1.Items.Add("Ratio: " + IntToStr(CompressionRatio)+"%"); ListBox1.Items.Add("Spanned: " + IntToStr(IsZipFileSpanned)); end; end; end; |