From be1f9db781db96b5d2ec45aa889e21daa6a1af36 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 22 Nov 2016 16:54:46 +1000 Subject: Various random white space clean ups. --- .../World/Warp3DMap/Warp3DImageModule.cs | 2 +- .../CoalescedSceneObjectsSerializer.cs | 50 +++++++++++----------- .../Scenes/Serialization/SceneObjectSerializer.cs | 28 ++++++------ OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 2 +- 4 files changed, 41 insertions(+), 41 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 5f2534b..9fdef6a 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -651,7 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap catch (Exception e) { m_log.Warn(string.Format("[WARP 3D IMAGE MODULE]: Failed to decode asset {0}, exception ", id), e); - } + } } return ret; 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 /// /// 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", // 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); - +// 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 @@ -140,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // m_log.DebugFormat( // "[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); @@ -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; } } 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 part.LinkNum = linkNum; part.TrimPermissions(); } - } + } while (reader.ReadToNextSibling("Part")); } @@ -156,7 +156,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); } - + public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState) { using (StringWriter sw = new StringWriter()) @@ -190,7 +190,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (!noRootElement) writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); - + writer.WriteStartElement(String.Empty, "RootPart", String.Empty); ToXmlFormat(sceneObject.RootPart, writer); writer.WriteEndElement(); @@ -212,23 +212,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (doScriptStates) sceneObject.SaveScriptedState(writer); - + if (!noRootElement) writer.WriteEndElement(); // SceneObjectGroup // m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time); - } + } protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) { SOPToXml2(writer, part, new Dictionary()); } - + public static SceneObjectGroup FromXml2Format(string xmlData) { //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); //int time = System.Environment.TickCount; - + try { XmlDocument doc = new XmlDocument(); @@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization // Script state may, or may not, exist. Not having any, is NOT // ever a problem. sceneObject.LoadScriptState(doc); - + return sceneObject; } catch (Exception e) @@ -307,14 +307,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - + /// /// Modifies a SceneObjectGroup. /// /// The object /// Whether the object was actually modified public delegate bool SceneObjectModifier(SceneObjectGroup sog); - + /// /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. /// @@ -328,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization CoalescedSceneObjects coa = null; string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); - + if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) { // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); @@ -483,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); - + #endregion #region ShapeXmlProcessors initialization @@ -1139,7 +1139,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { shp.HollowShape = Util.ReadEnum(reader, "HollowShape"); } - + private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader) { shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); @@ -1372,7 +1372,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (sop.MediaUrl != null) writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); WriteVector(writer, "AttachedPos", sop.AttachedPos); - + if (sop.DynAttrs.CountNamespaces > 0) { writer.WriteStartElement("DynAttrs"); diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 9ec4e1d..453d95d 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -510,7 +510,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// private void RecordGestureAssetUuids(AssetBase gestureAsset) - { + { using (MemoryStream ms = new MemoryStream(gestureAsset.Data)) using (StreamReader sr = new StreamReader(ms)) { -- cgit v1.1