SOP to xml: don't waste space with some unset optional parameters.

master
UbitUmarov 2020-05-26 12:48:08 +01:00
parent d460a3fc86
commit 0a48da85a3
1 changed files with 16 additions and 15 deletions

View File

@ -87,10 +87,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if(data[len -1 ] == 0)
--len;
XmlReaderSettings xset = new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment, CloseInput = true };
XmlParserContext xpc = new XmlParserContext(null, null, null, XmlSpace.None);
xpc.Encoding = Util.UTF8NoBomEncoding;
MemoryStream ms = new MemoryStream(data, 0, len, false);
using(StreamReader sr = new StreamReader(ms, Encoding.UTF8))
{
using (XmlReader reader = XmlReader.Create(ms, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
using (XmlReader reader = XmlReader.Create(ms, xset, xpc))
{
try
{
@ -103,7 +104,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
}
}
/// <summary>
/// Deserialize a scene object from the original xml format
@ -1572,6 +1572,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);
WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL);
if(sop.StandOffset != Vector3.Zero);
WriteVector(writer, "StandTarget", sop.StandOffset);
writer.WriteElementString("ParentID", sop.ParentID.ToString());
writer.WriteElementString("CreationDate", sop.CreationDate.ToString());
@ -1661,7 +1662,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if(data != null && data.Length > 0)
writer.WriteElementString("SOPAnims", Convert.ToBase64String(data));
}
if(Math.Abs(sop.SitActiveRange) > 1e-5)
writer.WriteElementString("SitActRange", sop.SitActiveRange.ToString(Culture.FormatProvider));
writer.WriteEndElement();
}