diff options
author | ubit | 2012-07-07 08:43:56 +0200 |
---|---|---|
committer | ubit | 2012-07-07 08:43:56 +0200 |
commit | 6090140077110664d4512a0bdb4c11b82237a7aa (patch) | |
tree | f385c96fc23ccad22854fea54d7f84bbd978cbc8 | |
parent | Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
parent | fix vehicle to XML string (diff) | |
download | opensim-SC_OLD-6090140077110664d4512a0bdb4c11b82237a7aa.zip opensim-SC_OLD-6090140077110664d4512a0bdb4c11b82237a7aa.tar.gz opensim-SC_OLD-6090140077110664d4512a0bdb4c11b82237a7aa.tar.bz2 opensim-SC_OLD-6090140077110664d4512a0bdb4c11b82237a7aa.tar.xz |
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPVehicle.cs | 20 |
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 | ||