1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-14 05:15:16 -05:00
Simba/Projects/ScriptManager/scriptmanager.pas
Merlijn Wajer 14e929decc Just a bit of the Script Manager code.
I need to code a lot more, and it will be a bit hackish.

Basically, the TMMLSettings is not able to handle childs with the same name.
It can parse them into the tree, but the finding methods will not work. (They
will always find the first.)
Three possibilities:
-   Delete the one we just parsed, and search again. (We will get the next
result)
-   Use WalkToNode and then manually parse the node. (This is more dangerous
but doesn't delete the settints)
-   Do the XML parsing semi-manually, kind of like rewriting the settings unit.
2010-06-08 00:15:20 +02:00

87 lines
1.3 KiB
ObjectPascal

unit scriptmanager;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, ComCtrls, settings, MufasaTypes;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
ImageList1: TImageList;
ListView1: TListView;
TreeView1: TTreeView;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
TSimbaScript = class(TObject)
public
Name, Version, Author, Description: String;
Tags, Files: TStringArray;
private
public
constructor Create(n: TTreeNode);
destructor Delete;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure fill(s: TMMLSettings);
var
i:integer;
n, nn: TTreeNode;
ss: TSimbaScript;
begin
n := s.WalkToNode('Scripts/ScriptList/');
nn := n.GetFirstChild;
while nn <> nil do
begin
ss := TSimbaScript.Create(nn);
nn := nn.GetNextSibling;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s: TMMLSettings;
begin
s := TMMLSettings.Create(TreeView1.Items);
s.LoadFromXML('/scratch/gittest/list.xml');
fill(s);
s.Free;
end;
{ TSimbaScript }
constructor TSimbaScript.Create(n: TTreeNode);
begin
end;
destructor TSimbaScript.Delete;
begin
end;
end.