Merge branch 'master' of ssh://snoopy@opensimulator.org/var/git/opensim

iar_mods
Snoopy Pfeffer 2012-02-04 00:39:58 +01:00
commit bd9d7484f0
23 changed files with 314 additions and 148 deletions

View File

@ -1252,7 +1252,7 @@ VALUES
,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se
,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit
,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position
,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id
,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id
WHERE [regionUUID] = @regionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
@ -1307,14 +1307,14 @@ VALUES
[block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics],
[terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne],
[elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit],
[terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id]
[terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[covenant_datetime],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id]
)
VALUES
(@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide,
@block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics,
@terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne,
@elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit,
@terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)";
@terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant, @covenant_datetime, @sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
@ -1376,7 +1376,7 @@ VALUES
Convert.ToSingle(row["sunvectorz"])
);
newSettings.Covenant = new UUID((Guid)row["covenant"]);
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
if (row["loaded_creation_id"] is DBNull)
@ -1789,6 +1789,7 @@ VALUES
parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y));
parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z));
parameters.Add(_Database.CreateParameter("covenant", settings.Covenant));
parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime));
parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID));

View File

@ -1043,3 +1043,11 @@ FOR CreatorID
ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL
COMMIT
:VERSION 29 #---------------------
BEGIN TRANSACTION
ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0
COMMIT

View File

@ -994,7 +994,7 @@ namespace OpenSim.Data.MySQL
"elevation_2_sw, water_height, " +
"terrain_raise_limit, terrain_lower_limit, " +
"use_estate_sun, fixed_sun, sun_position, " +
"covenant, Sandbox, sunvectorx, sunvectory, " +
"covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " +
"sunvectorz, loaded_creation_datetime, " +
"loaded_creation_id, map_tile_ID, " +
"TelehubObject, parcel_tile_ID) " +
@ -1010,7 +1010,7 @@ namespace OpenSim.Data.MySQL
"?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " +
"?WaterHeight, ?TerrainRaiseLimit, " +
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
"?SunPosition, ?Covenant, ?Sandbox, " +
"?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " +
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
"?LoadedCreationDateTime, ?LoadedCreationID, " +
"?TerrainImageID, ?TelehubObject, ?ParcelImageID) ";
@ -1292,7 +1292,7 @@ namespace OpenSim.Data.MySQL
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
newSettings.Covenant = DBGuid.FromDB(row["covenant"]);
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]);
if (row["loaded_creation_id"] is DBNull)
@ -1630,6 +1630,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
cmd.Parameters.AddWithValue("CovenantChangedDateTime", settings.CovenantChangedDateTime);
cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime);
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID);

View File

@ -869,3 +869,8 @@ BEGIN;
ALTER TABLE `landaccesslist` ADD COLUMN `Expires` INTEGER NOT NULL DEFAULT 0;
COMMIT;
:VERSION 42 #--------------------- Region Covenant changed time
BEGIN;
ALTER TABLE regionsettings ADD COLUMN covenant_datetime int unsigned NOT NULL DEFAULT '0';
COMMIT;

View File

@ -466,4 +466,9 @@ ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
COMMIT;
COMMIT;
:VERSION 22
BEGIN;
ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0;
COMMIT;

View File

@ -1185,6 +1185,7 @@ namespace OpenSim.Data.SQLite
createCol(regionsettings, "fixed_sun", typeof (Int32));
createCol(regionsettings, "sun_position", typeof (Double));
createCol(regionsettings, "covenant", typeof(String));
createCol(regionsettings, "covenant_datetime", typeof(Int32));
createCol(regionsettings, "map_tile_ID", typeof(String));
regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] };
return regionsettings;
@ -1509,6 +1510,7 @@ namespace OpenSim.Data.SQLite
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
newSettings.Covenant = new UUID((String) row["covenant"]);
newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
return newSettings;
@ -1833,6 +1835,7 @@ namespace OpenSim.Data.SQLite
row["fixed_sun"] = settings.FixedSun;
row["sun_position"] = settings.SunPosition;
row["covenant"] = settings.Covenant.ToString();
row["covenant_datetime"] = settings.CovenantChangedDateTime;
row["map_tile_ID"] = settings.TerrainImageID.ToString();
}

View File

@ -1235,7 +1235,7 @@ namespace OpenSim.Framework
void SendEstateCovenantInformation(UUID covenant);
void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags,
uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner);
uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner);
/// <summary>
/// Send land properties to the client.

View File

@ -34,7 +34,7 @@ using OpenMetaverse;
namespace OpenSim.Framework
{
public struct LandAccessEntry
public class LandAccessEntry
{
public UUID AgentID;
public int Expires;

View File

@ -413,6 +413,14 @@ namespace OpenSim.Framework
set { m_Covenant = value; }
}
private int m_CovenantChanged = 0;
public int CovenantChangedDateTime
{
get { return m_CovenantChanged; }
set { m_CovenantChanged = value; }
}
private int m_LoadedCreationDateTime;
public int LoadedCreationDateTime
{
@ -492,4 +500,4 @@ namespace OpenSim.Framework
l_SpawnPoints.Clear();
}
}
}
}

View File

@ -24,11 +24,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Xml;
using log4net;
using OpenMetaverse;
using OpenSim.Services.Interfaces;
@ -39,6 +41,55 @@ namespace OpenSim.Framework.Serialization.External
/// </summary>
public class ExternalRepresentationUtils
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Populate a node with data read from xml using a dictinoary of processors
/// </summary>
/// <param name="nodeToFill"></param>
/// <param name="processors">
/// A <see cref="Dictionary<System.String, Action<NodeType, XmlTextReader>>"/>
/// </param>
/// <param name="xtr">
/// A <see cref="XmlTextReader"/>
/// </param>
public static void ExecuteReadProcessors<NodeType>(
NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr)
{
string nodeName = string.Empty;
while (xtr.NodeType != XmlNodeType.EndElement)
{
nodeName = xtr.Name;
// m_log.DebugFormat("[ExternalRepresentationUtils]: Processing: {0}", nodeName);
Action<NodeType, XmlTextReader> p = null;
if (processors.TryGetValue(xtr.Name, out p))
{
// m_log.DebugFormat("[ExternalRepresentationUtils]: Found {0} processor, nodeName);
try
{
p(nodeToFill, xtr);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
nodeName, e.Message, e.StackTrace);
if (xtr.NodeType == XmlNodeType.EndElement)
xtr.Read();
}
}
else
{
// m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName);
xtr.ReadOuterXml(); // ignore
}
}
}
/// <summary>
/// Takes a XML representation of a SceneObjectPart and returns another XML representation
/// with creator data added to it.

View File

@ -28,8 +28,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.Xml;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
@ -40,8 +42,119 @@ namespace OpenSim.Framework.Serialization.External
/// </summary>
public class LandDataSerializer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
private static Dictionary<string, Action<LandData, XmlTextReader>> m_ldProcessors
= new Dictionary<string, Action<LandData, XmlTextReader>>();
private static Dictionary<string, Action<LandAccessEntry, XmlTextReader>> m_laeProcessors
= new Dictionary<string, Action<LandAccessEntry, XmlTextReader>>();
static LandDataSerializer()
{
// LandData processors
m_ldProcessors.Add(
"Area", (ld, xtr) => ld.Area = Convert.ToInt32(xtr.ReadElementString("Area")));
m_ldProcessors.Add(
"AuctionID", (ld, xtr) => ld.AuctionID = Convert.ToUInt32(xtr.ReadElementString("AuctionID")));
m_ldProcessors.Add(
"AuthBuyerID", (ld, xtr) => ld.AuthBuyerID = UUID.Parse(xtr.ReadElementString("AuthBuyerID")));
m_ldProcessors.Add(
"Category", (ld, xtr) => ld.Category = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category")));
m_ldProcessors.Add(
"ClaimDate", (ld, xtr) => ld.ClaimDate = Convert.ToInt32(xtr.ReadElementString("ClaimDate")));
m_ldProcessors.Add(
"ClaimPrice", (ld, xtr) => ld.ClaimPrice = Convert.ToInt32(xtr.ReadElementString("ClaimPrice")));
m_ldProcessors.Add(
"GlobalID", (ld, xtr) => ld.GlobalID = UUID.Parse(xtr.ReadElementString("GlobalID")));
m_ldProcessors.Add(
"GroupID", (ld, xtr) => ld.GroupID = UUID.Parse(xtr.ReadElementString("GroupID")));
m_ldProcessors.Add(
"IsGroupOwned", (ld, xtr) => ld.IsGroupOwned = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned")));
m_ldProcessors.Add(
"Bitmap", (ld, xtr) => ld.Bitmap = Convert.FromBase64String(xtr.ReadElementString("Bitmap")));
m_ldProcessors.Add(
"Description", (ld, xtr) => ld.Description = xtr.ReadElementString("Description"));
m_ldProcessors.Add(
"Flags", (ld, xtr) => ld.Flags = Convert.ToUInt32(xtr.ReadElementString("Flags")));
m_ldProcessors.Add(
"LandingType", (ld, xtr) => ld.LandingType = Convert.ToByte(xtr.ReadElementString("LandingType")));
m_ldProcessors.Add(
"Name", (ld, xtr) => ld.Name = xtr.ReadElementString("Name"));
m_ldProcessors.Add(
"Status", (ld, xtr) => ld.Status = (ParcelStatus)Convert.ToSByte(xtr.ReadElementString("Status")));
m_ldProcessors.Add(
"LocalID", (ld, xtr) => ld.LocalID = Convert.ToInt32(xtr.ReadElementString("LocalID")));
m_ldProcessors.Add(
"MediaAutoScale", (ld, xtr) => ld.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale")));
m_ldProcessors.Add(
"MediaID", (ld, xtr) => ld.MediaID = UUID.Parse(xtr.ReadElementString("MediaID")));
m_ldProcessors.Add(
"MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL"));
m_ldProcessors.Add(
"MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL"));
m_ldProcessors.Add(
"ParcelAccessList", ProcessParcelAccessList);
m_ldProcessors.Add(
"PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours")));
m_ldProcessors.Add(
"PassPrice", (ld, xtr) => ld.PassPrice = Convert.ToInt32(xtr.ReadElementString("PassPrice")));
m_ldProcessors.Add(
"SalePrice", (ld, xtr) => ld.SalePrice = Convert.ToInt32(xtr.ReadElementString("SalePrice")));
m_ldProcessors.Add(
"SnapshotID", (ld, xtr) => ld.SnapshotID = UUID.Parse(xtr.ReadElementString("SnapshotID")));
m_ldProcessors.Add(
"UserLocation", (ld, xtr) => ld.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation")));
m_ldProcessors.Add(
"UserLookAt", (ld, xtr) => ld.UserLookAt = Vector3.Parse(xtr.ReadElementString("UserLookAt")));
// No longer used here //
// m_ldProcessors.Add("Dwell", (landData, xtr) => return);
m_ldProcessors.Add(
"OtherCleanTime", (ld, xtr) => ld.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime")));
// LandAccessEntryProcessors
m_laeProcessors.Add(
"AgentID", (lae, xtr) => lae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID")));
m_laeProcessors.Add(
"Time", (lae, xtr) =>
{
// We really don't care about temp vs perm here and this
// would break on old oars. Assume all bans are perm
xtr.ReadElementString("Time");
lae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
}
);
m_laeProcessors.Add(
"AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
}
public static void ProcessParcelAccessList(LandData ld, XmlTextReader xtr)
{
if (!xtr.IsEmptyElement)
{
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
{
LandAccessEntry lae = new LandAccessEntry();
xtr.ReadStartElement("ParcelAccessEntry");
ExternalRepresentationUtils.ExecuteReadProcessors<LandAccessEntry>(lae, m_laeProcessors, xtr);
xtr.ReadEndElement();
ld.ParcelAccessList.Add(lae);
}
}
xtr.Read();
}
/// <summary>
/// Reify/deserialize landData
/// </summary>
@ -63,72 +176,14 @@ namespace OpenSim.Framework.Serialization.External
{
LandData landData = new LandData();
StringReader sr = new StringReader(serializedLandData);
XmlTextReader xtr = new XmlTextReader(sr);
xtr.ReadStartElement("LandData");
landData.Area = Convert.ToInt32( xtr.ReadElementString("Area"));
landData.AuctionID = Convert.ToUInt32( xtr.ReadElementString("AuctionID"));
landData.AuthBuyerID = UUID.Parse( xtr.ReadElementString("AuthBuyerID"));
landData.Category = (ParcelCategory)Convert.ToSByte( xtr.ReadElementString("Category"));
landData.ClaimDate = Convert.ToInt32( xtr.ReadElementString("ClaimDate"));
landData.ClaimPrice = Convert.ToInt32( xtr.ReadElementString("ClaimPrice"));
landData.GlobalID = UUID.Parse( xtr.ReadElementString("GlobalID"));
landData.GroupID = UUID.Parse( xtr.ReadElementString("GroupID"));
landData.IsGroupOwned = Convert.ToBoolean( xtr.ReadElementString("IsGroupOwned"));
landData.Bitmap = Convert.FromBase64String( xtr.ReadElementString("Bitmap"));
landData.Description = xtr.ReadElementString("Description");
landData.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags"));
landData.LandingType = Convert.ToByte( xtr.ReadElementString("LandingType"));
landData.Name = xtr.ReadElementString("Name");
landData.Status = (ParcelStatus)Convert.ToSByte( xtr.ReadElementString("Status"));
landData.LocalID = Convert.ToInt32( xtr.ReadElementString("LocalID"));
landData.MediaAutoScale = Convert.ToByte( xtr.ReadElementString("MediaAutoScale"));
landData.MediaID = UUID.Parse( xtr.ReadElementString("MediaID"));
landData.MediaURL = xtr.ReadElementString("MediaURL");
landData.MusicURL = xtr.ReadElementString("MusicURL");
landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID"));
landData.ParcelAccessList = new List<LandAccessEntry>();
xtr.Read();
if (xtr.Name != "ParcelAccessList")
throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name));
if (!xtr.IsEmptyElement)
using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData)))
{
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
{
LandAccessEntry pae = new LandAccessEntry();
reader.ReadStartElement("LandData");
xtr.ReadStartElement("ParcelAccessEntry");
pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID"));
// We really don't care about temp vs perm here and this
// would break on old oars. Assume all bans are perm
xtr.ReadElementString("Time");
pae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time"));
pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList"));
xtr.ReadEndElement();
ExternalRepresentationUtils.ExecuteReadProcessors<LandData>(landData, m_ldProcessors, reader);
landData.ParcelAccessList.Add(pae);
}
reader.ReadEndElement();
}
xtr.Read();
landData.PassHours = Convert.ToSingle( xtr.ReadElementString("PassHours"));
landData.PassPrice = Convert.ToInt32( xtr.ReadElementString("PassPrice"));
landData.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice"));
landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
// No longer used here
xtr.ReadElementString("Dwell");
landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
xtr.ReadEndElement();
xtr.Close();
sr.Close();
return landData;
}

View File

@ -41,14 +41,13 @@ namespace OpenSim.Framework.Serialization.External
{
/// <summary>
/// Serialize and deserialize user inventory items as an external format.
/// </summary>
/// XXX: Please do not use yet.
/// </summary>
public class UserInventoryItemSerializer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private delegate void InventoryItemXmlProcessor(InventoryItemBase item, XmlTextReader reader);
private static Dictionary<string, InventoryItemXmlProcessor> m_InventoryItemXmlProcessors = new Dictionary<string, InventoryItemXmlProcessor>();
private static Dictionary<string, Action<InventoryItemBase, XmlTextReader>> m_InventoryItemXmlProcessors
= new Dictionary<string, Action<InventoryItemBase, XmlTextReader>>();
#region InventoryItemBase Processor initialization
static UserInventoryItemSerializer()
@ -205,39 +204,14 @@ namespace OpenSim.Framework.Serialization.External
{
reader.ReadStartElement("InventoryItem");
string nodeName = string.Empty;
while (reader.NodeType != XmlNodeType.EndElement)
{
nodeName = reader.Name;
InventoryItemXmlProcessor p = null;
if (m_InventoryItemXmlProcessors.TryGetValue(reader.Name, out p))
{
//m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
try
{
p(item, reader);
}
catch (Exception e)
{
m_log.DebugFormat("[InventoryItemSerializer]: exception while parsing {0}: {1}", nodeName, e);
if (reader.NodeType == XmlNodeType.EndElement)
reader.Read();
}
}
else
{
// m_log.DebugFormat("[InventoryItemSerializer]: caught unknown element {0}", nodeName);
reader.ReadOuterXml(); // ignore
}
}
ExternalRepresentationUtils.ExecuteReadProcessors<InventoryItemBase>(
item, m_InventoryItemXmlProcessors, reader);
reader.ReadEndElement(); // InventoryItem
}
//m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
return item;
}
public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)

View File

@ -33,8 +33,11 @@ using OpenSim.Framework;
namespace OpenSim.Framework.Serialization.External
{
/// <summary>
/// Serialize and deserialize region settings as an external format.
/// Serialize and deserialize user profiles as an external format.
/// </summary>
/// <remarks>
/// Currently UNUSED.
/// </remarks>
public class UserProfileSerializer
{
public const int MAJOR_VERSION = 0;

View File

@ -27,11 +27,12 @@
using System;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Framework.Serialization.External;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using NUnit.Framework;
using OpenSim.Framework;
using OpenSim.Framework.Serialization.External;
using OpenSim.Tests.Common;
namespace OpenSim.Framework.Serialization.Tests
{
@ -92,6 +93,8 @@ namespace OpenSim.Framework.Serialization.Tests
[Test]
public void LandDataSerializerSerializeTest()
{
TestHelpers.InMethod();
string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n");
Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string");
@ -112,20 +115,32 @@ namespace OpenSim.Framework.Serialization.Tests
/// Test the LandDataSerializer.Deserialize() method
/// </summary>
[Test]
public void TestLandDataSerializerDeserializeFromStringTest()
public void TestLandDataDeserializeNoAccessLists()
{
LandData reifiedLandData = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized);
Assert.That(reifiedLandData != null, "Deserialize(string) returned null");
Assert.That(reifiedLandData.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID");
Assert.That(reifiedLandData.Name == this.land.Name, "Reified LandData.Name != original LandData.Name");
TestHelpers.InMethod();
log4net.Config.XmlConfigurator.Configure();
LandData reifiedLandDataWithParcelAccessList = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList);
Assert.That(reifiedLandDataWithParcelAccessList != null,
LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized);
Assert.That(ld != null, "Deserialize(string) returned null");
Assert.That(ld.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID");
Assert.That(ld.Name == this.land.Name, "Reified LandData.Name != original LandData.Name");
}
[Test]
public void TestLandDataDeserializeWithAccessLists()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList);
Assert.That(ld != null,
"Deserialize(string) returned null (pre-serialized with parcel access list)");
Assert.That(reifiedLandDataWithParcelAccessList.GlobalID == this.landWithParcelAccessList.GlobalID,
Assert.That(ld.GlobalID == this.landWithParcelAccessList.GlobalID,
"Reified LandData.GlobalID != original LandData.GlobalID (pre-serialized with parcel access list)");
Assert.That(reifiedLandDataWithParcelAccessList.Name == this.landWithParcelAccessList.Name,
Assert.That(ld.Name == this.landWithParcelAccessList.Name,
"Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)");
Assert.That(ld.ParcelAccessList.Count, Is.EqualTo(2));
Assert.That(ld.ParcelAccessList[0].AgentID, Is.EqualTo(UUID.Parse("62d65d45-c91a-4f77-862c-46557d978b6c")));
}
}
}

View File

@ -4439,7 +4439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
edata.CovenantID = covenant;
edata.CovenantTimestamp = 0;
edata.CovenantTimestamp = (uint) m_scene.RegionInfo.RegionSettings.CovenantChangedDateTime;
edata.EstateOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName);
einfopack.Data = edata;
@ -4447,8 +4447,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
public void SendDetailedEstateData(
UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
UUID covenant, string abuseEmail, UUID estateOwner)
UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner)
{
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant);
@ -4473,7 +4473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
returnblock[4].Parameter = Utils.StringToBytes(sunPosition.ToString());
returnblock[5].Parameter = Utils.StringToBytes(parentEstate.ToString());
returnblock[6].Parameter = Utils.StringToBytes(covenant.ToString());
returnblock[7].Parameter = Utils.StringToBytes("1160895077"); // what is this?
returnblock[7].Parameter = Utils.StringToBytes(covenantChanged.ToString());
returnblock[8].Parameter = Utils.StringToBytes("1"); // what is this?
returnblock[9].Parameter = Utils.StringToBytes(abuseEmail);

View File

@ -80,6 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
GetEstateFlags(),
sun,
Scene.RegionInfo.RegionSettings.Covenant,
(uint) Scene.RegionInfo.RegionSettings.CovenantChangedDateTime,
Scene.RegionInfo.EstateSettings.AbuseEmail,
estateOwner);
@ -268,6 +269,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
// remoteClient.Name, estateCovenantID);
Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
Scene.RegionInfo.RegionSettings.CovenantChangedDateTime = Util.UnixTimeSinceEpoch();
Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
}

View File

@ -2729,10 +2729,6 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null)
return;
// When running OpenSim tests, Scene (and EventManager can be null).
// Need to fix tests before we can trigger this here
// ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
ParentGroup.QueueForUpdateCheck();
int timeNow = Util.UnixTimeSinceEpoch();
@ -2754,6 +2750,9 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
// UUID, Name, TimeStampFull);
if (ParentGroup.Scene != null)
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
}
/// <summary>
@ -2765,15 +2764,12 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null)
return;
// When running OpenSim tests, Scene (and EventManager can be null).
// Need to fix tests before we can trigger this here
// ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
// This was pulled from SceneViewer. Attachments always receive full updates.
// I could not verify if this is a requirement but this maintains existing behavior
if (ParentGroup.IsAttachment)
{
ScheduleFullUpdate();
return;
}
if (UpdateFlag == UpdateRequired.NONE)
@ -2788,6 +2784,9 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}",
// UUID, Name, TimeStampTerse);
}
if (ParentGroup.Scene != null)
ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this);
}
public void ScriptSetPhysicsStatus(bool UsePhysics)

View File

@ -1243,7 +1243,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner)
{
}

View File

@ -933,7 +933,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint)
{
}
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner)
{
}

View File

@ -140,24 +140,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC
// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
// }
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
scene.AddNewClient(npcAvatar, PresenceType.Npc);
ScenePresence sp;
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
{
m_log.DebugFormat(
"[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
sp.CompleteMovement(npcAvatar, false);
}
else
{
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
}
lock (m_avatars)
{
scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd);
scene.AddNewClient(npcAvatar, PresenceType.Npc);
ScenePresence sp;
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
{
m_log.DebugFormat(
"[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
sp.CompleteMovement(npcAvatar, false);
}
else
{
m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
}
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
}
m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);

View File

@ -972,7 +972,7 @@ namespace OpenSim.Tests.Common.Mock
{
}
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner)
{
}

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" />
<bindingRedirect oldVersion="2.0.6.0" newVersion="2.4.6.0" />
<bindingRedirect oldVersion="2.1.4.0" newVersion="2.4.6.0" />
<bindingRedirect oldVersion="2.2.8.0" newVersion="2.4.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<log4net>
<!-- A1 is set to be a ConsoleAppender -->
<appender name="A1" type="log4net.Appender.ConsoleAppender">
<!-- A1 uses PatternLayout -->
<layout type="log4net.Layout.PatternLayout">
<!-- Print the date in ISO 8601 format -->
<conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
</layout>
</appender>
<!-- Set root logger level to DEBUG and its only appender to A1 -->
<root>
<level value="DEBUG" />
<appender-ref ref="A1" />
</root>
</log4net>
</configuration>

View File

@ -218,6 +218,7 @@
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>