mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-24 18:22:25 -05:00
Final, I think.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@378 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
aa5fb8bda8
commit
e4b17843d5
@ -39,7 +39,7 @@
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<UsageCount Value="35"/>
|
||||
<UsageCount Value="39"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unit1.pas"/>
|
||||
@ -47,10 +47,10 @@
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Unit1"/>
|
||||
<CursorPos X="32" Y="174"/>
|
||||
<TopLine Value="151"/>
|
||||
<CursorPos X="1" Y="24"/>
|
||||
<TopLine Value="5"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="35"/>
|
||||
<UsageCount Value="39"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
@ -84,10 +84,10 @@
|
||||
<Filename Value="settings.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="settings"/>
|
||||
<CursorPos X="1" Y="194"/>
|
||||
<TopLine Value="168"/>
|
||||
<CursorPos X="32" Y="483"/>
|
||||
<TopLine Value="453"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="33"/>
|
||||
<UsageCount Value="37"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
@ -95,18 +95,14 @@
|
||||
<UnitName Value="updater"/>
|
||||
<CursorPos X="2" Y="88"/>
|
||||
<TopLine Value="55"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="16"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="../../../../Documents/lazarus/lcl/comctrls.pp"/>
|
||||
<UnitName Value="ComCtrls"/>
|
||||
<CursorPos X="77" Y="1920"/>
|
||||
<TopLine Value="1902"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="3" Y="2190"/>
|
||||
<TopLine Value="2172"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../../../../Documents/lazarus/lcl/include/treeview.inc"/>
|
||||
@ -124,10 +120,10 @@
|
||||
<Unit10>
|
||||
<Filename Value="../../../../Documents/fpc/rtl/objpas/strutils.pp"/>
|
||||
<UnitName Value="strutils"/>
|
||||
<CursorPos X="1" Y="176"/>
|
||||
<CursorPos X="70" Y="25"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="16"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
@ -147,123 +143,123 @@
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="173" Column="1" TopLine="161"/>
|
||||
<Caret Line="40" Column="21" TopLine="22"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="184" Column="3" TopLine="166"/>
|
||||
<Caret Line="325" Column="30" TopLine="306"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="154" Column="1" TopLine="137"/>
|
||||
<Caret Line="49" Column="61" TopLine="23"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="76" Column="3" TopLine="56"/>
|
||||
<Caret Line="242" Column="6" TopLine="215"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="65" Column="32" TopLine="39"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="235" Column="31" TopLine="213"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="42" Column="6" TopLine="42"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="14" Column="46" TopLine="1"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="70" Column="2" TopLine="56"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="288" Column="26" TopLine="270"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="75" Column="8" TopLine="62"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="337" Column="1" TopLine="319"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="80" Column="1" TopLine="52"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="248" Column="38" TopLine="224"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="79" Column="3" TopLine="51"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="42" Column="28" TopLine="23"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="173" Column="19" TopLine="143"/>
|
||||
<Caret Line="169" Column="51" TopLine="141"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="38" Column="24" TopLine="24"/>
|
||||
<Caret Line="251" Column="63" TopLine="1"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="326" Column="45" TopLine="294"/>
|
||||
<Caret Line="23" Column="53" TopLine="1"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="314" Column="13" TopLine="296"/>
|
||||
<Caret Line="194" Column="12" TopLine="176"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="40" Column="21" TopLine="22"/>
|
||||
<Caret Line="224" Column="9" TopLine="209"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="325" Column="30" TopLine="306"/>
|
||||
<Caret Line="40" Column="21" TopLine="22"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="49" Column="61" TopLine="23"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="32" Column="21" TopLine="12"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="242" Column="6" TopLine="215"/>
|
||||
<Caret Line="98" Column="22" TopLine="88"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="235" Column="31" TopLine="213"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="48" Column="69" TopLine="1"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="14" Column="46" TopLine="1"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="105" Column="29" TopLine="85"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="288" Column="26" TopLine="270"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="110" Column="16" TopLine="85"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="337" Column="1" TopLine="319"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="113" Column="29" TopLine="85"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="248" Column="38" TopLine="224"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="206" Column="7" TopLine="180"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="42" Column="28" TopLine="23"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="25" Column="60" TopLine="14"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="169" Column="51" TopLine="141"/>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="509" Column="65" TopLine="481"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="251" Column="63" TopLine="1"/>
|
||||
<Caret Line="464" Column="5" TopLine="448"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="23" Column="53" TopLine="1"/>
|
||||
<Caret Line="471" Column="1" TopLine="451"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="194" Column="12" TopLine="176"/>
|
||||
<Caret Line="481" Column="19" TopLine="453"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="224" Column="9" TopLine="209"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="79" Column="1" TopLine="72"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="settings.pas"/>
|
||||
<Caret Line="40" Column="21" TopLine="22"/>
|
||||
<Filename Value="unit1.pas"/>
|
||||
<Caret Line="26" Column="2" TopLine="8"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
|
@ -5,7 +5,7 @@ unit settings;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ComCtrls;
|
||||
Classes, SysUtils, ComCtrls, xmlread, xmlwrite, DOM;
|
||||
|
||||
|
||||
|
||||
@ -34,6 +34,13 @@ type
|
||||
function WalkToNode(KeyName: String): TTreeNode;
|
||||
function GetNodePath(Node: TTreeNode): String;
|
||||
|
||||
procedure InternalLoadFromXML(XMLDoc: TXMLDocument);
|
||||
procedure WriteXMLData(n: TTreeNode;
|
||||
XMLNode: TDOMNode; XMLDoc: TXMLDocument;
|
||||
var XMLChild: TDOMNode; var C: Integer);
|
||||
procedure WalkTree(Node: TTreeNode; XMLNode: TDOMNode; XMLDoc: TXMLDocument;
|
||||
var C: Integer);
|
||||
|
||||
public
|
||||
function ListKeys(KeyName: String): TStringArray;
|
||||
function KeyExists(KeyName: String): Boolean;
|
||||
@ -44,6 +51,10 @@ type
|
||||
function GetKeyValue(KeyName: String): String;
|
||||
function GetSetDefaultKeyValue(KeyName, defVal: String): String;
|
||||
|
||||
public
|
||||
procedure LoadFromXML(fileName: String);
|
||||
procedure SaveToXML(fileName: String);
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -75,6 +86,54 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TMMLSettings.InternalLoadFromXML(XMLDoc: TXMLDocument);
|
||||
var
|
||||
iNode: TDOMNode;
|
||||
|
||||
procedure ProcessNode(Node: TDOMNode; TreeNode: TTreeNode);
|
||||
var
|
||||
cNode: TDOMNode;
|
||||
s: string;
|
||||
d: TSettingData;
|
||||
|
||||
begin
|
||||
if Node = nil then Exit; // Stops if reached a leaf
|
||||
|
||||
// Adds a node to the tree
|
||||
if (Node.NodeType = 3) then
|
||||
s := 'Data'
|
||||
else
|
||||
s := Node.NodeName;
|
||||
|
||||
TreeNode := Nodes.AddChild(TreeNode, s);
|
||||
if (Node.NodeType = 3) then
|
||||
begin
|
||||
d := TSettingData.Create;
|
||||
D.Val := Node.NodeValue;
|
||||
TreeNode.Data := D;
|
||||
|
||||
TreeNode.Text := 'Value';
|
||||
end;
|
||||
// Goes to the child node
|
||||
cNode := Node.FirstChild;
|
||||
|
||||
// Processes all child nodes
|
||||
while cNode <> nil do
|
||||
begin
|
||||
ProcessNode(cNode, TreeNode);
|
||||
cNode := cNode.NextSibling;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
iNode := XMLDoc.DocumentElement;
|
||||
while iNode <> nil do
|
||||
begin
|
||||
ProcessNode(iNode, nil); // Recursive
|
||||
iNode := iNode.NextSibling;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMMLSettings.KeyNameToKeys(KeyName: String): TStringArray;
|
||||
// yay for SRL!
|
||||
function srl_Explode(str, del: string): TStringArray;
|
||||
@ -126,13 +185,12 @@ begin
|
||||
inc(i);
|
||||
if i = length(s) then
|
||||
break;
|
||||
n := N.GetFirstChild;
|
||||
N := N.GetFirstChild;
|
||||
end else
|
||||
n := n.GetNextSibling;
|
||||
N := N.GetNextSibling;
|
||||
end;
|
||||
|
||||
Result := N;
|
||||
|
||||
end;
|
||||
|
||||
function TMMLSettings.GetNodePath(Node: TTreeNode): String;
|
||||
@ -279,6 +337,7 @@ begin
|
||||
if path[0] <> nParent.Text then
|
||||
begin
|
||||
writeln('First key doesn''t match. First key should always match');
|
||||
exit(false);
|
||||
end;
|
||||
for i := 0 to length(Path) - 2 do
|
||||
begin
|
||||
@ -358,5 +417,73 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMMLSettings.LoadFromXML(fileName: String);
|
||||
var
|
||||
Doc: TXMLDocument;
|
||||
begin
|
||||
ReadXMLFile(Doc, fileName);
|
||||
InternalLoadFromXML(Doc);
|
||||
Doc.Free;
|
||||
end;
|
||||
|
||||
procedure TMMLSettings.WriteXMLData(n: TTreeNode;
|
||||
XMLNode: TDOMNode; XMLDoc: TXMLDocument;
|
||||
var XMLChild: TDOMNode; var C: Integer);
|
||||
|
||||
var
|
||||
DDataNode, DataNode: TDOMNode;
|
||||
|
||||
begin
|
||||
if n.Text = 'Value' then
|
||||
begin
|
||||
XMLChild := XMLDoc.CreateTextNode(TSettingData(N.Data).Val);
|
||||
end else
|
||||
begin
|
||||
XMLChild := XMLDoc.CreateElement(n.Text);
|
||||
end;
|
||||
Inc(C);
|
||||
XMLNode.AppendChild(XMLChild);
|
||||
end;
|
||||
|
||||
procedure TMMLSettings.WalkTree(Node: TTreeNode; XMLNode: TDOMNode; XMLDoc: TXMLDocument;
|
||||
var C: Integer);
|
||||
var
|
||||
N: TTreeNode;
|
||||
XMLChild: TDOMNode;
|
||||
|
||||
begin
|
||||
N := Node.GetFirstChild;
|
||||
|
||||
while assigned(n) do
|
||||
begin
|
||||
WriteXMLData(n, XMLNode, XMLDoc, XMLChild, C);
|
||||
|
||||
WalkTree(n, XMLChild, XMLDoc, C);
|
||||
n := n.GetNextSibling;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMMLSettings.SaveToXML(fileName: String);
|
||||
var
|
||||
XMLDoc: TXMLDocument;
|
||||
RootNode: TDOMNode;
|
||||
C: Integer;
|
||||
begin
|
||||
XMLDoc := TXMLDocument.Create;
|
||||
|
||||
RootNode := XMLDoc.CreateElement('Settings');
|
||||
XMLDoc.AppendChild(RootNode);
|
||||
|
||||
RootNode := XMLDoc.DocumentElement;
|
||||
|
||||
C := 0;
|
||||
if Nodes.GetFirstNode <> nil then
|
||||
WalkTree(Nodes.GetFirstNode, RootNode, XMLDoc, C);
|
||||
|
||||
WriteXMLFile(XMLDoc, fileName);
|
||||
|
||||
XMLDoc.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
ComCtrls, StdCtrls, XMLRead, XMLWrite, DOM;
|
||||
ComCtrls, StdCtrls;
|
||||
|
||||
type
|
||||
|
||||
@ -22,8 +22,6 @@ type
|
||||
private
|
||||
{ private declarations }
|
||||
|
||||
procedure LoadFromXML(tree: TTreeView; XMLDoc: TXMLDocument);
|
||||
procedure SaveToXML(s: String);
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
@ -35,123 +33,6 @@ implementation
|
||||
uses
|
||||
settings;
|
||||
|
||||
|
||||
procedure WriteXMLData(n: TTreeNode;
|
||||
XMLNode: TDOMNode; XMLDoc: TXMLDocument;
|
||||
var XMLChild: TDOMNode; var C: Integer);
|
||||
|
||||
var
|
||||
DDataNode, DataNode: TDOMNode;
|
||||
|
||||
begin
|
||||
if n.Text = 'Value' then
|
||||
begin
|
||||
XMLChild := XMLDoc.CreateTextNode(TSettingData(N.Data).Val);
|
||||
end else
|
||||
begin
|
||||
XMLChild := XMLDoc.CreateElement(n.Text);
|
||||
end;
|
||||
Inc(C);
|
||||
XMLNode.AppendChild(XMLChild);
|
||||
end;
|
||||
|
||||
procedure WalkTree(Node: TTreeNode; XMLNode: TDOMNode; XMLDoc: TXMLDocument;
|
||||
var C: Integer);
|
||||
var
|
||||
N: TTreeNode;
|
||||
XMLChild: TDOMNode;
|
||||
|
||||
begin
|
||||
N := Node.GetFirstChild;
|
||||
|
||||
while assigned(n) do
|
||||
begin
|
||||
WriteXMLData(n, XMLNode, XMLDoc, XMLChild, C);
|
||||
|
||||
WalkTree(n, XMLChild, XMLDoc, C);
|
||||
n := n.GetNextSibling;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.SaveToXML(s: String);
|
||||
var
|
||||
XMLDoc: TXMLDocument;
|
||||
RootNode: TDOMNode;
|
||||
C: Integer;
|
||||
|
||||
begin
|
||||
XMLDoc := TXMLDocument.Create;
|
||||
|
||||
RootNode := XMLDoc.CreateElement('Settings');
|
||||
XMLDoc.AppendChild(RootNode);
|
||||
|
||||
RootNode := XMLDoc.DocumentElement;
|
||||
|
||||
C := 0;
|
||||
if TreeView1.Items.GetFirstNode <> nil then
|
||||
WalkTree(TreeView1.Items.GetFirstNode, RootNode, XMLDoc, C);
|
||||
|
||||
{ writeln(TreeView1.Items.TopLvlCount);
|
||||
for i := 0 to TreeView1.Items.TopLvlCount -1 do
|
||||
begin
|
||||
WriteXMLData(TreeView1.Items.TopLvlItems[i], RootNode, XMLDoc, XMLChild, C);
|
||||
WalkTree(TreeView1.Items.TopLvlItems[i], XMLChild, XMLDoc, C);
|
||||
end; }
|
||||
|
||||
WriteXMLFile(XMLDoc, s);
|
||||
|
||||
XMLDoc.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadFromXML(tree: TTreeView; XMLDoc: TXMLDocument);
|
||||
var
|
||||
iNode: TDOMNode;
|
||||
|
||||
procedure ProcessNode(Node: TDOMNode; TreeNode: TTreeNode);
|
||||
var
|
||||
cNode: TDOMNode;
|
||||
s: string;
|
||||
d: TSettingData;
|
||||
|
||||
begin
|
||||
if Node = nil then Exit; // Stops if reached a leaf
|
||||
|
||||
// Adds a node to the tree
|
||||
if (Node.NodeType = 3) then
|
||||
s := 'Data'
|
||||
else
|
||||
s := Node.NodeName;
|
||||
|
||||
TreeNode := tree.Items.AddChild(TreeNode, s);
|
||||
if (Node.NodeType = 3) then
|
||||
begin
|
||||
d := TSettingData.Create;
|
||||
D.Val := Node.NodeValue;
|
||||
TreeNode.Data := D;
|
||||
|
||||
TreeNode.Text := 'Value';
|
||||
end;
|
||||
// Goes to the child node
|
||||
cNode := Node.FirstChild;
|
||||
|
||||
// Processes all child nodes
|
||||
while cNode <> nil do
|
||||
begin
|
||||
ProcessNode(cNode, TreeNode);
|
||||
cNode := cNode.NextSibling;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
iNode := XMLDoc.DocumentElement;
|
||||
while iNode <> nil do
|
||||
begin
|
||||
ProcessNode(iNode, nil); // Recursive
|
||||
iNode := iNode.NextSibling;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.SaveButtonClick(Sender: TObject);
|
||||
@ -184,23 +65,26 @@ begin
|
||||
ss:=ss +'/' + s[0];
|
||||
end; }
|
||||
|
||||
sett.SaveToXML('settings.xml');
|
||||
sett.Free;
|
||||
SaveToXML('settings.xml');
|
||||
//SaveToXML('settings.xml');
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadButtonClick(Sender: TObject);
|
||||
var
|
||||
doc: TXMLDocument;
|
||||
s: TMMLSettings;
|
||||
begin
|
||||
if not FileExists('settings.xml') then
|
||||
begin
|
||||
TreeView1.Items.Clear;
|
||||
SaveToXML('settings.xml');
|
||||
s := TMMLSettings.Create(TreeView1.Items);
|
||||
s.SaveToXML('settings.xml');
|
||||
s.Free;
|
||||
end;
|
||||
ReadXMLFile(doc, 'settings.xml');
|
||||
|
||||
TreeView1.Items.Clear;
|
||||
LoadFromXML(TreeView1, doc);
|
||||
s := TMMLSettings.Create(TreeView1.Items);
|
||||
s.LoadFromXML('settings.xml');
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
Loading…
Reference in New Issue
Block a user