Merge branch 'master' of ssh://villavu.com:54367/simba

This commit is contained in:
Cazax 2010-07-22 20:45:40 -04:00
commit 6b34a9d108
11 changed files with 1599 additions and 75 deletions

View File

@ -702,7 +702,7 @@ begin
begin
mdtm := SDTMToMDTM(toSDTM);
WriteLn('');
WriteLn(mdtm.ToString);
WriteLn('DTM := DTMFromString(''' + mdtm.ToString + ''');');
WriteLn('');
mdtm.Free;
end;

View File

@ -38,10 +38,10 @@ var
DeContents : string;
Failed : boolean;
begin
Memo.Lines.Add('Downloading Reflection...');
Memo.Lines.Add('Downloading Reflection...');
Contents := GetPage('http://wizzup.org/static/srl/srlref.tar.bz2');
Failed := True;
Memo.Lines.Add('Uncompressing Reflection...');
Memo.Lines.Add('Uncompressing Reflection...');
if DecompressBZip2(Contents,DeContents,4096) then
if UnTarEx(DeContents,IncludePath,true) then
Failed := False;
@ -77,9 +77,6 @@ begin
Exit;
Updating := True;
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
if (LocalR < OnlineR) then
begin
case MessageDlg('Reflection Updater', 'Updates are available. '+
@ -98,7 +95,6 @@ begin
f.ShowModal;
end else
begin
MessageDlg('Reflection Updater', 'No Reflection update' ,mtConfirmation, [mbYes],0);
writeln('No Reflection update');
end;
@ -132,12 +128,20 @@ end;
procedure OnReflectionUpdateClick(Sender: TObject);
begin
Update;
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
if (OnlineR <= LocalR) then
MessageDlg('Reflection Updater', 'No Reflection update' ,mtConfirmation, [mbYes],0)
else
Update;
end;
procedure OnUpdateTimer(Sender: TObject);
begin;
Timer.Interval := 30 * 60 * 1000; //Every half hour
GetLocalVersion(LocalR);
GetOnlineVersion(OnlineR);
Update;
end;

1446
Extensions/security.sex Normal file

File diff suppressed because it is too large Load Diff

View File

@ -65,15 +65,15 @@ begin
Failed := not UnTarEx(DeContents,PluginPath,false);
end;
if Failed then
begin
begin
Writeln('Failed to update the plugins');
Memo.Lines.Add('Failed to update the plugins');
end
Memo.Lines.Add('Failed to update the plugins');
end
else
begin
begin
Writeln('Succesfully updated your plugins.');
Memo.Lines.Add('Succesfully updated your plugins.');
end;
Memo.Lines.Add('Succesfully updated your plugins.');
end;
DeContents := '';
Contents := '';
Result := Failed;
@ -87,10 +87,10 @@ var
DeContents : string;
Failed : boolean;
begin
Memo.Lines.Add('Downloading SRL...');
Memo.Lines.Add('Downloading SRL...');
Contents := GetPage('http://wizzup.org/static/srl/srl.tar.bz2');
Failed := True;
Memo.Lines.Add('Uncompressing SRL...');
Memo.Lines.Add('Uncompressing SRL...');
if DecompressBZip2(Contents,DeContents,4096) then
if UnTarEx(DeContents,IncludePath,true) then
Failed := False;
@ -99,10 +99,10 @@ begin
if Result then
Result := Failed;
if not Failed then
begin
Memo.Lines.Add('Succesfully updated your SRL!');
begin
Memo.Lines.Add('Succesfully updated your SRL!');
Writeln('Succesfully updated your SRL!');
end;
end;
end;
procedure DoUpdate(Sender: TObject);
@ -132,18 +132,16 @@ begin
Exit;
Updating := True;
GetLocalVersion(LocalP,LocalS);
GetOnlineVersion(OnlineP,OnlineS);
if (LocalP < OnlineP) or (LocalS < OnlineS) then
begin
case MessageDlg('SRL Updater', 'Updates are available. '+
'Do you want to open the Updater now?',
mtConfirmation, [mbNo,mbYes],0) of
mrYes : OpenForm := True;
else
OpenForm := False;
end;
case MessageDlg('SRL Updater', 'Updates are available. '+
'Do you want to open the Updater now?',
mtConfirmation, [mbNo,mbYes],0) of
mrYes : OpenForm := True;
else
OpenForm := False;
end;
if not OpenForm then
begin
Updating := False;
@ -153,7 +151,6 @@ begin
f.ShowModal;
end else
begin
MessageDlg('SRL Updater', 'No SRL update / Plugins update available!' ,mtConfirmation, [mbYes],0);
writeln('No SRL update / Plugins update available!');
end;
@ -183,14 +180,22 @@ begin
else
Settings.SetKeyValue('AutoUpdate', 'True');
end;
procedure OnSRLUpdateClick(Sender: TObject);
begin
Update;
GetLocalVersion(LocalP,LocalS);
GetOnlineVersion(OnlineP,OnlineS);
if (OnlineP <= LocalP) and (OnlineS <= LocalS) then
MessageDlg('SRL Updater', 'No SRL update / Plugins update available!', mtConfirmation, [mbYes], 0)
else
Update;
end;
procedure OnUpdateTimer(Sender: TObject);
begin;
Timer.Interval := 30 * 60 * 1000; //Every half hour
GetLocalVersion(LocalP,LocalS);
GetOnlineVersion(OnlineP,OnlineS);
Update;
end;
@ -289,4 +294,4 @@ begin;
result := '1.0';
end;
begin
end.
end.

View File

@ -7,7 +7,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{524C9B9A-B57F-4FEC-89BE-292202EBA44D}
AppName=Simba
AppVerName=Simba Release Candidate
AppVerName=Simba Release Candidate 2
AppPublisherURL=http://simba.villavu.com/
AppSupportURL=http://simba.villavu.com/
AppUpdatesURL=http://simba.villavu.com/
@ -38,6 +38,7 @@ Source: "C:\Simba\Extensions\srl.sex"; DestDir: "{app}\Extensions"; Flags: ignor
Source: "C:\Simba\Extensions\associate.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\dtm_editor.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\reflection.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Extensions\security.sex"; DestDir: "{app}\Extensions"; Flags: ignoreversion
Source: "C:\Simba\Includes\mml.simba"; DestDir: "{app}\Includes"; Flags: ignoreversion
Source: "C:\Simba\Fonts\*"; DestDir: "{app}\Fonts"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Simba\Tests\PS\*"; DestDir:"{app}\Scripts\Tests"; Flags: ignoreversion

View File

@ -1,18 +1,18 @@
object Form1: TForm1
Left = 478
Height = 556
Top = 156
Width = 556
Left = 544
Height = 615
Top = 169
Width = 554
Anchors = [akTop, akLeft, akRight]
Caption = 'Form1'
ClientHeight = 556
ClientWidth = 556
ClientHeight = 615
ClientWidth = 554
OnCreate = FormCreate
LCLVersion = '0.9.29'
object ListView1: TListView
Left = 16
Height = 520
Top = 16
Height = 512
Top = 8
Width = 232
Anchors = [akTop, akLeft, akBottom]
Columns = <
@ -41,15 +41,65 @@ object Form1: TForm1
end
object Memo1: TMemo
Left = 272
Height = 520
Height = 504
Top = 16
Width = 264
Width = 262
Anchors = [akTop, akLeft, akRight, akBottom]
Lines.Strings = (
'Memo1'
)
TabOrder = 2
end
object Button1: TButton
Left = 16
Height = 33
Top = 576
Width = 520
Anchors = [akLeft, akBottom]
Caption = 'Button1'
TabOrder = 3
end
object Edit1: TEdit
Left = 72
Height = 27
Top = 536
Width = 176
Anchors = [akLeft, akBottom]
TabOrder = 4
end
object Label1: TLabel
Left = 24
Height = 18
Top = 536
Width = 35
Anchors = [akLeft, akBottom]
Caption = 'Filter:'
ParentColor = False
end
object SearchIn: TComboBox
Left = 344
Height = 29
Top = 534
Width = 192
ItemHeight = 0
ItemIndex = 0
Items.Strings = (
'Tags, Name, Author'
'Name'
'Tags'
'Author'
)
TabOrder = 5
Text = 'Tags, Name, Author'
end
object Label2: TLabel
Left = 272
Height = 18
Top = 536
Width = 53
Caption = 'Filter by:'
ParentColor = False
end
object ImageList1: TImageList
left = 80
top = 272

View File

@ -36,7 +36,12 @@ type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
SearchIn: TComboBox;
Edit1: TEdit;
ImageList1: TImageList;
Label1: TLabel;
Label2: TLabel;
ListView1: TListView;
Memo1: TMemo;
MenuItem1: TMenuItem;
@ -79,6 +84,8 @@ var
ss: TSimbaScript;
LI: TListItem;
strarr: TStringArray;
b: TButton;
begin
if not s.ListKeys('Scripts/ScriptList', strarr) then
writeln('ListKeys returned false');

View File

@ -78,13 +78,12 @@ type
ScriptName : string;//The name of the currently opened/saved file.
ScriptDefault : string;//The default script e.g. program new; begin end.
ScriptChanged : boolean;//We need this for that little * (edited star).
ScriptThread : TMThread;//Just one thread for now..
FScriptState : TScriptState;//Stores the ScriptState, if you want the Run/Pause/Start buttons to change accordingly, acces through Form1
// ScriptThread : TMThread;//Just one thread for now..
// FScriptState : TScriptState;//Stores the ScriptState, if you want the Run/Pause/Start buttons to change accordingly, acces through Form1
procedure undo;
procedure redo;
procedure HandleErrorData;
procedure MakeActiveScriptFrame;
procedure ScriptThreadTerminate(Sender: TObject);
constructor Create(TheOwner: TComponent); override;
{ public declarations }
end;
@ -582,11 +581,6 @@ begin
end;
end;
procedure TScriptFrame.ScriptThreadTerminate(Sender: TObject);
begin
FScriptState:= ss_None;
SimbaForm.RefreshTab;
end;
procedure AddKey(const SynEdit : TSynEdit; const ACmd: TSynEditorCommand; const AKey: word;const AShift: TShiftState);
begin
with SynEdit.KeyStrokes.Add do
@ -612,7 +606,7 @@ begin
ScriptDefault:= StartText;
ScriptName:= 'Untitled';
ScriptChanged := false;
FScriptState:= ss_None;
ScriptErrorLine:= -1;
OwnerSheet.Caption:= ScriptName;
SynEdit.Highlighter := SimbaForm.CurrHighlighter;

View File

@ -48,7 +48,7 @@ uses
CastaliaSimplePasPar, v_AutoCompleteForm, PSDump;
const
SimbaVersion = 702;
SimbaVersion = 704;
type
@ -396,6 +396,7 @@ type
Picker: TMColorPicker;
Selector: TMWindowSelector;
OnScriptStart : TScriptStartEvent;
FScriptState: TScriptState;
{$ifdef mswindows}
ConsoleVisible : boolean;
procedure ShowConsole( ShowIt : boolean);
@ -410,6 +411,7 @@ type
function SaveCurrentScriptAsDefault : boolean;
function CanExitOrOpen : boolean;
function ClearScript : boolean;
procedure ScriptThreadTerminate(Sender: TObject);
procedure RunScript;
procedure PauseScript;
procedure StopScript;
@ -852,13 +854,21 @@ end;
//{$ENDIF}
procedure TSimbaForm.ScriptThreadTerminate(Sender: TObject);
begin
mDebugLn('Thread terminated');
ScriptState := ss_None;
CurrThread := nil;
end;
procedure TSimbaForm.RunScript;
begin
with CurrScript do
begin
if ScriptState = ss_Paused then
begin;
ScriptThread.Resume;
CurrThread.Resume;
// ScriptThread.Resume;
ScriptState := ss_Running;
Exit;
end else
@ -867,13 +877,13 @@ begin
FormWritelnEx('The script hasn''t stopped yet, so we cannot start a new one.');
exit;
end;
InitalizeTMThread(scriptthread);
ScriptThread.CompileOnly:= false;
ScriptThread.OnTerminate:=@ScriptThreadTerminate;
InitalizeTMThread(CurrThread);
CurrThread.CompileOnly:= false;
CurrThread.OnTerminate:=@ScriptThreadTerminate;
ScriptState:= ss_Running;
FirstRun := false;
//Lets run it!
ScriptThread.Resume;
CurrThread.Resume;
end;
end;
@ -884,14 +894,14 @@ begin
if ScriptState = ss_Running then
begin;
{$ifdef MSWindows}
ScriptThread.Suspended:= True;
CurrThread.Suspended:= True;
ScriptState:= ss_Paused;
{$else}
mDebugLn('Linux users are screwed, no pause button for u!');
{$endif}
end else if ScriptState = ss_Paused then
begin;
ScriptThread.Resume;
CurrThread.Resume;
ScriptState := ss_Running;
end;
end;
@ -905,20 +915,20 @@ begin
ss_Stopping:
begin //Terminate the thread the tough way.
mDebugLn('Terminating the Scriptthread');
mDebugLn('Exit code terminate: ' +inttostr(KillThread(ScriptThread.Handle)));
WaitForThreadTerminate(ScriptThread.Handle, 0);
ScriptThread.Free;
mDebugLn('Exit code terminate: ' +inttostr(KillThread(CurrThread.Handle)));
WaitForThreadTerminate(CurrThread.Handle, 0);
CurrThread.Free;
ScriptState := ss_None;
end;
ss_Running:
begin
ScriptThread.Terminate;
CurrThread.Terminate;
ScriptState := ss_Stopping;
end;
ss_Paused:
begin
ScriptThread.Resume;
ScriptThread.Terminate;
CurrThread.Resume;
CurrThread.Terminate;
ScriptState:= ss_Stopping;
end;
end;
@ -1136,7 +1146,11 @@ begin
end;
StatusBar.Panels[Panel_ScriptName].Text:= Script.ScriptName;
StatusBar.Panels[Panel_ScriptPath].text:= Script.ScriptFile;
SetScriptState(Tab.ScriptFrame.FScriptState);//To set the buttons right
{ XXX: No longer update buttons }
// SetScriptState(Tab.ScriptFrame.FScriptState);//To set the buttons right
if Self.Showing then
if Tab.TabSheet.TabIndex = Self.PageControl1.TabIndex then
if CurrScript.SynEdit.CanFocus then
@ -2311,7 +2325,7 @@ begin;
if CurrScript.ScriptName <> '' then
SynExporterHTML.Title:= 'Simba - ' + CurrScript.ScriptName
else
SynExporterHTML.Title:= 'Cogat - Untitled';
SynExporterHTML.Title:= 'Simba - Untitled';
SynExporterHTML.ExportAll(CurrScript.SynEdit.Lines);
SynExporterHTML.SaveToFile(FileName);
end;
@ -2622,7 +2636,7 @@ end;
function TSimbaForm.GetScriptState: TScriptState;
begin
result := CurrScript.FScriptState;
result := FScriptState;
end;
function TSimbaForm.GetShowParamHintAuto: boolean;
@ -2685,7 +2699,7 @@ end;
procedure TSimbaForm.SetScriptState(const State: TScriptState);
begin
CurrScript.FScriptState:= State;
FScriptState:= State;
with Self.StatusBar.panels[Panel_State] do
case state of
ss_Running : begin Text := 'Running'; TB_Run.Enabled:= False; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif}
@ -2878,7 +2892,7 @@ begin
LocalCopy := CurrentSyncInfo;
mDebugLn('Executing : ' + LocalCopy.MethodName);
thread:= TMThread(LocalCopy.OldThread);
mmlpsthread.CurrThread:= thread;
//mmlpsthread.CurrThread:= thread;
try
if thread is TPSThread then
begin
@ -2893,7 +2907,7 @@ begin
raise Exception.Create('ThreadSafeCall not implemented on this client');
end;
finally
mmlpsthread.CurrThread:= nil;
//mmlpsthread.CurrThread:= nil;
end;
end;

View File

@ -1,5 +1,5 @@
program new;
{.LoadDLL libsmart}
{$Loadlib libsmart}
function IsKeyDown(C:Char): Boolean;
begin
Result := SmartIsKeyDown(ord(c));
@ -54,11 +54,12 @@ var
w,h:integer;
begin
SmartSetup('http://world19.runescape.com/', 'plugin.js?param=o0,a1,m0', 765, 503);
SetTargetArray(SmartImageArray, 765,503);
wait(30000);
{ SetTargetArray(SmartImageArray, 765,503);
getclientdimensions(w,h);
writeln(inttostr(w) + ' , ' + inttostr(h));
if findcolortolerance(w,h,clwhite,0,0,764,502,300) then
smartmovemouse(w,h);
Wait(5000);
savescreenshot(scriptPath + 'smart.bmp');
savescreenshot(scriptPath + 'smart.bmp'); }
end.

View File

@ -188,8 +188,10 @@ type
procedure AddMethod(meth: TExpMethod); override;
end;
threadvar
var
CurrThread : TMThread;
var
PluginsGlob: TMPlugins;