To V0.3.7.1

Universal Installer added (wip)
OPM Version incremented

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5725 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-29 12:38:16 +00:00
parent d3dfc8e221
commit a1814e26bd
13 changed files with 957 additions and 19 deletions

View File

@ -66,7 +66,7 @@ More information in the Wiki Home Page http://wiki.freepascal.org/LazAutoUpdater
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"/>
<Version Minor="3" Release="6"/>
<Version Minor="3" Release="7" Build="1"/>
<Files Count="7">
<Item1>
<Filename Value="ulazautoupdate.pas"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="LazAutoupdate Universal Installer"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N Value="True"/>
<OutDir Value="locale"/>
</i18n>
<VersionInfo>
<UseVersionInfo Value="True"/>
<RevisionNr Value="1"/>
<Attributes pvaPreRelease="True"/>
<StringTable Comments="Installet/Updater using LazAutoUpdate" ProductVersion="0.0.0.0"/>
</VersionInfo>
<BuildModes Count="5">
<Item1 Name="Debug" Default="True"/>
<Item2 Name="Win32">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\win32\lauinstaller"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="i386"/>
<TargetOS Value="win32"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-FcUTF8"/>
</Other>
</CompilerOptions>
</Item2>
<Item3 Name="Win64">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\win64\lauinstaller"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="win64"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-FcUTF8"/>
</Other>
</CompilerOptions>
</Item3>
<Item4 Name="Linux32">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\linux32\lauinstaller"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="i386"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-FcUTF8"/>
</Other>
</CompilerOptions>
</Item4>
<Item5 Name="Linux64">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\linux64\lauinstaller"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<TargetCPU Value="x86_64"/>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-FcUTF8"/>
</Other>
</CompilerOptions>
</Item5>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="lazupdate"/>
<MinVersion Minor="3" Release="7" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="lauinstaller.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="compiled\debug\lauinstaller"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<UseHeaptrc Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-FcUTF8
-dDEBUGMODE"/>
<OtherDefines Count="1">
<Define0 Value="DEBUGMODE"/>
</OtherDefines>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,54 @@
program lauinstaller;
{
License (MIT)
=============
LazAutoUpdate Universal Installer (c)2017 Gordon Bamber (minesadorada@charcodelvalle.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
}
{$mode objfpc}{$H+}
{$ifdef Linux}
{$ifdef FPC_CROSSCOMPILING}
{$ifdef CPUARM}
//if GUI, then uncomment
//{$linklib GLESv2}
{$endif}
{$linklib libc_nonshared.a}
{$endif}
{$endif}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, umainform
{ you can add units after this };
{$R *.res}
begin
Application.Title:='LazAutoupdate Universal Installer';
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(Tmainform, mainform);
Application.Run;
end.

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="Linux64"/>
<Units Count="7">
<Unit0>
<Filename Value="lauinstaller.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<CursorPos X="25" Y="5"/>
<UsageCount Value="27"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<CursorPos X="50" Y="7"/>
<UsageCount Value="27"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
<Unit2>
<Filename Value="C:\laztrunk\lazarus\lcl\include\control.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="3760"/>
<CursorPos X="46" Y="3778"/>
<UsageCount Value="10"/>
</Unit2>
<Unit3>
<Filename Value="..\ulazautoupdate.pas"/>
<EditorIndex Value="3"/>
<TopLine Value="122"/>
<CursorPos X="26" Y="148"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\ushortcut.pas"/>
<EditorIndex Value="2"/>
<CursorPos Y="6"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\testapp\testapp.lpr"/>
<EditorIndex Value="-1"/>
<CursorPos Y="30"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<Filename Value="..\aboutlazautoupdateunit.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="299"/>
<CursorPos X="68" Y="324"/>
<UsageCount Value="10"/>
</Unit6>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="umainform.pas"/>
<Caret Line="59" TopLine="20"/>
</Position1>
<Position2>
<Filename Value="umainform.pas"/>
<Caret Line="61" Column="18" TopLine="20"/>
</Position2>
<Position3>
<Filename Value="umainform.pas"/>
<Caret Line="42" Column="8" TopLine="29"/>
</Position3>
<Position4>
<Filename Value="umainform.pas"/>
<Caret Line="73" Column="58" TopLine="30"/>
</Position4>
<Position5>
<Filename Value="umainform.pas"/>
<Caret Line="82" TopLine="30"/>
</Position5>
<Position6>
<Filename Value="umainform.pas"/>
<Caret Line="54" Column="27" TopLine="13"/>
</Position6>
<Position7>
<Filename Value="umainform.pas"/>
<Caret Line="62" Column="34" TopLine="53"/>
</Position7>
<Position8>
<Filename Value="umainform.pas"/>
<Caret Line="89" Column="49" TopLine="65"/>
</Position8>
<Position9>
<Filename Value="umainform.pas"/>
<Caret Line="36" TopLine="9"/>
</Position9>
<Position10>
<Filename Value="umainform.pas"/>
<Caret Line="60" Column="32" TopLine="33"/>
</Position10>
<Position11>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1836" Column="7" TopLine="1813"/>
</Position11>
<Position12>
<Filename Value="umainform.pas"/>
<Caret Line="110" Column="7" TopLine="65"/>
</Position12>
<Position13>
<Filename Value="umainform.pas"/>
<Caret Line="60" Column="34" TopLine="50"/>
</Position13>
<Position14>
<Filename Value="umainform.pas"/>
<Caret Line="9" Column="51" TopLine="2"/>
</Position14>
<Position15>
<Filename Value="umainform.pas"/>
<Caret Line="8" Column="35"/>
</Position15>
<Position16>
<Filename Value="umainform.pas"/>
<Caret Line="108" Column="90" TopLine="65"/>
</Position16>
<Position17>
<Filename Value="umainform.pas"/>
<Caret Line="8" Column="22"/>
</Position17>
<Position18>
<Filename Value="umainform.pas"/>
<Caret Line="67" Column="69" TopLine="47"/>
</Position18>
<Position19>
<Filename Value="umainform.pas"/>
<Caret Line="13" Column="32"/>
</Position19>
<Position20>
<Filename Value="umainform.pas"/>
<Caret Line="78" Column="82" TopLine="52"/>
</Position20>
<Position21>
<Filename Value="umainform.pas"/>
<Caret Line="83" Column="36" TopLine="58"/>
</Position21>
<Position22>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1923" TopLine="1888"/>
</Position22>
<Position23>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1933" Column="60" TopLine="1897"/>
</Position23>
<Position24>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1938" Column="83" TopLine="1903"/>
</Position24>
<Position25>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1934" Column="41" TopLine="1902"/>
</Position25>
<Position26>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="881" Column="38" TopLine="871"/>
</Position26>
<Position27>
<Filename Value="umainform.pas"/>
<Caret Line="177" Column="46" TopLine="148"/>
</Position27>
<Position28>
<Filename Value="umainform.pas"/>
<Caret Line="117" Column="3" TopLine="115"/>
</Position28>
<Position29>
<Filename Value="umainform.pas"/>
<Caret Line="128" Column="38" TopLine="124"/>
</Position29>
<Position30>
<Filename Value="umainform.pas"/>
<Caret Line="166" Column="7" TopLine="139"/>
</Position30>
</JumpHistory>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,31 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: tmainform.caption
msgid "mainform"
msgstr ""
#: tmainform.cmd_install.caption
msgid "Install"
msgstr ""
#: tmainform.cmd_run.caption
msgid "Run"
msgstr ""
#: tmainform.grp_action.caption
msgid "Action"
msgstr ""
#: tmainform.grp_application.caption
msgid "Application"
msgstr ""
#: tmainform.mnu_file.caption
msgid "&File"
msgstr ""
#: tmainform.mnu_fileexit.caption
msgid "E&xit"
msgstr ""

View File

@ -0,0 +1,131 @@
object mainform: Tmainform
Left = 737
Height = 241
Top = 222
Width = 320
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'mainform'
ClientHeight = 221
ClientWidth = 320
Menu = MainMenu1
OnClose = FormClose
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
Position = poWorkAreaCenter
LCLVersion = '1.7'
Scaled = True
object cmd_close: TBitBtn
Left = 125
Height = 30
Top = 179
Width = 75
Anchors = [akRight, akBottom]
DefaultCaption = True
Kind = bkClose
ModalResult = 11
OnClick = mnu_fileExitClick
TabOrder = 0
end
object grp_Application: TRadioGroup
Left = 0
Height = 113
Top = 0
Width = 320
Align = alTop
AutoFill = True
Caption = 'Application'
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 93
ClientWidth = 316
ItemIndex = 2
Items.Strings = (
'LazAutoUpdate Update Pack'
'LazAutoUpdate Tray Updater'
'LazAutoUpdate Test Application'
'Retro Ski Run'
)
OnSelectionChanged = grp_ApplicationSelectionChanged
TabOrder = 1
end
object grp_Action: TGroupBox
Left = 0
Height = 57
Top = 113
Width = 320
Align = alTop
Caption = 'Action'
ClientHeight = 37
ClientWidth = 316
TabOrder = 2
object cmd_Install: TButton
Left = 8
Height = 25
Top = 0
Width = 75
Caption = 'Install'
OnClick = cmd_InstallClick
TabOrder = 0
end
object cmd_Run: TButton
Left = 88
Height = 25
Top = 0
Width = 75
Caption = 'Run'
OnClick = cmd_RunClick
TabOrder = 1
end
end
object LazAutoUpdate1: TLazAutoUpdate
About.Description.Strings = (
'A component for updating your application'#13#10'Designed for projects hosted by SourceForge'#13#10#13#10'Main methods:'#13#10'Procedure AutoUpdate'#13#10'Function NewVersionAvailable: Boolean'#13#10'Function DownloadNewVersion: Boolean'#13#10'Function UpdateToNewVersion: Boolean'#13#10'Procedure ShowWhatsNewIfAvailable'#13#10'For troubleshooting, set DebugMode=TRUE'
)
About.Title = 'About LazAutoUpdate'
About.Height = 450
About.Width = 400
About.Font.Color = clNavy
About.Font.Height = -13
About.BackGroundColor = clWindow
About.Version = '0.3.4.0'
About.Authorname = 'Gordon Bamber'
About.Organisation = 'Public Domain'
About.AuthorEmail = 'minesadorada@charcodelvalle.com'
About.ComponentName = 'Laz Auto-update v0.3.4.0'
About.LicenseType = abModifiedGPL
OnDebugEvent = LazAutoUpdate1DebugEvent
auOtherSourceURL = '<not applicable>'
auOtherSourceFilename = '<not applicable>'
UpdatesFolder = 'updates'
VersionsININame = 'versions.ini'
ShowUpdateInCaption = True
VersionCountLimit = 1000000
DownloadCountLimit = 10000000
ZipfileName = 'versions.zip'
GitHubProjectname = '<not applicable>'
GitHubRepositoryName = '<not applicable>'
GitHubBranchOrTag = '<not applicable>'
WorkingMode = lauUpdate
ShortCut.ShortcutName = 'MyShortcutName'
ShortCut.Category = scAudioVideo
Left = 80
Top = 16
end
object MainMenu1: TMainMenu
Left = 104
Top = 16
object mnu_file: TMenuItem
Caption = '&File'
object mnu_fileExit: TMenuItem
Caption = 'E&xit'
OnClick = mnu_fileExitClick
end
end
end
end

View File

@ -0,0 +1,9 @@
{"version":1,"strings":[
{"hash":134533565,"name":"tmainform.caption","sourcebytes":[109,97,105,110,102,111,114,109],"value":"mainform"},
{"hash":265345406,"name":"tmainform.grp_application.caption","sourcebytes":[65,112,112,108,105,99,97,116,105,111,110],"value":"Application"},
{"hash":75149406,"name":"tmainform.grp_action.caption","sourcebytes":[65,99,116,105,111,110],"value":"Action"},
{"hash":5941372,"name":"tmainform.cmd_install.caption","sourcebytes":[73,110,115,116,97,108,108],"value":"Install"},
{"hash":22974,"name":"tmainform.cmd_run.caption","sourcebytes":[82,117,110],"value":"Run"},
{"hash":2805797,"name":"tmainform.mnu_file.caption","sourcebytes":[38,70,105,108,101],"value":"&File"},
{"hash":4710148,"name":"tmainform.mnu_fileexit.caption","sourcebytes":[69,38,120,105,116],"value":"E&xit"}
]}

View File

@ -0,0 +1,238 @@
unit umainform;
{
License (MIT)
=============
LazAutoUpdate Universal Installer (c)2017 Gordon Bamber (minesadorada@charcodelvalle.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
}
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LazUTF8, FileUtil, LazFileUtils, Forms, Controls,
Graphics, Dialogs, Buttons,
Menus, StdCtrls, ExtCtrls, asyncprocess,
ulazautoupdate, eventlog;
// resourcestring
type
{ Tmainform }
Tmainform = class(TForm)
cmd_Run: TButton;
cmd_Install: TButton;
cmd_close: TBitBtn;
grp_Action: TGroupBox;
LazAutoUpdate1: TLazAutoUpdate;
MainMenu1: TMainMenu;
mnu_fileExit: TMenuItem;
mnu_file: TMenuItem;
grp_Application: TRadioGroup;
procedure cmd_InstallClick(Sender: TObject);
procedure cmd_RunClick(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure grp_ApplicationSelectionChanged(Sender: TObject);
procedure LazAutoUpdate1DebugEvent(Sender: TObject;
lauMethodName, lauMessage: string);
procedure mnu_fileExitClick(Sender: TObject);
private
Logger: TEventLog;
procedure ConfigureLazAutoUpdate(const AItemIndex: integer);
procedure RunInstalledApp;
public
end;
var
mainform: Tmainform;
implementation
{$R *.lfm}
Var
sDirectoryToInstallTo:String;
{ Tmainform }
procedure Tmainform.FormCreate(Sender: TObject);
begin
Caption := Application.Title;
Icon := Application.Icon;
sDirectoryToInstallTo:=ProgramDirectory + 'installed';
LazAutoUpdate1.DebugMode:=TRUE;
LazAutoUpdate1.ShowUpdateInCaption:=True;
ConfigureLazAutoUpdate(2); // Default is TestApp
Logger := TEventLog.Create(nil);
Logger.LogType := ltFile;
Logger.FileName := Application.Title + '.log';
Logger.Active := True; // Logging uses OnDebugEvent of LazAutoUpdate
end;
procedure Tmainform.cmd_InstallClick(Sender: TObject);
begin
LazAutoUpdate1.WorkingMode := lauInstall;
// Uses SilentUpdate method to install the app if it isn't running
// Else uses UpdateToNewVersion to close/update it
// Let the component do the work!
if LazAutoUpdate1.DownloadNewVersion then
if LazAutoUpdate1.UpdateToNewVersion then
begin
ShowMessageFmt('Success. %s installed.', [LazAutoUpdate1.AppFileWithPath]);
end
else
begin
ShowMessageFmt('Failure. See logfile %s', [Logger.FileName]);
end;
// Restore standard mode
LazAutoUpdate1.WorkingMode := lauUpdate;
end;
procedure Tmainform.cmd_RunClick(Sender: TObject);
begin
RunInstalledApp;
end;
procedure Tmainform.RunInstalledApp;
var
AProcess: TAsyncProcess;
begin
if not FileExistsUTF8(LazAutoUpdate1.AppFileWithPath) then
begin
ShowMessageFmt('%s does not exist! Install it first.',
[LazAutoUpdate1.AppFileWithPath]);
Exit;
end;
AProcess := TAsyncProcess.Create(nil);
try
AProcess.Executable := LazAutoUpdate1.AppFileWithPath;
AProcess.Execute;
finally
Aprocess.Free;
end;
end;
procedure Tmainform.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
if Assigned(Logger) then
begin
Logger.Active := False;
FreeAndNil(Logger);
end;
end;
procedure Tmainform.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
If LazAutoUpdate1.DownloadInProgress Then
Begin
CanClose := False;
ShowMessage('Please wait. Download is still in progress.');
End;
end;
procedure Tmainform.grp_ApplicationSelectionChanged(Sender: TObject);
begin
ConfigureLazAutoUpdate(grp_Application.ItemIndex);
end;
procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject;
lauMethodName, lauMessage: string);
begin
Logger.Log(lauMethodName + ' - ' + lauMessage);
end;
procedure Tmainform.mnu_fileExitClick(Sender: TObject);
begin
Close;
end;
procedure Tmainform.ConfigureLazAutoUpdate(const AItemIndex: integer);
begin
// Note: This routine relies on a consistent naming convention for your
// executables in Windows 32/64-bit and Linux 32/64-bit (see Const C_PFX declaration)
case AItemIndex of
0: //Update Pack
begin
LazAutoUpdate1.ProjectType := auSourceForge; // can be auGitHubReleaseZip or auOther
LazAutoUpdate1.SFProjectname := 'lazautoupdate'; // Or GitHub properties
LazAutoUpdate1.UpdatesFolder := 'updates'; // Subfolder in repository
LazAutoUpdate1.VersionsININame := 'updatepack' + C_PFX + '.ini'; // as specified
LazAutoUpdate1.ZipfileName := 'updatepack' + C_PFX + '.zip'; // as specified
// Note: sDirectoryToInstallTo does not end in a DirectorySeparator
{$IFDEF WINDOWS}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'updatepack.exe';
{$ELSE}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'updatepack';
{$ENDIF}
// Our responsibility to make the folder
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then
ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion := '0.0.0.0';
end;
1: // Tray Updater
;
2: // Test Application
begin
LazAutoUpdate1.ProjectType := auSourceForge;
LazAutoUpdate1.SFProjectname := 'lazautoupdate';
LazAutoUpdate1.UpdatesFolder := 'updates';
LazAutoUpdate1.VersionsININame := 'testapp' + C_PFX + '.ini';
LazAutoUpdate1.ZipfileName := 'testapp' + C_PFX + '.zip';
{$IFDEF WINDOWS}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'testapp' + C_PFX + '.exe';
{$ELSE}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'testapp' + C_PFX;
{$ENDIF}
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then
ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion := '0.0.0.0';
end;
3: // Retro Ski Run
begin
LazAutoUpdate1.ProjectType := auSourceForge;
LazAutoUpdate1.SFProjectname := 'lazautoupdate';
LazAutoUpdate1.UpdatesFolder := 'updates';
LazAutoUpdate1.VersionsININame := 'ski' + C_PFX + '.ini';
LazAutoUpdate1.ZipfileName := 'ski' + C_PFX + '.zip';
{$IFDEF WINDOWS}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'ski' + C_PFX + '.exe';
{$ELSE}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'ski' + C_PFX;
{$ENDIF}
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then
ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion := '0.0.0.0';
end;
end;
end;
end.

View File

@ -142,8 +142,11 @@ const
V0.3.4: Added unit ushortcut (CreateDesktopShortCut) for installers
V0.3.5: Rule #3:There is to be NO v0.3.5.0
V0.3.6: Bugfixed CreateShortCut code
V0.3.7: Added public property Mode=(lauUpdate|lauInstall)
V0.3.7.1: Added (DoSilentUpdate) copy C_UPDATEHMNAME to installed folder
V0.3.8: ??
}
C_TLazAutoUpdateComponentVersion = '0.3.6.0';
C_TLazAutoUpdateComponentVersion = '0.3.7.1';
C_TThreadedDownloadComponentVersion = '0.0.3.0';
{
V0.0.1: Initial alpha
@ -242,8 +245,6 @@ type
procedure Execute; override;
end;
type
// This type is currently unused
TProjectType = (auSourceForge, auGitHubReleaseZip, auOther);
// Array of these records used for multiple updates
@ -254,6 +255,8 @@ type
VersionNumber: cardinal;
end;
TWorkingMode = (lauUpdate,lauInstall);
TThreadedDownload = class; // Forward declaration
TShortCutClass = class; // Forward declaration
{TLAZAUTOUPDATE}
@ -292,6 +295,7 @@ type
fDownloadInprogress: boolean;
fWindowsAdminCheck: boolean;
fShortCutClass: TShortCutClass;
fWorkingMode:TWorkingMode;
{$IFDEF UNIX}
FUpdateHMProcess: TAsyncProcess;
{$ENDIF}
@ -460,17 +464,17 @@ type
write fGitHubRepositoryName;
// Default=master but any branchname or tagname is OK
property GitHubBranchOrTag: string read fGitHubBranchOrTag write fGitHubBranchOrTag;
// Install or Update (default=Update)
property WorkingMode:TworkingMode read fWorkingMode write fWorkingMode;
// Subproperties available
property ShortCut: TShortCutClass read fShortCutClass write fShortCutClass;
end;
type
TShortCutCategory = (scAudioVideo, scAudio, scDevelopment,
scEducation, scGame, scGraphics, scNetwork, scOffice, scScience, scSettings,
scSystem, scUtility);
// TShortCutCategoryFlags = Set of TShortCutCategory;
type
TShortCutClass = class(TPersistent)
private
// ShortCut stuff for CreateDesktopShortCut in ushortcut.pas
@ -559,7 +563,6 @@ type
}
end;
type
// For the TShortCutClass filename properties (needs propedits unit)
TMyFileNamePropertyEditor = class(TFileNamePropertyEditor)
public
@ -833,7 +836,7 @@ begin
fCopyTree := True; // User can change
// UpdateList: Redundant?
AddToUpdateList('', LazUTF8.ParamStrUTF8(0), GetFileVersion, 0);
fWorkingMode:=lauUpdate; // Default
fProjectType := auSourceForge; // User can change
fUpdatesFolder := C_UpdatesFolder; // User can change
fVersionsININame := C_OnlineVersionsININame; // User can change
@ -876,11 +879,11 @@ begin
// AboutBox properties
AboutBoxComponentName := Format('Laz Auto-update v%s',
[C_TLazAutoUpdateComponentVersion]);
;
AboutBoxVersion := C_TLazAutoUpdateComponentVersion;
AboutBoxWidth := 400;
AboutBoxHeight := 450;
sz := 'A component for updating your application' + LineEnding;
sz += 'Designed for projects hosted by SourceForge' + LineEnding + LineEnding;
sz += 'Designed for projects hosted by SourceForge and GitHub' + LineEnding + LineEnding;
sz += 'Main methods:' + LineEnding;
sz += 'Procedure AutoUpdate' + LineEnding;
sz += 'Function NewVersionAvailable: Boolean' + LineEnding;
@ -893,7 +896,6 @@ begin
// AboutBoxBackgroundColor:=clWindow;
//AboutBoxFontName (string)
//AboutBoxFontSize (integer)
AboutBoxVersion := C_TLazAutoUpdateComponentVersion;
AboutBoxAuthorname := 'Gordon Bamber';
//AboutBoxOrganisation (string)
AboutBoxAuthorEmail := 'minesadorada@charcodelvalle.com';
@ -1822,6 +1824,7 @@ var
SectionStringList: TStrings;
szTempUpdatesFolder: string;
begin
// fWorkingMode=lauInstall or lauUpdate
Result := False;
// read the VMT once
if Assigned(fOndebugEvent) then
@ -1829,15 +1832,23 @@ begin
if fFireDebugEvent then
fOndebugEvent(Self, 'DoSilentUpdate', 'Starting DoSilentUpdate');
if fFireDebugEvent then
If fWorkingMode=lauUpdate then
fOndebugEvent(Self, 'DoSilentUpdate','Update mode')
else
fOndebugEvent(Self, 'DoSilentUpdate','Install mode');
if not FileExistsUTF8(fAppFilename) then
If fWorkingMode=lauUpdate then
begin
if fFireDebugEvent then
fOndebugEvent(Self, 'DoSilentUpdate',
Format('AppFilename %s is missing. Exiting routine', [fAppFilename]));
Exit;
if not FileExistsUTF8(fAppFilename) then
begin
if fFireDebugEvent then
fOndebugEvent(Self, 'DoSilentUpdate',
Format('AppFilename %s is missing. Exiting routine', [fAppFilename]));
Exit;
end;
end;
// uses fUpdatesFolder
szTempUpdatesFolder := AppendPathDelim(ExtractFilePath(fAppFilename) + fUpdatesFolder);
@ -1908,6 +1919,25 @@ begin
[szTempUpdatesFolder + 'whatsnew.txt', szAppFolder + 'whatsnew.txt']));
end;
If (fWorkingMode=lauInstall) then
If FileExistsUTF8(C_UPDATEHMNAME) then
begin
If FileUtil.CopyFile(C_UPDATEHMNAME,szAppFolder + C_UPDATEHMNAME) then
if fFireDebugEvent then
fOndebugEvent(Self, 'DoSilentUpdate',
Format('Sucessfully copied %s to %s',
[C_UPDATEHMNAME, szAppFolder]))
else
if fFireDebugEvent then
fOndebugEvent(Self, 'DoSilentUpdate',
Format('Unabled to copy %s to %s',
[C_UPDATEHMNAME, szAppFolder]));
end
else
if fFireDebugEvent then
fOndebugEvent(Self, 'DoSilentUpdate','Unable to locate ' + C_UPDATEHMNAME);
// Deal with C_LAUTRayINI
// Copied to the global application data folder
// Add entry 'Location'
@ -1929,6 +1959,7 @@ begin
if fFireDebugEvent then
fOndebugEvent(Self, 'DoSilentUpdate',
Format('App data directory changed to %s', [szLAUTrayAppPath]));
// Now AppDataDirectory/updatehm(+C_PFX)/
try
if ForceDirectory(szLAUTrayAppPath) then
@ -2023,6 +2054,7 @@ begin
Exit;
end;
{$ENDIF}
// fWorkingMode=lauInstall or lauUpdate
szAppDir := AppendPathDelim(ExtractFilePath(fAppFilename));
// read the VMT once

View File

@ -9,7 +9,7 @@
"ForceNotify" : false,
"InternalVersion" : 1,
"Name" : "lazupdate.lpk",
"Version" : "0.3.6.0"
"Version" : "0.3.7.1"
}
]
}