1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-21 16:55:01 -05:00

Simba: Patch 2 (out of 2) for Paster extension.

By Dgby714
This commit is contained in:
Merlijn Wajer 2010-09-26 12:57:34 +02:00
parent b980641a64
commit eef83f6457
2 changed files with 27 additions and 0 deletions

View File

@ -66,6 +66,7 @@ uses
tpa, //Tpa stuff
SynRegExpr,
lclintf,
httpsend,
SimbaUnit,updateform, mmisc, mmlpsthread; // for GetTickCount and others.//Writeln
{$ifdef Linux}
@ -183,6 +184,7 @@ begin
AddFunction(@ext_InputQuery,'function InputQuery(const ACaption, APrompt : String; var Value : String) : Boolean;');
AddFunction(@ext_ScriptText,'function ScriptText: string;');
AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox');
AddFunction(@ext_GetPageEx,'function GetPageEx(const URL, PostData, MimeType: string): string;');
AddRegisteredVariable('Simba','TForm');
AddRegisteredVariable('Simba_MainMenu','TMainMenu');
AddRegisteredVariable('Client','TClient');

View File

@ -128,3 +128,28 @@ begin
Result := SimbaForm.CurrScript.SynEdit.Lines.Text;
Result := ReplaceRegExpr('Players\[(.*?)\]\.([N|n][A|a][M|m][E|e]|[P|p][A|a][S|s]{2}|[P|p][I|i][N|n])\s*\:\=\s*\''.*?\'';', Result, 'Players[$1].$2 := ''*********'';', True);
end;
function ext_GetPageEx(const URL, PostData, MimeType: string): string;
var
HTTPSend: THTTPSend;
begin
HTTPSend := THTTPSend.Create;
try
HTTPSend.MimeType := MimeType;
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
mDebugLn('Exception in GetPage in Extensions: ' + e.message);
end;
finally
HTTPSend.Free;
end;
end;