From c6b99fbca5b0f60e043693cb577f06fafa75f61c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 17 Jun 2007 09:44:39 +0000 Subject: * Added 'LogFilename' attribute to simconfig.xml - in order to specify log name * removed some greedy try-catch * ignored some bins --- Common/OpenSim.GenericConfig/Xml/XmlConfig.cs | 59 +++++++++++---------------- 1 file changed, 23 insertions(+), 36 deletions(-) (limited to 'Common') diff --git a/Common/OpenSim.GenericConfig/Xml/XmlConfig.cs b/Common/OpenSim.GenericConfig/Xml/XmlConfig.cs index 40c252f..c526aec 100644 --- a/Common/OpenSim.GenericConfig/Xml/XmlConfig.cs +++ b/Common/OpenSim.GenericConfig/Xml/XmlConfig.cs @@ -49,45 +49,32 @@ namespace OpenSim.GenericConfig public void LoadData() { doc = new XmlDocument(); - try - { - if (System.IO.File.Exists(fileName)) - { - XmlTextReader reader = new XmlTextReader(fileName); - reader.WhitespaceHandling = WhitespaceHandling.None; - doc.Load(reader); - reader.Close(); - } - else - { - createdFile = true; - rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); - doc.AppendChild(rootNode); - configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); - rootNode.AppendChild(configNode); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - return; - } - try + if (System.IO.File.Exists(fileName)) { - rootNode = doc.FirstChild; - if (rootNode.Name != "Root") - throw new Exception("Error: Invalid .xml File. Missing "); - - configNode = rootNode.FirstChild; - if (configNode.Name != "Config") - throw new Exception("Error: Invalid .xml File. first child should be "); - + XmlTextReader reader = new XmlTextReader(fileName); + reader.WhitespaceHandling = WhitespaceHandling.None; + doc.Load(reader); + reader.Close(); } - catch (Exception e) + else { - Console.WriteLine(e.Message); + createdFile = true; + rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); + doc.AppendChild(rootNode); + configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); + rootNode.AppendChild(configNode); } + + + rootNode = doc.FirstChild; + if (rootNode.Name != "Root") + throw new Exception("Error: Invalid .xml File. Missing "); + + configNode = rootNode.FirstChild; + if (configNode.Name != "Config") + throw new Exception("Error: Invalid .xml File. first child should be "); + if (createdFile) { this.Commit(); @@ -108,7 +95,7 @@ namespace OpenSim.GenericConfig { if (configNode.Attributes[attributeName] != null) { - ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; + ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; } else { @@ -131,6 +118,6 @@ namespace OpenSim.GenericConfig rootNode = null; doc = null; } - + } } -- cgit v1.1