From 01a2b58790fd5fd4d3ee5d5bf2fcb1b7e0c85597 Mon Sep 17 00:00:00 2001 From: gbamber Date: Fri, 20 Jan 2017 11:11:56 +0000 Subject: [PATCH] TestApp updated LazAutoUpdate updated git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5680 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../latest_stable/testapp/testapp.lpi | 15 +++ .../latest_stable/testapp/testapp.lps | 114 +++++++++--------- .../latest_stable/testapp/testapp.res | Bin 139584 -> 139584 bytes .../latest_stable/testapp/umainform.lfm | 6 +- .../latest_stable/testapp/umainform.pas | 36 +++++- .../latest_stable/ulazautoupdate.pas | 20 ++- 6 files changed, 123 insertions(+), 68 deletions(-) diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lpi b/components/lazautoupdate/latest_stable/testapp/testapp.lpi index 580a58fe8..84889eac0 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lpi +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lpi @@ -19,7 +19,10 @@ + + + @@ -50,6 +53,11 @@ + + + + + @@ -218,6 +226,13 @@ + + + + + + diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lps b/components/lazautoupdate/latest_stable/testapp/testapp.lps index e66cd1229..8c9fc9be1 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lps +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lps @@ -9,8 +9,8 @@ - - + + @@ -19,9 +19,10 @@ - - - + + + + @@ -32,7 +33,7 @@ - + @@ -46,13 +47,12 @@ - + - - - + + @@ -60,7 +60,7 @@ - + @@ -147,7 +147,7 @@ - + @@ -159,129 +159,129 @@ - - - + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.res b/components/lazautoupdate/latest_stable/testapp/testapp.res index 2feb20d57a5c3091f2e52171eb6749f3d47dde80..1ef28c4df2ff92c037563e4ef255b8c56026a668 100644 GIT binary patch delta 47 ucmX?bh~vN^jtxiHSQ#0BaPvtvWky~@20aEiZvM&M{*#??`%iWzcS!(2R1CZT delta 47 wcmX?bh~vN^jtxiHSQ$WI^GP;kMqUF3Jq8dq1kueu+1r1zGj9LM&g3o$06?t_wg3PC diff --git a/components/lazautoupdate/latest_stable/testapp/umainform.lfm b/components/lazautoupdate/latest_stable/testapp/umainform.lfm index 3f4bbd219..7cc4a9fbc 100644 --- a/components/lazautoupdate/latest_stable/testapp/umainform.lfm +++ b/components/lazautoupdate/latest_stable/testapp/umainform.lfm @@ -1,7 +1,7 @@ object mainform: Tmainform - Left = 125 + Left = 771 Height = 209 - Top = 292 + Top = 224 Width = 335 BorderIcons = [biSystemMenu] Caption = 'mainform' @@ -119,8 +119,6 @@ object mainform: Tmainform CopyTree = False UpdatesFolder = 'updates' VersionsININame = 'testapp.ini' - ShowUpdateInCaption = True - ShowDialogs = True VersionCountLimit = 1000000 DownloadCountLimit = 10000000 ZipfileName = 'testapp.zip' diff --git a/components/lazautoupdate/latest_stable/testapp/umainform.pas b/components/lazautoupdate/latest_stable/testapp/umainform.pas index dcb2ff518..9803865ed 100644 --- a/components/lazautoupdate/latest_stable/testapp/umainform.pas +++ b/components/lazautoupdate/latest_stable/testapp/umainform.pas @@ -7,13 +7,19 @@ interface uses Classes, SysUtils, Forms, ComCtrls, Buttons, StdCtrls,LazFileUtils,FileUtil, - ulazautoupdate,eventlog; + ulazautoupdate,eventlog,Dialogs; CONST {$IFDEF WINDOWS} {$IFDEF CPU32} + {$IFDEF DEBUGMODE} + C_VERSIONSINNAME = 'testappwin32debug.ini'; + C_ZIPFILENAME = 'testappwin32debug.zip'; + C_LogFileName = 'testappwin32debuglog.txt'; + {$ELSE} C_VERSIONSINNAME = 'testappwin32.ini'; C_ZIPFILENAME = 'testappwin32.zip'; C_LogFileName = 'testappwin32log.txt'; + {$ENDIF} {$ENDIF} {$IFDEF CPU64} C_VERSIONSINNAME = 'testappwin64.ini'; @@ -87,20 +93,34 @@ begin LazAutoUpdate1.DebugMode:=TRUE; LazAutoUpdate1.VersionsININame:=C_VERSIONSINNAME; LazAutoUpdate1.ZipfileName:=C_ZIPFILENAME; - lbl_Version.Caption:='Version: ' + LazAutoUpdate1.AppVersion; + LazAutoUpdate1.GitHubProjectname:='lazarusccr'; + LazAutoUpdate1.GitHubRepositoryName:='TestApp'; + LazAutoUpdate1.GitHubBranchOrTag:='updates'; + LazAutoUpdate1.ShowUpdateInCaption:=TRUE; Caption:=Application.Title; + If Assigned(Logger) then FreeAndNil(Logger); if FileExistsUTF8(C_LogFileName) then DeleteFile(C_LogFileName); + Application.Processmessages; Logger := TEventLog.Create(nil); + TRY Logger.LogType := ltFile; Logger.FileName := C_LogFileName; Logger.Active := True; Logger.Info('Start of Log'); + Except + Raise Exception.Create('Trouble with the logger. Click OK to quit'); + If Assigned(Logger) then FreeAndNil(Logger); + Application.Terminate; + end; + // FORCE AN UPDATE EVERY TIME HERE? + // LazAutoUpdate1.AppVersion:='0.0.0.0'; + lbl_Version.Caption:='Version: ' + LazAutoUpdate1.AppVersion; end; procedure Tmainform.FormDestroy(Sender: TObject); begin - Logger.Info('End of Log'); + If Assigned(Logger) then Logger.Info('End of Log'); FreeAndNil(Logger); end; @@ -116,7 +136,11 @@ end; procedure Tmainform.cmd_updateToNewVersionClick(Sender: TObject); begin - LazAutoUpdate1.UpdateToNewVersion; +{$IFDEF DEBUGMODE} + ShowMessage('Please do not try updating in DEBUG mode'); +{$ELSE} + LazAutoUpdate1.UpdateToNewVersion; +{$ENDIF} end; procedure Tmainform.FormActivate(Sender: TObject); @@ -131,7 +155,11 @@ end; procedure Tmainform.cmd_AutoUpdateClick(Sender: TObject); begin + {$IFDEF DEBUGMODE} + ShowMessage('Please do not try updating in DEBUG mode'); + {$ELSE} LazAutoUpdate1.AutoUpdate; + {$ENDIF} end; procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName, diff --git a/components/lazautoupdate/latest_stable/ulazautoupdate.pas b/components/lazautoupdate/latest_stable/ulazautoupdate.pas index fdb90881f..2271c16be 100644 --- a/components/lazautoupdate/latest_stable/ulazautoupdate.pas +++ b/components/lazautoupdate/latest_stable/ulazautoupdate.pas @@ -1109,6 +1109,7 @@ begin ReturnCode := 0; DownloadSize := 0; fDownloadInprogress := True; + DebugMode:=fDebugMode; if not fSilentMode then fParentForm.Caption := C_Checking; CheckForOpenSSL; @@ -1314,6 +1315,7 @@ begin ReturnCode := 0; DownloadSize := 0; fUnzipAfter := True; + DebugMode:=fDebugMode; if not fSilentMode then szOldCaption := fParentForm.Caption; if not fSilentMode then @@ -1931,7 +1933,11 @@ begin // Running update using updatehm? if not AppIsRunning(ExtractFileName(fAppFilename)) then - Result := DoSilentUpdate + begin + if fFireDebugEvent then + fOndebugEvent(Self, 'UpdateToNewVersion','Doing SilentUpdate'); + Result := DoSilentUpdate; + end else begin cCount := 0; @@ -1972,10 +1978,18 @@ begin szParams := szParams + ' ' + fParentApplication.Title; if (fCopyTree = True) then szParams := szParams + ' copytree'; - if fFireDebugEvent then fOndebugEvent(Self, 'UpdateToNewVersion', Format('Executing %s', [szAppDir + C_UPDATER])); - RunAsAdmin(fParentForm.Handle, szAppDir + C_UPDATER, szParams); + if RunAsAdmin(fParentForm.Handle, szAppDir + C_UPDATER, szParams) then + begin + if fFireDebugEvent then + fOndebugEvent(Self, 'UpdateToNewVersion','RunAsAdmin succeeded'); + end + else + begin + if fFireDebugEvent then + fOndebugEvent(Self, 'UpdateToNewVersion','RunAsAdmin failed'); + end; // Check for C_WhatsNewFilename in the app directory in a LOOP if fFireDebugEvent then