This sample shows how use ZipForge transactions.
Download ZipForge | Learn More | All Delphi samples
unit uMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ZipForge;
type
TfmMain = class(TForm)
bnStart: TBitBtn;
BitBtn2: TBitBtn;
Label1: TLabel;
Archiver: TZipForge;
procedure bnStartClick(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
public
end;
var
fmMain: TfmMain;
implementation
{$R *.DFM}
procedure TfmMain.bnStartClick(Sender: TObject);
begin
with Archiver do
begin
FileName := 'Archive\test.zip';
OpenArchive(fmCreate);
BeginUpdate;
BaseDir := 'Source';
try
AddFiles('*.*');
except
CancelUpdate;
CloseArchive;
ShowMessage('Error adding all files');
Exit;
end;
BaseDir := 'Source1\';
try
AddFiles('*.htm*');
except
CancelUpdate;
CloseArchive;
ShowMessage('Error adding html files');
Exit;
end;
EndUpdate;
BaseDir := 'Dest';
ExtractFiles('*.*');
CloseArchive;
end;
ShowMessage('All files were added and extracted successfully.');
end;
procedure TfmMain.BitBtn2Click(Sender: TObject);
begin
Close;
end;
end.
Download ZipForge | Learn More | All Delphi samples
|