aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/SOPVehicle.cs20
1 files changed, 13 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
index 45ca00c..e2ef77b 100644
--- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
@@ -565,31 +565,37 @@ namespace OpenSim.Region.Framework.Scenes
565 565
566 public string ToXml2() 566 public string ToXml2()
567 { 567 {
568 MemoryStream ms = new MemoryStream(); 568 MemoryStream ms = new MemoryStream(512);
569 UTF8Encoding enc = new UTF8Encoding(); 569 UTF8Encoding enc = new UTF8Encoding();
570 XmlTextWriter writer = new XmlTextWriter(ms, null); 570 XmlTextWriter xwriter = new XmlTextWriter(ms, enc);
571 ToXml2(writer); 571 ToXml2(xwriter);
572 return enc.GetString(ms.ToArray()); 572 xwriter.Flush();
573 string s = ms.GetStreamString();
574 xwriter.Close();
575 return s;
573 } 576 }
574 577
575 public static SOPVehicle FromXml2(string text) 578 public static SOPVehicle FromXml2(string text)
576 { 579 {
577 if (text == String.Empty) 580 if (text == String.Empty)
578 return null; 581 return null;
582
579 UTF8Encoding enc = new UTF8Encoding(); 583 UTF8Encoding enc = new UTF8Encoding();
580 MemoryStream ms = new MemoryStream(enc.GetBytes(text)); 584 MemoryStream ms = new MemoryStream(enc.GetBytes(text));
581 XmlTextReader reader = new XmlTextReader(ms); 585 XmlTextReader xreader = new XmlTextReader(ms);
582 586
583 SOPVehicle v = new SOPVehicle(); 587 SOPVehicle v = new SOPVehicle();
584 bool error; 588 bool error;
585 589
586 v.FromXml2(reader, out error); 590 v.FromXml2(xreader, out error);
591
592 xreader.Close();
593
587 if (error) 594 if (error)
588 { 595 {
589 v = null; 596 v = null;
590 return null; 597 return null;
591 } 598 }
592
593 return v; 599 return v;
594 } 600 }
595 601