From d10b5e29bcef7335d38d4cbb590b60b7b171897b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 14 May 2009 16:33:04 +0000 Subject: * refactor: break some of xml2 serialization out of sog --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 13 ------------- OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs | 4 ++-- .../Scenes/Serialization/SceneObjectSerializer.cs | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fd2d746..5611b03 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -583,19 +583,6 @@ namespace OpenSim.Region.Framework.Scenes #endregion - public string ToXmlString2() - { - using (StringWriter sw = new StringWriter()) - { - using (XmlTextWriter writer = new XmlTextWriter(sw)) - { - ToXml2(writer); - } - - return sw.ToString(); - } - } - public void ToXml2(XmlTextWriter writer) { //m_log.DebugFormat("[SOG]: Starting serialization of SOG {0} to XML2", Name); diff --git a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs index 49fe8a4..5418139 100644 --- a/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/SceneXmlLoader.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Scenes public static string SaveGroupToXml2(SceneObjectGroup grp) { - return grp.ToXmlString2(); + return SceneObjectSerializer.ToXml2Format(grp); } public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) @@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes continue; } - stream.WriteLine(g.ToXmlString2()); + stream.WriteLine(SceneObjectSerializer.ToXml2Format(g)); primCount++; } } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index aa331d9..0ec1922 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -31,6 +31,7 @@ using System.Reflection; using System.Xml; using log4net; using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Scenes.Serialization @@ -246,6 +247,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); // SceneObjectGroup //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); + } + + /// + /// Serialize a scene object to the 'xml2' format. + /// + /// + /// + public static string ToXml2Format(ISceneObject sceneObject) + { + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + sceneObject.ToXml2(writer); + } + + return sw.ToString(); + } } } } -- cgit v1.1