some refactoring

afrisby
MW 2007-10-10 08:30:36 +00:00
parent f13611bbc9
commit 8cf2daa838
2 changed files with 40 additions and 0 deletions

View File

@ -656,6 +656,7 @@ namespace OpenSim.Region.Environment.Scenes
int primCount = 0; int primCount = 0;
if ((fileName.StartsWith("http:")) | (File.Exists(fileName))) if ((fileName.StartsWith("http:")) | (File.Exists(fileName)))
{ {
XmlTextReader reader = new XmlTextReader(fileName); XmlTextReader reader = new XmlTextReader(fileName);
reader.WhitespaceHandling = WhitespaceHandling.None; reader.WhitespaceHandling = WhitespaceHandling.None;
doc.Load(reader); doc.Load(reader);

View File

@ -234,6 +234,45 @@ namespace OpenSim.Region.Environment.Scenes
ScheduleGroupForFullUpdate(); ScheduleGroupForFullUpdate();
} }
/// <summary>
///
/// </summary>
public SceneObjectGroup(string xmlData)
{
StringReader sr = new StringReader(xmlData);
XmlTextReader reader = new XmlTextReader(sr);
reader.Read();
reader.ReadStartElement("SceneObjectGroup");
reader.ReadStartElement("RootPart");
m_rootPart = SceneObjectPart.FromXml(reader);
reader.ReadEndElement();
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name == "Part")
{
reader.Read();
SceneObjectPart Part = SceneObjectPart.FromXml(reader);
AddPart(Part);
}
break;
case XmlNodeType.EndElement:
break;
}
}
reader.Close();
sr.Close();
m_rootPart.SetParent(this);
m_parts.Add(m_rootPart.UUID, m_rootPart);
m_rootPart.ParentID = 0;
UpdateParentIDs();
ScheduleGroupForFullUpdate();
}
private void AttachToBackup() private void AttachToBackup()
{ {
if (InSceneBackup) if (InSceneBackup)