Code tidy up. Versions unchanged

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5686 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-22 11:51:19 +00:00
parent a315ebc428
commit 51562d5e28
10 changed files with 242 additions and 185 deletions

View File

@@ -87,10 +87,6 @@ msgstr "Please wait. Processing...."
msgid "Property SFProjectName is empty!" msgid "Property SFProjectName is empty!"
msgstr "Property SFProjectName is empty!" msgstr "Property SFProjectName is empty!"
#: ulazautoupdate.c_sourceforgedownload
msgid "SourceForge download"
msgstr "SourceForge download"
#: ulazautoupdate.c_takingtoolong #: ulazautoupdate.c_takingtoolong
msgid "Check is taking too long (bad/slow internet connection?). Try again later?" msgid "Check is taking too long (bad/slow internet connection?). Try again later?"
msgstr "Check is taking too long (bad/slow internet connection?). Try again later?" msgstr "Check is taking too long (bad/slow internet connection?). Try again later?"
@@ -164,3 +160,4 @@ msgstr "This application is up-to-date"
#: ulazautoupdate.rsvewversionsh #: ulazautoupdate.rsvewversionsh
msgid "Vew version %s has downloaded. Click OK to update now." msgid "Vew version %s has downloaded. Click OK to update now."
msgstr "Vew version %s has downloaded. Click OK to update now." msgstr "Vew version %s has downloaded. Click OK to update now."

View File

@@ -87,10 +87,6 @@ msgstr "Espera. Procesamiento de..."
msgid "Property SFProjectName is empty!" msgid "Property SFProjectName is empty!"
msgstr "¡Propiedad SFProjectName está vacía!" msgstr "¡Propiedad SFProjectName está vacía!"
#: ulazautoupdate.c_sourceforgedownload
msgid "SourceForge download"
msgstr "Descargar de SourceForge"
#: ulazautoupdate.c_takingtoolong #: ulazautoupdate.c_takingtoolong
msgid "Check is taking too long (bad/slow internet connection?). Try again later?" msgid "Check is taking too long (bad/slow internet connection?). Try again later?"
msgstr "Cheque tarda demasiado (mala/lenta conexión a internet?). ¿Inténtalo más tarde?" msgstr "Cheque tarda demasiado (mala/lenta conexión a internet?). ¿Inténtalo más tarde?"
@@ -164,3 +160,4 @@ msgstr "Esta aplicación es actualizada"
#: ulazautoupdate.rsvewversionsh #: ulazautoupdate.rsvewversionsh
msgid "Vew version %s has downloaded. Click OK to update now." msgid "Vew version %s has downloaded. Click OK to update now."
msgstr "Ver versión %s se ha descargado. Haga clic en Aceptar para actualizar ahora." msgstr "Ver versión %s se ha descargado. Haga clic en Aceptar para actualizar ahora."

View File

@@ -77,10 +77,6 @@ msgstr ""
msgid "Property SFProjectName is empty!" msgid "Property SFProjectName is empty!"
msgstr "" msgstr ""
#: ulazautoupdate.c_sourceforgedownload
msgid "SourceForge download"
msgstr ""
#: ulazautoupdate.c_takingtoolong #: ulazautoupdate.c_takingtoolong
msgid "Check is taking too long (bad/slow internet connection?). Try again later?" msgid "Check is taking too long (bad/slow internet connection?). Try again later?"
msgstr "" msgstr ""

View File

@@ -10,7 +10,7 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<CursorPos X="25" Y="28"/> <CursorPos X="25" Y="28"/>
<UsageCount Value="54"/> <UsageCount Value="55"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@@ -19,10 +19,9 @@
<ComponentName Value="mainform"/> <ComponentName Value="mainform"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/> <TopLine Value="59"/>
<TopLine Value="97"/> <CursorPos X="4" Y="108"/>
<CursorPos X="23" Y="119"/> <UsageCount Value="55"/>
<UsageCount Value="54"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
@@ -33,7 +32,7 @@
<WindowIndex Value="1"/> <WindowIndex Value="1"/>
<TopLine Value="3"/> <TopLine Value="3"/>
<CursorPos X="76" Y="8"/> <CursorPos X="76" Y="8"/>
<UsageCount Value="37"/> <UsageCount Value="38"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
@@ -45,14 +44,15 @@
<Unit4> <Unit4>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<WindowIndex Value="1"/> <EditorIndex Value="1"/>
<TopLine Value="184"/> <TopLine Value="478"/>
<CursorPos X="50" Y="204"/> <CursorPos X="28" Y="502"/>
<ExtraEditorCount Value="2"/> <ExtraEditorCount Value="2"/>
<ExtraEditor1> <ExtraEditor1>
<EditorIndex Value="1"/> <IsVisibleTab Value="True"/>
<TopLine Value="2255"/> <WindowIndex Value="1"/>
<CursorPos X="22" Y="2277"/> <TopLine Value="216"/>
<CursorPos X="50" Y="236"/>
</ExtraEditor1> </ExtraEditor1>
<ExtraEditor2> <ExtraEditor2>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
@@ -145,8 +145,8 @@
<Filename Value="..\updatehmsource\updatehm.lpr"/> <Filename Value="..\updatehmsource\updatehm.lpr"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<WindowIndex Value="1"/> <WindowIndex Value="1"/>
<TopLine Value="35"/> <TopLine Value="132"/>
<CursorPos X="40" Y="51"/> <CursorPos X="6" Y="338"/>
<UsageCount Value="17"/> <UsageCount Value="17"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit16> </Unit16>
@@ -162,129 +162,126 @@
<OtherDefines Count="1"> <OtherDefines Count="1">
<Define0 Value="DEBUGMODE"/> <Define0 Value="DEBUGMODE"/>
</OtherDefines> </OtherDefines>
<General>
<ActiveWindowIndexAtStart Value="1"/>
</General>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="61" Column="80" TopLine="37"/> <Caret Line="592" Column="3" TopLine="567"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="757" Column="2" TopLine="718"/> <Caret Line="982" TopLine="966"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="2282" Column="46" TopLine="2250"/> <Caret Line="1745" Column="17" TopLine="1720"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="592" Column="3" TopLine="567"/> <Caret Line="1898" Column="17" TopLine="1873"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="982" TopLine="966"/> <Caret Line="2267" TopLine="2247"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1745" Column="17" TopLine="1720"/> <Caret Line="2286" Column="17" TopLine="2247"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1898" Column="17" TopLine="1873"/> <Caret Line="2270" TopLine="2246"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="2267" TopLine="2247"/> <Caret Line="2273" Column="17" TopLine="2246"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="2286" Column="17" TopLine="2247"/> <Caret Line="2269" TopLine="2244"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="2270" TopLine="2246"/> <Caret Line="592" Column="3" TopLine="567"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="umainform.pas"/>
<Caret Line="2273" Column="17" TopLine="2246"/> <Caret Line="99" Column="38" TopLine="64"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="umainform.pas"/>
<Caret Line="2269" TopLine="2244"/> <Caret Line="127" Column="28" TopLine="123"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="592" Column="3" TopLine="567"/> <Caret Line="472" Column="22" TopLine="446"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="umainform.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="99" Column="38" TopLine="64"/> <Caret Line="1094" Column="27" TopLine="1082"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="umainform.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="127" Column="28" TopLine="123"/> <Caret Line="1117" Column="23" TopLine="1082"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="472" Column="22" TopLine="446"/> <Caret Line="1120" Column="35" TopLine="1082"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1094" Column="27" TopLine="1082"/> <Caret Line="1123" Column="35" TopLine="1082"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1117" Column="23" TopLine="1082"/> <Caret Line="1316" Column="25" TopLine="1298"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1120" Column="35" TopLine="1082"/> <Caret Line="1324" Column="23" TopLine="1298"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1123" Column="35" TopLine="1082"/> <Caret Line="1358" Column="73" TopLine="1264"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1316" Column="25" TopLine="1298"/> <Caret Line="2187" Column="58" TopLine="2140"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1324" Column="23" TopLine="1298"/> <Caret Line="2216" Column="15" TopLine="2169"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1358" Column="73" TopLine="1264"/> <Caret Line="2231" Column="46" TopLine="2205"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="umainform.pas"/>
<Caret Line="2187" Column="58" TopLine="2140"/> <Caret Line="133" TopLine="113"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="umainform.pas"/>
<Caret Line="2216" Column="15" TopLine="2169"/> <Caret Line="19" Column="43" TopLine="7"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="..\ulazautoupdate.pas"/> <Filename Value="umainform.pas"/>
<Caret Line="2231" Column="46" TopLine="2205"/> <Caret Line="153" TopLine="123"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="umainform.pas"/> <Filename Value="umainform.pas"/>
<Caret Line="133" TopLine="113"/> <Caret Line="165" TopLine="124"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="umainform.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="19" Column="43" TopLine="7"/> <Caret Line="209" Column="24" TopLine="184"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="umainform.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="153" TopLine="123"/> <Caret Line="193" Column="17" TopLine="184"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="umainform.pas"/> <Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="165" TopLine="124"/> <Caret Line="1929" Column="33" TopLine="1904"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectSession> </ProjectSession>

View File

@@ -1,12 +1,26 @@
unit ulazautoupdate; unit ulazautoupdate;
{ {
Summary and Copyright
=====================
LazAutoUpdate (c)2015 Gordon Bamber (minesadorada@charcodelvalle.com) LazAutoUpdate (c)2015 Gordon Bamber (minesadorada@charcodelvalle.com)
A Lazarus Visual component that enables an update service for Executables.
Web References
==============
Wiki Page: http://wiki.freepascal.org/LazAutoUpdater
Forum thread: http://forum.lazarus.freepascal.org/index.php/topic,25444.0.html
SourceForge project: https://sourceforge.net/projects/lazautoupdate/
Other Credits
=============
VersionSupport: Mike Thompson - mike.cornflake@gmail.com VersionSupport: Mike Thompson - mike.cornflake@gmail.com
Added to and modified by minesadorada@charcodelvalle.com (added to and modified by minesadorada@charcodelvalle.com)
Windows admin function: Vincent at freepascal forum Windows admin RunAs function: Vincent at freepascal forum
THpttpClient code: GetMem at freepascal forum
License
=======
This library is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation; either version 2 of the License, or (at your
@@ -31,6 +45,12 @@ unit ulazautoupdate;
You should have received a copy of the GNU Library General Public License You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation, along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Version Control and History
===========================
Via SVN: https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/
Via SourceForge: https://sourceforge.net/projects/lazautoupdate/
Also see 'Version History' below
} }
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
@@ -62,6 +82,8 @@ const
C_LAUTRayINI = 'lauimport.ini'; C_LAUTRayINI = 'lauimport.ini';
{ {
Version History
===============
V0.0.1: Initial alpha V0.0.1: Initial alpha
V0.0.2: Added auOther properties V0.0.2: Added auOther properties
V0.0.3: Limit to download time V0.0.3: Limit to download time
@@ -130,21 +152,31 @@ const
C_GUIEntry = 'GUI'; C_GUIEntry = 'GUI';
C_ModuleEntry = 'Module'; C_ModuleEntry = 'Module';
C_MASTER = 'master'; C_MASTER = 'master';
// Compiler mode directives
// (note: nothing for Mac/Darwin)
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
{$IFDEF CPU32}C_UPDATER = 'updatehmwin32.exe'; {$IFDEF CPU32}
C_LOCALUPDATER = 'lauupdatewin32.exe';{$ENDIF} C_UPDATER = 'updatehmwin32.exe';
{$IFDEF CPU64}C_UPDATER = 'updatehmwin64.exe'; C_LOCALUPDATER = 'lauupdatewin32.exe';
C_LOCALUPDATER = 'lauupdatewin64.exe';{$ENDIF} {$ENDIF}
// Windows Constants {$IFDEF CPU64}
C_RUNONCEKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce'; C_UPDATER = 'updatehmwin64.exe';
C_RUNKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'; C_LOCALUPDATER = 'lauupdatewin64.exe';
{$ENDIF}
{$ENDIF} {$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}
{$IFDEF CPU32}C_UPDATER = 'updatehmlinux32'; {$IFDEF CPU32}
C_LOCALUPDATER = 'lauupdatelinux32';{$ENDIF} C_UPDATER = 'updatehmlinux32';
{$IFDEF CPU64}C_UPDATER = 'updatehmlinux64'; C_LOCALUPDATER = 'lauupdatelinux32';
C_LOCALUPDATER = 'lauupdatelinux64';{$ENDIF}
{$ENDIF} {$ENDIF}
{$IFDEF CPU64}
C_UPDATER = 'updatehmlinux64';
C_LOCALUPDATER = 'lauupdatelinux64';
{$ENDIF}
{$ENDIF}
// Windows Constants (unused)
C_RUNONCEKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce';
C_RUNKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run';
resourcestring resourcestring
C_ComponentPrettyName = 'Lazarus Auto-Update Component'; C_ComponentPrettyName = 'Lazarus Auto-Update Component';
@@ -174,7 +206,7 @@ resourcestring
C_FolderMissing = 'Missing %s folder'; C_FolderMissing = 'Missing %s folder';
C_NotApplicable = '<not applicable>'; C_NotApplicable = '<not applicable>';
C_ThreadStarted = 'Thread Started'; C_ThreadStarted = 'Thread Started';
C_SourceForgeDownload = 'SourceForge download'; // C_SourceForgeDownload = 'SourceForge download';
C_CannotLoadFromRemote = 'Cannot load document from remote server'; C_CannotLoadFromRemote = 'Cannot load document from remote server';
C_DownloadIsEmpty = 'Downloaded document is empty.'; C_DownloadIsEmpty = 'Downloaded document is empty.';
C_DownloadFailedErrorCode = 'Download failed with error code '; C_DownloadFailedErrorCode = 'Download failed with error code ';
@@ -464,6 +496,11 @@ type
fLastError: string; // Propagated to TThreadedDownload fLastError: string; // Propagated to TThreadedDownload
constructor Create(URL, FileName: string); constructor Create(URL, FileName: string);
procedure Execute; override; // Starts thread procedure Execute; override; // Starts thread
// Todo:
{
procedure GetDownloadSize;
procedure ShowProgress;
}
end; end;

View File

@@ -1,12 +1,13 @@
program updatehm; program updatehm;
{$ifdef Linux} {$ifdef Linux}
{$ifdef FPC_CROSSCOMPILING} {$ifdef FPC_CROSSCOMPILING}
{$ifdef CPUARM} {$ifdef CPUARM}
//if GUI, then uncomment //if GUI, then uncomment
//{$linklib GLESv2} //{$linklib GLESv2}
{$endif} {$endif}
@@ -56,7 +57,9 @@ program updatehm;
uses uses
SysUtils, SysUtils,
LazUTF8,LazFileUtils,FileUtil, LazUTF8,
LazFileUtils,
FileUtil,
process, process,
eventlog, eventlog,
DateUtils, DateUtils,
@@ -145,11 +148,17 @@ begin
end; end;
Logger := TEventLog.Create(nil); Logger := TEventLog.Create(nil);
try
Logger.LogType := ltFile; Logger.LogType := ltFile;
Logger.FileName := C_LogFileName; Logger.FileName := C_LogFileName;
if FileExistsUTF8(C_LogFileName) then if FileExistsUTF8(C_LogFileName) then
DeleteFile(C_LogFileName); DeleteFile(C_LogFileName);
Logger.Active := True; Logger.Active := True;
except
Logger.Active := False;
FreeAndNil(Logger);
Halt(1);
end;
Logger.Info('Start of Log'); Logger.Info('Start of Log');
bCopyTreeSuccess := False; bCopyTreeSuccess := False;
@@ -243,7 +252,8 @@ begin
// Add entry 'Location' // Add entry 'Location'
if FileExistsUTF8(szUpdatesFullPath + C_LAUTRayINI) then if FileExistsUTF8(szUpdatesFullPath + C_LAUTRayINI) then
begin begin
szLAUTrayAppPath := GetAppConfigDirUTF8(False, True);; szLAUTrayAppPath := GetAppConfigDirUTF8(False, True);
;
try try
ForceDirectory(szLAUTrayAppPath); ForceDirectory(szLAUTrayAppPath);
Fileutil.CopyFile(szUpdatesFullPath + C_LAUTRayINI, szLAUTrayAppPath + Fileutil.CopyFile(szUpdatesFullPath + C_LAUTRayINI, szLAUTrayAppPath +

View File

@@ -1,7 +1,7 @@
object mainform: Tmainform object mainform: Tmainform
Left = 767 Left = 715
Height = 481 Height = 481
Top = 215 Top = 197
Width = 587 Width = 587
AllowDropFiles = True AllowDropFiles = True
BorderIcons = [biSystemMenu, biMinimize] BorderIcons = [biSystemMenu, biMinimize]
@@ -188,6 +188,7 @@ object mainform: Tmainform
OnCloseUp = cmb_profileCloseUp OnCloseUp = cmb_profileCloseUp
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
Sorted = True
Style = csDropDownList Style = csDropDownList
TabOrder = 0 TabOrder = 0
Text = 'Default' Text = 'Default'

View File

@@ -36,7 +36,7 @@ unit umainform;
interface interface
uses uses
Classes, SysUtils, LazUTF8,LazFileUtils,FileUtil, Forms, Controls, Dialogs, Classes, SysUtils, LazUTF8, LazFileUtils, FileUtil, Forms, Controls, Dialogs,
Buttons, Menus, StdCtrls, EditBtn, Spin, ComCtrls, ulazautoupdate, inifiles, Buttons, Menus, StdCtrls, EditBtn, Spin, ComCtrls, ulazautoupdate, inifiles,
eventlog, umemoform, Zipper, strutils, asyncprocess, lclintf, types; eventlog, umemoform, Zipper, strutils, asyncprocess, lclintf, types;
@@ -196,7 +196,7 @@ type
procedure spn3Change(Sender: TObject); procedure spn3Change(Sender: TObject);
procedure spn4Change(Sender: TObject); procedure spn4Change(Sender: TObject);
procedure tab_configureContextPopup(Sender: TObject; MousePos: TPoint; procedure tab_configureContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean); var Handled: boolean);
private private
{ private declarations } { private declarations }
AppConfig: TINIFile; // Application config file. Holds current Profile name AppConfig: TINIFile; // Application config file. Holds current Profile name
@@ -205,7 +205,8 @@ type
ProfilenameList: TStringList; // Used to populate the combo box ProfilenameList: TStringList; // Used to populate the combo box
szCurrentProfileName: string; // Name used to Save/Load profiles to the INI file szCurrentProfileName: string; // Name used to Save/Load profiles to the INI file
bCurrentProfileSaved, bComponentDownloaded, bIsVirgin: boolean; bCurrentProfileSaved, bComponentDownloaded, bIsVirgin: boolean;
bShowCodeWindow, bShowFileManager, bShowOnlineWebsite, bOverRideUserPrefs,DebugMode: boolean; bShowCodeWindow, bShowFileManager, bShowOnlineWebsite,
bOverRideUserPrefs, DebugMode: boolean;
// DragFileStringList:TStringList; // DragFileStringList:TStringList;
procedure ReadProfileFromINI(AProfileName: string); // Writes ProfileRec to disk procedure ReadProfileFromINI(AProfileName: string); // Writes ProfileRec to disk
procedure WriteProfileToINI(AProfileName: string); // Reads ProfileRec from disk procedure WriteProfileToINI(AProfileName: string); // Reads ProfileRec from disk
@@ -358,19 +359,21 @@ begin
end; end;
procedure Tmainform.tab_configureContextPopup(Sender: TObject; procedure Tmainform.tab_configureContextPopup(Sender: TObject;
MousePos: TPoint; var Handled: Boolean); MousePos: TPoint; var Handled: boolean);
begin begin
end; end;
procedure Tmainform.FormCreate(Sender: TObject); procedure Tmainform.FormCreate(Sender: TObject);
begin begin
If LowerCase(ParamStr(1))='debug' then DebugMode:=TRUE if LowerCase(ParamStr(1)) = 'debug' then
else DebugMode:=FALSE; DebugMode := True
else
DebugMode := False;
Caption := Application.Title; Caption := Application.Title;
Icon := Application.Icon; Icon := Application.Icon;
AppConfig := TINIFile.Create(GetAppConfigDir(false) + C_APPCONFIGNAME); AppConfig := TINIFile.Create(GetAppConfigDir(False) + C_APPCONFIGNAME);
ProfileConfig := TINIFile.Create(GetAppConfigDir(false) + C_PROFILECONFIGNAME); ProfileConfig := TINIFile.Create(GetAppConfigDir(False) + C_PROFILECONFIGNAME);
ProfilenameList := TStringList.Create; ProfilenameList := TStringList.Create;
ProfileRec.DragFileStringList := TStringList.Create; ProfileRec.DragFileStringList := TStringList.Create;
if FileExistsUTF8('readme.txt') then if FileExistsUTF8('readme.txt') then
@@ -416,18 +419,22 @@ begin
cmb_profile.Clear; cmb_profile.Clear;
cmb_profile.Items := ProfileNameList; cmb_profile.Items := ProfileNameList;
cmb_profile.ItemIndex := cmb_profile.Items.IndexOf(szCurrentProfileName); cmb_profile.ItemIndex := cmb_profile.Items.IndexOf(szCurrentProfileName);
If LazAutoUpdate1.CreateLocalLauImportFile if LazAutoUpdate1.CreateLocalLauImportFile then
then LazAutoUpdate1.RelocateLauImportFile; LazAutoUpdate1.RelocateLauImportFile;
if bIsVirgin then if bIsVirgin then
PageControl1.ActivePage := tab_intro PageControl1.ActivePage := tab_intro
else else
PageControl1.ActivePage := tab_configure; PageControl1.ActivePage := tab_configure;
If DebugMode then EventLog1.FileName := ChangeFileExt(ParamStr(0), '.log'); if DebugMode then
If DebugMode then if FileExistsUTF8(EventLog1.FileName) then EventLog1.FileName := ChangeFileExt(ParamStr(0), '.log');
if DebugMode then
if FileExistsUTF8(EventLog1.FileName) then
SysUtils.DeleteFile(EventLog1.FileName); SysUtils.DeleteFile(EventLog1.FileName);
If DebugMode then EventLog1.AppendContent := True; if DebugMode then
If DebugMode then EventLog1.Active := True; EventLog1.AppendContent := True;
LazAutoUpdate1.DebugMode:=DebugMode; if DebugMode then
EventLog1.Active := True;
LazAutoUpdate1.DebugMode := DebugMode;
end; end;
procedure Tmainform.FormDestroy(Sender: TObject); procedure Tmainform.FormDestroy(Sender: TObject);
@@ -453,10 +460,10 @@ var
begin begin
for i := Low(FileNames) to High(FileNames) do for i := Low(FileNames) to High(FileNames) do
if ((ProfileRec.DragFileStringList.IndexOf(FileNames[i]) = -1) and if ((ProfileRec.DragFileStringList.IndexOf(FileNames[i]) = -1) and
(FileNames[i] <> ProfileRec.AppPath) and (FileNames[i] <> (FileNames[i] <> ProfileRec.AppPath) and
ProfileRec.WhatsNewPath) and (FileNames[i] <> (FileNames[i] <> ProfileRec.WhatsNewPath) and
LazAutoUpdate1.UpdateExe) and (FileNames[i] <> (FileNames[i] <> LazAutoUpdate1.UpdateExe) and
LazAutoUpdate1.UpdateExeSilent)) then (FileNames[i] <> LazAutoUpdate1.UpdateExeSilent)) then
if (DirPathExists(FileNames[i]) = True) then if (DirPathExists(FileNames[i]) = True) then
begin // Not allowed to drag a directory into the list begin // Not allowed to drag a directory into the list
ShowMessage('You dragged a directory. For whole directories, use the CopyTree facility'); ShowMessage('You dragged a directory. For whole directories, use the CopyTree facility');
@@ -483,7 +490,8 @@ end;
procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; WhereAt, Message: string); procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; WhereAt, Message: string);
begin begin
If DebugMode AND (EventLog1.Active=TRUE) then EventLog1.Log(Format('LazAutoUpdate: Source=%s, Message=%s', [WhereAt, Message])); if DebugMode and (EventLog1.Active = True) then
EventLog1.Log(Format('LazAutoUpdate: Source=%s, Message=%s', [WhereAt, Message]));
end; end;
procedure Tmainform.lst_dragfilesDblClick(Sender: TObject); procedure Tmainform.lst_dragfilesDblClick(Sender: TObject);
@@ -681,7 +689,8 @@ begin
CanClose := True; CanClose := True;
end; end;
if CanClose then if CanClose then
If DebugMode then EventLog1.Active := False; if DebugMode then
EventLog1.Active := False;
end; end;
procedure Tmainform.cmd_UseAppnameVersionsINIClick(Sender: TObject); procedure Tmainform.cmd_UseAppnameVersionsINIClick(Sender: TObject);
@@ -715,7 +724,7 @@ begin
ZipFileName := 'packagesource.zip'; ZipFileName := 'packagesource.zip';
ShowUpdateInCaption := True; ShowUpdateInCaption := True;
VersionINI := TIniFile.Create('new' + VersionsININame); VersionINI := TIniFile.Create('new' + VersionsININame);
// VersionINI := TIniFile.Create(VersionsININame); // VersionINI := TIniFile.Create(VersionsININame);
AppVersion := VersionINI.ReadString('versions', 'GUI', '0.0.0.0'); AppVersion := VersionINI.ReadString('versions', 'GUI', '0.0.0.0');
VersionINI.Free; VersionINI.Free;
if NewVersionAvailable then if NewVersionAvailable then
@@ -751,7 +760,7 @@ end;
procedure Tmainform.cmb_profileClick(Sender: TObject); procedure Tmainform.cmb_profileClick(Sender: TObject);
begin begin
szCurrentProfileName := cmb_profile.Items[cmb_profile.ItemIndex]; szCurrentProfileName := cmb_profile.Items[cmb_profile.ItemIndex];
// Auto-save current profile // Auto-save current profile
AppConfig.WriteString('Current', 'Profilename', szCurrentProfileName); AppConfig.WriteString('Current', 'Profilename', szCurrentProfileName);
ReadFromGUI(szCurrentProfileName); // Read from GUI ReadFromGUI(szCurrentProfileName); // Read from GUI
WriteProfileToINI(szCurrentProfileName); // Write to disk WriteProfileToINI(szCurrentProfileName); // Write to disk
@@ -923,11 +932,12 @@ begin
Execute; Execute;
end; end;
if bShowOnlineWebsite then if bShowOnlineWebsite then
If LazAutoUpdate1.ProjectType=auSourceForge then if LazAutoUpdate1.ProjectType = auSourceForge then
OpenURL('https://sourceforge.net/projects/' + ProfileRec.SFProjectName + '/'); OpenURL('https://sourceforge.net/projects/' + ProfileRec.SFProjectName + '/');
If LazAutoUpdate1.ProjectType=auGitHubReleaseZip then if LazAutoUpdate1.ProjectType = auGitHubReleaseZip then
OpenURL('https://github.com/' + LazAutoUpdate1.GitHubProjectName + '/' + LazAutoUpdate1.GitHubBranchOrTag + '/'); OpenURL('https://github.com/' + LazAutoUpdate1.GitHubProjectName +
If LazAutoUpdate1.ProjectType=auOther then '/' + LazAutoUpdate1.GitHubBranchOrTag + '/');
if LazAutoUpdate1.ProjectType = auOther then
OpenURL(LazAutoUpdate1.auOtherSourceURL + '/'); OpenURL(LazAutoUpdate1.auOtherSourceURL + '/');
{$ELSE} {$ELSE}
@@ -941,11 +951,13 @@ begin
if bShowFileManager then if bShowFileManager then
Execute; Execute;
Parameters.Clear; Parameters.Clear;
If LazAutoUpdate1.ProjectType=auSourceForge then if LazAutoUpdate1.ProjectType = auSourceForge then
Parameters.Add('https://sourceforge.net/projects/' + ProfileRec.SFProjectName + '/'); Parameters.Add('https://sourceforge.net/projects/' +
If LazAutoUpdate1.ProjectType=auGitHubReleaseZip then ProfileRec.SFProjectName + '/');
Parameters.Add('https://github.com/' + LazAutoUpdate1.GitHubProjectName + '/' + LazAutoUpdate1.GitHubBranchOrTag + '/'); if LazAutoUpdate1.ProjectType = auGitHubReleaseZip then
If LazAutoUpdate1.ProjectType=auOther then Parameters.Add('https://github.com/' + LazAutoUpdate1.GitHubProjectName +
'/' + LazAutoUpdate1.GitHubBranchOrTag + '/');
if LazAutoUpdate1.ProjectType = auOther then
Parameters.Add(LazAutoUpdate1.auOtherSourceURL + '/'); Parameters.Add(LazAutoUpdate1.auOtherSourceURL + '/');
if bShowOnlineWebsite then if bShowOnlineWebsite then
Execute; Execute;
@@ -962,13 +974,15 @@ begin
end; end;
procedure Tmainform.cmd_NewProfileClick(Sender: TObject); procedure Tmainform.cmd_NewProfileClick(Sender: TObject);
Var var
szProfileName:String; szProfileName: string;
begin begin
szProfileName := ''; szProfileName := '';
if NOT InputQuery('New Profile Name', if not InputQuery('New Profile Name', 'Type new profile name here',
'Type new profile name here',FALSE,szProfilename) then exit; False, szProfilename) then
if szProfileName = '' then exit; exit;
if szProfileName = '' then
exit;
// We have a valid profile name... // We have a valid profile name...
// Does it already exist? // Does it already exist?
@@ -985,8 +999,13 @@ begin
// Set last item in list as current // Set last item in list as current
cmb_profile.ItemIndex := cmb_profile.Items.Count - 1; cmb_profile.ItemIndex := cmb_profile.Items.Count - 1;
bCurrentProfileSaved := False; bCurrentProfileSaved := False;
end
else
begin
ShowMessage('This profile name already exists. Please choose a new name');
Exit;
end; end;
if (ProfilenameList.IndexOf(cmb_profile.Text) >= 0) then if (ProfilenameList.IndexOf(cmb_profile.Text) >= 0) then
MessageDlg(Application.Title, MessageDlg(Application.Title,
Format(rsNewProfileCreated, [szCurrentProfileName]), Format(rsNewProfileCreated, [szCurrentProfileName]),
mtInformation, [mbOK], 0); mtInformation, [mbOK], 0);
@@ -1023,7 +1042,8 @@ begin
begin begin
ProfileName := AProfileName; ProfileName := AProfileName;
AppPath := ReadString(AProfileName, 'AppPath', ProgramDirectory + 'myapp.exe'); AppPath := ReadString(AProfileName, 'AppPath', ProgramDirectory + 'myapp.exe');
OutDir := CleanAndExpandDirectory(ReadString(AProfileName, 'OutDir', ProgramDirectory)); OutDir := CleanAndExpandDirectory(ReadString(AProfileName,
'OutDir', ProgramDirectory));
NewVersion.VString := ReadString(AProfileName, 'NewVersion', '0.0.0.0'); NewVersion.VString := ReadString(AProfileName, 'NewVersion', '0.0.0.0');
FillVersionInteger(NewVersion); FillVersionInteger(NewVersion);
VersionsINI := ReadString(AProfileName, 'VersionsINI', 'versions.ini'); VersionsINI := ReadString(AProfileName, 'VersionsINI', 'versions.ini');
@@ -1228,7 +1248,8 @@ begin
DeleteFile(ProfileRec.Zipfilename); DeleteFile(ProfileRec.Zipfilename);
Application.ProcessMessages; Application.ProcessMessages;
if FileExistsUTF8(ProfileRec.Zipfilename) then if FileExistsUTF8(ProfileRec.Zipfilename) then
If DebugMode then EventLog1.Error('Unable to delete %s', [ProfileRec.Zipfilename]); if DebugMode then
EventLog1.Error('Unable to delete %s', [ProfileRec.Zipfilename]);
end; end;
AZipper := TZipper.Create; AZipper := TZipper.Create;
@@ -1326,7 +1347,8 @@ begin
DeleteFile(ProfileRec.Outdir + C_LAUTRayINI); DeleteFile(ProfileRec.Outdir + C_LAUTRayINI);
Application.ProcessMessages; Application.ProcessMessages;
if FileExistsUTF8(ProfileRec.Outdir + C_LAUTRayINI) then if FileExistsUTF8(ProfileRec.Outdir + C_LAUTRayINI) then
If DebugMode then EventLog1.Error('Unable to delete %s', [ProfileRec.Outdir + C_LAUTRayINI]); if DebugMode then
EventLog1.Error('Unable to delete %s', [ProfileRec.Outdir + C_LAUTRayINI]);
LAUTRayINI := TINIFile.Create(ProfileRec.Outdir + C_LAUTRayINI); LAUTRayINI := TINIFile.Create(ProfileRec.Outdir + C_LAUTRayINI);
try try

View File

@@ -23,7 +23,7 @@
<UseVersionInfo Value="True"/> <UseVersionInfo Value="True"/>
<MajorVersionNr Value="1"/> <MajorVersionNr Value="1"/>
<MinorVersionNr Value="2"/> <MinorVersionNr Value="2"/>
<RevisionNr Value="2"/> <RevisionNr Value="3"/>
<StringTable Comments="Updated Jan 2017" FileDescription="Companion to LazAutoUpdate component" InternalName="updatepack" LegalCopyright="(c)2015 minesadorada@charcodelvalle.com" OriginalFilename="updatepack" ProductName="Lazarus/FPC" ProductVersion="2.6.4"/> <StringTable Comments="Updated Jan 2017" FileDescription="Companion to LazAutoUpdate component" InternalName="updatepack" LegalCopyright="(c)2015 minesadorada@charcodelvalle.com" OriginalFilename="updatepack" ProductName="Lazarus/FPC" ProductVersion="2.6.4"/>
</VersionInfo> </VersionInfo>
<BuildModes Count="5"> <BuildModes Count="5">