From 8cf2daa838485771e633e9953f0ab992e187c22c Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 10 Oct 2007 08:30:36 +0000 Subject: some refactoring --- OpenSim/Region/Environment/Scenes/Scene.cs | 1 + .../Region/Environment/Scenes/SceneObjectGroup.cs | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index befda0e..288cbee 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -656,6 +656,7 @@ namespace OpenSim.Region.Environment.Scenes int primCount = 0; if ((fileName.StartsWith("http:")) | (File.Exists(fileName))) { + XmlTextReader reader = new XmlTextReader(fileName); reader.WhitespaceHandling = WhitespaceHandling.None; doc.Load(reader); diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 5989879..5ff0d72 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -234,6 +234,45 @@ namespace OpenSim.Region.Environment.Scenes ScheduleGroupForFullUpdate(); } + /// + /// + /// + 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() { if (InSceneBackup) -- cgit v1.1