diff --git a/components/lazautoupdate/latest_stable/lazupdate.lpk b/components/lazautoupdate/latest_stable/lazupdate.lpk index f047622a2..c58120389 100644 --- a/components/lazautoupdate/latest_stable/lazupdate.lpk +++ b/components/lazautoupdate/latest_stable/lazupdate.lpk @@ -32,7 +32,7 @@ A component for SourceForge and GitHub Project Developers and end-users to update their apps easily. Drop onto a form, set a few properties and call the Method 'AutoUpdate' - as easy as pie! Fully configurable. -Included in the source tree is Update Pack - an app that makes update maintenance simple and efficient. Also TrayUpdater - a systray app that scedules updates automatically. +Included in the source tree is Update Pack - an app that makes update maintenance simple and efficient. Also TrayUpdater - a systray app that schedules updates automatically. Compiles and runs in Windows and Linux. More information in the Wiki Home Page http://wiki.freepascal.org/LazAutoUpdater"/> - + diff --git a/components/lazautoupdate/latest_stable/trayicon/trayupdater.lpi b/components/lazautoupdate/latest_stable/trayicon/trayupdater.lpi index 4ee76a880..63cb8d15d 100644 --- a/components/lazautoupdate/latest_stable/trayicon/trayupdater.lpi +++ b/components/lazautoupdate/latest_stable/trayicon/trayupdater.lpi @@ -22,8 +22,7 @@ - - + diff --git a/components/lazautoupdate/latest_stable/trayicon/trayupdater.lps b/components/lazautoupdate/latest_stable/trayicon/trayupdater.lps index 7c30965b7..7fd5be1d4 100644 --- a/components/lazautoupdate/latest_stable/trayicon/trayupdater.lps +++ b/components/lazautoupdate/latest_stable/trayicon/trayupdater.lps @@ -8,10 +8,11 @@ + - + @@ -43,7 +44,6 @@ - @@ -262,123 +262,123 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - - - - - - + + - - + + + + + + - + diff --git a/components/lazautoupdate/latest_stable/trayicon/trayupdater.res b/components/lazautoupdate/latest_stable/trayicon/trayupdater.res index fa455fa74..53e7eaaa1 100644 Binary files a/components/lazautoupdate/latest_stable/trayicon/trayupdater.res and b/components/lazautoupdate/latest_stable/trayicon/trayupdater.res differ diff --git a/components/lazautoupdate/latest_stable/ulazautoupdate.pas b/components/lazautoupdate/latest_stable/ulazautoupdate.pas index ba3028213..d252a682c 100644 --- a/components/lazautoupdate/latest_stable/ulazautoupdate.pas +++ b/components/lazautoupdate/latest_stable/ulazautoupdate.pas @@ -138,9 +138,10 @@ const V0.2.9: Added CreateLocalLauImportFile in UpdateToNewVersion V0.3.1: Added SetExecutePermission (LINUX only) V0.3.2: Bugfix for DoSilentUpdate - V0.3.3: ?? + V0.3.3: Added event OnUpdate + V0.3.4: ?? } - C_TLazAutoUpdateComponentVersion = '0.3.2'; + C_TLazAutoUpdateComponentVersion = '0.3.3'; C_TThreadedDownloadComponentVersion = '0.0.3'; { V0.0.1: Initial alpha @@ -253,9 +254,9 @@ type OnlineVersion: string) of object; TOnDownloaded = procedure(Sender: TObject; ResultCode, BytesDownloaded: integer) of object; - // ToDo: TOnUpdated?? TOnDebugEvent = procedure(Sender: TObject; lauMethodName, lauMessage: string) of object; + TOnUpdated = Procedure(Sender:TObject;NewVersion,LauMessage:String) of Object; TLazAutoUpdate = class(TAboutLazAutoUpdate) private @@ -293,6 +294,7 @@ type FOnNewVersionAvailable: TOnNewVersionAvailable; FOnDownloaded: TOnDownloaded; fOnDebugEvent: TOnDebugEvent; + fOnUpdated:TOnUpdated; fLastError: string; fVersionCountLimit, fDownloadCountLimit: cardinal; fZipfileName: string; @@ -317,6 +319,8 @@ type function GetThreadDownloadReturnCode: integer; function IsOnlineVersionNewer(const sznewINIPath: string): boolean; function DoSilentUpdate: boolean; + function GetUpdateSilentExe:String; + function GetUpdateExe:String; protected public @@ -394,6 +398,7 @@ type read FOnNewVersionAvailable write FOnNewVersionAvailable; property OnDownloaded: TOnDownloaded read fOnDownloaded write fOnDownloaded; property OnDebugEvent: TOnDebugEvent read fOnDebugEvent write fOnDebugEvent; + property OnUpdated:TOnUpdated read fOnUpdated write fOnUpdated; // Embedded class property ThreadDownload: TThreadedDownload @@ -432,9 +437,9 @@ type // Default is application filename.zip property ZipfileName: string read fZipfileName write fZipfileName; // Name of Console app - property UpdateExe: string read fUpdateExe; + property UpdateExe: string read GetUpdateExe; // Name of Console app - property UpdateExeSilent: string read fUpdateSilentExe; + property UpdateExeSilent: string read GetUpdateSilentExe; // Main project name/UserName property GitHubProjectname: string read fGitHubProjectName write fGitHubProjectName; // Name of your GitHub repository within the project/username @@ -726,9 +731,8 @@ begin fZipfileName := ''; // assign later // BE SURE TO CHANGE THE CONSTANTS IF YOU CHANGE THE UPDATE EXE NAME - fUpdateExe := C_UPDATEHMNAME; - fUpdateSilentExe := C_LAUUPDATENAME; - + GetUpdateSilentExe; + GetUpdateExe; // Assorted versioninfo properties fLCLVersion := GetLCLVersion; @@ -771,6 +775,23 @@ begin FreeAndNil(fThreadDownload); inherited Destroy; end; +function TLazAutoUpdate.GetUpdateSilentExe:String; +begin + fUpdateSilentExe := C_LAUUPDATENAME; + If csDesigning in ComponentState then + Result:='lauupdate' + else + Result:=fUpdateSilentExe; +end; + +function TLazAutoUpdate.GetUpdateExe:String; +begin + fUpdateExe := C_UPDATEHMNAME; + If csDesigning in ComponentState then + Result:='updatehm' + else + Result:=fUpdateExe; +end; function TLazAutoUpdate.AppIsActive(const ExeName: string): boolean; begin @@ -844,6 +865,7 @@ begin C_WhatsNewFilename); Exit; end; + // Create the form, memo and close button if fParentForm <> nil then WhatsNewForm := TForm.CreateNew(fParentForm) @@ -2116,14 +2138,32 @@ begin begin fParentApplication.ProcessMessages; Inc(CCount); - if cCount > 10000000 then + if cCount > 100000 then + begin + // Fire the OnUpdated event + If Assigned(fOnUpdated) then + begin + fOnUpdated(Self,fGUIOnlineVersion,'Unsuccessful update'); + Application.Processmessages; + Sleep(100); + end; Break; // Get out of jail in case updatehm.exe fails to copy file + end; end; finally FUpdateHMProcess.Free; end; {$ENDIF} CreateLocalLauImportFile; // Creates a new import file in GetAppConfigDirUTF8 + + // Fire the OnUpdated event + If Assigned(fOnUpdated) then + begin + fOnUpdated(Self,fGUIOnlineVersion,'Successful update'); + Application.Processmessages; + Sleep(100); + end; + if fFireDebugEvent then fOndebugEvent(Self, 'UpdateToNewVersion', 'Success'); diff --git a/components/lazautoupdate/latest_stable/updatepack/umainform.lfm b/components/lazautoupdate/latest_stable/updatepack/umainform.lfm index 5a1cee757..8da6bc6f1 100644 --- a/components/lazautoupdate/latest_stable/updatepack/umainform.lfm +++ b/components/lazautoupdate/latest_stable/updatepack/umainform.lfm @@ -1,7 +1,7 @@ object mainform: Tmainform - Left = 1335 + Left = 375 Height = 481 - Top = 384 + Top = 127 Width = 587 AllowDropFiles = True BorderIcons = [biSystemMenu, biMinimize] @@ -706,7 +706,10 @@ object mainform: Tmainform About.AuthorEmail = 'minesadorada@gmail.com' About.ComponentName = 'Laz Auto-update v0.1.1' About.LicenseType = abLGPL + OnNewVersionAvailable = LazAutoUpdate1NewVersionAvailable + OnDownloaded = LazAutoUpdate1Downloaded OnDebugEvent = LazAutoUpdate1DebugEvent + OnUpdated = LazAutoUpdate1Updated SFProjectName = 'lazautoupdate' UpdatesFolder = 'updates' VersionsININame = 'updatepack.ini' diff --git a/components/lazautoupdate/latest_stable/updatepack/umainform.pas b/components/lazautoupdate/latest_stable/updatepack/umainform.pas index f4b385436..c28215502 100644 --- a/components/lazautoupdate/latest_stable/updatepack/umainform.pas +++ b/components/lazautoupdate/latest_stable/updatepack/umainform.pas @@ -182,6 +182,12 @@ type procedure FormShow(Sender: TObject); procedure grp_dragfilesDblClick(Sender: TObject); procedure LazAutoUpdate1DebugEvent(Sender: TObject; WhereAt, Message: string); + procedure LazAutoUpdate1Downloaded(Sender: TObject; ResultCode, + BytesDownloaded: integer); + procedure LazAutoUpdate1NewVersionAvailable(Sender: TObject; + Newer: boolean; OnlineVersion: string); + procedure LazAutoUpdate1Updated(Sender: TObject; NewVersion, + LauMessage: String); procedure lst_dragfilesDblClick(Sender: TObject); procedure mnuoptionsDisplayFileMangerClick(Sender: TObject); procedure mnuoptionsShowCodeInfoClick(Sender: TObject); @@ -419,27 +425,30 @@ begin cmb_profile.Clear; cmb_profile.Items := ProfileNameList; cmb_profile.ItemIndex := cmb_profile.Items.IndexOf(szCurrentProfileName); + { if LazAutoUpdate1.CreateLocalLauImportFile then LazAutoUpdate1.RelocateLauImportFile; + } if bIsVirgin then PageControl1.ActivePage := tab_intro else PageControl1.ActivePage := tab_configure; + if DebugMode then + BEGIN EventLog1.FileName := ChangeFileExt(ParamStr(0), '.log'); - if DebugMode then if FileExistsUTF8(EventLog1.FileName) then SysUtils.DeleteFile(EventLog1.FileName); - if DebugMode then EventLog1.AppendContent := True; - if DebugMode then EventLog1.Active := True; - LazAutoUpdate1.DebugMode := DebugMode; + LazAutoUpdate1.DebugMode := DebugMode; + end; end; procedure Tmainform.FormDestroy(Sender: TObject); begin // No memory leaks! + If Assigned(EventLog1) then FreeAndNil(EventLog1); FreeAndNil(ProfileConfig); FreeAndNil(AppConfig); FreeAndNil(ProfilenameList); @@ -494,6 +503,29 @@ begin EventLog1.Log(Format('LazAutoUpdate: Source=%s, Message=%s', [WhereAt, Message])); end; +procedure Tmainform.LazAutoUpdate1Downloaded(Sender: TObject; ResultCode, + BytesDownloaded: integer); +begin + if DebugMode and (EventLog1.Active = True) then + EventLog1.Log(Format('LazAutoUpdate: OnDownloaded ResultCode=%d BytesDownloaded=%d', + [ResultCode, BytesDownloaded])); +end; + +procedure Tmainform.LazAutoUpdate1NewVersionAvailable(Sender: TObject; + Newer: boolean; OnlineVersion: string); +begin + if DebugMode and (EventLog1.Active = True) then + EventLog1.Log(Format('LazAutoUpdate: NewVersionAvailable OnlineVersion=%s', + [OnlineVersion])); +end; + +procedure Tmainform.LazAutoUpdate1Updated(Sender: TObject; NewVersion, + LauMessage: String); +begin + if DebugMode and (EventLog1.Active = True) then + EventLog1.Log(Format('LazAutoUpdate: New Version=%s, Message=%s', [NewVersion, LauMessage])); +end; + procedure Tmainform.lst_dragfilesDblClick(Sender: TObject); var i: integer; diff --git a/components/lazautoupdate/latest_stable/updatepack/updatepack.lpi b/components/lazautoupdate/latest_stable/updatepack/updatepack.lpi index ac931ba76..0ca97aca4 100644 --- a/components/lazautoupdate/latest_stable/updatepack/updatepack.lpi +++ b/components/lazautoupdate/latest_stable/updatepack/updatepack.lpi @@ -23,7 +23,7 @@ - + diff --git a/components/lazautoupdate/latest_stable/updatepack/updatepack.res b/components/lazautoupdate/latest_stable/updatepack/updatepack.res index 0f0b3e247..d79b33def 100644 Binary files a/components/lazautoupdate/latest_stable/updatepack/updatepack.res and b/components/lazautoupdate/latest_stable/updatepack/updatepack.res differ diff --git a/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip b/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip index 1975b0c05..1be6b6817 100644 Binary files a/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip and b/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip differ diff --git a/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json b/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json index 6da75d9ec..f28054264 100644 --- a/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json +++ b/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json @@ -9,7 +9,7 @@ "ForceNotify" : false, "InternalVersion" : 1, "Name" : "lazupdate.lpk", - "Version" : "0.3.2.0" + "Version" : "0.3.3.0" } ] }