First commit 26/03/2001
This commit is contained in:
170
backup_src.cpp
Normal file
170
backup_src.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "backup_src.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "CABArchiver"
|
||||
#pragma link "CABArchiver"
|
||||
#pragma resource "*.dfm"
|
||||
TBackup *Backup;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TBackup::TBackup(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBackup::SpeedButton1Click(TObject *Sender)
|
||||
{
|
||||
if ( iswitch->Visible == true ) FCab->Text = "";
|
||||
iswitch->Visible = false;
|
||||
|
||||
BuscaDestino->Visible = true;
|
||||
FCab->Visible = true;
|
||||
|
||||
if ( !FCab->Text.IsEmpty() )
|
||||
{
|
||||
if ( FileExists( FCab->Text ) )
|
||||
{
|
||||
CABARchiver1->FileName = FCab->Text;
|
||||
CABARchiver1->ExtractDir = ExtractFileDir( Application->ExeName ) + "\\datos";
|
||||
CABARchiver1->FileDirExtraction = true;
|
||||
Panel2->Visible = true;
|
||||
Gauge1->Visible = true;
|
||||
Gauge2->Visible = true;
|
||||
CABARchiver1->ExtractAll();
|
||||
Panel2->Visible = false;
|
||||
Gauge1->Visible = false;
|
||||
Gauge2->Visible = false;
|
||||
}
|
||||
FCab->Text = "";
|
||||
Panel1->Caption = "www.infdj.com | JD soft.";
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBackup::SpeedButton2Click(TObject *Sender)
|
||||
{
|
||||
if ( iswitch->Visible == false ) FCab->Text = "";
|
||||
iswitch->Visible = true;
|
||||
|
||||
BuscaDestino->Visible = true;
|
||||
FCab->Visible = true;
|
||||
|
||||
//-----------------------------------<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if ( !FCab->Text.IsEmpty() )
|
||||
{
|
||||
TSearchRec sr;
|
||||
int iAttributes = faReadOnly | faHidden | faSysFile | faArchive;
|
||||
int i1 = 0;
|
||||
TCABItem *Item;
|
||||
iSalvar1->Visible = true;
|
||||
Panel2->Visible = true;
|
||||
CABARchiver1->FileDirExtraction = true;
|
||||
if (FindFirst(ExtractFileDir( Application->ExeName ) + "\\datos\\*.*", iAttributes, sr) == 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
if ((sr.Attr & iAttributes) == sr.Attr)
|
||||
{
|
||||
Item = CABARchiver1->Contents->AddItem();
|
||||
Item->FileName = ExtractFileDir( Application->ExeName ) + "\\datos\\"+sr.Name;
|
||||
i1++;
|
||||
}
|
||||
} while (FindNext(sr) == 0);
|
||||
FindClose(sr);
|
||||
}
|
||||
|
||||
if ( i1 == 0 )
|
||||
{
|
||||
ShowMessage( "No se encontraron datos a comprimir" );
|
||||
} else {
|
||||
iSalvar2->Visible = true;
|
||||
Gauge1->Visible = true;
|
||||
Gauge2->Visible = true;
|
||||
CABARchiver1->FileName = FCab->Text;
|
||||
CABARchiver1->Compress();
|
||||
}
|
||||
iSalvar1->Visible = false;
|
||||
iSalvar2->Visible = false;
|
||||
iSalvar3->Visible = false;
|
||||
Gauge1->Visible = false;
|
||||
Gauge2->Visible = false;
|
||||
Panel2->Visible = false;
|
||||
FCab->Text = "";
|
||||
Panel1->Caption = "www.infdj.com | JD soft.";
|
||||
}
|
||||
//-----------------------------------<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBackup::SpeedButton3Click(TObject *Sender)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBackup::BuscaDestinoClick(TObject *Sender)
|
||||
{
|
||||
if ( iswitch->Visible )
|
||||
{
|
||||
if (SaveDialog1->Execute())
|
||||
FCab->Text = SaveDialog1->FileName;
|
||||
} else {
|
||||
if (OpenDialog1->Execute())
|
||||
FCab->Text = OpenDialog1->FileName;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBackup::CABARchiver1CABMessage(TObject *sender, int position,
|
||||
int total, AnsiString message, TStat mode, AnsiString Lapse)
|
||||
{
|
||||
Panel2->Caption = Lapse; //(you will affiche the time from the begin to the end)
|
||||
|
||||
switch(mode){
|
||||
case cmMessage:
|
||||
Panel1->Caption = message; // ( you affiche the message of the progression...)
|
||||
break;
|
||||
case cmProgressFirst: // ( you will initialise the first gauge)
|
||||
Gauge1->Min = position;
|
||||
Gauge1->Max = total;
|
||||
Gauge1->Position = 0;
|
||||
break; //(this gauge will be use to see the all progress)
|
||||
case cmProgress: //(this will update the progress of gauge1)
|
||||
Gauge1->Position = position;
|
||||
break;
|
||||
case cmStatus: //(this will update the first gauge, and send a message )
|
||||
Gauge1->Position = position;
|
||||
Panel1->Caption = message+"-"+AnsiString(position) + "-"+AnsiString(total);
|
||||
break;
|
||||
case cmSecondFirst: //(this will initialise the gauge2 made for progress of a file)
|
||||
Gauge2->Min = position;
|
||||
Gauge2->Max = total;
|
||||
Gauge2->Position = 0;
|
||||
break;
|
||||
case cmSecond: //(this will update the progress of gauge2)
|
||||
Gauge2->Position = position;
|
||||
break;
|
||||
};
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TBackup::Image1MouseMove(TObject *Sender,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
if (Shift.Contains(ssLeft)) // make sure button is down
|
||||
{
|
||||
Left += (X-StartX);
|
||||
Top += (Y-StartY);
|
||||
}
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TBackup::Image1MouseDown(TObject *Sender,
|
||||
TMouseButton Button, TShiftState Shift, int X, int Y)
|
||||
{
|
||||
StartX = X;
|
||||
StartY = Y;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user