diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Serialization/External/LandDataSerializer.cs | 64 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs | 86 |
2 files changed, 118 insertions, 32 deletions
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index 4376249..e9af2ca 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs | |||
@@ -132,47 +132,47 @@ namespace OpenSim.Framework.Serialization.External | |||
132 | xtw.WriteStartDocument(); | 132 | xtw.WriteStartDocument(); |
133 | xtw.WriteStartElement("LandData"); | 133 | xtw.WriteStartElement("LandData"); |
134 | 134 | ||
135 | xtw.WriteElementString("Area", landData.Area.ToString()); | 135 | xtw.WriteElementString("Area", Convert.ToString(landData.Area)); |
136 | xtw.WriteElementString("AuctionID", landData.AuctionID.ToString()); | 136 | xtw.WriteElementString("AuctionID", Convert.ToString(landData.AuctionID)); |
137 | xtw.WriteElementString("AuthBuyerID", landData.AuthBuyerID.ToString()); | 137 | xtw.WriteElementString("AuthBuyerID", landData.AuthBuyerID.ToString()); |
138 | xtw.WriteElementString("Category", landData.Category.ToString()); | 138 | xtw.WriteElementString("Category", Convert.ToString(landData.Category)); |
139 | xtw.WriteElementString("ClaimDate", landData.ClaimDate.ToString()); | 139 | xtw.WriteElementString("ClaimDate", Convert.ToString(landData.ClaimDate)); |
140 | xtw.WriteElementString("ClaimPrice", landData.ClaimPrice.ToString()); | 140 | xtw.WriteElementString("ClaimPrice", Convert.ToString(landData.ClaimPrice)); |
141 | xtw.WriteElementString("GlobalID", landData.GlobalID.ToString()); | 141 | xtw.WriteElementString("GlobalID", landData.GlobalID.ToString()); |
142 | xtw.WriteElementString("GroupID", landData.GroupID.ToString()); | 142 | xtw.WriteElementString("GroupID", landData.GroupID.ToString()); |
143 | xtw.WriteElementString("IsGroupOwned", landData.IsGroupOwned.ToString()); | 143 | xtw.WriteElementString("IsGroupOwned", Convert.ToString(landData.IsGroupOwned)); |
144 | xtw.WriteElementString("Bitmap", landData.Bitmap.ToString()); | 144 | xtw.WriteElementString("Bitmap", Convert.ToBase64String(landData.Bitmap)); |
145 | xtw.WriteElementString("Description", landData.Description); | 145 | xtw.WriteElementString("Description", landData.Description); |
146 | xtw.WriteElementString("Flags", landData.Flags.ToString()); | 146 | xtw.WriteElementString("Flags", Convert.ToString(landData.Flags)); |
147 | xtw.WriteElementString("LandingType", landData.LandingType.ToString()); | 147 | xtw.WriteElementString("LandingType", Convert.ToString(landData.LandingType)); |
148 | xtw.WriteElementString("Name", landData.Name); | 148 | xtw.WriteElementString("Name", landData.Name); |
149 | xtw.WriteElementString("Status", landData.Status.ToString()); | 149 | xtw.WriteElementString("Status", Convert.ToString(landData.Status)); |
150 | xtw.WriteElementString("LocalID", landData.LocalID.ToString()); | 150 | xtw.WriteElementString("LocalID", landData.LocalID.ToString()); |
151 | xtw.WriteElementString("MediaAutoScale", landData.MediaAutoScale.ToString()); | 151 | xtw.WriteElementString("MediaAutoScale", Convert.ToString(landData.MediaAutoScale)); |
152 | xtw.WriteElementString("MediaID", landData.MediaID.ToString()); | 152 | xtw.WriteElementString("MediaID", landData.MediaID.ToString()); |
153 | xtw.WriteElementString("MediaURL", landData.MediaURL.ToString()); | 153 | xtw.WriteElementString("MediaURL", landData.MediaURL); |
154 | xtw.WriteElementString("MusicURL", landData.MusicURL.ToString()); | 154 | xtw.WriteElementString("MusicURL", landData.MusicURL); |
155 | xtw.WriteElementString("OwnerID", landData.OwnerID.ToString()); | 155 | xtw.WriteElementString("OwnerID", landData.OwnerID.ToString()); |
156 | 156 | ||
157 | xtw.WriteStartElement("ParcelAccessList"); | 157 | xtw.WriteStartElement("ParcelAccessList"); |
158 | foreach (ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList) | 158 | foreach (ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList) |
159 | { | 159 | { |
160 | xtw.WriteStartElement("ParcelAccessEntry"); | 160 | xtw.WriteStartElement("ParcelAccessEntry"); |
161 | xtw.WriteElementString("AgentID", pal.AgentID.ToString()); | 161 | xtw.WriteElementString("AgentID", pal.AgentID.ToString()); |
162 | xtw.WriteElementString("Time", pal.Time.ToString()); | 162 | xtw.WriteElementString("Time", Convert.ToString(pal.Time)); |
163 | xtw.WriteElementString("AccessList", pal.Flags.ToString()); | 163 | xtw.WriteElementString("AccessList", Convert.ToString(pal.Flags)); |
164 | xtw.WriteEndElement(); | 164 | xtw.WriteEndElement(); |
165 | } | 165 | } |
166 | xtw.WriteEndElement(); | 166 | xtw.WriteEndElement(); |
167 | 167 | ||
168 | xtw.WriteElementString("PassHours", landData.PassHours.ToString()); | 168 | xtw.WriteElementString("PassHours", Convert.ToString(landData.PassHours)); |
169 | xtw.WriteElementString("PassPrice", landData.PassPrice.ToString()); | 169 | xtw.WriteElementString("PassPrice", Convert.ToString(landData.PassPrice)); |
170 | xtw.WriteElementString("SalePrice", landData.SalePrice.ToString()); | 170 | xtw.WriteElementString("SalePrice", Convert.ToString(landData.SalePrice)); |
171 | xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); | 171 | xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString()); |
172 | xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); | 172 | xtw.WriteElementString("UserLocation", landData.UserLocation.ToString()); |
173 | xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); | 173 | xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString()); |
174 | xtw.WriteElementString("Dwell", landData.Dwell.ToString()); | 174 | xtw.WriteElementString("Dwell", Convert.ToString(landData.Dwell)); |
175 | xtw.WriteElementString("OtherCleanTime", landData.OtherCleanTime.ToString()); | 175 | xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime)); |
176 | 176 | ||
177 | xtw.WriteEndElement(); | 177 | xtw.WriteEndElement(); |
178 | 178 | ||
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs new file mode 100644 index 0000000..f1881a1 --- /dev/null +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections.Generic; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Framework.Serialization.External; | ||
31 | using OpenMetaverse; | ||
32 | using OpenMetaverse.StructuredData; | ||
33 | using NUnit.Framework; | ||
34 | |||
35 | namespace OpenSim.Framework.Serialization.Tests | ||
36 | { | ||
37 | [TestFixture] | ||
38 | public class LandDataSerializerTest | ||
39 | { | ||
40 | private LandData land; | ||
41 | |||
42 | [SetUp] | ||
43 | public void setup() | ||
44 | { | ||
45 | // setup LandData object | ||
46 | this.land = new LandData(); | ||
47 | this.land.AABBMax = new Vector3(0, 0, 0); | ||
48 | this.land.AABBMin = new Vector3(128, 128, 128); | ||
49 | this.land.Area = 128; | ||
50 | this.land.AuctionID = 0; | ||
51 | this.land.AuthBuyerID = new UUID(); | ||
52 | this.land.Category = ParcelCategory.Residential; | ||
53 | this.land.ClaimDate = 0; | ||
54 | this.land.ClaimPrice = 0; | ||
55 | this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50"); | ||
56 | this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5"); | ||
57 | this.land.GroupPrims = 0; | ||
58 | this.land.Description = "land data to test LandDataSerializer"; | ||
59 | this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat); | ||
60 | this.land.LandingType = (byte)LandingType.Direct; | ||
61 | this.land.Name = "LandDataSerializerTest Land"; | ||
62 | this.land.Status = ParcelStatus.Leased; | ||
63 | this.land.LocalID = 0; | ||
64 | this.land.MediaAutoScale = (byte)0x01; | ||
65 | this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7"); | ||
66 | this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4"; | ||
67 | this.land.OwnerID = new UUID("1b8eedf9-6d15-448b-8015-24286f1756bf"); | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// </summary> | ||
72 | [Test] | ||
73 | public void TestLandDataSerializerSerializeTest() | ||
74 | { | ||
75 | string serialized = LandDataSerializer.Serialize(this.land); | ||
76 | Assert.That(serialized.Length > 0); | ||
77 | } | ||
78 | |||
79 | /// <summary> | ||
80 | /// </summary> | ||
81 | [Test] | ||
82 | public void TestLandDataSerializerDeserializeTest() | ||
83 | { | ||
84 | } | ||
85 | } | ||
86 | } | ||