mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Massive tab and trailing space cleanup
This commit is contained in:
@@ -68,54 +68,54 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public static string ToXml(CoalescedSceneObjects coa, bool doScriptStates)
|
||||
{
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using (XmlTextWriter writer = new XmlTextWriter(sw))
|
||||
{
|
||||
{
|
||||
Vector3 size;
|
||||
|
||||
|
||||
List<SceneObjectGroup> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<string, object>());
|
||||
}
|
||||
|
||||
|
||||
public static SceneObjectGroup FromXml2Format(string xmlData)
|
||||
{
|
||||
//m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
|
||||
//int time = System.Environment.TickCount;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
@@ -780,7 +780,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
obj.VehicleParams = vehicle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
|
||||
{
|
||||
List<string> errorNodeNames;
|
||||
@@ -1235,7 +1235,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
{
|
||||
shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
|
||||
}
|
||||
|
||||
|
||||
private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader)
|
||||
{
|
||||
shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
|
||||
@@ -1367,13 +1367,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
if (sog.RootPart.KeyframeMotion != null)
|
||||
{
|
||||
Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
|
||||
Byte[] data = sog.RootPart.KeyframeMotion.Serialize();
|
||||
|
||||
writer.WriteStartElement(String.Empty, "KeyframeMotion", String.Empty);
|
||||
writer.WriteBase64(data, 0, data.Length);
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
@@ -1438,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
WriteShape(writer, sop.Shape, options);
|
||||
|
||||
WriteVector(writer, "Scale", sop.Scale);
|
||||
WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation);
|
||||
WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation);
|
||||
WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
|
||||
WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);
|
||||
WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL);
|
||||
@@ -1472,7 +1472,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");
|
||||
@@ -1520,7 +1520,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
writer.WriteElementString("SoundRadius", sop.SoundRadius.ToString().ToLower());
|
||||
}
|
||||
writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower());
|
||||
|
||||
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user