1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 10:42:20 -05:00

Last version for the old update system. + small getpage fix.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@544 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-02-21 19:36:35 +00:00
parent f3deb2e79b
commit 1b53ece9c6
3 changed files with 65 additions and 39 deletions

View File

@ -43,7 +43,7 @@ uses
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings; ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
const const
SimbaVersion = 538; SimbaVersion = 544;
type type
@ -1681,10 +1681,14 @@ end;
procedure TForm1.NewsTimerTimer(Sender: TObject); procedure TForm1.NewsTimerTimer(Sender: TObject);
var var
s: String; s: String;
News : TStringList; {Need it for correct EOL stuff}
begin begin
NewsTimer.Enabled:=False; NewsTimer.Enabled:=False;
s := GetSimbaNews; s := GetSimbaNews;
Memo1.Append(s); News := TStringList.Create;
News.Text:= s;
Memo1.Lines.AddStrings(News);
News.free;
end; end;
procedure TForm1.OnLinePSScript(Sender: TObject); procedure TForm1.OnLinePSScript(Sender: TObject);

View File

@ -65,10 +65,26 @@ var
SimbaUpdateForm: TSimbaUpdateForm; SimbaUpdateForm: TSimbaUpdateForm;
implementation implementation
uses uses
internets, TestUnit, simbasettings,lclintf; internets, TestUnit, simbasettings,lclintf;
const
SimbaURL = {$IFDEF WINDOWS}
{$IFDEF CPUI386}
'http://simba.villavu.com/bin/Windows/x86/Stable/'
{$ELSE}
'http://simba.villavu.com/bin/Windows/x86_64/Stable/'
{$ENDIF}
{$ELSE}
{$IFDEF CPUI386}
'http://simba.villavu.com/bin/Linux/x86/Stable/'
{$ELSE}
'http://simba.villavu.com/bin/Linux/x86_64/Stable/'
{$ENDIF}
{$ENDIF};
function TSimbaUpdateForm.CanUpdate: Boolean; function TSimbaUpdateForm.CanUpdate: Boolean;
begin begin
GetLatestSimbaVersion; GetLatestSimbaVersion;
@ -83,24 +99,10 @@ begin
if SimbaVersionThread = nil then//Create thread (only if no-other one is already running) if SimbaVersionThread = nil then//Create thread (only if no-other one is already running)
begin begin
SimbaVersionThread := TSimbaVersionThread.Create(true); SimbaVersionThread := TSimbaVersionThread.Create(true);
SettingsForm.Settings.CreateKey('Settings/Updater/RemoteVersionLink',true);
SettingsForm.Settings.SetKeyValue('Settings/Updater/RemoteVersionLink',SimbaURL + 'Version');
SimbaVersionThread.InputURL := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists( SimbaVersionThread.InputURL := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Updater/RemoteVersionLink', 'Settings/Updater/RemoteVersionLink',SimbaURL + 'Version',SimbaSettingsFile);
{$IFDEF WINDOWS}
{$IFDEF CPUI386}
'http://simba.villavu.com/bin/Windows/x86/Stable/Version'
{$ELSE}
'http://simba.villavu.com/bin/Windows/x86_64/Stable/Version'
{$ENDIF}
{$ELSE}
{$IFDEF CPUI386}
'http://simba.villavu.com/bin/Linux/x86/Stable/Version'
{$ELSE}
'http://simba.villavu.com/bin/Linux/x86_64/Stable/Version'
{$ENDIF}
{$ENDIF}
, SimbaSettingsFile);
SimbaVersionThread.Resume; SimbaVersionThread.Resume;
while SimbaVersionThread.Done = false do//Wait till thread is done while SimbaVersionThread.Done = false do//Wait till thread is done
begin begin
@ -195,9 +197,12 @@ begin
FCancelling := False; FCancelling := False;
FCancelled := False; FCancelled := False;
SettingsForm.Settings.CreateKey('Settings/Updater/RemoteLink',true);
SettingsForm.Settings.SetKeyValue('Settings/Updater/RemoteLink',SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF});
Updater.FileURL := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists( Updater.FileURL := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Updater/RemoteLink', 'Settings/Updater/RemoteLink',
'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF}, SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF},
SimbaSettingsFile SimbaSettingsFile
); );

View File

@ -50,12 +50,19 @@ uses
{ OTHER } { OTHER }
function GetPage(URL: String): String; function GetPage(URL: String): String;
var var
s: TStringList; HTTP : THTTPSend;
begin begin;
s:=TStringList.Create; HTTP := THTTPSend.Create;
HttpGetText(URL, s); Result := '';
result := s.Text; try
s.Free; if HTTP.HTTPMethod('GET', URL) then
begin
SetLength(result,HTTP.Document.Size);
HTTP.Document.Read(result[1],length(result));
end;
finally
HTTP.Free;
end;
end; end;
{ TMInternet } { TMInternet }
@ -125,12 +132,17 @@ begin
if not fHandleCookies then if not fHandleCookies then
HTTPSend.Cookies.Clear; HTTPSend.Cookies.Clear;
HTTPSend.MimeType := 'text/html'; HTTPSend.MimeType := 'text/html';
if HTTPSend.HTTPMethod('GET',url) then try
begin; if HTTPSend.HTTPMethod('GET',url) then
SetLength(result,HTTPSend.Document.Size); begin;
HTTPSend.Document.Read(result[1],length(result)); SetLength(result,HTTPSend.Document.Size);
end else HTTPSend.Document.Read(result[1],length(result));
result := ''; end else
result := '';
except
on e : exception do
Writeln('THTTPClient error: ' + e.message);
end;
end; end;
function THTTPClient.PostHTTPPage(Url: string; PostData: string): string; function THTTPClient.PostHTTPPage(Url: string; PostData: string): string;
@ -138,12 +150,17 @@ begin
HTTPSend.MimeType := 'application/x-www-form-urlencoded'; HTTPSend.MimeType := 'application/x-www-form-urlencoded';
HTTPSend.Document.Clear; HTTPSend.Document.Clear;
HTTPSend.Document.Write(Postdata[1],length(postdata)); HTTPSend.Document.Write(Postdata[1],length(postdata));
if HTTPSend.HTTPMethod('POST',url) then try
begin; if HTTPSend.HTTPMethod('POST',url) then
SetLength(result,HTTPSend.Document.Size); begin;
HTTPSend.Document.Read(result[1],Length(result)); SetLength(result,HTTPSend.Document.Size);
end else HTTPSend.Document.Read(result[1],Length(result));
result := ''; end else
result := '';
except
on e : exception do
Writeln('THTTPClient error: ' + e.message);
end;
end; end;
function THTTPClient.PostHTTPPage(Url: string): string; function THTTPClient.PostHTTPPage(Url: string): string;