Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit ATTterm;
- interface
- uses Classes, ATTTerm.EngineFtp,SysUtils;
- type TAntesdeIniciarAtualizacao = procedure ( ) of object;
- type EExceptionCaminhoPastaExecutaveis = class( Exception )
- public
- Function StrException( const Value: string ): string;
- constructor Create( AOwner: TComponent; Const Value: String ); reintroduce; overload;
- end;
- type TAtualizadorTerm = class( TComponent )
- private
- FCaminhoexecutaveis: string;
- Finteger: integer;
- FEngine: TAtttermEngineFtp;
- FDiretorioRaizFtp: string;
- FDiretorioparaextracao: string;
- FDiretoriodosExecutaveis: string;
- Fprogress: integer;
- FTAntesdeIniciarAtualizacao: TAntesdeIniciarAtualizacao;
- function getFCaminhoexecutaveis: string;
- {Private declaration}
- protected
- {Protected declaration}
- public
- {Public declaration declaration}
- constructor Create( AOwner: TComponent ); override;
- destructor Destroy; override;
- procedure AfterConstruction; override;
- procedure BeforeDestruction; override;
- published
- {Protected declaration}
- property Caminhoexecutaveis: string read getFCaminhoexecutaveis write FCaminhoexecutaveis;
- property DiretorioRaizFtp: string read FDiretorioRaizFtp write FDiretorioRaizFtp;
- property Diretorioparaextracao: string read FDiretorioparaextracao write FDiretorioparaextracao;
- property DiretoriodosExecutaveis: string read FDiretoriodosExecutaveis write FDiretoriodosExecutaveis;
- property Progress: integer read Fprogress;
- property AntesdeAtualizar: TAntesdeIniciarAtualizacao read FTAntesdeIniciarAtualizacao write FTAntesdeIniciarAtualizacao;
- function StartAtualizacao:Boolean;
- procedure Register;
- end;
- implementation
- { TAtualizadorTerm }
- procedure TAtualizadorTerm.AfterConstruction;
- begin
- inherited AfterConstruction;
- end;
- procedure TAtualizadorTerm.BeforeDestruction;
- begin
- inherited BeforeDestruction;
- end;
- constructor TAtualizadorTerm.Create( AOwner: TComponent );
- begin
- inherited Create( AOwner );
- end;
- destructor TAtualizadorTerm.Destroy;
- begin
- inherited Destroy;
- end;
- function TAtualizadorTerm.getFCaminhoexecutaveis: string;
- begin
- Result := FCaminhoexecutaveis;
- EExceptionCaminhoPastaExecutaveis.Create(nil,FCaminhoexecutaveis);
- end;
- procedure TAtualizadorTerm.Register;
- begin
- Classes.RegisterComponents('Atualizador', [ TAtualizadorTerm ]);
- end;
- function TAtualizadorTerm.StartAtualizacao: Boolean;
- begin
- if assigned( FTAntesdeIniciarAtualizacao ) then
- begin
- FTAntesdeIniciarAtualizacao();
- end;
- if not Assigned( FEngine ) then
- begin
- FEngine := TAtttermEngineFtp.Create( FDiretorioRaizFtp,FDiretorioparaextracao,FDiretoriodosExecutaveis,Fprogress );
- end;
- end;
- { TExceptionCaminhoPastaExecutaveis }
- constructor EExceptionCaminhoPastaExecutaveis.Create(AOwner: TComponent; const Value: String);
- begin
- inherited Create( Value );
- StrException( Value );
- end;
- function EExceptionCaminhoPastaExecutaveis.StrException(const Value: string): string;
- begin
- if Trim( Value ).IsEmpty then
- Result:= ' Caminho da pasta dos executáveis não pode ser vazio, informe um valor ';
- end;
- initialization
- RegisterClass( TAtualizadorTerm );
- finalization
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement