From b16abc8166c29585cb76cc55c3bdd76e5833cb4f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 5 Jan 2017 19:07:37 +0000 Subject: Massive tab and trailing space cleanup --- .../CoalescedSceneObjectsSerializer.cs | 60 +++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index 998789d..7f7977e 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 /// /// public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates) - { + { using (StringWriter sw = new StringWriter()) { using (XmlTextWriter writer = new XmlTextWriter(sw)) - { + { Vector3 size; - + List coaObjects = coa.Objects; - + // m_log.DebugFormat( -// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", +// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", // coaObjects.Count); - + // This is weak - we're relying on the set of coalesced objects still being identical Vector3[] offsets = coa.GetSizeAndOffsets(out size); writer.WriteStartElement("CoalescedObject"); - + writer.WriteAttributeString("x", size.X.ToString()); writer.WriteAttributeString("y", size.Y.ToString()); - writer.WriteAttributeString("z", size.Z.ToString()); - + writer.WriteAttributeString("z", size.Z.ToString()); + // Embed the offsets into the group XML for (int i = 0; i < coaObjects.Count; i++) { SceneObjectGroup obj = coaObjects[i]; - + // m_log.DebugFormat( -// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", -// i, obj.Name); - +// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", +// i, obj.Name); + writer.WriteStartElement("SceneObjectGroup"); writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); - + SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, doScriptStates); - + writer.WriteEndElement(); // SceneObjectGroup - } - + } + writer.WriteEndElement(); // CoalescedObject } string output = sw.ToString(); - + // Console.WriteLine(output); - + return output; } } @@ -123,14 +123,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) { // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); - + coa = null; - + try { // Quickly check if this is a coalesced object, without fully parsing the XML using (StringReader sr = new StringReader(xml)) - { + { using (XmlTextReader reader = new XmlTextReader(sr)) { reader.MoveToContent(); // skip possible xml declaration @@ -138,9 +138,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (reader.Name != "CoalescedObject") { // m_log.DebugFormat( - // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", + // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", // reader.Name); - + return false; } } @@ -151,12 +151,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); if (e == null) return false; - + coa = new CoalescedSceneObjects(UUID.Zero); XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); int i = 0; - + foreach (XmlNode n in groups) { SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); @@ -166,10 +166,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } else { - // XXX: Possibly we should fail outright here rather than continuing if a particular component of the + // XXX: Possibly we should fail outright here rather than continuing if a particular component of the // coalesced object fails to load. m_log.WarnFormat( - "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", + "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.", i); } @@ -181,8 +181,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e); Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml); return false; - } - + } + return true; } } -- cgit v1.1