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

Parsing of the XML concept.

Adding the rest of the data is peanuts. Now to figure out a good place to
install the scripts to. The hardest part is probably keeping track of installed
scripts, and updating them when possible.
This commit is contained in:
Merlijn Wajer 2010-06-12 14:29:56 +02:00
parent 903299b580
commit 3c8a311844
3 changed files with 107 additions and 61 deletions

View File

@ -34,12 +34,12 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="9"> <Units Count="10">
<Unit0> <Unit0>
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="project1"/> <UnitName Value="project1"/>
<UsageCount Value="36"/> <UsageCount Value="37"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
@ -50,9 +50,9 @@
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="34"/> <TopLine Value="83"/>
<CursorPos X="6" Y="58"/> <CursorPos X="15" Y="118"/>
<UsageCount Value="36"/> <UsageCount Value="37"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
@ -76,8 +76,8 @@
<UnitName Value="settings"/> <UnitName Value="settings"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="45"/> <TopLine Value="85"/>
<CursorPos X="5" Y="74"/> <CursorPos X="29" Y="94"/>
<UsageCount Value="13"/> <UsageCount Value="13"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
@ -118,127 +118,136 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
<DefaultSyntaxHighlighter Value="Text"/> <DefaultSyntaxHighlighter Value="Text"/>
</Unit8> </Unit8>
<Unit9>
<Filename Value="../../../fpc/rtl/inc/objpash.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="183"/>
<CursorPos X="21" Y="201"/>
<SyntaxHighlighter Value="Delphi"/>
<UsageCount Value="10"/>
<DefaultSyntaxHighlighter Value="Text"/>
</Unit9>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="36" Column="29" TopLine="4"/> <Caret Line="29" Column="62" TopLine="12"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="37" Column="29" TopLine="4"/> <Caret Line="31" Column="31" TopLine="12"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="38" Column="37" TopLine="7"/> <Caret Line="37" Column="23" TopLine="19"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="37" Column="37" TopLine="6"/> <Caret Line="64" Column="25" TopLine="36"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="36" Column="37" TopLine="5"/> <Caret Line="55" Column="11" TopLine="45"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="11" Column="52" TopLine="1"/> <Caret Line="52" Column="5" TopLine="28"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="24" Column="86" TopLine="1"/> <Caret Line="59" Column="13" TopLine="34"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="19" Column="26" TopLine="6"/> <Caret Line="63" Column="24" TopLine="52"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="../../Units/MMLAddon/settings.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="1" Column="1" TopLine="1"/> <Caret Line="53" Column="12" TopLine="34"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../Units/MMLAddon/settings.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="31" Column="54" TopLine="1"/> <Caret Line="57" Column="22" TopLine="35"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../Units/MMLAddon/settings.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="31" Column="71" TopLine="1"/> <Caret Line="55" Column="21" TopLine="38"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="41" Column="10" TopLine="6"/> <Caret Line="33" Column="17" TopLine="27"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="35" Column="82" TopLine="10"/> <Caret Line="58" Column="34" TopLine="50"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="21" Column="69" TopLine="10"/> <Caret Line="54" Column="10" TopLine="36"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="41" Column="39" TopLine="11"/> <Caret Line="77" Column="22" TopLine="59"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="42" Column="15" TopLine="11"/> <Caret Line="56" Column="20" TopLine="36"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="30" Column="62" TopLine="12"/> <Caret Line="253" Column="11" TopLine="230"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="29" Column="62" TopLine="12"/> <Caret Line="75" Column="24" TopLine="57"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="31" Column="31" TopLine="12"/> <Caret Line="194" Column="30" TopLine="177"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="37" Column="23" TopLine="19"/> <Caret Line="54" Column="17" TopLine="38"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="64" Column="25" TopLine="36"/> <Caret Line="77" Column="22" TopLine="59"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="55" Column="11" TopLine="45"/> <Caret Line="254" Column="14" TopLine="242"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="52" Column="5" TopLine="28"/> <Caret Line="75" Column="24" TopLine="57"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="59" Column="13" TopLine="34"/> <Caret Line="71" Column="7" TopLine="49"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="../../Units/MMLAddon/settings.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="63" Column="24" TopLine="52"/> <Caret Line="73" Column="23" TopLine="56"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="53" Column="12" TopLine="34"/> <Caret Line="107" Column="32" TopLine="89"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="57" Column="22" TopLine="35"/> <Caret Line="60" Column="15" TopLine="38"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="55" Column="21" TopLine="38"/> <Caret Line="62" Column="15" TopLine="27"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="scriptmanager.pas"/> <Filename Value="scriptmanager.pas"/>
<Caret Line="33" Column="17" TopLine="27"/> <Caret Line="64" Column="7" TopLine="33"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="scriptmanager.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
<Caret Line="58" Column="34" TopLine="50"/> <Caret Line="10" Column="27" TopLine="1"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@ -1,9 +1,9 @@
object Form1: TForm1 object Form1: TForm1
Left = 1499 Left = 1490
Height = 567 Height = 567
Top = 51 Top = 293
Width = 825 Width = 825
ActiveControl = Button1 ActiveControl = TreeView1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 567 ClientHeight = 567
ClientWidth = 825 ClientWidth = 825

View File

@ -1,3 +1,26 @@
{
This file is part of the Simba Project
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
Simba is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Simba is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MML. If not, see <http://www.gnu.org/licenses/>.
See the file COPYING, included in this distribution,
for details about the copyright.
Script Manager for the Simba project.
}
unit scriptmanager; unit scriptmanager;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
@ -33,7 +56,7 @@ type
private private
public public
constructor Create(n: TTreeNode); constructor Create;
destructor Delete; destructor Delete;
end; end;
@ -48,15 +71,24 @@ implementation
procedure fill(s: TMMLSettings); procedure fill(s: TMMLSettings);
var var
i:integer; i:integer;
n, nn: TTreeNode;
ss: TSimbaScript; ss: TSimbaScript;
LI: TListItem;
strarr: TStringArray;
begin begin
n := s.WalkToNode('Scripts/ScriptList/'); if not s.ListKeys('Scripts/ScriptList', strarr) then
nn := n.GetFirstChild; writeln('ListKeys returned false');
while nn <> nil do writeln('strarr length: ' + inttostr(length(strarr)));
for i := 0 to high(strarr) do
begin begin
ss := TSimbaScript.Create(nn); writeln(s.GetKeyValue('Scripts/ScriptList/Script/Name'));
nn := nn.GetNextSibling; ss := TSimbaScript.Create();
ss.Name := s.GetKeyValue('Scripts/ScriptList/Script/Name');
LI := Form1.ListView1.Items.Add;
LI.Caption := ss.Name;
LI.Data := ss;
LI.ImageIndex:= 0;
s.DeleteKey('Scripts/ScriptList/Script');
end; end;
end; end;
@ -72,14 +104,19 @@ end;
{ TSimbaScript } { TSimbaScript }
constructor TSimbaScript.Create(n: TTreeNode); constructor TSimbaScript.Create;
begin begin
inherited;
{stuff here}
end; end;
destructor TSimbaScript.Delete; destructor TSimbaScript.Delete;
begin begin
{stuff here}
inherited;
end; end;
end. end.