aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-22 16:54:46 +1000
committerDavid Walter Seikel2016-11-22 16:54:46 +1000
commitbe1f9db781db96b5d2ec45aa889e21daa6a1af36 (patch)
tree38eb98d0e35531329a993a23b2227475984abc16 /OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
parentAlas "make IARs for those that logged on since the last time" failed, 8.2 bro... (diff)
downloadopensim-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/CoalescedSceneObjectsSerializer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs50
1 files changed, 25 insertions, 25 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 }