1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 18:52:15 -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;
const
SimbaVersion = 538;
SimbaVersion = 544;
type
@ -1681,10 +1681,14 @@ end;
procedure TForm1.NewsTimerTimer(Sender: TObject);
var
s: String;
News : TStringList; {Need it for correct EOL stuff}
begin
NewsTimer.Enabled:=False;
s := GetSimbaNews;
Memo1.Append(s);
News := TStringList.Create;
News.Text:= s;
Memo1.Lines.AddStrings(News);
News.free;
end;
procedure TForm1.OnLinePSScript(Sender: TObject);

View File

@ -65,10 +65,26 @@ var
SimbaUpdateForm: TSimbaUpdateForm;
implementation
uses
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;
begin
GetLatestSimbaVersion;
@ -83,24 +99,10 @@ begin
if SimbaVersionThread = nil then//Create thread (only if no-other one is already running)
begin
SimbaVersionThread := TSimbaVersionThread.Create(true);
SettingsForm.Settings.CreateKey('Settings/Updater/RemoteVersionLink',true);
SettingsForm.Settings.SetKeyValue('Settings/Updater/RemoteVersionLink',SimbaURL + 'Version');
SimbaVersionThread.InputURL := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Updater/RemoteVersionLink',
{$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);
'Settings/Updater/RemoteVersionLink',SimbaURL + 'Version',SimbaSettingsFile);
SimbaVersionThread.Resume;
while SimbaVersionThread.Done = false do//Wait till thread is done
begin
@ -195,9 +197,12 @@ begin
FCancelling := 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(
'Settings/Updater/RemoteLink',
'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF},
SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF},
SimbaSettingsFile
);

View File

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