This commit is contained in:
f1iwq2 committed 2023-04-12 17:51:51 +02:00
1 parent 1eaadabf4b
commit 21344ebd93
21 files changed
+229 -70

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+12 -1
View File
@@ -1635,7 +1635,7 @@ var s,sa,SOrigine: string;
trouve_section_branche,trouve_section_sig,trouve_section_act,trouve_tempo_feu, trouve_section_branche,trouve_section_sig,trouve_section_act,trouve_tempo_feu,
trouve_algo_uni,croi,trouve_Nb_cantons_Sig,trouve_dem_aig,trouve_demcnxCOMUSB,trouve_demcnxEth : boolean; trouve_algo_uni,croi,trouve_Nb_cantons_Sig,trouve_dem_aig,trouve_demcnxCOMUSB,trouve_demcnxEth : boolean;
virgule,i_detect,i,erreur,aig2,detect,offset,j,position, virgule,i_detect,i,erreur,aig2,detect,offset,j,position,
ComptEl,Compt_IT,Num_Element,adr,t,Nligne,postriple,itl, ComptEl,Compt_IT,Num_Element,adr,Nligne,postriple,itl,
postjd,postjs,nv,it,Num_Champ,asp,adraig,poscroi : integer; postjd,postjs,nv,it,Num_Champ,asp,adraig,poscroi : integer;
function lit_ligne : string ; function lit_ligne : string ;
@@ -6682,6 +6682,8 @@ begin
i:=index_feu(adr); i:=index_feu(adr);
dec:=feux[i].decodeur; dec:=feux[i].decodeur;
x:=feux[i].aspect; x:=feux[i].aspect;
// signal directionnel
if x>10 then if x>10 then
begin begin
nombre_adresses_signal:=x-10; nombre_adresses_signal:=x-10;
@@ -6709,6 +6711,15 @@ begin
end; end;
end; end;
if dec=7 then nc:=8; // sr if dec=7 then nc:=8; // sr
if dec=8 then
begin
case x of
3 : nc:=3;
4,5 : nc:=4;
7 : nc:=5;
9 : nc:=5;
end;
end;
nombre_adresses_signal:=nc; nombre_adresses_signal:=nc;
end; end;
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+7 -3
View File
@@ -18,7 +18,7 @@ object FormPrinc: TFormPrinc
OnCreate = FormCreate OnCreate = FormCreate
DesignSize = ( DesignSize = (
1197 1197
612) 611)
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object LabelTitre: TLabel object LabelTitre: TLabel
@@ -1203,7 +1203,7 @@ object FormPrinc: TFormPrinc
object SplitterH: TSplitter object SplitterH: TSplitter
Left = 0 Left = 0
Top = 0 Top = 0
Height = 590 Height = 589
end end
object ScrollBox1: TScrollBox object ScrollBox1: TScrollBox
Left = 632 Left = 632
@@ -1268,7 +1268,7 @@ object FormPrinc: TFormPrinc
end end
object StatusBar1: TStatusBar object StatusBar1: TStatusBar
Left = 0 Left = 0
Top = 590 Top = 589
Width = 1197 Width = 1197
Height = 22 Height = 22
Panels = <> Panels = <>
@@ -1928,6 +1928,10 @@ object FormPrinc: TFormPrinc
Caption = 'A propos' Caption = 'A propos'
OnClick = Apropos1Click OnClick = Apropos1Click
end end
object Vrifiernouvelleversion1: TMenuItem
Caption = 'V'#233'rifier nouvelle version'
OnClick = Vrifiernouvelleversion1Click
end
end end
object Roulage1: TMenuItem object Roulage1: TMenuItem
Caption = 'Roulage' Caption = 'Roulage'
+118 -10
View File
@@ -163,6 +163,7 @@ type
Panel2: TPanel; Panel2: TPanel;
FenRich: TRichEdit; FenRich: TRichEdit;
SplitterV: TSplitter; SplitterV: TSplitter;
Vrifiernouvelleversion1: TMenuItem;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure MSCommUSBLenzComm(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
@@ -241,6 +242,7 @@ type
procedure EditAdrTrainChange(Sender: TObject); procedure EditAdrTrainChange(Sender: TObject);
procedure SplitterVMoved(Sender: TObject); procedure SplitterVMoved(Sender: TObject);
procedure PopupMenuFeuPopup(Sender: TObject); procedure PopupMenuFeuPopup(Sender: TObject);
procedure Vrifiernouvelleversion1Click(Sender: TObject);
private private
{ Déclarations privées } { Déclarations privées }
procedure DoHint(Sender : Tobject); procedure DoHint(Sender : Tobject);
@@ -288,15 +290,14 @@ Max_Simule=10000;
Max_Event_det_tick=30000; Max_Event_det_tick=30000;
EtatSign : array[0..13] of string[20] =('carré','sémaphore','sémaphore cli','vert','vert cli','violet', EtatSign : array[0..13] of string[20] =('carré','sémaphore','sémaphore cli','vert','vert cli','violet',
'blanc','blanc cli','jaune','jaune cli','ral 30','ral 60','rappel 30','rappel 60'); 'blanc','blanc cli','jaune','jaune cli','ral 30','ral 60','rappel 30','rappel 60');
NbDecodeur = 8; NbDecodeur = 9;
decodeur : array[0..NbDecodeur-1] of string[20] =('rien','Digital Bahn','CDF','LDT','LEB','Digikeijs 4018','Unisemaf Paco','SR'); decodeur : array[0..NbDecodeur-1] of string[20] =('rien','Digital Bahn','CDF','LDT','LEB','Digikeijs 4018','Unisemaf Paco','Stéphane Ravaut','Arcomora');
Etats : array[0..19] of string[30]=('Non commandé', Etats : array[0..19] of string[30]=('Non commandé',
'carré','sémaphore','sémaphore cli','vert','vert cli','violet','blanc','blanc cli','jaune','jaune cli', 'carré','sémaphore','sémaphore cli','vert','vert cli','violet','blanc','blanc cli','jaune','jaune cli',
'ralen 30','ralen 60','ralen 60 + jaune cli','rappel 30','rappel 60','rappel 30 + jaune','rappel 30 + jaune cli','rappel 60 + jaune','rappel 60 + jaune cli'); 'ralen 30','ralen 60','ralen 60 + jaune cli','rappel 30','rappel 60','rappel 30 + jaune','rappel 30 + jaune cli','rappel 60 + jaune','rappel 60 + jaune cli');
type type
Taccessoire = (aigP,feu); // aiguillage ou feu Taccessoire = (aigP,feu); // aiguillage ou feu
TMA = (valide,devalide);
TEquipement = (rien,aig,tjd,tjs,triple,det,buttoir,voie,crois,act); // voie uniquement pour le tco TEquipement = (rien,aig,tjd,tjs,triple,det,buttoir,voie,crois,act); // voie uniquement pour le tco
TBranche = record TBranche = record
BType : Tequipement ; // ne prend que les valeurs suivantes: dét aig Buttoir BType : Tequipement ; // ne prend que les valeurs suivantes: dét aig Buttoir
@@ -1537,7 +1538,7 @@ begin
width:=LargImg; width:=LargImg;
Height:=HtImg; Height:=HtImg;
s:='Index='+IntToSTR(rang)+' @='+inttostr(Adresse)+' Décodeur='+intToSTR(feux[rang].Decodeur)+ s:='Index='+IntToSTR(rang)+' @='+inttostr(Adresse)+' Décodeur='+decodeur[feux[rang].Decodeur]+
' Adresse détecteur associé='+intToSTR(feux[rang].Adr_det1)+ ' Adresse détecteur associé='+intToSTR(feux[rang].Adr_det1)+
' Adresse élement suivant='+intToSTR(feux[rang].Adr_el_suiv1); ' Adresse élement suivant='+intToSTR(feux[rang].Adr_el_suiv1);
if feux[rang].Btype_suiv1=aig then s:=s+' (aig)'; if feux[rang].Btype_suiv1=aig then s:=s+' (aig)';
@@ -2596,8 +2597,102 @@ begin
if ((Combine=rappel_60) and (aspect=jaune_cli)) then envoi5_LEB($11); if ((Combine=rappel_60) and (aspect=jaune_cli)) then envoi5_LEB($11);
if ((Combine=ral_60) and (aspect=jaune_cli)) then envoi5_LEB($12); if ((Combine=ral_60) and (aspect=jaune_cli)) then envoi5_LEB($12);
end; end;
end;
// pilote le décodeur arcomora
procedure envoi_arcomora(adresse :integer);
var asp,aspect,combine,code,offset,sortie : integer;
s : string;
begin
index:=index_feu(adresse);
if (feux[index].AncienEtat<>feux[index].EtatSignal) then //; && (stop_cmd==FALSE))
begin
code:=feux[index].EtatSignal;
asp:=feux[index].aspect;
code_to_aspect(code,aspect,combine);
s:='Signal Arcomora: ad'+IntToSTR(adresse)+'='+chaine_signal(code);
if traceSign then affiche(s,clOrange);
if Affsignal then afficheDebug(s,clOrange);
if AffDetSig then
begin
s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal);
AfficheDebug(s,clyellow);
end;
Sleep(60);
if asp=2 then
begin
case aspect of
violet : begin offset:=0;sortie:=2;end;
blanc : begin offset:=0;sortie:=1;end;
blanc_cli : begin offset:=1;sortie:=1;end;
end;
end;
if asp=3 then
begin
case aspect of
vert : begin offset:=0;sortie:=1;end;
jaune : begin offset:=0;sortie:=2;end;
semaphore : begin offset:=1;sortie:=1;end;
vert_cli : begin offset:=1;sortie:=2;end;
semaphore_cli : begin offset:=2;sortie:=1;end;
jaune_cli : begin offset:=2;sortie:=2;end;
end;
end;
if (asp=4) or (asp=5) then
begin
case aspect of
vert : begin offset:=0;sortie:=1;end;
jaune : begin offset:=0;sortie:=2;end;
semaphore : begin offset:=1;sortie:=1;end;
carre : begin offset:=1;sortie:=2;end;
vert_cli : begin offset:=2;sortie:=1;end;
jaune_cli : begin offset:=2;sortie:=2;end;
semaphore_cli : begin offset:=3;sortie:=1;end;
end;
end;
if (asp=7) then
begin
case aspect of
vert : begin offset:=0;sortie:=1;end;
jaune : begin offset:=0;sortie:=2;end;
semaphore : begin offset:=1;sortie:=1;end;
carre : begin offset:=1;sortie:=2;end;
vert_cli : begin offset:=4;sortie:=1;end;
semaphore_cli : begin offset:=4;sortie:=2;end;
end;
case combine of
ral_30 : begin offset:=2;sortie:=1;end;
ral_60 : begin offset:=3;sortie:=1;end;
end;
end;
if (asp=9) then
begin
case aspect of
vert : begin offset:=0;sortie:=1;end;
jaune : begin offset:=0;sortie:=2;end;
semaphore : begin offset:=1;sortie:=1;end;
carre : begin offset:=1;sortie:=2;end;
vert_cli : begin offset:=4;sortie:=1;end;
semaphore_cli : begin offset:=4;sortie:=2;end;
end;
case combine of
ral_30 : begin offset:=2;sortie:=1;end;
rappel_30 : begin offset:=2;sortie:=2;end;
ral_60 : begin offset:=3;sortie:=1;end;
rappel_60 : begin offset:=3;sortie:=2;end;
end;
end;
end; end;
Pilote_acc(adresse+offset,sortie,feu);
end;
(*========================================================================== (*==========================================================================
envoie les données au décodeur NMRA étendu envoie les données au décodeur NMRA étendu
@@ -2643,9 +2738,6 @@ begin
AfficheDebug(s,clyellow); AfficheDebug(s,clyellow);
end; end;
// attention: impossible d'envoyer des octets en XpressNet!!
// NMRA ne focntionnera pas..
case aspect of case aspect of
carre : valeur:=0; carre : valeur:=0;
semaphore : valeur:=1; semaphore : valeur:=1;
@@ -3538,6 +3630,7 @@ begin
5 : digi_4018(Adr); 5 : digi_4018(Adr);
6 : envoi_UniSemaf(Adr); 6 : envoi_UniSemaf(Adr);
7 : envoi_SR(Adr); 7 : envoi_SR(Adr);
8 : envoi_arcomora(Adr);
end; end;
// Gestion démarrage temporisé des trains si on quitte le rouge : ne fonctionne qu'en roulage // Gestion démarrage temporisé des trains si on quitte le rouge : ne fonctionne qu'en roulage
@@ -8871,9 +8964,9 @@ end;
// traitement des évènements actionneurs (detecteurs aussi) // traitement des évènements actionneurs (detecteurs aussi)
// adr adr2 : pour mémoire de zone // adr adr2 : pour mémoire de zone
procedure Event_act(adr,adr2,etat : integer;trainDecl : string); procedure Event_act(adr,adr2,etat : integer;trainDecl : string);
var typ,i,v,va,etatAct,Af,Ao,Access,sortie,dZ1F,dZ2F,dZ1O,dZ2O : integer; var typ,i,v,etatAct,Af,Ao,Access,sortie,dZ1F,dZ2F,dZ1O,dZ2O : integer;
s,st,trainDest : string; s,st,trainDest : string;
fm,fd,presTrain_PN,adresseOk,etatvalide : boolean; fm,fd,adresseOk,etatvalide : boolean;
Ts : TAccessoire; Ts : TAccessoire;
begin begin
if adr<=0 then exit; if adr<=0 then exit;
@@ -10526,7 +10619,7 @@ end;
// Lance et connecte CDM rail. en sortie si CDM est lancé Lance_CDM=true, // Lance et connecte CDM rail. en sortie si CDM est lancé Lance_CDM=true,
function Lance_CDM : boolean; function Lance_CDM : boolean;
var i,retour,retour2 : integer; var i,retour : integer;
repertoire,s : string; repertoire,s : string;
cdm_lanceLoc : boolean; cdm_lanceLoc : boolean;
begin begin
@@ -13640,6 +13733,21 @@ begin
ob.Items[1].Caption:='Informations du signal '+intToSTR(AdrPilote); ob.Items[1].Caption:='Informations du signal '+intToSTR(AdrPilote);
end; end;
procedure TFormPrinc.Vrifiernouvelleversion1Click(Sender: TObject);
var s : string;
v_publie,v_utile : real;
erreur : integer;
begin begin
V_publie:=verifie_version;
str(v_publie:2:2,s);
if v_publie>0 then
begin
val(version,V_utile,erreur);
if V_utile=V_publie then Affiche('Votre version '+Version+SousVersion+' est à jour',clLime);
if V_utile>V_publie then Affiche('Votre version '+version+SousVersion+' est plus récente que la version publiée '+s,clLime);
end
else Affiche('Site CDM-Rail inateignable',clred);
end;
end. end.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+3 -6
View File
@@ -2521,7 +2521,7 @@ end;
// Element 24 // Element 24
procedure dessin_24(Canvas : Tcanvas;x,y,mode: integer); procedure dessin_24(Canvas : Tcanvas;x,y,mode: integer);
var x0,y0,xc,yc,jx1,jy1,jx2,xf,yf,position : integer; var x0,y0,xc,yc,jx1,jy1,xf,yf,position : integer;
r : Trect; r : Trect;
fond: tcolor; fond: tcolor;
@@ -4196,7 +4196,6 @@ end;
procedure TFormTCO.FormActivate(Sender: TObject); procedure TFormTCO.FormActivate(Sender: TObject);
var s : string; var s : string;
r :Trect;
begin begin
if affevt then Affiche('Form TCO activate',clyellow); if affevt then Affiche('Form TCO activate',clyellow);
if not(Forminit) then if not(Forminit) then
@@ -4347,8 +4346,7 @@ end;
// vérifie que les icones adjacentes sont cohérentes // vérifie que les icones adjacentes sont cohérentes
function verif_cellule(x,y,Bim : integer) : boolean; function verif_cellule(x,y,Bim : integer) : boolean;
var res,verif : boolean; var res,verif : boolean;
Bimz,i : integer; Bimz,i,bl : integer;
bl,bz : integer;
begin begin
result:=true; result:=true;
verif:=false; verif:=false;
@@ -5361,8 +5359,7 @@ end;
procedure TFormTCO.ImageTCOMouseMove(Sender: TObject; Shift: TShiftState;X, Y: Integer); procedure TFormTCO.ImageTCOMouseMove(Sender: TObject; Shift: TShiftState;X, Y: Integer);
var r : Trect; var r : Trect;
cellX,cellY,x0,y0,XSel1,YSel1,XSel2,YSel2,Bimage,xMiniSelP,yMiniSelP,xMaxiSelP,yMaxiSelP : integer; cellX,cellY,XSel1,YSel1,XSel2,YSel2,Bimage,xMiniSelP,yMiniSelP,xMaxiSelP,yMaxiSelP : integer;
s : string;
begin begin
//Affiche('ImageTCOMouseMove',clLime); //Affiche('ImageTCOMouseMove',clLime);
if Temposouris<1 then exit; if Temposouris<1 then exit;
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -1,8 +1,8 @@
object FormVersion: TFormVersion object FormVersion: TFormVersion
Left = 222 Left = 222
Top = 260 Top = 260
BorderIcons = [] BorderIcons = [biSystemMenu]
BorderStyle = bsNone BorderStyle = bsDialog
Caption = 'V'#233'rification de version' Caption = 'V'#233'rification de version'
ClientHeight = 234 ClientHeight = 234
ClientWidth = 645 ClientWidth = 645
@@ -18,9 +18,9 @@ object FormVersion: TFormVersion
TextHeight = 20 TextHeight = 20
object Memo1: TMemo object Memo1: TMemo
Left = 8 Left = 8
Top = 16 Top = 8
Width = 625 Width = 625
Height = 209 Height = 217
Color = clNavy Color = clNavy
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clYellow Font.Color = clYellow
+84 -46
View File
@@ -23,10 +23,11 @@ var
Lance_verif : integer; Lance_verif : integer;
verifVersion,notificationVersion : boolean; verifVersion,notificationVersion : boolean;
Const Version='5.74'; // sert à la comparaison de la version publiée Const Version='5.75'; // sert à la comparaison de la version publiée
SousVersion=' '; // A B C ... en cas d'absence de sous version mettre un espace SousVersion=' '; // A B C ... en cas d'absence de sous version mettre un espace
function GetCurrentProcessEnvVar(const VariableName: string): string; function GetCurrentProcessEnvVar(const VariableName: string): string;
function verifie_version : real;
implementation implementation
@@ -57,40 +58,47 @@ end;
// téléchargement d'une page internet sans cache dans un fichier // téléchargement d'une page internet sans cache dans un fichier
function DownloadURL_NOCache(aUrl: string;s : string): Boolean; // aUrl = adresse URL du fichier - S : chemin et nom du fichier à écrire - taille : renvoie la taille lue en octets
function DownloadURL_NOCache(aUrl: string;s : string;var taille : longint): Boolean;
var var
hSession: HINTERNET; hSession: HINTERNET;
hService: HINTERNET; hService: HINTERNET;
Fs:TFileStream; Fs:TFileStream;
lpBuffer: array[0..1024 + 1] of byte; lpBuffer: array[0..1024 + 1] of byte;
dwBytesRead: DWORD; dwBytesRead: DWORD;
dwTimeout : integer; i : integer;
t : longint;
begin begin
Result := False; Result := False;
DeleteFile(s); t:=0;
//Affiche('VV1',clLime); Try Fs := TFileStream.Create(s,fmCreate);
Application.ProcessMessages; //hSession := InternetOpen('MyApp', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
Try Fs:=TFileStream.Create(s,fmCreate,fmShareDenyNone); hSession := InternetOpen('MyApp', INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY, nil, nil, 0);
hSession:=InternetOpen('MyApp',INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
try try
if Assigned(hSession) then if Assigned(hSession) then
begin begin
// fonction longue //Affiche('Session assignée',clLime);
dwTimeout:=2000; //2s
//Affiche('VV2',clLime);
Application.ProcessMessages;
InternetSetOption(hSession,INTERNET_OPTION_CONNECT_TIMEOUT,@dwTimeOut, SizeOf(dwTimeOut));
hService := InternetOpenUrl(hSession, PChar(aUrl), nil, 0, INTERNET_FLAG_RELOAD, 0); hService := InternetOpenUrl(hSession, PChar(aUrl), nil, 0, INTERNET_FLAG_RELOAD, 0);
i:=getLastError;
if i<>0 then
case i of
12037 : Affiche('Erreur validité de certificat',clred);
12157 : Affiche('Erreur canal sécurisé SSL 2.0',clred);
else affiche('Erreur '+intToSTR(i),clred);
end;
if Assigned(hService) then if Assigned(hService) then
try try
//Affiche('Service assigné',clLime);
while True do while True do
begin begin
dwBytesRead := 1024; dwBytesRead := 1024;
InternetReadFile(hService,@lpBuffer,1024,dwBytesRead); InternetReadFile(hService,@lpBuffer,1024,dwBytesRead);
fs.WriteBuffer(lpBuffer,dwBytesRead); fs.WriteBuffer(lpBuffer,dwBytesRead);
t:=t+dwBytesRead;
if dwBytesRead=0 then break; if dwBytesRead=0 then break;
end; end;
Result := True; Result := True;
taille:=t;
finally finally
InternetCloseHandle(hService); InternetCloseHandle(hService);
end; end;
@@ -103,25 +111,25 @@ begin
end; end;
end; end;
procedure verifie_version;
var s,s2,s3,Version_p,Url,LocalFile : string; function verifie_version : real;
trouve_version,trouve_zip,zone_comm : boolean; var s,s2,s3,Version_p,Url,LocalFile,nomfichier : string;
trouve_version,trouve_zip,zone_comm,LocZip : boolean;
fichier : text; fichier : text;
i,j,erreur,Ncomm,i2,i3,l : integer; i,j,erreur,Ncomm,i2,i3,l : integer;
V_publie,V_utile : real; V_utile,V_publie : real;
SV_publie : char; SV_publie : char;
taille : longint;
comm : array[1..10] of string; comm : array[1..10] of string;
begin begin
//Affiche('vérifie version',clLime); //Affiche('vérifie version',clLime);
if not(AvecInit) then exit ;
if not(verifVersion) then exit;
Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499'; Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499';
LocalFile:='page.txt'; LocalFile:='page.txt';
trouve_version:=false; trouve_version:=false;
trouve_zip:=false; trouve_zip:=false;
zone_comm:=false; zone_comm:=false;
Ncomm:=0; Ncomm:=0;
if DownloadURL_NOCache(Url,localFile) then if DownloadURL_NOCache(Url,localFile,taille) then
begin begin
AssignFile(fichier,LocalFile); AssignFile(fichier,LocalFile);
reset(fichier); reset(fichier);
@@ -129,10 +137,10 @@ begin
begin begin
readln(fichier,s); readln(fichier,s);
//Affiche(s,clyellow); //Affiche(s,clyellow);
s:=LowerCase(s); //s:=LowerCase(s);
if not(trouve_version) then if not(trouve_version) then
begin begin
i:=pos('version ',s); i:=pos('version ',LowerCase(s));
trouve_version:=i<>0; trouve_version:=i<>0;
if trouve_version then if trouve_version then
begin begin
@@ -142,7 +150,7 @@ begin
end; end;
if not(trouve_zip) then if not(trouve_zip) then
begin begin
i:=pos('.zip',s); i:=pos('.zip',LowerCase(s));
trouve_zip:=i<>0; trouve_zip:=i<>0;
//if trouve_zip then Affiche(s,clyellow); //if trouve_zip then Affiche(s,clyellow);
if trouve_zip then if trouve_zip then
@@ -154,7 +162,7 @@ begin
// commentaire en gras // commentaire en gras
if zone_comm then if zone_comm then
begin begin
i:=pos('bold">',s)+6;i2:=posEx('<br />',s,i+1); i3:=posEx('</span>',s,i+1) ; i:=pos('bold">',LowerCase(s))+6;i2:=posEx('<br />',LowerCase(s),i+1); i3:=posEx('</span>',LowerCase(s),i+1) ;
if i<>6 then if i<>6 then
begin begin
//Affiche(s,clred); //Affiche(s,clred);
@@ -164,7 +172,7 @@ begin
Delete(s,1,i2-1); Delete(s,1,i2-1);
j:=0; j:=0;
repeat repeat
i:=pos('<br />',s)+6;i3:=posEx('</span>',s,i+1);i2:=posEx('<br />',s,i+1); i:=pos('<br />',LowerCase(s))+6;i3:=posEx('</span>',LowerCase(s),i+1);i2:=posEx('<br />',LowerCase(s),i+1);
inc(ncomm); inc(ncomm);
if i2<i3 then if i2<i3 then
begin begin
@@ -185,18 +193,33 @@ begin
if trouve_version and trouve_zip then if trouve_version and trouve_zip then
begin begin
// isoler le champ version // isoler le champ version
i:=pos('version ',s2); i:=pos('version ',LowerCase(s2));
delete(s2,1,i+7); delete(s2,1,i+7);
j:=pos(' ',s2); j:=pos(' ',s2);
Version_p:=copy(s2,1,j-1); // version dans version_p Exemple V4.73b Version_p:=copy(s2,1,j-1); // version dans version_p Exemple V4.73b
// isoler l'url du zip // isoler l'url du zip
i:=pos('href="',s3); i:=pos('.zip',LowerCase(s3));
delete(s3,1,i+5); repeat
j:=pos('"',s3); dec(i);
s3:=copy(s3,1,j-1); locZip:=s3[i]='=';
i:=pos('.',s3); until (i=1) or LocZip;
if i<>0 then delete(s3,i,1); // supprimer le . if locZip then
s3:='http://cdmrail.free.fr/ForumCDR'+s3 ; begin
delete(s3,1,i+1);
end;
i:=pos('zip"',LowerCase(s3)); // s3 contient l'url du zip
s3:=copy(s3,1,i+2);
//isoler le nom du fichier
i:=length(s3);
repeat
dec(i);
locZip:=s3[i]='/';
until (i=1) or LocZip;
nomfichier:=copy(s3,i+1,length(s3)-i);
//Affiche(s3,clLime);
//Affiche(nomfichier,clred);
// changer le . en , // changer le . en ,
s:=Version_p; s:=Version_p;
@@ -220,7 +243,6 @@ begin
FormVersion.Top:=10; FormVersion.Top:=10;
FormVersion.Left:=10; FormVersion.Left:=10;
FormVersion.show; FormVersion.show;
//aff(s3); // url dans s3
s:='Vous utilisez la version '+version+SousVersion+' mais il existe la version '+Version_p+SV_publie; s:='Vous utilisez la version '+version+SousVersion+' mais il existe la version '+Version_p+SV_publie;
if ncomm>0 then if ncomm>0 then
begin begin
@@ -231,31 +253,31 @@ begin
if MessageDlg(s+'. Voulez-vous la télécharger?',mtConfirmation,[mbYes,mbNo],0)=mrYes then if MessageDlg(s+'. Voulez-vous la télécharger?',mtConfirmation,[mbYes,mbNo],0)=mrYes then
begin begin
// récupérer depuis la variable d'environnement windows USERPROFILE le repertoire de la session ouverte // récupérer depuis la variable d'environnement windows USERPROFILE le repertoire de la session ouverte
s:=GetCurrentProcessEnvVar('USERPROFILE')+'\Downloads\Signaux_Complexes_GL.Zip'; s:=GetCurrentProcessEnvVar('USERPROFILE')+'\Downloads\'+Nomfichier;
Aff('Téléchargement de '+s3+' dans '); Aff('Téléchargement de '+s3+' dans ');
Aff(s); Aff(s);
if DownloadURL_NOCache(s3,s) then if DownloadURL_NOCache(s3,s,taille) then
//if true then begin
if taille>700000 then
begin begin
Aff('Téléchargement réussi'); Aff('Téléchargement réussi');
Aff('Vous pouvez ouvrir le dossier de téléchargement, décomprimer le zip et l''installer'); Aff('Vous pouvez ouvrir le dossier de téléchargement, décomprimer le zip et l''installer');
end end
else Aff('Echec de téléchargement'); else Aff('Echec 2 de téléchargement');
end
else Aff('Echec 1 de téléchargement');
end end
else formVersion.Free; else formVersion.Free;
end; end;
result:=V_publie;
if notificationVersion then
begin
if V_utile=V_publie then Affiche('Votre version '+Version_p+SousVersion+' est à jour',clLime);
if V_utile>V_publie then Affiche('Votre version '+version+SousVersion+' est plus récente que la version publiée '+Version_p+SV_publie,clLime);
end;
end; end;
end end
else else
begin begin
if notificationVersion then Affiche('Pas d''accès au site CDM rail ou échec téléchargement',clorange); result:=0;
if notificationVersion then Affiche('Pas d''accès au site ou échec téléchargement',clorange);
end; end;
end; end;
@@ -263,13 +285,29 @@ end;
procedure TFormVersion.FormCreate(Sender: TObject); procedure TFormVersion.FormCreate(Sender: TObject);
begin begin
Timerverif.Interval:=1000; // timer à 1 seconde Timerverif.Interval:=1000; // timer à 1 seconde
Lance_verif:=3; // lancer la vérification de version dans 1s Lance_verif:=2; // lancer la vérification de version dans 3s
end; end;
procedure TFormVersion.TimerVerifTimer(Sender: TObject); procedure TFormVersion.TimerVerifTimer(Sender: TObject);
var V_utile,V_publie : real;
erreur: integer;
s : string;
begin begin
if lance_verif>0 then dec(lance_verif); if lance_verif>0 then dec(lance_verif);
if lance_verif=1 then begin lance_verif:=0;verifie_version;end; if lance_verif=0 then
begin
timerVerif.Enabled:=false;
if not(AvecInit) then exit;
if not(verifVersion) then exit;
V_publie:=verifie_version;
if notificationVersion and (v_publie>0) then
begin
val(version,V_utile,erreur);
str(v_publie:2:2,s);
if V_utile=V_publie then Affiche('Votre version '+Version+SousVersion+' est à jour',clLime);
if V_utile>V_publie then Affiche('Votre version '+version+SousVersion+' est plus récente que la version publiée '+s,clLime);
end;
end;
end; end;
begin begin
+1
View File
@@ -162,4 +162,5 @@ version 5.73 : Ajout d'un bouton d'autorisation pour le pare-feu windows.
version 5.74 : Correction bug création nouveau TCO. version 5.74 : Correction bug création nouveau TCO.
Nouvel installeur-> Signaux complexes s'installe dans c:\programmes\signaux_complexes. Nouvel installeur-> Signaux complexes s'installe dans c:\programmes\signaux_complexes.
avec un raccourci sur le bureau. avec un raccourci sur le bureau.
version : Gestion du décodeur de signaux Arcomora.