Another attempt at fixing the disappearing estate_settings.xml file.

afrisby
Brian McBee 2007-09-11 21:41:26 +00:00
parent 71f94d8421
commit b521e5d219
1 changed files with 24 additions and 25 deletions

View File

@ -60,28 +60,31 @@ namespace OpenSim.Framework.Configuration
} }
public void LoadData() public void LoadData()
{ {
doc = new XmlDocument(); lock (this)
if (File.Exists(fileName))
{ {
XmlTextReader reader = new XmlTextReader(fileName); doc = new XmlDocument();
reader.WhitespaceHandling = WhitespaceHandling.None; if (File.Exists(fileName))
doc.Load(reader); {
reader.Close(); XmlTextReader reader = new XmlTextReader(fileName);
} reader.WhitespaceHandling = WhitespaceHandling.None;
else doc.Load(reader);
{ reader.Close();
createdFile = true; }
rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); else
doc.AppendChild(rootNode); {
configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); createdFile = true;
rootNode.AppendChild(configNode); rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
} doc.AppendChild(rootNode);
configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
rootNode.AppendChild(configNode);
}
LoadDataToClass(); LoadDataToClass();
if (createdFile) if (createdFile)
{ {
this.Commit(); this.Commit();
}
} }
} }
@ -124,11 +127,7 @@ namespace OpenSim.Framework.Configuration
{ {
Directory.CreateDirectory(Util.configDir()); Directory.CreateDirectory(Util.configDir());
} }
doc.Save(fileName);
lock(this)
{
doc.Save(fileName);
}
} }
public void Close() public void Close()