aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
diff options
context:
space:
mode:
authorMic Bowman2011-08-26 15:23:46 -0700
committerMic Bowman2011-08-26 15:23:46 -0700
commit23f10f1d22d5ecf542119e39503230994c521bf0 (patch)
tree2498e8cccf2ed398052dfa53e9a1faf6e998d039 /OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
parentMerge branch 'master' into bulletsim (diff)
parentrefactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar (diff)
downloadopensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.zip
opensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.tar.gz
opensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.tar.bz2
opensim-SC-23f10f1d22d5ecf542119e39503230994c521bf0.tar.xz
Merge branch 'master' into bulletsim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs31
1 files changed, 22 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 8fb9fad..a60ee9b 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -127,26 +127,36 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
127 /// <returns></returns> 127 /// <returns></returns>
128 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject) 128 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject)
129 { 129 {
130 return ToOriginalXmlFormat(sceneObject, true);
131 }
132
133 /// <summary>
134 /// Serialize a scene object to the original xml format
135 /// </summary>
136 /// <param name="sceneObject"></param>
137 /// <param name="doScriptStates">Control whether script states are also serialized.</para>
138 /// <returns></returns>
139 public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, bool doScriptStates)
140 {
130 using (StringWriter sw = new StringWriter()) 141 using (StringWriter sw = new StringWriter())
131 { 142 {
132 using (XmlTextWriter writer = new XmlTextWriter(sw)) 143 using (XmlTextWriter writer = new XmlTextWriter(sw))
133 { 144 {
134 ToOriginalXmlFormat(sceneObject, writer); 145 ToOriginalXmlFormat(sceneObject, writer, doScriptStates);
135 } 146 }
136 147
137 return sw.ToString(); 148 return sw.ToString();
138 } 149 }
139 } 150 }
140
141 151
142 /// <summary> 152 /// <summary>
143 /// Serialize a scene object to the original xml format 153 /// Serialize a scene object to the original xml format
144 /// </summary> 154 /// </summary>
145 /// <param name="sceneObject"></param> 155 /// <param name="sceneObject"></param>
146 /// <returns></returns> 156 /// <returns></returns>
147 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) 157 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates)
148 { 158 {
149 ToOriginalXmlFormat(sceneObject, writer, false); 159 ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
150 } 160 }
151 161
152 /// <summary> 162 /// <summary>
@@ -156,10 +166,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
156 /// <param name="writer"></param> 166 /// <param name="writer"></param>
157 /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param> 167 /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
158 /// <returns></returns> 168 /// <returns></returns>
159 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement) 169 public static void ToOriginalXmlFormat(
170 SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates, bool noRootElement)
160 { 171 {
161 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); 172// m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", sceneObject.Name);
162 //int time = System.Environment.TickCount; 173// int time = System.Environment.TickCount;
163 174
164 if (!noRootElement) 175 if (!noRootElement)
165 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); 176 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
@@ -182,12 +193,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
182 } 193 }
183 194
184 writer.WriteEndElement(); // OtherParts 195 writer.WriteEndElement(); // OtherParts
185 sceneObject.SaveScriptedState(writer); 196
197 if (doScriptStates)
198 sceneObject.SaveScriptedState(writer);
186 199
187 if (!noRootElement) 200 if (!noRootElement)
188 writer.WriteEndElement(); // SceneObjectGroup 201 writer.WriteEndElement(); // SceneObjectGroup
189 202
190 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); 203// m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time);
191 } 204 }
192 205
193 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) 206 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)