From e398c33648dabca1b7243214e3faa1e36f8cf024 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 May 2011 12:17:46 +0100 Subject: [PATCH] Add PayPrice to serialization format Xml2 --- .../Framework/Scenes/SceneObjectPart.cs | 9 ++--- .../Serialization/SceneObjectSerializer.cs | 37 ++++++++++++++++++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8a8a6993cc..331abb27b4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -144,11 +144,10 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 StatusSandboxPos; - // TODO: This needs to be persisted in next XML version update! - - public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; - - + [XmlIgnore] + public int[] PayPrice = {-2,-2,-2,-2,-2}; + + [XmlIgnore] public PhysicsActor PhysActor { get { return m_physActor; } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index bb8a83a1af..872816c450 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -341,6 +341,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); + m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0); + m_SOPXmlProcessors.Add("PayPrice1", ProcessPayPrice1); + m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2); + m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3); + m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4); #endregion #region TaskInventoryXmlProcessors initialization @@ -698,6 +703,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); } + + private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty); + } + + private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty); + } + + private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty); + } + + private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty); + } + + private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader) + { + obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); + } + #endregion #region TaskInventoryXmlProcessors @@ -1069,7 +1100,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); } - #endregion ////////// Write ///////// @@ -1175,6 +1205,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); + writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString()); + writer.WriteElementString("PayPrice1", sop.PayPrice[1].ToString()); + writer.WriteElementString("PayPrice2", sop.PayPrice[2].ToString()); + writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString()); + writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString()); writer.WriteEndElement(); }