diff options
author | David Walter Seikel | 2016-11-22 16:54:46 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-22 16:54:46 +1000 |
commit | be1f9db781db96b5d2ec45aa889e21daa6a1af36 (patch) | |
tree | 38eb98d0e35531329a993a23b2227475984abc16 /OpenSim/Region/Framework/Scenes/Serialization | |
parent | Alas "make IARs for those that logged on since the last time" failed, 8.2 bro... (diff) | |
download | opensim-SC_OLD-be1f9db781db96b5d2ec45aa889e21daa6a1af36.zip opensim-SC_OLD-be1f9db781db96b5d2ec45aa889e21daa6a1af36.tar.gz opensim-SC_OLD-be1f9db781db96b5d2ec45aa889e21daa6a1af36.tar.bz2 opensim-SC_OLD-be1f9db781db96b5d2ec45aa889e21daa6a1af36.tar.xz |
Various random white space clean ups.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | 50 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 28 |
2 files changed, 39 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 998789d..1e42fc5 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -68,54 +68,54 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
68 | /// </param> | 68 | /// </param> |
69 | /// <returns></returns> | 69 | /// <returns></returns> |
70 | public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates) | 70 | public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates) |
71 | { | 71 | { |
72 | using (StringWriter sw = new StringWriter()) | 72 | using (StringWriter sw = new StringWriter()) |
73 | { | 73 | { |
74 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | 74 | using (XmlTextWriter writer = new XmlTextWriter(sw)) |
75 | { | 75 | { |
76 | Vector3 size; | 76 | Vector3 size; |
77 | 77 | ||
78 | List<SceneObjectGroup> coaObjects = coa.Objects; | 78 | List<SceneObjectGroup> coaObjects = coa.Objects; |
79 | 79 | ||
80 | // m_log.DebugFormat( | 80 | // m_log.DebugFormat( |
81 | // "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", | 81 | // "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", |
82 | // coaObjects.Count); | 82 | // coaObjects.Count); |
83 | 83 | ||
84 | // This is weak - we're relying on the set of coalesced objects still being identical | 84 | // This is weak - we're relying on the set of coalesced objects still being identical |
85 | Vector3[] offsets = coa.GetSizeAndOffsets(out size); | 85 | Vector3[] offsets = coa.GetSizeAndOffsets(out size); |
86 | 86 | ||
87 | writer.WriteStartElement("CoalescedObject"); | 87 | writer.WriteStartElement("CoalescedObject"); |
88 | 88 | ||
89 | writer.WriteAttributeString("x", size.X.ToString()); | 89 | writer.WriteAttributeString("x", size.X.ToString()); |
90 | writer.WriteAttributeString("y", size.Y.ToString()); | 90 | writer.WriteAttributeString("y", size.Y.ToString()); |
91 | writer.WriteAttributeString("z", size.Z.ToString()); | 91 | writer.WriteAttributeString("z", size.Z.ToString()); |
92 | 92 | ||
93 | // Embed the offsets into the group XML | 93 | // Embed the offsets into the group XML |
94 | for (int i = 0; i < coaObjects.Count; i++) | 94 | for (int i = 0; i < coaObjects.Count; i++) |
95 | { | 95 | { |
96 | SceneObjectGroup obj = coaObjects[i]; | 96 | SceneObjectGroup obj = coaObjects[i]; |
97 | 97 | ||
98 | // m_log.DebugFormat( | 98 | // m_log.DebugFormat( |
99 | // "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", | 99 | // "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", |
100 | // i, obj.Name); | 100 | // i, obj.Name); |
101 | 101 | ||
102 | writer.WriteStartElement("SceneObjectGroup"); | 102 | writer.WriteStartElement("SceneObjectGroup"); |
103 | writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); | 103 | writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); |
104 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); | 104 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); |
105 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); | 105 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); |
106 | 106 | ||
107 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); | 107 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); |
108 | 108 | ||
109 | writer.WriteEndElement(); // SceneObjectGroup | 109 | writer.WriteEndElement(); // SceneObjectGroup |
110 | } | 110 | } |
111 | 111 | ||
112 | writer.WriteEndElement(); // CoalescedObject | 112 | writer.WriteEndElement(); // CoalescedObject |
113 | } | 113 | } |
114 | 114 | ||
115 | string output = sw.ToString(); | 115 | string output = sw.ToString(); |
116 | 116 | ||
117 | // Console.WriteLine(output); | 117 | // Console.WriteLine(output); |
118 | 118 | ||
119 | return output; | 119 | return output; |
120 | } | 120 | } |
121 | } | 121 | } |
@@ -123,14 +123,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
123 | public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) | 123 | public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) |
124 | { | 124 | { |
125 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); | 125 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); |
126 | 126 | ||
127 | coa = null; | 127 | coa = null; |
128 | 128 | ||
129 | try | 129 | try |
130 | { | 130 | { |
131 | // Quickly check if this is a coalesced object, without fully parsing the XML | 131 | // Quickly check if this is a coalesced object, without fully parsing the XML |
132 | using (StringReader sr = new StringReader(xml)) | 132 | using (StringReader sr = new StringReader(xml)) |
133 | { | 133 | { |
134 | using (XmlTextReader reader = new XmlTextReader(sr)) | 134 | using (XmlTextReader reader = new XmlTextReader(sr)) |
135 | { | 135 | { |
136 | reader.MoveToContent(); // skip possible xml declaration | 136 | reader.MoveToContent(); // skip possible xml declaration |
@@ -140,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
140 | // m_log.DebugFormat( | 140 | // m_log.DebugFormat( |
141 | // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", | 141 | // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", |
142 | // reader.Name); | 142 | // reader.Name); |
143 | 143 | ||
144 | return false; | 144 | return false; |
145 | } | 145 | } |
146 | } | 146 | } |
@@ -151,12 +151,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
151 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | 151 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); |
152 | if (e == null) | 152 | if (e == null) |
153 | return false; | 153 | return false; |
154 | 154 | ||
155 | coa = new CoalescedSceneObjects(UUID.Zero); | 155 | coa = new CoalescedSceneObjects(UUID.Zero); |
156 | 156 | ||
157 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | 157 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); |
158 | int i = 0; | 158 | int i = 0; |
159 | 159 | ||
160 | foreach (XmlNode n in groups) | 160 | foreach (XmlNode n in groups) |
161 | { | 161 | { |
162 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | 162 | SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); |
@@ -181,8 +181,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
181 | m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); | 181 | m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); |
182 | Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml); | 182 | Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml); |
183 | return false; | 183 | return false; |
184 | } | 184 | } |
185 | 185 | ||
186 | return true; | 186 | return true; |
187 | } | 187 | } |
188 | } | 188 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 4caa9cb..8f2c146 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
107 | part.LinkNum = linkNum; | 107 | part.LinkNum = linkNum; |
108 | part.TrimPermissions(); | 108 | part.TrimPermissions(); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | while (reader.ReadToNextSibling("Part")); | 111 | while (reader.ReadToNextSibling("Part")); |
112 | } | 112 | } |
113 | 113 | ||
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
156 | { | 156 | { |
157 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); | 157 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); |
158 | } | 158 | } |
159 | 159 | ||
160 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState) | 160 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState) |
161 | { | 161 | { |
162 | using (StringWriter sw = new StringWriter()) | 162 | using (StringWriter sw = new StringWriter()) |
@@ -190,7 +190,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
190 | 190 | ||
191 | if (!noRootElement) | 191 | if (!noRootElement) |
192 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | 192 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); |
193 | 193 | ||
194 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); | 194 | writer.WriteStartElement(String.Empty, "RootPart", String.Empty); |
195 | ToXmlFormat(sceneObject.RootPart, writer); | 195 | ToXmlFormat(sceneObject.RootPart, writer); |
196 | writer.WriteEndElement(); | 196 | writer.WriteEndElement(); |
@@ -212,23 +212,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
212 | 212 | ||
213 | if (doScriptStates) | 213 | if (doScriptStates) |
214 | sceneObject.SaveScriptedState(writer); | 214 | sceneObject.SaveScriptedState(writer); |
215 | 215 | ||
216 | if (!noRootElement) | 216 | if (!noRootElement) |
217 | writer.WriteEndElement(); // SceneObjectGroup | 217 | writer.WriteEndElement(); // SceneObjectGroup |
218 | 218 | ||
219 | // m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time); | 219 | // m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time); |
220 | } | 220 | } |
221 | 221 | ||
222 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) | 222 | protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) |
223 | { | 223 | { |
224 | SOPToXml2(writer, part, new Dictionary<string, object>()); | 224 | SOPToXml2(writer, part, new Dictionary<string, object>()); |
225 | } | 225 | } |
226 | 226 | ||
227 | public static SceneObjectGroup FromXml2Format(string xmlData) | 227 | public static SceneObjectGroup FromXml2Format(string xmlData) |
228 | { | 228 | { |
229 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 229 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
230 | //int time = System.Environment.TickCount; | 230 | //int time = System.Environment.TickCount; |
231 | 231 | ||
232 | try | 232 | try |
233 | { | 233 | { |
234 | XmlDocument doc = new XmlDocument(); | 234 | XmlDocument doc = new XmlDocument(); |
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
278 | // Script state may, or may not, exist. Not having any, is NOT | 278 | // Script state may, or may not, exist. Not having any, is NOT |
279 | // ever a problem. | 279 | // ever a problem. |
280 | sceneObject.LoadScriptState(doc); | 280 | sceneObject.LoadScriptState(doc); |
281 | 281 | ||
282 | return sceneObject; | 282 | return sceneObject; |
283 | } | 283 | } |
284 | catch (Exception e) | 284 | catch (Exception e) |
@@ -307,14 +307,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
310 | 310 | ||
311 | /// <summary> | 311 | /// <summary> |
312 | /// Modifies a SceneObjectGroup. | 312 | /// Modifies a SceneObjectGroup. |
313 | /// </summary> | 313 | /// </summary> |
314 | /// <param name="sog">The object</param> | 314 | /// <param name="sog">The object</param> |
315 | /// <returns>Whether the object was actually modified</returns> | 315 | /// <returns>Whether the object was actually modified</returns> |
316 | public delegate bool SceneObjectModifier(SceneObjectGroup sog); | 316 | public delegate bool SceneObjectModifier(SceneObjectGroup sog); |
317 | 317 | ||
318 | /// <summary> | 318 | /// <summary> |
319 | /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. | 319 | /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. |
320 | /// </summary> | 320 | /// </summary> |
@@ -328,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
328 | CoalescedSceneObjects coa = null; | 328 | CoalescedSceneObjects coa = null; |
329 | 329 | ||
330 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); | 330 | string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); |
331 | 331 | ||
332 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | 332 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) |
333 | { | 333 | { |
334 | // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | 334 | // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); |
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
483 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); | 483 | m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); |
484 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); | 484 | m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); |
485 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); | 485 | m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); |
486 | 486 | ||
487 | #endregion | 487 | #endregion |
488 | 488 | ||
489 | #region ShapeXmlProcessors initialization | 489 | #region ShapeXmlProcessors initialization |
@@ -1139,7 +1139,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1139 | { | 1139 | { |
1140 | shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); | 1140 | shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader) | 1143 | private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader) |
1144 | { | 1144 | { |
1145 | shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); | 1145 | shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); |
@@ -1372,7 +1372,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1372 | if (sop.MediaUrl != null) | 1372 | if (sop.MediaUrl != null) |
1373 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); | 1373 | writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); |
1374 | WriteVector(writer, "AttachedPos", sop.AttachedPos); | 1374 | WriteVector(writer, "AttachedPos", sop.AttachedPos); |
1375 | 1375 | ||
1376 | if (sop.DynAttrs.CountNamespaces > 0) | 1376 | if (sop.DynAttrs.CountNamespaces > 0) |
1377 | { | 1377 | { |
1378 | writer.WriteStartElement("DynAttrs"); | 1378 | writer.WriteStartElement("DynAttrs"); |