aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.GenericConfig
diff options
context:
space:
mode:
authorMW2007-04-02 15:48:01 +0000
committerMW2007-04-02 15:48:01 +0000
commitfdc9ed89b4adaa7f23ca06613b2ee36c30895021 (patch)
tree3c90368815d37055bac61ee3bdce5b5593715e2a /OpenSim.GenericConfig
parentAdded OpenSim.GenericConfig.Xml project, so we can swap to a more generic con... (diff)
downloadopensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.zip
opensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.gz
opensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.bz2
opensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.xz
OpenSim no longer uses OpenSim.Config.SimConfigDb4o, it now uses OpenSim.GenericConfig.Xml (or a class implementing IGenericConfig).
Diffstat (limited to 'OpenSim.GenericConfig')
-rw-r--r--OpenSim.GenericConfig/Xml/XmlConfig.cs25
1 files changed, 21 insertions, 4 deletions
diff --git a/OpenSim.GenericConfig/Xml/XmlConfig.cs b/OpenSim.GenericConfig/Xml/XmlConfig.cs
index 39321cc..c398229 100644
--- a/OpenSim.GenericConfig/Xml/XmlConfig.cs
+++ b/OpenSim.GenericConfig/Xml/XmlConfig.cs
@@ -12,6 +12,7 @@ namespace OpenSim.GenericConfig
12 private XmlNode rootNode; 12 private XmlNode rootNode;
13 private XmlNode configNode; 13 private XmlNode configNode;
14 private string fileName; 14 private string fileName;
15 private bool createdFile = false;
15 16
16 public XmlConfig(string filename) 17 public XmlConfig(string filename)
17 { 18 {
@@ -23,10 +24,22 @@ namespace OpenSim.GenericConfig
23 doc = new XmlDocument(); 24 doc = new XmlDocument();
24 try 25 try
25 { 26 {
26 XmlTextReader reader = new XmlTextReader(fileName); 27 if (System.IO.File.Exists(fileName))
27 reader.WhitespaceHandling = WhitespaceHandling.None; 28 {
28 doc.Load(reader); 29 XmlTextReader reader = new XmlTextReader(fileName);
29 reader.Close(); 30 reader.WhitespaceHandling = WhitespaceHandling.None;
31 doc.Load(reader);
32 reader.Close();
33 }
34 else
35 {
36 createdFile = true;
37 rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
38 doc.AppendChild(rootNode);
39 configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
40 rootNode.AppendChild(configNode);
41 }
42
30 } 43 }
31 catch (Exception e) 44 catch (Exception e)
32 { 45 {
@@ -48,6 +61,10 @@ namespace OpenSim.GenericConfig
48 { 61 {
49 Console.WriteLine(e.Message); 62 Console.WriteLine(e.Message);
50 } 63 }
64 if (createdFile)
65 {
66 this.Commit();
67 }
51 } 68 }
52 69
53 public string GetAttribute(string attributeName) 70 public string GetAttribute(string attributeName)