Small bit of refactoring related to the hypergrid link loading from xml files.

0.6.2-post-fixes
MW 2009-01-15 17:09:51 +00:00
parent d40e07a2c7
commit 0ec96d294a
1 changed files with 47 additions and 42 deletions

View File

@ -147,48 +147,7 @@ namespace OpenSim
{ {
if ((cmdparams.Length == 1) || (cmdparams.Length ==2)) if ((cmdparams.Length == 1) || (cmdparams.Length ==2))
{ {
try LoadXmlLinkFile(cmdparams);
{
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());
}
} }
else 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) private void ReadLinkFromConfig(IConfig config)
{ {
RegionInfo regInfo; RegionInfo regInfo;