Skip to content

Commit 98e51d6

Browse files
committed
EKeyfinder v0.1 Beta 3 release
Finished implementing software update feature. git-svn-id: svn://svn.code.sf.net/p/ekeyfinder/code/trunk@32 b14f650f-2e60-4330-827c-04cc947f8aee
1 parent 544204f commit 98e51d6

File tree

5 files changed

+69
-59
lines changed

5 files changed

+69
-59
lines changed

Main.dfm

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ object Form1: TForm1
22
Left = 0
33
Top = 0
44
Caption = 'Enchanted Keyfinder v'
5-
ClientHeight = 661
5+
ClientHeight = 681
66
ClientWidth = 632
77
Color = clWhite
88
TransparentColorValue = clFuchsia
@@ -27,15 +27,15 @@ object Form1: TForm1
2727
Left = 230
2828
Top = 0
2929
Width = 2
30-
Height = 642
30+
Height = 662
3131
ExplicitLeft = 241
3232
ExplicitHeight = 250
3333
end
3434
object ListBox1: TListBox
3535
Left = 0
3636
Top = 0
3737
Width = 230
38-
Height = 642
38+
Height = 662
3939
Align = alLeft
4040
BiDiMode = bdLeftToRight
4141
Constraints.MinWidth = 100
@@ -54,12 +54,13 @@ object Form1: TForm1
5454
ShowHint = False
5555
TabOrder = 0
5656
OnClick = ListBox1Click
57+
ExplicitHeight = 642
5758
end
5859
object Memo1: TMemo
5960
Left = 232
6061
Top = 0
6162
Width = 400
62-
Height = 642
63+
Height = 662
6364
Align = alClient
6465
Constraints.MinHeight = 100
6566
Constraints.MinWidth = 100
@@ -71,10 +72,11 @@ object Form1: TForm1
7172
ParentFont = False
7273
ReadOnly = True
7374
TabOrder = 1
75+
ExplicitHeight = 642
7476
end
7577
object StatusBar1: TStatusBar
7678
Left = 0
77-
Top = 642
79+
Top = 662
7880
Width = 632
7981
Height = 19
8082
Panels = <
@@ -87,12 +89,13 @@ object Form1: TForm1
8789
item
8890
Width = 50
8991
end>
92+
ExplicitTop = 642
9093
end
9194
object RefreshPanel: TPanel
9295
Left = 232
9396
Top = 0
9497
Width = 400
95-
Height = 642
98+
Height = 662
9699
Align = alClient
97100
Ctl3D = True
98101
Font.Charset = DEFAULT_CHARSET
@@ -105,6 +108,7 @@ object Form1: TForm1
105108
ParentFont = False
106109
TabOrder = 5
107110
Visible = False
111+
ExplicitHeight = 642
108112
object lblRefresh: TLabel
109113
Left = 88
110114
Top = 50
@@ -123,7 +127,7 @@ object Form1: TForm1
123127
Left = 232
124128
Top = 0
125129
Width = 400
126-
Height = 642
130+
Height = 662
127131
Align = alClient
128132
Ctl3D = True
129133
Font.Charset = DEFAULT_CHARSET
@@ -137,6 +141,7 @@ object Form1: TForm1
137141
TabOrder = 4
138142
Visible = False
139143
OnClick = Panel1Click
144+
ExplicitHeight = 642
140145
object lblVersion: TLabel
141146
Left = 30
142147
Top = 300

Main.pas

Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,15 @@ TForm1 = class(TForm)
180180
bWin2k, bWinXP, bVista, bWinNT4: boolean;
181181

182182
const
183-
kfVersion = '0.1 Beta 2';
184-
kfDate = 'January 18th, 2011';
183+
kfVersion = '0.1 Beta 3';
184+
kfDate = 'January 20th, 2011';
185185
DefDelimCSV = ',';
186186
DefLogPath = '.';
187187
KEY_WOW64_64KEY = $0100;
188188

189189
SE_PRIVILEGE_DISABLED = 0;
190190
SE_RESTORE_NAME = 'SeRestorePrivilege';
191+
sLineBreak = {$IFDEF LINUX} AnsiChar(#10) {$ENDIF} {$IFDEF MSWINDOWS} AnsiString(#13#10) {$ENDIF};
191192

192193
function IsWow64: boolean;
193194
function BrowseForFolder(var Foldr: string; const Title: string): boolean;
@@ -206,7 +207,7 @@ implementation
206207

207208
uses
208209
CommDlg, Dlgs, ShlObj, license, options, registration, remote, WinXPKey,
209-
update;
210+
update, ActnList;
210211

211212
resourcestring
212213
rsSetPrivUserNotHaveAccess = 'The current user does not have the required ' +
@@ -2117,14 +2118,14 @@ function DoDownload(const rFile: string;const lFile: string): Boolean;
21172118
//downloader.OnDownloadProgress := Form6.URL_OnDownloadProgress;
21182119
try
21192120
ExecuteTarget(nil);
2121+
//Execute
2122+
//ExecuteAction(Execute);
21202123
except
21212124
on E : Exception do
21222125
begin
21232126
ShowMessage(E.Message);
21242127
Result := False;
21252128
end;
2126-
//MessageDlg('Can''t read keyfinder.cfg. Error: ' + E.Message, mtError, [mbOK], 0);
2127-
//Result := False;
21282129
end;
21292130
finally
21302131
Free;
@@ -2133,77 +2134,79 @@ function DoDownload(const rFile: string;const lFile: string): Boolean;
21332134

21342135
procedure TForm1.MnuItmWebUpdateClick(Sender: TObject);
21352136
var
2136-
test : Boolean;
2137-
CFGVer : string;
2138-
newCFG : string;
2139-
newVersion : string;
2137+
kfUpdate, cfgUpdate : Boolean;
2138+
CFGVer, newCFG, newVersion, kfURL, cfgURL, Section : string;
21402139
myINI: TINIFile;
2141-
kfURL : string
2140+
21422141
begin
21432142
//future update dialog
21442143
//ShellExecute(Handle, nil, PChar('http://sourceforge.net/project/platformdownload.php?group_id=222327'), nil, nil, SW_NORMAL);
21452144
//Form6.Visible := True;
21462145
//Form1.Enabled := False;
21472146

2148-
{var
2149-
myINI: TINIFile;
2150-
begin
2151-
try
2152-
myINI := TINIFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
2153-
myINI.WriteString('Settings', 'LogFilePath', sLogFilePath);
2154-
myINI.WriteBool('Settings', 'Logging', bLogging);
2155-
myINI.WriteString('Settings', 'CSVDelim', sDelimCSV);
2156-
myINI.WriteBool('Settings', 'AppendTop', bAppendTop);
2157-
myINI.WriteBool('Settings', 'AutoSave', bAutoSave);
2158-
myINI.WriteBool('Settings', 'LoadHive', bAutoHive);
2159-
myINI.WriteBool('Settings', 'LogOverwrite', bLogOverwrite);
2160-
myINI.WriteBool('Settings', 'PrintKeys', bToBePrinted);
2161-
myINI.WriteString('Settings', 'SavePath', sAutoSaveDir);
2162-
myINI.WriteString('Settings', 'ReportsPath', sReportsPath);
2163-
myINI.WriteString('Settings', 'UserHivePath', sUserHivePath);
2164-
myINI.WriteString('Settings', 'SoftwareHivePath', sSoftwareHivePath);
2165-
SaveFont(myINI, 'AppListFont', Form1.ListBox1.Font);
2166-
SaveFont(myINI, 'KeyListFont', Form1.Memo1.Font);
2167-
myINI.UpdateFile;
2168-
finally
2169-
myINI.Free;
2170-
end;}
2171-
21722147
//Temporary update dialog
21732148
//yes=6 and no=7
21742149
if MessageDlg('This will connect to the internet to check for any Keyfinder or cfg updates. Do you want to continue?', mtConfirmation , [mbYes,mbNo], 0) = 6 then
21752150
begin
2151+
kfUpdate := False;
2152+
cfgUpdate := False;
2153+
21762154
//download update.ini to parse version information
21772155
if not DoDownload('http://keyfinder.sourceforge.net/update.ini',GetTempDirectory + 'update.ini') then
21782156
Exit;
21792157
try
2158+
Section := 'Update Software';
21802159
myINI := TINIFile.Create(GetTempDirectory + 'update.ini');
2181-
myINI.ReadString('Update Software','CurrentVersion');
2160+
newVersion := myINI.ReadString(Section,'CurrentVersion','');
2161+
kfURL := myINI.ReadString(Section,'URL','');
2162+
newCFG := myINI.ReadString(Section,'ConfigVersion','');
2163+
cfgURL := myINI.ReadString(Section,'ConfigPath','');
2164+
CFGVer := RightStr(sCFGVer,Length(sCFGVer) - Pos(' ',sCFGVer));
2165+
CFGVer := RightStr(CFGVer,Length(CFGVer) - Pos(' ',CFGVer));
21822166
finally
21832167
myINI.Free;
21842168
end;
21852169

2170+
//Enchanted Keyfinder update check
2171+
if not (newVersion = kfVersion) then
2172+
begin
2173+
if MessageDlg('There is a new version of Keyfinder: v' + newVersion + sLineBreak + 'Do you want to visit the download page?', mtConfirmation , [mbYes,mbNo], 0) = 6 then
2174+
ShellExecute(Handle, nil, PChar(kfURL), nil, nil, SW_NORMAL);
2175+
kfUpdate := True;
2176+
end;
2177+
21862178

2187-
//keyfinder.cfg update
2179+
//keyfinder.cfg update check
21882180
if not FileExists(ExtractFilePath(Application.ExeName) + 'keyfinder.cfg') then
21892181
begin
2190-
if MessageDlg('You don''t appear to have a keyfinder.cfg file. This will allow you to detect the keys of more software. Do you want the latest version?', mtConfirmation , [mbYes,mbNo], 0) = 6 then
2191-
if DoDownload('http://keyfinder.sourceforge.net/keyfinder.cfg',ExtractFilePath(Application.ExeName) + 'keyfinder.cfg') then
2182+
if MessageDlg('You don''t appear to have a keyfinder.cfg file. This will allow you to detect the keys of more software.' + sLineBreak + 'Do you want the latest version?', mtConfirmation , [mbYes,mbNo], 0) = 6 then
2183+
if DoDownload(cfgURL,ExtractFilePath(Application.ExeName) + 'keyfinder.cfg') then
21922184
begin
21932185
MessageDlg( 'Success!' , mtInformation , [mbOK], 0);
21942186
Refresh1Click(nil);
2195-
end
2196-
else
2197-
MessageDlg( 'fail' , mtInformation , [mbOK], 0);
2187+
end;
2188+
cfgUpdate := True;
2189+
end
2190+
else if not (CFGVer = newCFG) then
2191+
begin
2192+
if MessageDlg('There is a new version of keyfinder.cfg: ' + newCFG + ' This will allow you to detect the keys of more software.' + sLineBreak + 'Do you want the latest version?', mtConfirmation , [mbYes,mbNo], 0) = 6 then
2193+
if DoDownload(cfgURL,ExtractFilePath(Application.ExeName) + 'keyfinder.cfg') then
2194+
begin
2195+
MessageDlg( 'Success!' , mtInformation , [mbOK], 0);
2196+
Refresh1Click(nil);
2197+
end;
2198+
cfgUpdate := True;
2199+
end
2200+
else
2201+
begin
2202+
if kfUpdate then
2203+
MessageDlg( 'You have the latest keyfinder.cfg.' , mtInformation , [mbOK], 0);
21982204
end;
2199-
{i := Pos(' ', CurrentLine);
2200-
s := TrimRight(RightStr(CurrentLine, Length(CurrentLine) - i));
2201-
i := Pos(' ', s) + 1;
2202-
CurrentLine := TrimRight(LeftStr(s, +i));}
2203-
CFGVer := RightStr(sCFGVer,Length(sCFGVer) - Pos(' ',sCFGVer));
2204-
CFGVer := RightStr(CFGVer,Length(CFGVer) - Pos(' ',CFGVer));
22052205

2206-
MessageDlg( CFGVer , mtInformation , [mbOK], 0);
2206+
if not (kfUpdate or cfgUpdate) then
2207+
MessageDlg( 'Nothing to update.' , mtInformation , [mbOK], 0);
2208+
if FileExists(GetTempDirectory + 'update.ini') then
2209+
DeleteFile( PChar(GetTempDirectory + 'update.ini') );
22072210
end;
22082211

22092212

changelog.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Enchanted Keyfinder (EK) Changelog
2-
Build 0.1.0.142 Beta 2 -- January 18th, 2011
2+
Build 0.1.0.209 Beta 3 -- January 20th, 2011
33
----------------------------------
4-
x. Added icons to the menus
4+
1. Added icons to the menus.
5+
2. Implmented online updates to ease the process of checking for a new
6+
version.
57

68
Build 0.1.0.142 Beta 2 -- January 18th, 2011
79
----------------------------------

keyfinder.bdsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
<VersionInfo Name="MajorVer">0</VersionInfo>
151151
<VersionInfo Name="MinorVer">1</VersionInfo>
152152
<VersionInfo Name="Release">0</VersionInfo>
153-
<VersionInfo Name="Build">203</VersionInfo>
153+
<VersionInfo Name="Build">210</VersionInfo>
154154
<VersionInfo Name="Debug">False</VersionInfo>
155155
<VersionInfo Name="PreRelease">True</VersionInfo>
156156
<VersionInfo Name="Special">False</VersionInfo>
@@ -162,7 +162,7 @@
162162
<VersionInfoKeys>
163163
<VersionInfoKeys Name="CompanyName">Enchanted Keyfinder Project</VersionInfoKeys>
164164
<VersionInfoKeys Name="FileDescription">Enchanted Keyfinder</VersionInfoKeys>
165-
<VersionInfoKeys Name="FileVersion">0.1.0.203</VersionInfoKeys>
165+
<VersionInfoKeys Name="FileVersion">0.1.0.210</VersionInfoKeys>
166166
<VersionInfoKeys Name="InternalName">keyfinder</VersionInfoKeys>
167167
<VersionInfoKeys Name="LegalCopyright">GPL</VersionInfoKeys>
168168
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>

keyfinder.res

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)