// online version typeof sRefVersion = S;; typeof wUpdateWindow = ObjWin;; fun cbEndDlUpdate(file)= _DSwindow wUpdateWindow; set wUpdateWindow = nil; _delExe "launch" "setup"; _addExe "launch" _checkpack file; _startExe "launch" "setup" nil; 0;; fun cbErrorDlUpdate(file)= _DLGMessageBox _channel nil (loc "ERROR") (loc "ERROR_HS") 0; _DSwindow wUpdateWindow; set wUpdateWindow = nil; 0;; fun cbCancelUpdate(btn, url)= stopUrlDownload url; _DSwindow wUpdateWindow; set wUpdateWindow = nil; 0;; fun cbOkUpdate(btn, p)= let p -> [url cmbmode txtinfo btnok] in let _GETcombo cmbmode -> [pos _] in if pos == 1 then ( _openbrowserhttp url; _DSwindow wUpdateWindow; set wUpdateWindow = nil; 0; ) else ( _ENbutton btnok 0; _ENcombo cmbmode 0; _SETtext txtinfo (loc "DLUPDATE"); fileDownloadUrl url nil sUpdateFile @cbEndDlUpdate @cbErrorDlUpdate; 0; ); 0;; fun cbDestroyUptWin(win, url)= stopUrlDownload url; _DSwindow wUpdateWindow; set wUpdateWindow = nil; 0;; fun crUpdateWindow(url)= if ((strlen url) <= 4) then nil else if wUpdateWindow != nil then ( _SETfocus wUpdateWindow; 0; ) else let _GETscreenSize -> [sw sh] in let [300 130] -> [w h] in let _CRwindow _channel nil (sw/2 - (w/2)) (sh/2 - (h/2)) w h WN_DIALOG (loc "NUPDATE") -> updtwin in let _CRtext _channel updtwin 5 5 w-10 60 ET_ALIGN_CENTER (loc "QUPDATE") -> txtinfo in let _CRcombo _channel updtwin 5 65 w-10 120 CB_NOEDIT "" -> cmbmode in let _CRbutton _channel updtwin 5 (h-25) 60 20 PB_DEFAULT|PB_TABFOCUS (loc "OK") -> btnok in let _CRbutton _channel updtwin (w-65) (h-25) 60 20 PB_TABFOCUS (loc "CANCEL") -> btncancel in ( _ADDcombo cmbmode 0 (loc "CNUPDATE1"); _ADDcombo cmbmode 1 (loc "CNUPDATE2"); _SELcombo cmbmode 1; _CBwinDestroy updtwin @cbDestroyUptWin url; _CBbutton btncancel @cbCancelUpdate url; _CBbutton btnok @cbOkUpdate [url cmbmode txtinfo btnok]; set wUpdateWindow = updtwin; 0; ); 0;; fun cbGetUpgrade(a, url, state)= if (((strlen url) <= 4) || (state == 0)) then nil else ( fileDownloadUrl url nil sUpdateFile @cbEndDlUpdate @cbErrorDlUpdate; //_openbrowserhttp url; ); 0;; fun CheckReferenceVersion(l, p) = _fooS ">>>>>>>>> Recovering Voyager's Reference Version from Internet - File content:"; _fooS strcat ">>>>>>>>> current version : " (itoa _versiondate); _fooS (hd l); _fooS (hd tl l); if !strcmp "#SCOLVER#" (hd l) then ( if (!strcmp (hd tl l) "nil") then ( _fooS ">>>>>>>>>> Local version is up to date !"; if p != 1 then nil else _DLGMessageBox _channel nil (loc "NOUPDATET") (loc "NOUPDATE") 0; 0; ) else ( _fooS ">>>>>>>>>> New version available !"; //_DLGrflmessage _DLGMessageBox chn0 nil (loc "NUPDATE") (loc "QUPDATE") 2 @cbGetUpgrade (hd tl l); crUpdateWindow (hd tl l); 0; ); 0; ) else ( _fooS ">>>>>>>>> Recovering Voyager's Reference Version from Internet - Bad file content !"; 0; ); 0;; fun cbGotCurrentVer(req, p, data, code) = if (code == 0) then ( set sRefVersion = strcat sRefVersion data; 0; ) else if (code == 1) then ( CheckReferenceVersion lineextr sRefVersion p; 0; ) else ( _fooS ">>>>>>>>> Recovering Voyager's Reference Version from Internet failed !"; 0; ); 0;; fun cbGetCurrentVer(url, p, rc) = _fooS strcatn "Check Internet connection on "::url::" result "::(itoa rc)::"\n"::nil; if (!rc) then 0 else // Active Internet Connection detected ( let (getInfo (strextr _getpack _checkpack sVersionFile) "version") -> thisversion in if (thisversion == nil) then 0 else ( set sRefVersion = ""; // _versiondate est en négatif puisque nombre de secondes depuis 1970 INETGetURL chn0 _fooS (strcat sUpdateUrl thisversion) 0 @cbGotCurrentVer p; 0; ); ); 0;; fun _checkUpdate(p)= _refreshExe; /* Check Scol upgrade */ _rflINETisConnected sTesturl @cbGetCurrentVer p; 0;;