From 0ec96d294a561a692f7ee3c425db22a86cdcda49 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 15 Jan 2009 17:09:51 +0000 Subject: Small bit of refactoring related to the hypergrid link loading from xml files. --- OpenSim/Region/Application/HGOpenSimNode.cs | 89 +++++++++++++++-------------- 1 file changed, 47 insertions(+), 42 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index dcb8c15..f46c9e3 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs @@ -147,48 +147,7 @@ namespace OpenSim { if ((cmdparams.Length == 1) || (cmdparams.Length ==2)) { - try - { - XmlReader r = XmlReader.Create(cmdparams[0]); - XmlConfigSource cs = new XmlConfigSource(r); - string[] excludeSections = null; - - if (cmdparams.Length == 2) - { - if (cmdparams[1].StartsWith("excludeList:")) - { - string excludeString = cmdparams[1]; - excludeString = excludeString.Remove(0, 12); - char[] splitter = { ';' }; - - excludeSections = excludeString.Split(splitter); - } - } - - for (int i = 0; i < cs.Configs.Count; i++) - { - bool skip = false; - if ((excludeSections != null) &&(excludeSections.Length > 0 )) - { - for (int n = 0; n < excludeSections.Length; n++) - { - if (excludeSections[n] == cs.Configs[i].Name) - { - skip = true; - break; - } - } - } - if (!skip) - { - ReadLinkFromConfig(cs.Configs[i]); - } - } - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - } + LoadXmlLinkFile(cmdparams); } else { @@ -234,6 +193,52 @@ namespace OpenSim } + private void LoadXmlLinkFile(string[] cmdparams) + { + try + { + XmlReader r = XmlReader.Create(cmdparams[0]); + XmlConfigSource cs = new XmlConfigSource(r); + string[] excludeSections = null; + + if (cmdparams.Length == 2) + { + if (cmdparams[1].StartsWith("excludeList:")) + { + string excludeString = cmdparams[1]; + excludeString = excludeString.Remove(0, 12); + char[] splitter = { ';' }; + + excludeSections = excludeString.Split(splitter); + } + } + + for (int i = 0; i < cs.Configs.Count; i++) + { + bool skip = false; + if ((excludeSections != null) && (excludeSections.Length > 0)) + { + for (int n = 0; n < excludeSections.Length; n++) + { + if (excludeSections[n] == cs.Configs[i].Name) + { + skip = true; + break; + } + } + } + if (!skip) + { + ReadLinkFromConfig(cs.Configs[i]); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + } + } + private void ReadLinkFromConfig(IConfig config) { RegionInfo regInfo; -- cgit v1.1