1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-22 07:18:51 -05:00

Now checks for an update 10 seconds after startup.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@363 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2010-01-03 01:36:54 +00:00
parent bbc243e221
commit 5d9fc3b088
8 changed files with 668 additions and 561 deletions

View File

@ -10,7 +10,7 @@
<TargetFileExt Value=""/>
<Title Value="Simba"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="12"/>
<ActiveEditorIndexAtStart Value="7"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -36,7 +36,7 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="291">
<Units Count="294">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
@ -137,8 +137,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/>
<CursorPos X="59" Y="424"/>
<TopLine Value="723"/>
<CursorPos X="98" Y="424"/>
<TopLine Value="417"/>
<EditorIndex Value="7"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
@ -282,8 +282,8 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/>
<CursorPos X="25" Y="453"/>
<TopLine Value="438"/>
<CursorPos X="79" Y="271"/>
<TopLine Value="251"/>
<EditorIndex Value="6"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
@ -365,7 +365,7 @@
<IsPartOfProject Value="True"/>
<UnitName Value="bitmaps"/>
<CursorPos X="28" Y="397"/>
<TopLine Value="373"/>
<TopLine Value="241"/>
<EditorIndex Value="1"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
@ -572,8 +572,8 @@
<IsPartOfProject Value="True"/>
<UnitName Value="plugins"/>
<CursorPos X="40" Y="49"/>
<TopLine Value="33"/>
<EditorIndex Value="11"/>
<TopLine Value="55"/>
<EditorIndex Value="10"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit75>
@ -661,9 +661,9 @@
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="colourpicker"/>
<CursorPos X="21" Y="187"/>
<CursorPos X="58" Y="184"/>
<TopLine Value="167"/>
<EditorIndex Value="10"/>
<EditorIndex Value="9"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit88>
@ -871,11 +871,9 @@
</Unit117>
<Unit118>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/window.inc"/>
<CursorPos X="52" Y="55"/>
<TopLine Value="22"/>
<EditorIndex Value="9"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
<CursorPos X="35" Y="29"/>
<TopLine Value="18"/>
<UsageCount Value="13"/>
</Unit118>
<Unit119>
<Filename Value="../../../FPC/FPCCheckout/rtl/objpas/classes/compon.inc"/>
@ -1689,9 +1687,9 @@
<ComponentName Value="AboutForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="about"/>
<CursorPos X="44" Y="21"/>
<CursorPos X="119" Y="11"/>
<TopLine Value="4"/>
<UsageCount Value="180"/>
<UsageCount Value="184"/>
</Unit235>
<Unit236>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/>
@ -1705,7 +1703,7 @@
<UnitName Value="internets"/>
<CursorPos X="5" Y="14"/>
<TopLine Value="1"/>
<UsageCount Value="174"/>
<UsageCount Value="178"/>
</Unit237>
<Unit238>
<Filename Value="debugimageform.pas"/>
@ -1714,7 +1712,7 @@
<UnitName Value="debugimageform"/>
<CursorPos X="20" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="161"/>
<UsageCount Value="165"/>
</Unit238>
<Unit239>
<Filename Value="debugimage.pas"/>
@ -1724,7 +1722,7 @@
<UnitName Value="debugimage"/>
<CursorPos X="66" Y="17"/>
<TopLine Value="1"/>
<UsageCount Value="160"/>
<UsageCount Value="164"/>
</Unit239>
<Unit240>
<Filename Value="debugimage.lrs"/>
@ -1846,7 +1844,7 @@
<UnitName Value="framefunctionlist"/>
<CursorPos X="56" Y="9"/>
<TopLine Value="54"/>
<UsageCount Value="81"/>
<UsageCount Value="85"/>
</Unit257>
<Unit258>
<Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/>
@ -1901,7 +1899,7 @@
<UnitName Value="simpleanalyzer"/>
<CursorPos X="52" Y="104"/>
<TopLine Value="193"/>
<UsageCount Value="68"/>
<UsageCount Value="72"/>
</Unit265>
<Unit266>
<Filename Value="../../Units/Misc/mPasLex.pas"/>
@ -1966,11 +1964,9 @@
</Unit274>
<Unit275>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<CursorPos X="81" Y="63"/>
<TopLine Value="45"/>
<EditorIndex Value="12"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="21"/>
</Unit275>
<Unit276>
<Filename Value="../../Units/Synapse/synautil.pas"/>
@ -1983,10 +1979,10 @@
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="updater"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="44"/>
<EditorIndex Value="13"/>
<UsageCount Value="41"/>
<CursorPos X="10" Y="201"/>
<TopLine Value="190"/>
<EditorIndex Value="11"/>
<UsageCount Value="45"/>
<Loaded Value="True"/>
</Unit277>
<Unit278>
@ -1995,10 +1991,10 @@
<ComponentName Value="SimbaUpdateForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="updateform"/>
<CursorPos X="64" Y="107"/>
<TopLine Value="81"/>
<CursorPos X="95" Y="141"/>
<TopLine Value="104"/>
<EditorIndex Value="8"/>
<UsageCount Value="36"/>
<UsageCount Value="40"/>
<Loaded Value="True"/>
</Unit278>
<Unit279>
@ -2074,7 +2070,7 @@
<CursorPos X="15" Y="899"/>
<TopLine Value="870"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit289>
<Unit290>
@ -2083,128 +2079,142 @@
<TopLine Value="454"/>
<UsageCount Value="10"/>
</Unit290>
<Unit291>
<Filename Value="../../../../Documents/fpc/rtl/objpas/sysutils/sysunih.inc"/>
<CursorPos X="77" Y="14"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit291>
<Unit292>
<Filename Value="../../../../Documents/fpc/rtl/objpas/sysutils/sysstrh.inc"/>
<CursorPos X="10" Y="224"/>
<TopLine Value="206"/>
<UsageCount Value="10"/>
</Unit292>
<Unit293>
<Filename Value="../../../../Documents/fpc/rtl/objpas/sysutils/finah.inc"/>
<CursorPos X="10" Y="26"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit293>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<JumpHistory Count="29" HistoryIndex="28">
<Position1>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="189" Column="37" TopLine="177"/>
<Filename Value="testunit.pas"/>
<Caret Line="276" Column="31" TopLine="258"/>
</Position1>
<Position2>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="82" Column="23" TopLine="64"/>
<Filename Value="testunit.pas"/>
<Caret Line="429" Column="34" TopLine="411"/>
</Position2>
<Position3>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="203" Column="25" TopLine="188"/>
<Filename Value="testunit.pas"/>
<Caret Line="333" Column="1" TopLine="315"/>
</Position3>
<Position4>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="188" Column="14" TopLine="167"/>
<Filename Value="testunit.pas"/>
<Caret Line="105" Column="83" TopLine="93"/>
</Position4>
<Position5>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="67" Column="33" TopLine="49"/>
<Filename Value="testunit.pas"/>
<Caret Line="276" Column="31" TopLine="258"/>
</Position5>
<Position6>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="68" Column="33" TopLine="49"/>
<Filename Value="testunit.pas"/>
<Caret Line="436" Column="52" TopLine="416"/>
</Position6>
<Position7>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="190" Column="37" TopLine="167"/>
<Filename Value="testunit.pas"/>
<Caret Line="275" Column="54" TopLine="258"/>
</Position7>
<Position8>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="82" Column="23" TopLine="64"/>
<Filename Value="testunit.pas"/>
<Caret Line="428" Column="5" TopLine="424"/>
</Position8>
<Position9>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="399" Column="10" TopLine="373"/>
<Filename Value="updateform.pas"/>
<Caret Line="52" Column="30" TopLine="34"/>
</Position9>
<Position10>
<Filename Value="../../Units/MMLCore/windowutil.pas"/>
<Caret Line="21" Column="37" TopLine="3"/>
<Filename Value="testunit.pas"/>
<Caret Line="277" Column="31" TopLine="258"/>
</Position10>
<Position11>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="190" Column="24" TopLine="167"/>
<Filename Value="updateform.pas"/>
<Caret Line="58" Column="5" TopLine="41"/>
</Position11>
<Position12>
<Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/>
<Caret Line="931" Column="54" TopLine="913"/>
<Filename Value="updateform.pas"/>
<Caret Line="58" Column="9" TopLine="41"/>
</Position12>
<Position13>
<Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/>
<Caret Line="893" Column="24" TopLine="875"/>
<Filename Value="updateform.pas"/>
<Caret Line="57" Column="6" TopLine="41"/>
</Position13>
<Position14>
<Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/>
<Caret Line="931" Column="60" TopLine="913"/>
<Filename Value="testunit.pas"/>
<Caret Line="445" Column="30" TopLine="411"/>
</Position14>
<Position15>
<Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/>
<Caret Line="1255" Column="24" TopLine="1237"/>
<Filename Value="testunit.pas"/>
<Caret Line="425" Column="3" TopLine="423"/>
</Position15>
<Position16>
<Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/>
<Caret Line="1304" Column="72" TopLine="1286"/>
<Filename Value="updateform.pas"/>
<Caret Line="57" Column="70" TopLine="34"/>
</Position16>
<Position17>
<Filename Value="../../../../Documents/lazarus/lcl/graphics.pp"/>
<Caret Line="2448" Column="9" TopLine="2437"/>
<Filename Value="updateform.pas"/>
<Caret Line="58" Column="70" TopLine="34"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="14" Column="68" TopLine="1"/>
<Filename Value="updateform.pas"/>
<Caret Line="55" Column="7" TopLine="55"/>
</Position18>
<Position19>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="76" Column="13" TopLine="58"/>
<Filename Value="updateform.pas"/>
<Caret Line="9" Column="27" TopLine="1"/>
</Position19>
<Position20>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="181" Column="19" TopLine="163"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="95" Column="15" TopLine="78"/>
</Position20>
<Position21>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="210" Column="19" TopLine="192"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="70" Column="46" TopLine="34"/>
</Position21>
<Position22>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="51" Column="56" TopLine="34"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="57" Column="82" TopLine="39"/>
</Position22>
<Position23>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="74" Column="54" TopLine="58"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="70" Column="34" TopLine="39"/>
</Position23>
<Position24>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="76" Column="13" TopLine="58"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="57" Column="70" TopLine="39"/>
</Position24>
<Position25>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="278" Column="18" TopLine="251"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="37" Column="49" TopLine="28"/>
</Position25>
<Position26>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="219" Column="23" TopLine="207"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="198" Column="33" TopLine="180"/>
</Position26>
<Position27>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="268" Column="17" TopLine="262"/>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="35" Column="12" TopLine="10"/>
</Position27>
<Position28>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="193" Column="17" TopLine="163"/>
<Filename Value="updateform.pas"/>
<Caret Line="126" Column="40" TopLine="100"/>
</Position28>
<Position29>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="453" Column="25" TopLine="438"/>
<Filename Value="testunit.pas"/>
<Caret Line="58" Column="9" TopLine="38"/>
</Position29>
<Position30>
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<Caret Line="1" Column="1" TopLine="23"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 273
Left = 472
Height = 557
Top = 233
Top = 201
Width = 734
ActiveControl = ScriptPanel
Caption = 'THA FUKING MUFASA'
@ -104,15 +104,8 @@ object Form1: TForm1
Caption = 'ToolButton8'
Style = tbsDivider
end
object TB_Convert: TToolButton
Left = 289
Top = 2
Caption = 'TB_Convert'
Enabled = False
ImageIndex = 1
end
object TB_ReloadPlugins: TToolButton
Left = 312
Left = 289
Hint = 'Reload plugins'
Top = 2
Caption = 'TB_ReloadPlugins'
@ -120,7 +113,7 @@ object Form1: TForm1
ImageIndex = 13
end
object TB_Tray: TToolButton
Left = 335
Left = 312
Hint = 'Minimize to tray'
Top = 2
Caption = 'TB_Tray'
@ -163,6 +156,22 @@ object Form1: TForm1
Action = ActionSaveAll
Enabled = False
end
object ToolButton3: TToolButton
Left = 335
Top = 2
Width = 3
Caption = 'ToolButton3'
Style = tbsDivider
end
object UpdateButton: TToolButton
Left = 344
Hint = 'There is an Update is available'
Top = 2
Caption = 'UpdateButton'
ImageIndex = 1
Visible = False
OnClick = UpdateButtonClick
end
end
object StatusBar: TStatusBar
Left = 0
@ -406,7 +415,8 @@ object Form1: TForm1
end
end
object MainMenu1: TMainMenu
left = 528
left = 488
top = 144
object MenuFile: TMenuItem
Caption = '&File'
SubMenuImages = Mufasa_Image_List
@ -1216,7 +1226,8 @@ object Form1: TForm1
end
end
object Mufasa_Image_List: TImageList
left = 488
left = 448
top = 144
Bitmap = {
4C691B0000001000000010000000424242004242420042424200424242004242
420042424200424242004242420042424200424242004242420042424200A155
@ -2251,11 +2262,13 @@ object Form1: TForm1
}
Visible = True
OnClick = NoTray
left = 448
left = 528
top = 104
end
object TrayPopup: TPopupMenu
Images = Mufasa_Image_List
left = 568
left = 528
top = 144
object TrayStop: TMenuItem
Action = ActionStopScript
Enabled = False
@ -2324,7 +2337,8 @@ object Form1: TForm1
end
object TabPopup: TPopupMenu
Images = Mufasa_Image_List
left = 408
left = 488
top = 104
object MenuItemTabAdd: TMenuItem
Action = ActionNewTab
Bitmap.Data = {
@ -2413,7 +2427,8 @@ object Form1: TForm1
end
object ActionList: TActionList
Images = Mufasa_Image_List
left = 368
left = 448
top = 104
object ActionTabNext: TAction
Caption = 'Next tab'
OnExecute = ActionTabNextExecute
@ -2550,12 +2565,14 @@ object Form1: TForm1
end
object DebugTimer: TTimer
OnTimer = ProcessDebugStream
left = 608
left = 568
top = 104
end
object ScriptPopup: TPopupMenu
Images = Mufasa_Image_List
OnPopup = ScriptPopupPopup
left = 648
left = 568
top = 144
object PopupItemUndo: TMenuItem
Action = ActionUndo
Bitmap.Data = {
@ -2823,6 +2840,13 @@ object Form1: TForm1
Options = [frDown, frFindNext, frHideUpDown]
OnFind = dlgReplaceFind
OnReplace = dlgReplaceReplace
left = 688
left = 608
top = 104
end
object UpdateTimer: TTimer
Interval = 10000
OnTimer = UpdateTimerCheck
left = 608
top = 144
end
end

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,9 @@ uses
SynEditMiscClasses, LMessages, Buttons, PairSplitter,about, framefunctionlist,
ocr, updateform;
const
SimbaVersion = 363;
type
{ TMufasaTab }
@ -92,6 +95,9 @@ type
MenuEdit: TMenuItem;
MenuHelp: TMenuItem;
MenuExtra: TMenuItem;
UpdateTimer: TTimer;
ToolButton3: TToolButton;
UpdateButton: TToolButton;
UpdateMenuButton: TMenuItem;
MenuitemFillFunctionList: TMenuItem;
MenuItemFunctionList: TMenuItem;
@ -184,7 +190,6 @@ type
TB_PickColour: TToolButton;
TB_SelectClient: TToolButton;
ToolButton8: TToolButton;
TB_Convert: TToolButton;
MTrayIcon: TTrayIcon;
procedure ActionClearDebugExecute(Sender: TObject);
procedure ActionCloseTabExecute(Sender: TObject);
@ -266,7 +271,9 @@ type
procedure SpeedButtonSearchClick(Sender: TObject);
procedure Splitter1CanResize(Sender: TObject; var NewSize: Integer;
var Accept: Boolean);
procedure UpdateButtonClick(Sender: TObject);
procedure UpdateMenuButtonClick(Sender: TObject);
procedure UpdateTimerCheck(Sender: TObject);
private
PopupTab : integer;
SearchStart : TPoint;
@ -412,6 +419,21 @@ begin
NewSize := ScriptPanel.Width div 2
end;
procedure TForm1.UpdateButtonClick(Sender: TObject);
begin
SimbaUpdateForm.Show;
UpdateButton.Visible:=False;
end;
procedure TForm1.UpdateTimerCheck(Sender: TObject);
begin
if SimbaUpdateForm.CanUpdate then
UpdateButton.Visible:=True;
{ Only check once, at startup }
UpdateTimer.Enabled:=False;
end;
procedure TForm1.UpdateMenuButtonClick(Sender: TObject);
begin
SimbaUpdateForm.Show; { I don't see why Modal }

View File

@ -1,12 +1,13 @@
object SimbaUpdateForm: TSimbaUpdateForm
Left = 387
Left = 507
Height = 391
Top = 242
Top = 321
Width = 467
ActiveControl = UpdateButton
Caption = 'SimbaUpdateForm'
ClientHeight = 391
ClientWidth = 467
OnShow = CleanUpdateForm
LCLVersion = '0.9.29'
object DownloadProgress: TProgressBar
Left = 24
@ -19,8 +20,8 @@ object SimbaUpdateForm: TSimbaUpdateForm
end
object UpdateButton: TButton
Left = 24
Height = 25
Top = 32
Height = 40
Top = 16
Width = 413
Anchors = [akTop, akLeft, akRight]
Caption = 'Update!'
@ -49,8 +50,8 @@ object SimbaUpdateForm: TSimbaUpdateForm
end
object UpdateLog: TMemo
Left = 24
Height = 199
Top = 128
Height = 183
Top = 144
Width = 413
Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 4

View File

@ -1,20 +1,21 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TSimbaUpdateForm','FORMDATA',[
'TPF0'#16'TSimbaUpdateForm'#15'SimbaUpdateForm'#4'Left'#3#131#1#6'Height'#3
+#135#1#3'Top'#3#242#0#5'Width'#3#211#1#13'ActiveControl'#7#12'UpdateButton'#7
'TPF0'#16'TSimbaUpdateForm'#15'SimbaUpdateForm'#4'Left'#3#251#1#6'Height'#3
+#135#1#3'Top'#3'A'#1#5'Width'#3#211#1#13'ActiveControl'#7#12'UpdateButton'#7
+'Caption'#6#15'SimbaUpdateForm'#12'ClientHeight'#3#135#1#11'ClientWidth'#3
+#211#1#10'LCLVersion'#6#6'0.9.29'#0#12'TProgressBar'#16'DownloadProgress'#4
+'Left'#2#24#6'Height'#2#28#3'Top'#2'H'#5'Width'#3#157#1#7'Anchors'#11#5'akTo'
+'p'#6'akLeft'#7'akRight'#0#6'Smooth'#9#8'TabOrder'#2#0#0#0#7'TButton'#12'Upd'
+'ateButton'#4'Left'#2#24#6'Height'#2#25#3'Top'#2' '#5'Width'#3#157#1#7'Ancho'
+'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#7'Update!'#7'OnClick'#7
+#17'UpdateButtonClick'#8'TabOrder'#2#1#0#0#7'TButton'#8'OkButton'#4'Left'#3
+'j'#1#6'Height'#2#25#3'Top'#3'X'#1#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
+'akBottom'#0#7'Caption'#6#2'Ok'#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2
+#2#0#0#7'TButton'#12'CancelButton'#4'Left'#2#24#6'Height'#2#25#3'Top'#3'X'#1
+#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'Cancel'#7
+'OnClick'#7#17'CancelButtonClick'#8'TabOrder'#2#3#0#0#5'TMemo'#9'UpdateLog'#4
+'Left'#2#24#6'Height'#3#199#0#3'Top'#3#128#0#5'Width'#3#157#1#7'Anchors'#11#5
+'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabOrder'#2#4#0#0#0
+#211#1#6'OnShow'#7#15'CleanUpdateForm'#10'LCLVersion'#6#6'0.9.29'#0#12'TProg'
+'ressBar'#16'DownloadProgress'#4'Left'#2#24#6'Height'#2#28#3'Top'#2'H'#5'Wid'
+'th'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#6'Smooth'#9#8'Tab'
+'Order'#2#0#0#0#7'TButton'#12'UpdateButton'#4'Left'#2#24#6'Height'#2'('#3'To'
+'p'#2#16#5'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Ca'
+'ption'#6#7'Update!'#7'OnClick'#7#17'UpdateButtonClick'#8'TabOrder'#2#1#0#0#7
+'TButton'#8'OkButton'#4'Left'#3'j'#1#6'Height'#2#25#3'Top'#3'X'#1#5'Width'#2
+'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#2'Ok'#7'OnClick'#7#13
+'OkButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#12'CancelButton'#4'Left'#2#24
+#6'Height'#2#25#3'Top'#3'X'#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBott'
+'om'#0#7'Caption'#6#6'Cancel'#7'OnClick'#7#17'CancelButtonClick'#8'TabOrder'
+#2#3#0#0#5'TMemo'#9'UpdateLog'#4'Left'#2#24#6'Height'#3#183#0#3'Top'#3#144#0
+#5'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8
+'TabOrder'#2#4#0#0#0
]);

View File

@ -19,16 +19,21 @@ type
CancelButton: TButton;
DownloadProgress: TProgressBar;
procedure CancelButtonClick(Sender: TObject);
procedure CleanUpdateForm(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure UpdateButtonClick(Sender: TObject);
function CanUpdate: Boolean;
private
{ private declarations }
Updater: TMMLFileDownloader;
FCancelling: Boolean;
FSimbaVersion: Integer;
private
function OnUpdateBeat: Boolean;
function GetLatestSimbaVersion: Integer;
public
{ public declarations }
procedure PerformUpdate;
@ -41,6 +46,23 @@ var
implementation
uses
internets, TestUnit;
function TSimbaUpdateForm.CanUpdate: Boolean;
begin
GetLatestSimbaVersion;
Writeln('Latest Simba Version: ' + IntToStr(FSimbaVersion));
Exit(testunit.SimbaVersion < FSimbaVersion);
end;
function TSimbaUpdateForm.GetLatestSimbaVersion: Integer;
begin
FSimbaVersion := StrToIntDef(Trim(GetPage('http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF} + '.version')), -1);
Exit(FSimbaVersion);
end;
procedure TSimbaUpdateForm.UpdateButtonClick(Sender: TObject);
begin
Self.PerformUpdate;
@ -58,6 +80,13 @@ begin
end;
end;
procedure TSimbaUpdateForm.CleanUpdateForm(Sender: TObject);
begin
Self.DownloadProgress.Position:=0;
Self.UpdateLog.Clear;
Self.UpdateLog.Lines.Add('---------- Update Session ----------');
end;
procedure TSimbaUpdateForm.OkButtonClick(Sender: TObject);
begin
Self.ModalResult:=mrOK;
@ -88,11 +117,12 @@ begin
// Make this a setting later
Updater.FileURL := 'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF};
// Dynamic
//ApplicationName{$IFDEF WINDOWS} +'.exe'{$ENDIF};
Updater.ReplacementFile := ApplicationName{$IFDEF WINDOWS} +'.exe'{$ENDIF};
// Should work on Windows as well
Updater.ReplacementFile := ExtractFileName(Application.ExeName);
Updater.OnBeat := @Self.OnUpdateBeat;
Updater.BasePath := ExtractFilePath(Application.ExeName);
Self.UpdateLog.Lines.Add('Starting download of ' + Updater.FileURL + ' ...');
try

View File

@ -23,6 +23,7 @@ type
TMMLFileDownloader = class(TObject)
private
FFileURL: String;
FBasePath: String;
FReplacementFile: String;
FTotal: Integer;
HTTPSend: THTTPSend;
@ -30,6 +31,8 @@ type
FDownloaded: Boolean;
FOnChange: TMMLFunctionBoolean;
FOnBeat: TMMLFunctionBoolean;
private
procedure SetBasePath(s: string);
public
constructor Create;
@ -53,6 +56,8 @@ type
{ Return true if we have downloaded the file completely }
property Downloaded: Boolean read FDownloaded;
property BasePath: String read FBasePath write SetBasePath;
{ If either of these events return "True", an exception is thrown
and the download is cancelled. This way we can easily `cancel'
a download. }
@ -78,7 +83,15 @@ type
implementation
uses
strings;
procedure TMMLFileDownloader.SetBasePath(s: string);
begin
if s[length(s) - 1] <> DirectorySeparator then
s := s + DirectorySeparator;
FBasePath:=s;
end;
procedure TMMLFileDownloader.TryToGetFileSize;
var
@ -155,7 +168,7 @@ begin
if FileURL = '' then
raise Exception.Create('FileURL not set');
Response := TFileStream.Create(FReplacementFile + '_', fmCreate);
Response := TFileStream.Create(FBasePath + FReplacementFile + '_', fmCreate);
try
Result := HTTPSend.HTTPMethod('GET', FileURL);
@ -190,23 +203,23 @@ begin
exit(False);
//raise Exception.Create('ReplacementFile not set');
end;
if not FileExists(FReplacementFile) then
if not FileExists(FBasePath + FReplacementFile) then
begin
writeln('ReplacementFile not found');
exit(False);
//raise Exception.Create('ReplacementFile not found');
end;
if not FileExists(FReplacementFile+ '_') then
if not FileExists(FBasePath + FReplacementFile+ '_') then
begin
writeln('ReplacementFile + _ not found');
exit(False);
//raise Exception.Create('ReplacementFile + _ not found');
end;
RenameFile(FReplacementFile, FReplacementFile+'_old_');
RenameFile(FReplacementFile+'_', FReplacementFile);
DeleteFile(FReplacementFile+'_old_');
RenameFile(FBasePath + FReplacementFile, FBasePath + FReplacementFile+'_old_');
RenameFile(FBasePath + FReplacementFile +'_', FBasePath + FReplacementFile);
DeleteFile(FBasePath + FReplacementFile+'_old_');
{$IFDEF LINUX}
Chmod(FReplacementFile, PermissionBits[0] or PermissionBits[1] or PermissionBits[2]);
Chmod(FBasePath + FReplacementFile, PermissionBits[0] or PermissionBits[1] or PermissionBits[2]);
{$ENDIF}
end;
@ -219,6 +232,7 @@ begin
FDownloaded := False;
FReplacementFile:='';
FFileURL := '';
FBasePath:= '';
FOnChange := nil;
FOnBeat := nil;
end;