Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
12:53 pm
>Project Source modificado ahora usa Mutex para solo permitir solo una
instancia de la aplicacion.
>IP para conectarce remotamente cambiada.
>Otros.
  • Loading branch information
isaelfeliciano committed Nov 20, 2012
1 parent c96bf43 commit 5880079
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Easy_Actualizador.INI
Expand Up @@ -5,5 +5,5 @@ Rutas=D:\Easy System S2010\
Iniciado?=SI
Ruta_Winrar=C:\Archivos de programa\WinRAR\
Ruta_Act=D:\Actualizaciones\*.*
Num_Act=7
Num_Act=9
LetraDisco=D:
4 changes: 0 additions & 4 deletions Easy_Actualizador.dof
Expand Up @@ -105,10 +105,6 @@ HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
Expand Down
23 changes: 15 additions & 8 deletions Easy_Actualizador.dpr
Expand Up @@ -7,16 +7,23 @@ uses

{$R *.res}

var PreviousHandle :THandle;
var
Mutex :THandle;
PreviousHandle :THandle;
begin
PreviousHandle:= FindWindow('TFActualizador', 'FActualizador');
if PreviousHandle = 0 then
PreviousHandle:= FindWindow('TFActualizador', 'FActualizador');
Mutex:= CreateMutex(nil, True, 'Actualizador_ES');
if (Mutex = 0) OR (GetLastError = ERROR_ALREADY_EXISTS) then
begin
Application.Initialize;
Application.Title := 'ES Actualizador v1.1';
Application.CreateForm(TFActualizador, FActualizador);
Application.Run;
SetForeGroundWindow(PreviousHandle);
end
else
SetForeGroundWindow(PreviousHandle);
begin
Application.Initialize;
Application.Title := 'ES Actualizador v1.1';
Application.CreateForm(TFActualizador, FActualizador);
Application.Run;
if Mutex <> 0 then
closeHandle(Mutex);
end;
end.
Binary file modified Easy_Actualizador.exe
Binary file not shown.
25 changes: 17 additions & 8 deletions Easy_Actualizador.~dpr
Expand Up @@ -7,16 +7,25 @@ uses

{$R *.res}

var PreviousHandle :THandle;
var
Mutex :THandle;
PreviousHandle :THandle;
begin
PreviousHandle:= FindWindow('TFActualizador', 'FActualizador');
if PreviousHandle = 0 then
PreviousHandle:= FindWindow('TFActualizador', 'FActualizador');
Mutex:= CreateMutex(nil, True, 'Actualizador_ES');
if (Mutex = 0) OR (GetLastError = ERROR_ALREADY_EXISTS) then
begin
Application.Initialize;
Application.Title := 'ES Actualizador v1.1';
Application.CreateForm(TFActualizador, FActualizador);
Application.Run;
SetForeGroundWindow(PreviousHandle);
FActualizador.Top:= Screen.WorkAreaHeight -187;
FActualizador.Left:= Screen.WorkAreaWidth -597;
end
else
SetForeGroundWindow(PreviousHandle);
begin
Application.Initialize;
Application.Title := 'ES Actualizador v1.1';
Application.CreateForm(TFActualizador, FActualizador);
Application.Run;
if Mutex <> 0 then
closeHandle(Mutex);
end;
end.
Binary file modified UActualizador.dcu
Binary file not shown.
37 changes: 24 additions & 13 deletions UActualizador.pas
Expand Up @@ -186,7 +186,7 @@ procedure TFActualizador.PonerProgramaInicio;
IpServidor:= '10.0.0.15';

if Modo = 'Remoto' then
IpServidor:= '5.108.175.106';
IpServidor:= '25.108.175.106';

IdIcmpClient1.Host:= IpServidor;
IdIcmpClient1.Ping;
Expand Down Expand Up @@ -220,12 +220,14 @@ procedure TFActualizador.PonerProgramaInicio;
SimpleDataSet1.Close;
if Num1 < Num2 then
begin
Timer2.Enabled:= False;
FActualizador.Top:= Screen.WorkAreaHeight -187;
FActualizador.Left:= Screen.WorkAreaWidth -597;
Label2.Caption:= 'Descargando archivos';
Sleep(1000);
DescargarArchivo;
Timer2.Enabled:= False;
FActualizador.Top:= Screen.WorkAreaHeight -187;
FActualizador.Left:= Screen.WorkAreaWidth -597;
Label2.Caption:= 'Descargando archivos';
Sleep(1000);
DescargarArchivo;


///////////////////////////////REVISANDO NUEVA ACTUALIZACION: FIN
//shellexecute(Handle, 'open','taskkill /f /im Easy_System_S2010.exe',nil,nil,SW_NORMAL);

Expand All @@ -235,6 +237,9 @@ procedure TFActualizador.PonerProgramaInicio;
else begin
Label2.Caption:= 'No hay Actualizaciones';
Timer2.Enabled:=True;}
end
else begin
Label2.Caption:= 'ACTUALIZADO v.' + IntToStr(Num2);
end;
end;

Expand Down Expand Up @@ -296,7 +301,7 @@ procedure TFActualizador.PonerProgramaInicio;
FTP.Connect;

except
raise Exception.Create( 'No se ha podido conectar con el servidor1 ' + FTP.Host );
raise Exception.Create( 'No se ha podido conectar con el servidor. ');
end;

FTP.ChangeDir( '/Actualizaciones/' );
Expand All @@ -314,10 +319,10 @@ procedure TFActualizador.PonerProgramaInicio;
//Label1.Caption:= Afiles[i];
try
FTP.BeginWork(wmRead);
FTP.Get( ExtractFileName(AFiles[i]), 'D:\Easy System S2010\'+AFiles[i], True, True );
FTP.Get( ExtractFileName(AFiles[i]), LetraDisco+'\Easy System S2010\'+AFiles[i], True, True );
Sleep(500);
Except
raise Exception.Create( 'No se ha podido conectar con el servidor2 ' + FTP.Host );
raise Exception.Create( 'No se ha podido iniciar la descarga. ');
end;
end;

Expand All @@ -326,6 +331,7 @@ procedure TFActualizador.PonerProgramaInicio;
FTP.Free;
if Gauge1.Progress = Gauge1.MaxValue then begin
CerrarEs;
Gauge1.Visible:= False;
end;
end;
///////////////////////////////DESCARGANDO_ARCHIVO: FIN
Expand Down Expand Up @@ -374,13 +380,15 @@ procedure TFActualizador.PonerProgramaInicio;
///////////////////////////////DESCOMPRIMIENDO Y BORRANDO RAR'S: FIN

Label2.Caption:= 'Modificando Base de Datos...';
sleep(1000);
sql:= 'UPDATE ACTUALIZADOR SET '+Terminal+ ' = ' +IntToStr(Num2);
SQLConnection1.Execute(sql, nil, nil);
Ini := TIniFile.Create( ChangeFileExt( Application.ExeName, '.INI' ) );
Ini.WriteString( 'ComboBox1', 'Num_Act', IntToStr(Num2) );
For i:= 75 to 100 do
//Gauge1.Progress:= i;
Label2.Caption:= 'Actualizacion Terminada';
sleep(1000);
Ruta_Es_Exe:= Ruta+'Easy_System_S2010.exe';
//shellexecute(Handle, 'open',PChar(Ruta_Es_Exe),nil,nil,SW_NORMAL);
Label2.Caption:='';
Expand Down Expand Up @@ -595,8 +603,8 @@ procedure TFActualizador.SQLConnection1BeforeConnect(Sender: TObject);
SQLConnection1.Params.Values['Database']:= '10.0.0.15:D:\Easy System News\DATA.FDB';
end;
if Modo = 'Remoto' then begin
IpServidor:= '5.108.175.106';
SQLConnection1.Params.Values['Database']:= '5.108.175.106:D:\Easy System News\DATA.FDB';
IpServidor:= '25.108.175.106';
SQLConnection1.Params.Values['Database']:= '25.108.175.106:D:\Easy System News\DATA.FDB';
end;
end;
end;
Expand All @@ -608,7 +616,10 @@ procedure TFActualizador.Timer1Timer(Sender: TObject);

procedure TFActualizador.ActualizarAhora1Click(Sender: TObject);
begin
Copiando_Rars;
Label2.Caption:= 'Descargando archivos.';
FActualizador.Top:= Screen.WorkAreaHeight -187;
FActualizador.Left:= Screen.WorkAreaWidth -597;
DescargarArchivo;
end;

procedure TFActualizador.CerrarActualizador1Click(Sender: TObject);
Expand Down
37 changes: 24 additions & 13 deletions UActualizador.~pas
Expand Up @@ -186,7 +186,7 @@ if Modo = 'Local' then
IpServidor:= '10.0.0.15';

if Modo = 'Remoto' then
IpServidor:= '5.108.175.106';
IpServidor:= '25.108.175.106';

IdIcmpClient1.Host:= IpServidor;
IdIcmpClient1.Ping;
Expand Down Expand Up @@ -220,12 +220,14 @@ Ini2 := TIniFile.Create( ChangeFileExt( Application.ExeName, '.INI' ) );
SimpleDataSet1.Close;
if Num1 < Num2 then
begin
Timer2.Enabled:= False;
FActualizador.Top:= Screen.WorkAreaHeight -187;
FActualizador.Left:= Screen.WorkAreaWidth -597;
Label2.Caption:= 'Descargando archivos';
Sleep(500);
DescargarArchivo;
Timer2.Enabled:= False;
FActualizador.Top:= Screen.WorkAreaHeight -187;
FActualizador.Left:= Screen.WorkAreaWidth -597;
Label2.Caption:= 'Descargando archivos';
Sleep(1000);
DescargarArchivo;
end;

///////////////////////////////REVISANDO NUEVA ACTUALIZACION: FIN
//shellexecute(Handle, 'open','taskkill /f /im Easy_System_S2010.exe',nil,nil,SW_NORMAL);

Expand All @@ -235,6 +237,9 @@ Ini2 := TIniFile.Create( ChangeFileExt( Application.ExeName, '.INI' ) );
else begin
Label2.Caption:= 'No hay Actualizaciones';
Timer2.Enabled:=True;}
end
else begin
Label2.Caption:= 'ACTUALIZADO v.' + IntToStr(Num2);
end;
end;

Expand Down Expand Up @@ -296,7 +301,7 @@ begin
FTP.Connect;

except
raise Exception.Create( 'No se ha podido conectar con el servidor1 ' + FTP.Host );
raise Exception.Create( 'No se ha podido conectar con el servidor. ');
end;

FTP.ChangeDir( '/Actualizaciones/' );
Expand All @@ -314,10 +319,10 @@ begin
//Label1.Caption:= Afiles[i];
try
FTP.BeginWork(wmRead);
FTP.Get( ExtractFileName(AFiles[i]), 'D:\Easy System S2010\'+AFiles[i], True, True );
FTP.Get( ExtractFileName(AFiles[i]), LetraDisco+'\Easy System S2010\'+AFiles[i], True, True );
Sleep(500);
Except
raise Exception.Create( 'No se ha podido conectar con el servidor2 ' + FTP.Host );
raise Exception.Create( 'No se ha podido iniciar la descarga. ');
end;
end;

Expand All @@ -326,6 +331,7 @@ begin
FTP.Free;
if Gauge1.Progress = Gauge1.MaxValue then begin
CerrarEs;
Gauge1.Visible:= False;
end;
end;
///////////////////////////////DESCARGANDO_ARCHIVO: FIN
Expand Down Expand Up @@ -374,13 +380,15 @@ For i:= 25 to 75 do
///////////////////////////////DESCOMPRIMIENDO Y BORRANDO RAR'S: FIN

Label2.Caption:= 'Modificando Base de Datos...';
sleep(1000);
sql:= 'UPDATE ACTUALIZADOR SET '+Terminal+ ' = ' +IntToStr(Num2);
SQLConnection1.Execute(sql, nil, nil);
Ini := TIniFile.Create( ChangeFileExt( Application.ExeName, '.INI' ) );
Ini.WriteString( 'ComboBox1', 'Num_Act', IntToStr(Num2) );
For i:= 75 to 100 do
//Gauge1.Progress:= i;
Label2.Caption:= 'Actualizacion Terminada';
sleep(1000);
Ruta_Es_Exe:= Ruta+'Easy_System_S2010.exe';
//shellexecute(Handle, 'open',PChar(Ruta_Es_Exe),nil,nil,SW_NORMAL);
Label2.Caption:='';
Expand Down Expand Up @@ -595,8 +603,8 @@ begin
SQLConnection1.Params.Values['Database']:= '10.0.0.15:D:\Easy System News\DATA.FDB';
end;
if Modo = 'Remoto' then begin
IpServidor:= '5.108.175.106';
SQLConnection1.Params.Values['Database']:= '5.108.175.106:D:\Easy System News\DATA.FDB';
IpServidor:= '25.108.175.106';
SQLConnection1.Params.Values['Database']:= '25.108.175.106:D:\Easy System News\DATA.FDB';
end;
end;
end;
Expand All @@ -608,7 +616,10 @@ end;

procedure TFActualizador.ActualizarAhora1Click(Sender: TObject);
begin
Copiando_Rars;
Label2.Caption:= 'Descargando archivos.';
FActualizador.Top:= Screen.WorkAreaHeight -187;
FActualizador.Left:= Screen.WorkAreaWidth -597;
DescargarArchivo;
end;

procedure TFActualizador.CerrarActualizador1Click(Sender: TObject);
Expand Down
Binary file modified UNuevaAct.dcu
Binary file not shown.

0 comments on commit 5880079

Please sign in to comment.