32 using OpenSim.Framework;
34 using System.Reflection;
36 namespace OpenSim.Framework.Serialization.External
51 return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length));
64 StringReader sr =
new StringReader(serializedSettings);
65 XmlTextReader xtr =
new XmlTextReader(sr);
67 xtr.ReadStartElement(
"RegionSettings");
69 xtr.ReadStartElement(
"General");
71 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
76 settings.AllowDamage = bool.Parse(xtr.ReadElementContentAsString());
78 case "AllowLandResell":
79 settings.AllowLandResell = bool.Parse(xtr.ReadElementContentAsString());
81 case "AllowLandJoinDivide":
82 settings.AllowLandJoinDivide = bool.Parse(xtr.ReadElementContentAsString());
85 settings.BlockFly = bool.Parse(xtr.ReadElementContentAsString());
87 case "BlockLandShowInSearch":
88 settings.BlockShowInSearch = bool.Parse(xtr.ReadElementContentAsString());
90 case "BlockTerraform":
91 settings.BlockTerraform = bool.Parse(xtr.ReadElementContentAsString());
93 case "DisableCollisions":
94 settings.DisableCollisions = bool.Parse(xtr.ReadElementContentAsString());
96 case "DisablePhysics":
97 settings.DisablePhysics = bool.Parse(xtr.ReadElementContentAsString());
99 case "DisableScripts":
100 settings.DisableScripts = bool.Parse(xtr.ReadElementContentAsString());
102 case "MaturityRating":
103 settings.Maturity = int.Parse(xtr.ReadElementContentAsString());
105 case "RestrictPushing":
106 settings.RestrictPushing = bool.Parse(xtr.ReadElementContentAsString());
109 settings.AgentLimit = int.Parse(xtr.ReadElementContentAsString());
117 xtr.ReadEndElement();
118 xtr.ReadStartElement(
"GroundTextures");
120 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
125 settings.TerrainTexture1 = UUID.Parse(xtr.ReadElementContentAsString());
128 settings.TerrainTexture2 = UUID.Parse(xtr.ReadElementContentAsString());
131 settings.TerrainTexture3 = UUID.Parse(xtr.ReadElementContentAsString());
134 settings.TerrainTexture4 = UUID.Parse(xtr.ReadElementContentAsString());
136 case "ElevationLowSW":
139 case "ElevationLowNW":
142 case "ElevationLowSE":
145 case "ElevationLowNE":
148 case "ElevationHighSW":
151 case "ElevationHighNW":
154 case "ElevationHighSE":
157 case "ElevationHighNE":
163 xtr.ReadEndElement();
164 xtr.ReadStartElement(
"Terrain");
166 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
173 case "TerrainRaiseLimit":
176 case "TerrainLowerLimit":
180 settings.UseEstateSun = bool.Parse(xtr.ReadElementContentAsString());
183 settings.FixedSun = bool.Parse(xtr.ReadElementContentAsString());
186 settings.SunPosition = double.Parse(xtr.ReadElementContentAsString());
191 xtr.ReadEndElement();
193 if (xtr.IsStartElement(
"Telehub"))
195 xtr.ReadStartElement(
"Telehub");
197 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
201 case "TelehubObject":
202 settings.TelehubObject = UUID.Parse(xtr.ReadElementContentAsString());
205 string str = xtr.ReadElementContentAsString();
207 settings.AddSpawnPoint(sp);
221 StringWriter sw =
new StringWriter();
222 XmlTextWriter xtw =
new XmlTextWriter(sw);
223 xtw.Formatting = Formatting.Indented;
224 xtw.WriteStartDocument();
226 xtw.WriteStartElement(
"RegionSettings");
228 xtw.WriteStartElement(
"General");
229 xtw.WriteElementString(
"AllowDamage", settings.AllowDamage.ToString());
230 xtw.WriteElementString(
"AllowLandResell", settings.AllowLandResell.ToString());
231 xtw.WriteElementString(
"AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString());
232 xtw.WriteElementString(
"BlockFly", settings.BlockFly.ToString());
233 xtw.WriteElementString(
"BlockLandShowInSearch", settings.BlockShowInSearch.ToString());
234 xtw.WriteElementString(
"BlockTerraform", settings.BlockTerraform.ToString());
235 xtw.WriteElementString(
"DisableCollisions", settings.DisableCollisions.ToString());
236 xtw.WriteElementString(
"DisablePhysics", settings.DisablePhysics.ToString());
237 xtw.WriteElementString(
"DisableScripts", settings.DisableScripts.ToString());
238 xtw.WriteElementString(
"MaturityRating", settings.Maturity.ToString());
239 xtw.WriteElementString(
"RestrictPushing", settings.RestrictPushing.ToString());
240 xtw.WriteElementString(
"AgentLimit", settings.AgentLimit.ToString());
241 xtw.WriteElementString(
"ObjectBonus", settings.ObjectBonus.ToString());
242 xtw.WriteEndElement();
244 xtw.WriteStartElement(
"GroundTextures");
245 xtw.WriteElementString(
"Texture1", settings.TerrainTexture1.ToString());
246 xtw.WriteElementString(
"Texture2", settings.TerrainTexture2.ToString());
247 xtw.WriteElementString(
"Texture3", settings.TerrainTexture3.ToString());
248 xtw.WriteElementString(
"Texture4", settings.TerrainTexture4.ToString());
249 xtw.WriteElementString(
"ElevationLowSW", settings.Elevation1SW.ToString());
250 xtw.WriteElementString(
"ElevationLowNW", settings.Elevation1NW.ToString());
251 xtw.WriteElementString(
"ElevationLowSE", settings.Elevation1SE.ToString());
252 xtw.WriteElementString(
"ElevationLowNE", settings.Elevation1NE.ToString());
253 xtw.WriteElementString(
"ElevationHighSW", settings.Elevation2SW.ToString());
254 xtw.WriteElementString(
"ElevationHighNW", settings.Elevation2NW.ToString());
255 xtw.WriteElementString(
"ElevationHighSE", settings.Elevation2SE.ToString());
256 xtw.WriteElementString(
"ElevationHighNE", settings.Elevation2NE.ToString());
257 xtw.WriteEndElement();
259 xtw.WriteStartElement(
"Terrain");
260 xtw.WriteElementString(
"WaterHeight", settings.WaterHeight.ToString());
261 xtw.WriteElementString(
"TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString());
262 xtw.WriteElementString(
"TerrainLowerLimit", settings.TerrainLowerLimit.ToString());
263 xtw.WriteElementString(
"UseEstateSun", settings.UseEstateSun.ToString());
264 xtw.WriteElementString(
"FixedSun", settings.FixedSun.ToString());
265 xtw.WriteElementString(
"SunPosition", settings.SunPosition.ToString());
268 xtw.WriteEndElement();
270 xtw.WriteStartElement(
"Telehub");
273 xtw.WriteElementString(
"TelehubObject", settings.TelehubObject.ToString());
275 xtw.WriteElementString(
"SpawnPoint", sp.
ToString());
277 xtw.WriteEndElement();
279 xtw.WriteEndElement();
284 return sw.ToString();
static NumberFormatInfo NumberFormatInfo
static string Serialize(RegionSettings settings)
OpenSim.Framework.RegionSettings RegionSettings
static RegionSettings Deserialize(byte[] serializedSettings)
Deserialize settings
Serialize and deserialize region settings as an external format.
override string ToString()
Returns a string representation of this SpawnPoint.
UUID TelehubObject
Connected Telehub object
List< SpawnPoint > SpawnPoints()
static RegionSettings Deserialize(string serializedSettings)
Deserialize settings