diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SOPVehicle.cs | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index d3c2d27..41e8944 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs | |||
@@ -30,6 +30,8 @@ using System.Collections.Generic; | |||
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | using System.Text; | ||
34 | using System.IO; | ||
33 | using System.Xml; | 35 | using System.Xml; |
34 | using OpenSim.Framework.Serialization; | 36 | using OpenSim.Framework.Serialization; |
35 | using OpenSim.Framework.Serialization.External; | 37 | using OpenSim.Framework.Serialization.External; |
@@ -561,8 +563,56 @@ namespace OpenSim.Region.Framework.Scenes | |||
561 | } | 563 | } |
562 | 564 | ||
563 | 565 | ||
566 | public string ToXml2() | ||
567 | { | ||
568 | MemoryStream ms = new MemoryStream(512); | ||
569 | UTF8Encoding enc = new UTF8Encoding(); | ||
570 | XmlTextWriter xwriter = new XmlTextWriter(ms, enc); | ||
571 | ToXml2(xwriter); | ||
572 | xwriter.Flush(); | ||
573 | string s = ms.GetStreamString(); | ||
574 | xwriter.Close(); | ||
575 | return s; | ||
576 | } | ||
577 | |||
578 | public static SOPVehicle FromXml2(string text) | ||
579 | { | ||
580 | if (text == String.Empty) | ||
581 | return null; | ||
582 | |||
583 | UTF8Encoding enc = new UTF8Encoding(); | ||
584 | MemoryStream ms = new MemoryStream(enc.GetBytes(text)); | ||
585 | XmlTextReader xreader = new XmlTextReader(ms); | ||
586 | |||
587 | SOPVehicle v = new SOPVehicle(); | ||
588 | bool error; | ||
589 | |||
590 | v.FromXml2(xreader, out error); | ||
591 | |||
592 | xreader.Close(); | ||
593 | |||
594 | if (error) | ||
595 | { | ||
596 | v = null; | ||
597 | return null; | ||
598 | } | ||
599 | return v; | ||
600 | } | ||
601 | |||
602 | public static SOPVehicle FromXml2(XmlTextReader reader) | ||
603 | { | ||
604 | SOPVehicle vehicle = new SOPVehicle(); | ||
605 | |||
606 | bool errors = false; | ||
607 | |||
608 | vehicle.FromXml2(reader, out errors); | ||
609 | if (errors) | ||
610 | return null; | ||
611 | |||
612 | return vehicle; | ||
613 | } | ||
564 | 614 | ||
565 | public void FromXml2(XmlTextReader _reader, out bool errors) | 615 | private void FromXml2(XmlTextReader _reader, out bool errors) |
566 | { | 616 | { |
567 | errors = false; | 617 | errors = false; |
568 | reader = _reader; | 618 | reader = _reader; |
@@ -739,4 +789,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
739 | vd.m_referenceFrame = XRquat(); | 789 | vd.m_referenceFrame = XRquat(); |
740 | } | 790 | } |
741 | } | 791 | } |
742 | } \ No newline at end of file | 792 | } |