fix vehicle to XML string
parent
d0f7fb1d35
commit
afa02aa104
|
@ -565,31 +565,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public string ToXml2()
|
public string ToXml2()
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream();
|
MemoryStream ms = new MemoryStream(512);
|
||||||
UTF8Encoding enc = new UTF8Encoding();
|
UTF8Encoding enc = new UTF8Encoding();
|
||||||
XmlTextWriter writer = new XmlTextWriter(ms, null);
|
XmlTextWriter xwriter = new XmlTextWriter(ms, enc);
|
||||||
ToXml2(writer);
|
ToXml2(xwriter);
|
||||||
return enc.GetString(ms.ToArray());
|
xwriter.Flush();
|
||||||
|
string s = ms.GetStreamString();
|
||||||
|
xwriter.Close();
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SOPVehicle FromXml2(string text)
|
public static SOPVehicle FromXml2(string text)
|
||||||
{
|
{
|
||||||
if (text == String.Empty)
|
if (text == String.Empty)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
UTF8Encoding enc = new UTF8Encoding();
|
UTF8Encoding enc = new UTF8Encoding();
|
||||||
MemoryStream ms = new MemoryStream(enc.GetBytes(text));
|
MemoryStream ms = new MemoryStream(enc.GetBytes(text));
|
||||||
XmlTextReader reader = new XmlTextReader(ms);
|
XmlTextReader xreader = new XmlTextReader(ms);
|
||||||
|
|
||||||
SOPVehicle v = new SOPVehicle();
|
SOPVehicle v = new SOPVehicle();
|
||||||
bool error;
|
bool error;
|
||||||
|
|
||||||
v.FromXml2(reader, out error);
|
v.FromXml2(xreader, out error);
|
||||||
|
|
||||||
|
xreader.Close();
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
v = null;
|
v = null;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue