.NET Zip component, Delphi Zip component, Barcode .NET, BDE Replacement and other .NET and Delphi components from ComponentAce
Products Download Order Contact us

Search
 

Delphi/C++ Components
.NET Components
ActiveX Controls
Kylix Components

Download

Download
Download Commercial
Trial Limitations

Support

Submit Request
Support Options

Order

Purchase
Competitive Upgrade
Premium Support
Sales Policy
Upgrade Policy
License Types

Info

News
Mailing List
Articles
Testimonials



About Us
Partners
Links
Contact Us
Link to Us





Home > Delphi/C++ Components > ZipForge > ZipForge Transactions in Delphi

Delphi Zip Component ZipForge

Overview | Features | Requirements | Testimonials | Manual | Code Samples | Download | Order
ZipForge Transactions in Delphi
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
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmMain: TfmMain;

implementation

{$R *.DFM}

procedure TfmMain.bnStartClick(Sender: TObject);
begin
 with Archiver do
    begin
        FileName := 'Archive\test.zip';

        // Create a new archive file
        OpenArchive(fmCreate);

        // Start a transaction
        BeginUpdate;

        // Set path to folder with some HTML files to BaseDir
        BaseDir := 'Source';

        // Add all files from Source folder to the archive
        try
          AddFiles('*.*');
        except

          // If errors occur rollback transaction. All modifications will be cancelled.
          CancelUpdate;

          // Close archive and exit current procedure
          CloseArchive;
          ShowMessage('Error adding all files');
          Exit;
        end;

        // Set path to folder with some HTML files to BaseDir
        BaseDir := 'Source1\';

        // Add all HTML files from Source1 folder to the archive
        try
          AddFiles('*.htm*');
        except

          // If errors occurs rollback transaction. All modifications will be cancelled.
          CancelUpdate;

          // Close archive and exit current procedure
          CloseArchive;
          ShowMessage('Error adding html files');
          Exit;
        end;

        // Commit a transaction. All modifications will be saved.
        EndUpdate;

        // Set path to destination folder
        BaseDir := 'Dest';

        // Extract all files
        ExtractFiles('*.*');

        // Close the archive
        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


Product Info


Current version: 6.95
Released: January 21, 2019
Price: $ 69

downloadorder


Our Customers



Testimonials

The other people in the office didn't believe me when I said that all I had to do was document the problem and you would probably give me a fix overnight. Unbelievable! Keep up the great work. I hope you guys all make a fortune out of this product because it is truly fantastic and the support is the best I have ever encountered.

Mark Kefford

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Mar 19, 2024