mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 05:45:37 +08:00
.net xml things don't like null terminated strings
This commit is contained in:
@@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData);
|
||||
using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null))
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment}))
|
||||
using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -79,6 +79,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
public static SceneObjectGroup FromOriginalXmlData(byte[] data)
|
||||
{
|
||||
int len = data.Length;
|
||||
if(len < 32)
|
||||
return null;
|
||||
if(data[len -1 ] == 0)
|
||||
--len;
|
||||
using (MemoryStream ms = new MemoryStream(data,0, len, false))
|
||||
{
|
||||
using (XmlReader reader = XmlReader.Create(ms, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
|
||||
{
|
||||
try
|
||||
{
|
||||
return FromOriginalXmlFormat(reader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[SERIALIZER]: Deserialization of xml data failed ", e);
|
||||
string s = Utils.BytesToString(data);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize a scene object from the original xml format
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user