public void TestRegionSettingsDeserialize() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs); Assert.That(deserRs, Is.Not.Null); Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); Assert.That(deserRs.TelehubObject, Is.EqualTo(m_rs.TelehubObject)); Assert.That(deserRs.SpawnPoints()[0].ToString(), Is.EqualTo(m_rs.SpawnPoints()[0].ToString())); }
public static string Serialize(RegionSettings settings) { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement("RegionSettings"); xtw.WriteStartElement("General"); xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString()); xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString()); xtw.WriteElementString("AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString()); xtw.WriteElementString("BlockFly", settings.BlockFly.ToString()); xtw.WriteElementString("BlockLandShowInSearch", settings.BlockShowInSearch.ToString()); xtw.WriteElementString("BlockTerraform", settings.BlockTerraform.ToString()); xtw.WriteElementString("DisableCollisions", settings.DisableCollisions.ToString()); xtw.WriteElementString("DisablePhysics", settings.DisablePhysics.ToString()); xtw.WriteElementString("DisableScripts", settings.DisableScripts.ToString()); xtw.WriteElementString("MaturityRating", settings.Maturity.ToString()); xtw.WriteElementString("RestrictPushing", settings.RestrictPushing.ToString()); xtw.WriteElementString("AgentLimit", settings.AgentLimit.ToString()); xtw.WriteElementString("ObjectBonus", settings.ObjectBonus.ToString()); xtw.WriteEndElement(); xtw.WriteStartElement("GroundTextures"); xtw.WriteElementString("Texture1", settings.TerrainTexture1.ToString()); xtw.WriteElementString("Texture2", settings.TerrainTexture2.ToString()); xtw.WriteElementString("Texture3", settings.TerrainTexture3.ToString()); xtw.WriteElementString("Texture4", settings.TerrainTexture4.ToString()); xtw.WriteElementString("ElevationLowSW", settings.Elevation1SW.ToString()); xtw.WriteElementString("ElevationLowNW", settings.Elevation1NW.ToString()); xtw.WriteElementString("ElevationLowSE", settings.Elevation1SE.ToString()); xtw.WriteElementString("ElevationLowNE", settings.Elevation1NE.ToString()); xtw.WriteElementString("ElevationHighSW", settings.Elevation2SW.ToString()); xtw.WriteElementString("ElevationHighNW", settings.Elevation2NW.ToString()); xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString()); xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString()); xtw.WriteEndElement(); xtw.WriteStartElement("Terrain"); xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString()); xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString()); xtw.WriteElementString("TerrainLowerLimit", settings.TerrainLowerLimit.ToString()); xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString()); xtw.WriteElementString("FixedSun", settings.FixedSun.ToString()); xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which // calculates it automatically according to the date and other factors. xtw.WriteEndElement(); xtw.WriteStartElement("Telehub"); if (settings.TelehubObject != UUID.Zero) { xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString()); foreach (SpawnPoint sp in settings.SpawnPoints()) { xtw.WriteElementString("SpawnPoint", sp.ToString()); } } xtw.WriteEndElement(); xtw.WriteEndElement(); xtw.Close(); sw.Close(); return(sw.ToString()); }
public static string Serialize(RegionSettings settings, ViewerEnvironment RegionEnv) { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement("RegionSettings"); xtw.WriteStartElement("General"); xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString()); xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString()); xtw.WriteElementString("AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString()); xtw.WriteElementString("BlockFly", settings.BlockFly.ToString()); xtw.WriteElementString("BlockLandShowInSearch", settings.BlockShowInSearch.ToString()); xtw.WriteElementString("BlockTerraform", settings.BlockTerraform.ToString()); xtw.WriteElementString("DisableCollisions", settings.DisableCollisions.ToString()); xtw.WriteElementString("DisablePhysics", settings.DisablePhysics.ToString()); xtw.WriteElementString("DisableScripts", settings.DisableScripts.ToString()); xtw.WriteElementString("MaturityRating", settings.Maturity.ToString()); xtw.WriteElementString("RestrictPushing", settings.RestrictPushing.ToString()); xtw.WriteElementString("AgentLimit", settings.AgentLimit.ToString()); xtw.WriteElementString("ObjectBonus", settings.ObjectBonus.ToString()); xtw.WriteEndElement(); xtw.WriteStartElement("GroundTextures"); xtw.WriteElementString("Texture1", settings.TerrainTexture1.ToString()); xtw.WriteElementString("Texture2", settings.TerrainTexture2.ToString()); xtw.WriteElementString("Texture3", settings.TerrainTexture3.ToString()); xtw.WriteElementString("Texture4", settings.TerrainTexture4.ToString()); xtw.WriteElementString("ElevationLowSW", settings.Elevation1SW.ToString()); xtw.WriteElementString("ElevationLowNW", settings.Elevation1NW.ToString()); xtw.WriteElementString("ElevationLowSE", settings.Elevation1SE.ToString()); xtw.WriteElementString("ElevationLowNE", settings.Elevation1NE.ToString()); xtw.WriteElementString("ElevationHighSW", settings.Elevation2SW.ToString()); xtw.WriteElementString("ElevationHighNW", settings.Elevation2NW.ToString()); xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString()); xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString()); xtw.WriteEndElement(); xtw.WriteStartElement("Terrain"); xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString()); xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString()); xtw.WriteElementString("TerrainLowerLimit", settings.TerrainLowerLimit.ToString()); xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString()); xtw.WriteElementString("FixedSun", settings.FixedSun.ToString()); xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); xtw.WriteEndElement(); xtw.WriteStartElement("Telehub"); if (settings.TelehubObject != UUID.Zero) { xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString()); foreach (SpawnPoint sp in settings.SpawnPoints()) { xtw.WriteElementString("SpawnPoint", sp.ToString()); } } xtw.WriteEndElement(); if (RegionEnv != null) { xtw.WriteStartElement("Environment"); xtw.WriteElementString("data", ViewerEnvironment.ToOSDString(RegionEnv)); xtw.WriteEndElement(); } xtw.WriteEndElement(); xtw.Close(); sw.Close(); return(sw.ToString()); }
public static string Serialize(RegionSettings settings) { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement("RegionSettings"); xtw.WriteStartElement("General"); xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString()); xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString()); xtw.WriteElementString("AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString()); xtw.WriteElementString("BlockFly", settings.BlockFly.ToString()); xtw.WriteElementString("BlockLandShowInSearch", settings.BlockShowInSearch.ToString()); xtw.WriteElementString("BlockTerraform", settings.BlockTerraform.ToString()); xtw.WriteElementString("DisableCollisions", settings.DisableCollisions.ToString()); xtw.WriteElementString("DisablePhysics", settings.DisablePhysics.ToString()); xtw.WriteElementString("DisableScripts", settings.DisableScripts.ToString()); xtw.WriteElementString("MaturityRating", settings.Maturity.ToString()); xtw.WriteElementString("RestrictPushing", settings.RestrictPushing.ToString()); xtw.WriteElementString("AgentLimit", settings.AgentLimit.ToString()); xtw.WriteElementString("ObjectBonus", settings.ObjectBonus.ToString()); xtw.WriteEndElement(); xtw.WriteStartElement("GroundTextures"); xtw.WriteElementString("Texture1", settings.TerrainTexture1.ToString()); xtw.WriteElementString("Texture2", settings.TerrainTexture2.ToString()); xtw.WriteElementString("Texture3", settings.TerrainTexture3.ToString()); xtw.WriteElementString("Texture4", settings.TerrainTexture4.ToString()); xtw.WriteElementString("ElevationLowSW", settings.Elevation1SW.ToString()); xtw.WriteElementString("ElevationLowNW", settings.Elevation1NW.ToString()); xtw.WriteElementString("ElevationLowSE", settings.Elevation1SE.ToString()); xtw.WriteElementString("ElevationLowNE", settings.Elevation1NE.ToString()); xtw.WriteElementString("ElevationHighSW", settings.Elevation2SW.ToString()); xtw.WriteElementString("ElevationHighNW", settings.Elevation2NW.ToString()); xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString()); xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString()); xtw.WriteEndElement(); xtw.WriteStartElement("Terrain"); xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString()); xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString()); xtw.WriteElementString("TerrainLowerLimit", settings.TerrainLowerLimit.ToString()); xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString()); xtw.WriteElementString("FixedSun", settings.FixedSun.ToString()); xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which // calculates it automatically according to the date and other factors. xtw.WriteEndElement(); xtw.WriteStartElement("Telehub"); if (settings.TelehubObject != UUID.Zero) { xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString()); foreach (SpawnPoint sp in settings.SpawnPoints()) xtw.WriteElementString("SpawnPoint", sp.ToString()); } xtw.WriteEndElement(); xtw.WriteEndElement(); xtw.Close(); sw.Close(); return sw.ToString(); }