From 958fea9b97006e4df05b16b48ea960ece75b4eef Mon Sep 17 00:00:00 2001 From: Skidz Tweak Date: Mon, 2 Jan 2012 02:14:44 -0600 Subject: [PATCH 01/16] Ensureing assetcache folder exist --- Aurora/Simulation/Base/BinMigratorService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Aurora/Simulation/Base/BinMigratorService.cs b/Aurora/Simulation/Base/BinMigratorService.cs index 676571e025..75fdb62677 100644 --- a/Aurora/Simulation/Base/BinMigratorService.cs +++ b/Aurora/Simulation/Base/BinMigratorService.cs @@ -55,6 +55,7 @@ public bool UpgradeToTarget(int currentVersion) private void RunMigration2() { + if (!Directory.Exists("assetcache//")) return; foreach (string path in Directory.GetDirectories("assetcache//")) { Directory.Delete(path, true); From 1414ffefe0fe2a03ccfaa9e27e1c9f0648e4ae0b Mon Sep 17 00:00:00 2001 From: Skidz Tweak Date: Mon, 2 Jan 2012 04:11:53 -0600 Subject: [PATCH 02/16] Fix for physics compile path on 64bit --- prebuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prebuild.xml b/prebuild.xml index 6bd324957e..5c3a4af26e 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -166,12 +166,12 @@ - ../../../../bin/Physics/ + ../../../bin/Physics/ - ../../../../bin/Physics/ + ../../../bin/Physics/ From c8ba8c0d12153f1fcc588db0a0e971bf3e4f2c6d Mon Sep 17 00:00:00 2001 From: Skidz Tweak Date: Mon, 2 Jan 2012 04:44:58 -0600 Subject: [PATCH 03/16] Another small fix to the physic build path for 64bit --- prebuild.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prebuild.xml b/prebuild.xml index 5c3a4af26e..c7ba6741dc 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -206,7 +206,7 @@ - ../..../bin/Physics/ + ../../../bin/Physics/ From af8a60eb860eee59a5642d5fed79a4d56535696e Mon Sep 17 00:00:00 2001 From: Skidz Tweak Date: Mon, 2 Jan 2012 06:02:26 -0600 Subject: [PATCH 04/16] Changes to blackhole assets to ensure migration from the auroraassets_old table is not prevented by the assets flags. --- .../Asset/LocalAssetBlackholeConnector.cs | 141 ++++++++++-------- 1 file changed, 76 insertions(+), 65 deletions(-) diff --git a/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs b/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs index c97c373020..ce69c11294 100644 --- a/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs @@ -206,7 +206,12 @@ private AssetBase GetAsset(UUID uuid, bool metaOnly, bool displayMessages) dr = m_Gd.QueryData("WHERE id = '" + uuid + "' LIMIT 1", databaseTable, "id, hash_code, parent_id, creator_id, name, description, asset_type, create_time, access_time, asset_flags, host_uri"); asset = LoadAssetFromDR(dr); - if (asset != null) asset.ID = Store(asset); + if (asset != null) + { + bool results = false; + AssetBase asset2 = StoreAsset(asset, out results, true); + if (results) asset = asset2; + } } @@ -287,7 +292,7 @@ private AssetBase LoadAssetFromDR(IDataReader dr) public UUID Store(AssetBase asset) { bool successful; - asset = StoreAsset(asset, out successful); + asset = StoreAsset(asset, out successful, false); return asset.ID; } @@ -299,7 +304,7 @@ public UUID Store(AssetBase asset) public bool StoreAsset(AssetBase asset) { bool successful; - StoreAsset(asset, out successful); + StoreAsset(asset, out successful, false); return successful; } @@ -313,7 +318,7 @@ public void UpdateContent(UUID id, byte[] assetdata, out UUID newID) asset.Data = assetdata; bool success; - AssetBase newasset = StoreAsset(asset, out success); + AssetBase newasset = StoreAsset(asset, out success, false); if (success) { newID = newasset.ID; @@ -332,83 +337,89 @@ public void UpdateContent(UUID id, byte[] assetdata, out UUID newID) } - private AssetBase StoreAsset(AssetBase asset, out bool successful) + private AssetBase StoreAsset(AssetBase asset, out bool successful, bool justMovingDatabase) { ResetTimer(15000); try { - bool assetDoesExist = ExistsAsset(asset.ID); + bool assetDoesExist = false; // this was causing problems with convering the first asset which.. is a zero id.. - if (assetDoesExist) + if (!justMovingDatabase) { - string databaseTable = "auroraassets_" + asset.ID.ToString().Substring(0, 1); - List results = m_Gd.Query("id", asset.ID, databaseTable, "asset_flags"); - AssetFlags thisassetflag; - if ((results != null) && (results.Count >= 1)) - { - thisassetflag = (AssetFlags) int.Parse(results[0].ToString()); - } - else + assetDoesExist = ExistsAsset(asset.ID); + if (assetDoesExist) { - databaseTable = "auroraassets_old"; - results = m_Gd.Query("id", asset.ID, databaseTable, "asset_flags"); - thisassetflag = (AssetFlags)int.Parse(results[0].ToString()); - } + string databaseTable = "auroraassets_" + asset.ID.ToString().Substring(0, 1); + List results = m_Gd.Query("id", asset.ID, databaseTable, "asset_flags"); + AssetFlags thisassetflag; + if ((results != null) && (results.Count >= 1)) + { + thisassetflag = (AssetFlags)int.Parse(results[0].ToString()); + } + else + { + databaseTable = "auroraassets_old"; + results = m_Gd.Query("id", asset.ID, databaseTable, "asset_flags"); + thisassetflag = (AssetFlags)int.Parse(results[0].ToString()); + } - if ((thisassetflag & AssetFlags.Rewritable) != AssetFlags.Rewritable) - { - asset.ID = UUID.Random(); - asset.CreationDate = DateTime.UtcNow; - assetDoesExist = false; + if ((thisassetflag & AssetFlags.Rewritable) != AssetFlags.Rewritable) + { + asset.ID = UUID.Random(); + asset.CreationDate = DateTime.UtcNow; + assetDoesExist = false; + } } - } - - - // Ensure some data is correct - - if (asset.Name.Length > 64) asset.Name = asset.Name.Substring(0, 64); - if (asset.Description.Length > 128) asset.Description = asset.Description.Substring(0, 128); - - // Get the new hashcode if this is not MataOnly Data - if ((!asset.MetaOnly) || ((asset.Data != null) && (asset.Data.Length >= 1))) - asset.HashCode = WriteFile(asset.ID, asset.Data); + if (asset.Name.Length > 64) asset.Name = asset.Name.Substring(0, 64); + if (asset.Description.Length > 128) asset.Description = asset.Description.Substring(0, 128); - if ((!asset.MetaOnly) && ((asset.HashCode != asset.LastHashCode) || (!assetDoesExist))) - { + // Get the new hashcode if this is not MataOnly Data + if ((!asset.MetaOnly) || ((asset.Data != null) && (asset.Data.Length >= 1))) + asset.HashCode = WriteFile(asset.ID, asset.Data); - if (asset.HashCode != asset.LastHashCode) + if ((!asset.MetaOnly) && ((asset.HashCode != asset.LastHashCode) || (!assetDoesExist))) { - // check if that hash is being used anywhere later - m_Gd.Insert("auroraassets_tasks", new[] { "id", "task_type", "task_values" }, new object[] { UUID.Random(), "HASHCHECK", asset.LastHashCode }); - } - // check to see if this hash/creator combo already exist - List check1 = m_Gd.Query( - "hash_code = '" + asset.HashCode + "' and creator_id = '" + asset.CreatorID + - "'", "auroraassets_temp", "id"); - if ((check1 != null) && (check1.Count >= 1) && (asset.CreatorID != new UUID("11111111-1111-0000-0000-000100bba000"))) - { - successful = true; - AssetBase abtemp = GetAsset(UUID.Parse(check1[0])); - // not going to save it... - // use existing asset instead - if (abtemp != null) return abtemp; - - // that asset returned nothing.. so.. - // do some checks on it later - m_Gd.Insert("auroraassets_tasks", new[] { "id", "task_type", "task_values" }, - new object[] { UUID.Random(), "PARENTCHECK", check1[0] + "|" + asset.ID }); - asset.ParentID = asset.ID; - } - else if (asset.CreatorID != new UUID("11111111-1111-0000-0000-000100bba000")) - { - // was not found so insert it - m_Gd.Insert("auroraassets_temp", new[] { "id", "hash_code", "creator_id" }, - new object[] { asset.ID, asset.HashCode, asset.CreatorID }); - asset.ParentID = asset.ID; + if (asset.HashCode != asset.LastHashCode) + { + // check if that hash is being used anywhere later + m_Gd.Insert("auroraassets_tasks", new[] { "id", "task_type", "task_values" }, new object[] { UUID.Random(), "HASHCHECK", asset.LastHashCode }); + } + + // check to see if this hash/creator combo already exist + List check1 = m_Gd.Query( + "hash_code = '" + asset.HashCode + "' and creator_id = '" + asset.CreatorID + + "'", "auroraassets_temp", "id"); + if ((check1 != null) && (check1.Count >= 1) && (asset.CreatorID != new UUID("11111111-1111-0000-0000-000100bba000"))) + { + successful = true; + AssetBase abtemp = GetAsset(UUID.Parse(check1[0])); + // not going to save it... + // use existing asset instead + if (abtemp != null) return abtemp; + + // that asset returned nothing.. so.. + // do some checks on it later + m_Gd.Insert("auroraassets_tasks", new[] { "id", "task_type", "task_values" }, + new object[] { UUID.Random(), "PARENTCHECK", check1[0] + "|" + asset.ID }); + asset.ParentID = asset.ID; + } + else if (asset.CreatorID != new UUID("11111111-1111-0000-0000-000100bba000")) + { + // was not found so insert it + m_Gd.Insert("auroraassets_temp", new[] { "id", "hash_code", "creator_id" }, + new object[] { asset.ID, asset.HashCode, asset.CreatorID }); + asset.ParentID = asset.ID; + } } } + else assetDoesExist = true; + + + // Ensure some data is correct + + string database = "auroraassets_" + asset.ID.ToString().Substring(0, 1); // Delete and save the asset From 8f158e36dca7e7c4478c358fdc600361f39bf4bc Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Mon, 2 Jan 2012 13:07:54 -0500 Subject: [PATCH 05/16] Fix bugs with the possible ordering of loading (which fixes the script engine). --- Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 2 +- Aurora/Modules/Scripting/WorldComm/WorldCommModule.cs | 2 +- Aurora/Modules/Scripting/XMLRPC/XMLRPCModule.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 263b09bef0..7a1f5e45ea 100644 --- a/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -291,7 +291,6 @@ public void AddRegion(IScene scene) { m_scene = scene; - m_scriptModule = scene.RequestModuleInterface(); m_scene.RegisterModuleInterface(this); } @@ -301,6 +300,7 @@ public void RemoveRegion(IScene scene) public void RegionLoaded(IScene scene) { + m_scriptModule = scene.RequestModuleInterface(); } public Type ReplaceableInterface diff --git a/Aurora/Modules/Scripting/WorldComm/WorldCommModule.cs b/Aurora/Modules/Scripting/WorldComm/WorldCommModule.cs index 8ce03948b5..0a5c8384d3 100644 --- a/Aurora/Modules/Scripting/WorldComm/WorldCommModule.cs +++ b/Aurora/Modules/Scripting/WorldComm/WorldCommModule.cs @@ -136,7 +136,6 @@ public void AddRegion(IScene scene) { m_scene = scene; m_scene.RegisterModuleInterface(this); - m_scriptModule = scene.RequestModuleInterface(); m_scene.EventManager.OnChatFromClient += DeliverClientMessage; m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; } @@ -147,6 +146,7 @@ public void RemoveRegion(IScene scene) public void RegionLoaded(IScene scene) { + m_scriptModule = scene.RequestModuleInterface(); } public Type ReplaceableInterface diff --git a/Aurora/Modules/Scripting/XMLRPC/XMLRPCModule.cs b/Aurora/Modules/Scripting/XMLRPC/XMLRPCModule.cs index e1d9d0b320..14a8375c49 100644 --- a/Aurora/Modules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/Aurora/Modules/Scripting/XMLRPC/XMLRPCModule.cs @@ -122,7 +122,6 @@ public void AddRegion(IScene scene) m_scenes.Add(scene); scene.RegisterModuleInterface(this); - m_scriptModule = scene.RequestModuleInterface(); } public void RemoveRegion(IScene scene) @@ -146,6 +145,7 @@ public void RegionLoaded(IScene scene) httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); httpServer.Start(); } + m_scriptModule = scene.RequestModuleInterface(); } public Type ReplaceableInterface From 1d997e48e7255b0d9e0725cf4173fed1ff2c57e0 Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Mon, 2 Jan 2012 13:19:37 -0500 Subject: [PATCH 06/16] Fix another bug with http requests. --- .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 13 +++++++++---- .../Region/Framework/Interfaces/IHttpRequests.cs | 4 +--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 7a1f5e45ea..bd59f518d6 100644 --- a/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/Aurora/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -358,7 +358,7 @@ public class HTTPMax #endregion } - public class HttpRequestClass : IServiceRequest + public class HttpRequestClass : IHttpRequestClass { // Constants for parameters // public const int HTTP_BODY_MAXLENGTH = 2; @@ -370,16 +370,21 @@ public class HttpRequestClass : IServiceRequest public int HttpTimeout; public bool HttpVerifyCert = true; public int MaxLength; - public object[] Metadata = new object[0]; + public object[] _Metadata = new object[0]; + public object[] Metadata + { + get { return _Metadata; } + set { _Metadata = value; } + } public DateTime Next; public string OutboundBody; public HttpWebRequest Request; - public string ResponseBody; + public string ResponseBody { get; set; } public Dictionary ResponseHeaders; public List ResponseMetadata; - public int Status; + public int Status { get; set; } public string Url; private bool _finished; private Thread httpThread; diff --git a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs index 4b338ae866..5998633438 100644 --- a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs +++ b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs @@ -54,10 +54,8 @@ UUID StartHttpRequest(UUID primID, UUID itemID, string url, List paramet public interface IHttpRequestClass : IServiceRequest { - string Metadata { get; set; } + object[] Metadata { get; set; } int Status { get; set; } - UUID PrimID { get; set; } string ResponseBody { get; set; } - string ReqID { get; set; } } } \ No newline at end of file From 62f91a048ff6b549f8461659a3a387402a1c7a90 Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Mon, 2 Jan 2012 13:45:48 -0500 Subject: [PATCH 07/16] Add in a check to create the specified schema (MySQL) if it does not already exist. --- Aurora/DataManagerPlugins/MySQL/MySQLDataManager.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Aurora/DataManagerPlugins/MySQL/MySQLDataManager.cs b/Aurora/DataManagerPlugins/MySQL/MySQLDataManager.cs index 1b7726569a..0008e7834a 100644 --- a/Aurora/DataManagerPlugins/MySQL/MySQLDataManager.cs +++ b/Aurora/DataManagerPlugins/MySQL/MySQLDataManager.cs @@ -81,6 +81,11 @@ public IDataReader Query(string sql, Dictionary parameters) } public void ExecuteNonQuery(string sql, Dictionary parameters) + { + ExecuteNonQuery(m_connectionString, sql, parameters); + } + + public void ExecuteNonQuery(string connStr, string sql, Dictionary parameters) { try { @@ -91,7 +96,7 @@ public void ExecuteNonQuery(string sql, Dictionary parameters) param[i] = new MySqlParameter(p.Key, p.Value); i++; } - MySqlHelper.ExecuteNonQuery(m_connectionString, sql, param); + MySqlHelper.ExecuteNonQuery(connStr, sql, param); } catch (Exception e) { @@ -102,6 +107,12 @@ public void ExecuteNonQuery(string sql, Dictionary parameters) public override void ConnectToDatabase(string connectionstring, string migratorName, bool validateTables) { m_connectionString = connectionstring; + MySqlConnection c = new MySqlConnection(connectionstring); + int subStrA = connectionstring.IndexOf("Database="); + int subStrB = connectionstring.IndexOf(";", subStrA); + string noDatabaseConnector = m_connectionString.Substring(0, subStrA) + m_connectionString.Substring(subStrB+1); + + ExecuteNonQuery(noDatabaseConnector, "create schema IF NOT EXISTS " + c.Database, new Dictionary()); var migrationManager = new MigrationManager(this, migratorName, validateTables); migrationManager.DetermineOperation(); From a8cec4f93e9921d4a309dbaf4fa0aa7e17d76f2b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 2 Jan 2012 22:08:03 +0000 Subject: [PATCH 08/16] Sculpt maps: don't use FastBitmap since it always assumes Pixelformat32bppArgb, don't use graphics libs to do scaling. Don't cache in linux if alpha channel present, since Image.FromFile is broken on mono gdi ( actually gtk libs) --- Aurora/Physics/Meshing/Meshmerizer.cs | 11 ++++++- Aurora/Physics/Meshing/SculptMap.cs | 44 ++++++++++++++++++++++++--- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/Aurora/Physics/Meshing/Meshmerizer.cs b/Aurora/Physics/Meshing/Meshmerizer.cs index 3e1dd0dd41..4c65512979 100644 --- a/Aurora/Physics/Meshing/Meshmerizer.cs +++ b/Aurora/Physics/Meshing/Meshmerizer.cs @@ -74,6 +74,8 @@ public class Meshmerizer : IMesher #endif private readonly bool cacheSculptMaps = true; + private bool cacheSculptAlphaMaps = true; + private readonly string decodedSculptMapPath; private readonly bool useMeshiesPhysicsMesh; @@ -90,6 +92,13 @@ public Meshmerizer(IConfigSource config) cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); useMeshiesPhysicsMesh = start_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); + if (Environment.OSVersion.Platform == PlatformID.Unix) + { + cacheSculptAlphaMaps = false; + } + else + cacheSculptAlphaMaps = cacheSculptMaps; + try { if (!Directory.Exists(decodedSculptMapPath)) @@ -445,7 +454,7 @@ private Mesh CreateMeshFromPrimMesher(string primName, PrimitiveBaseShape primSh OpenJPEG.DecodeToImage(primShape.SculptData, out unusedData, out idata); unusedData = null; - if (cacheSculptMaps && idata != null) + if (cacheSculptMaps && (cacheSculptAlphaMaps || (((ImageFlags)(idata.Flags) & ImageFlags.HasAlpha) == 0))) { try { diff --git a/Aurora/Physics/Meshing/SculptMap.cs b/Aurora/Physics/Meshing/SculptMap.cs index 9860109cc7..a15c24da79 100644 --- a/Aurora/Physics/Meshing/SculptMap.cs +++ b/Aurora/Physics/Meshing/SculptMap.cs @@ -33,6 +33,7 @@ using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; +using System.Drawing.Imaging; using BitmapProcessing; #if SYSTEM_DRAWING @@ -96,10 +97,10 @@ public SculptMap(Bitmap bm, int lod) redBytes = new byte[numBytes]; greenBytes = new byte[numBytes]; blueBytes = new byte[numBytes]; - +/* FastBitmap unsafeBMP = new FastBitmap(bm); unsafeBMP.LockBitmap(); //Lock the bitmap for the unsafe operation - +*/ int byteNdx = 0; try @@ -110,10 +111,12 @@ public SculptMap(Bitmap bm, int lod) { Color pixel; if (smallMap) - pixel = unsafeBMP.GetPixel(x < width ? x : x - 1, +// pixel = unsafeBMP.GetPixel(x < width ? x : x - 1, + pixel = bm.GetPixel(x < width ? x : x - 1, y < height ? y : y - 1); else - pixel = unsafeBMP.GetPixel(x < width ? x*2 : x*2 - 1, + pixel = bm.GetPixel(x < width ? x : x - 1, +// pixel = unsafeBMP.GetPixel(x < width ? x*2 : x*2 - 1, y < height ? y*2 : y*2 - 1); redBytes[byteNdx] = pixel.R; @@ -130,7 +133,7 @@ public SculptMap(Bitmap bm, int lod) } //All done, unlock - unsafeBMP.UnlockBitmap(); +// unsafeBMP.UnlockBitmap(); width++; height++; @@ -170,6 +173,36 @@ public List> ToRows(bool mirror) private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight, InterpolationMode interpMode) { + + Bitmap scaledImage = new Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb); + + Color c; + float xscale = srcImage.Width / destWidth; + float yscale = srcImage.Height / destHeight; + + float sy = 0.5f; + for (int y = 0; y < destHeight; y++) + { + float sx = 0.5f; + for (int x = 0; x < destWidth; x++) + { + try + { + c = srcImage.GetPixel((int)(sx), (int)(sy)); + scaledImage.SetPixel(x, y, Color.FromArgb(c.R, c.G, c.B)); + } + catch (IndexOutOfRangeException) + { + } + + sx += xscale; + } + sy += yscale; + } + srcImage.Dispose(); + return scaledImage; + + /* Bitmap scaledImage = new Bitmap(srcImage, destWidth, destHeight); scaledImage.SetResolution(96.0f, 96.0f); @@ -183,6 +216,7 @@ private Bitmap ScaleImage(Bitmap srcImage, int destWidth, int destHeight, grPhoto.Dispose(); return scaledImage; + */ } } } From 4afce7181f6f85ca952eee2ddf1c75a611e5522b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 2 Jan 2012 22:13:20 +0000 Subject: [PATCH 09/16] replace bad meshs by a small prim and not a fullsize one, and warn about it. Don't try to cache trimeshData, that's actually will contain mainly pointers to data in mesh.cs. All sculps mesh loading and caching is ugly and needs a good revision when possible --- .../AuroraOpenDynamicsEngine/AODEPrim.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPrim.cs b/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPrim.cs index b271e15cf5..e501e9156c 100644 --- a/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPrim.cs +++ b/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPrim.cs @@ -905,24 +905,30 @@ public bool setMesh(AuroraODEPhysicsScene parent_scene, IMesh mesh) // Also fixed, needs release after usage if (vertexCount == 0 || indexCount == 0) + { + MainConsole.Instance.WarnFormat("[PHYSICS]: Got invalid mesh on prim at <{1},{2},{3}>. It can be a sculp with alpha channel in map. Replacing it by a small box.", _position.X, _position.Y, _position.Z); + _size.X = 0.01f; + _size.Y = 0.01f; + _size.Z = 0.01f; return false; + } primOOBoffset = mesh.GetCentroid(); hasOOBoffsetFromMesh = true; mesh.releaseSourceMeshData(); // free up the original mesh data to save memory - if (m_MeshToTriMeshMap.ContainsKey(mesh)) - { - _triMeshData = m_MeshToTriMeshMap[mesh]; - } - else +// if (m_MeshToTriMeshMap.ContainsKey(mesh)) +// { +// _triMeshData = m_MeshToTriMeshMap[mesh]; +// } +// else { _triMeshData = d.GeomTriMeshDataCreate(); d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); d.GeomTriMeshDataPreprocess(_triMeshData); - m_MeshToTriMeshMap[mesh] = _triMeshData; +// m_MeshToTriMeshMap[mesh] = _triMeshData; } _parent_scene.waitForSpaceUnlock(m_targetSpace); From 8066c5198eabe2eecf0539978665583b7ab94947 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 2 Jan 2012 22:51:22 +0000 Subject: [PATCH 10/16] bug fix. We need to get a contact data before using it no?:wq --- .../Physics/AuroraOpenDynamicsEngine/AODEPhysicsScene.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPhysicsScene.cs b/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPhysicsScene.cs index 074a6c7d34..2c152f3e21 100644 --- a/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPhysicsScene.cs +++ b/Aurora/Physics/AuroraOpenDynamicsEngine/AODEPhysicsScene.cs @@ -773,6 +773,10 @@ private void near(IntPtr space, IntPtr g1, IntPtr g2) for (int i = 0; i < count; i++) { + + if (!GetCurContactGeom(i, ref curContact)) + break; + if (curContact.depth > maxDepthContact.PenetrationDepth) { maxDepthContact.PenetrationDepth = curContact.depth; @@ -811,9 +815,6 @@ private void near(IntPtr space, IntPtr g1, IntPtr g2) if (p2 is PhysicsObject && ((PhysicsObject) p2).VolumeDetect) skipThisContact = true; // No collision on volume detect prims - if (!GetCurContactGeom(i, ref curContact)) - break; - if (curContact.depth < 0f) skipThisContact = true; From 35fd4e0f81f40771ce2f23ab74c48e9e3ba6d0e7 Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Mon, 2 Jan 2012 20:09:00 -0500 Subject: [PATCH 11/16] Fix a place where modules were not loading in the right order again. Switch a few things around to make them simpler to call. --- .../External/UserInventoryItemSerializer.cs | 2 +- Aurora/Framework/Utils/DataManager.cs | 19 +++++++++++++++++-- .../Connectors/IWCMuteListConnector.cs | 2 +- .../Connectors/IWCOfflineMessagesConnector.cs | 2 +- .../Connectors/IWCProfileConnector.cs | 2 +- .../LocalPresenceInfoConnector.cs | 2 +- .../OpenRegionSettingsConnector.cs | 2 +- .../Asset/LocalAssetBlackholeConnector.cs | 2 +- .../Database/Asset/LocalAssetMainConnector.cs | 2 +- .../Database/Auth/LocalAuthConnector.cs | 2 +- .../Database/Avatar/LocalAvatarConnector.cs | 2 +- .../Database/Friends/LocalFriendsConnector.cs | 2 +- .../Database/Grid/LocalGridConnector.cs | 2 +- .../Inventory/LocalInventoryConnector.cs | 2 +- .../Scheduler/LocalSchedulerConnector.cs | 2 +- .../UserAccount/LocalUserAccountConnector.cs | 2 +- .../Connectors/Local/GenericUtils.cs | 2 +- .../Local/LocalAbuseReportsConnector.cs | 2 +- .../Connectors/Local/LocalAssetConnector.cs | 2 +- .../Local/LocalAvatarArchiverConnector.cs | 2 +- .../Local/LocalDirectoryServiceConnector.cs | 2 +- .../Connectors/Local/LocalEmailConnector.cs | 2 +- .../Connectors/Local/LocalEstateConnector.cs | 2 +- .../Local/LocalGenericsConnector.cs | 2 +- .../Local/LocalGroupsServiceConnector.cs | 2 +- .../Local/LocalMuteListConnector.cs | 2 +- .../Local/LocalOfflineMessagesConnector.cs | 2 +- .../Local/LocalParcelServiceConnector.cs | 2 +- .../Connectors/Local/LocalProfileConnector.cs | 2 +- .../Connectors/Local/LocalRegionConnector.cs | 2 +- .../Local/LocalRegionInfoConnector.cs | 2 +- .../Local/LocalUserInfoConnector.cs | 2 +- .../RobustRemote/RemoteAgentConnector.cs | 2 +- .../RobustRemote/RemoteAssetConnector.cs | 2 +- .../RemoteDirectoryServiceConnector.cs | 2 +- .../RobustRemote/RemoteEmailConnector.cs | 2 +- .../RobustRemote/RemoteEstateConnector.cs | 2 +- .../RemoteGroupsServiceConnector.cs | 2 +- .../RobustRemote/RemoteMuteListConnector.cs | 2 +- .../RemoteOfflineMessagesConnector.cs | 2 +- .../RobustRemote/RemoteProfileConnector.cs | 2 +- .../RobustRemote/RemoteRegionConnector.cs | 2 +- .../SimianRemote/SimianAgentConnector.cs | 2 +- .../SimianRemote/SimianMuteListConnector.cs | 2 +- .../SimianOfflineMessagesConnector.cs | 2 +- .../SimianRemote/SimianProfileConnector.cs | 2 +- .../SimianRemote/SimianRegionConnector.cs | 2 +- .../Configuration/ConfigurationService.cs | 2 ++ .../RobustCompat/RobustInventoryConnector.cs | 2 +- 49 files changed, 66 insertions(+), 49 deletions(-) diff --git a/Aurora/Framework/Serialization/External/UserInventoryItemSerializer.cs b/Aurora/Framework/Serialization/External/UserInventoryItemSerializer.cs index 1235d703ab..0ce85a3799 100644 --- a/Aurora/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/Aurora/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -62,7 +62,7 @@ public static InventoryItemBase Deserialize(byte[] serialization) item.InvType = Convert.ToInt32(xtr.ReadElementString("InvType")); item.CreatorId = xtr.ReadElementString("CreatorUUID"); try - { + { item.CreatorData = xtr.ReadElementString("CreatorData"); } catch diff --git a/Aurora/Framework/Utils/DataManager.cs b/Aurora/Framework/Utils/DataManager.cs index 817a964899..d11481fe75 100644 --- a/Aurora/Framework/Utils/DataManager.cs +++ b/Aurora/Framework/Utils/DataManager.cs @@ -38,6 +38,11 @@ public static class DataManager private static readonly Dictionary Plugins = new Dictionary(); + public static List GetPlugins() + { + return new List(Plugins.Values); + } + /// /// Request a data plugin from the registry /// @@ -72,6 +77,16 @@ public static T RequestPlugin(string name) where T : IAuroraDataPlugin return default(T); } + /// + /// Register a new plugin to the registry + /// + /// + /// + public static void RegisterPlugin(IAuroraDataPlugin Plugin) + { + RegisterPlugin(Plugin.Name, Plugin); + } + /// /// Register a new plugin to the registry /// @@ -79,8 +94,8 @@ public static T RequestPlugin(string name) where T : IAuroraDataPlugin /// public static void RegisterPlugin(string Name, IAuroraDataPlugin Plugin) { - if (!Plugins.ContainsKey(Name)) - Plugins.Add(Name, Plugin); + if (!Plugins.ContainsKey(Plugin.Name)) + Plugins.Add(Plugin.Name, Plugin); } } } \ No newline at end of file diff --git a/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCMuteListConnector.cs b/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCMuteListConnector.cs index 8c4b62242e..14fb0fb045 100644 --- a/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCMuteListConnector.cs +++ b/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCMuteListConnector.cs @@ -53,7 +53,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor m_remoteService = new RemoteMuteListConnector(); m_remoteService.Initialize(unneeded, source, simBase, defaultConnectionString); m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCOfflineMessagesConnector.cs b/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCOfflineMessagesConnector.cs index 9c1f92e8f5..3258ed38d5 100644 --- a/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCOfflineMessagesConnector.cs +++ b/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCOfflineMessagesConnector.cs @@ -54,7 +54,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor m_remoteService = new RemoteOfflineMessagesConnector(); m_remoteService.Initialize(unneeded, source, simBase, defaultConnectionString); m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCProfileConnector.cs b/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCProfileConnector.cs index 73e9eea7e9..35237a46a9 100644 --- a/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCProfileConnector.cs +++ b/Aurora/Modules/Communications/InterWorldComms/Connectors/IWCProfileConnector.cs @@ -52,7 +52,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor m_remoteService = new RemoteProfileConnector(); m_remoteService.Initialize(unneeded, source, simBase, defaultConnectionString); m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Modules/World/BannedViewersModule/LocalPresenceInfoConnector.cs b/Aurora/Modules/World/BannedViewersModule/LocalPresenceInfoConnector.cs index 9481151085..c7ba8fba48 100644 --- a/Aurora/Modules/World/BannedViewersModule/LocalPresenceInfoConnector.cs +++ b/Aurora/Modules/World/BannedViewersModule/LocalPresenceInfoConnector.cs @@ -52,7 +52,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry DatabaseToAuthTable = source.Configs[Name].GetString("DatabasePathToAuthTable", DatabaseToAuthTable); } GD.ConnectToDatabase(DefaultConnectionString, "PresenceInfo", true); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs b/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs index eb5b7dd272..ee49244298 100644 --- a/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs +++ b/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs @@ -20,7 +20,7 @@ public string Name public void Initialize(IGenericData GenericData, Nini.Config.IConfigSource source, IRegistryCore simBase, string DefaultConnectionString) { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); string path = Util.BasePathCombine(System.IO.Path.Combine("data", "OpenRegionSettingsPage.html")); if(System.IO.File.Exists(path)) diff --git a/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs b/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs index ce69c11294..b3b2ef48a4 100644 --- a/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetBlackholeConnector.cs @@ -132,7 +132,7 @@ public void Initialize(IGenericData genericData, IConfigSource source, IRegistry if (m_Enabled) { MainConsole.Instance.Error("[BlackholeAssets]: Blackhole assets enabled"); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); try { needsConversion = (m_Gd.Query(" 1 = 1 LIMIT 1 ", "assets", "id").Count >= 1); diff --git a/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetMainConnector.cs b/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetMainConnector.cs index c47a940a1f..9f17e702f6 100644 --- a/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetMainConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Asset/LocalAssetMainConnector.cs @@ -31,7 +31,7 @@ public void Initialize(IGenericData genericData, IConfigSource source, IRegistry genericData.ConnectToDatabase(defaultConnectionString, "Asset", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } #endregion diff --git a/Aurora/Services/DataService/Connectors/Database/Auth/LocalAuthConnector.cs b/Aurora/Services/DataService/Connectors/Database/Auth/LocalAuthConnector.cs index f644db9fb4..fc3a0f83a4 100644 --- a/Aurora/Services/DataService/Connectors/Database/Auth/LocalAuthConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Auth/LocalAuthConnector.cs @@ -56,7 +56,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(connectionString, "Auth", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Database/Avatar/LocalAvatarConnector.cs b/Aurora/Services/DataService/Connectors/Database/Avatar/LocalAvatarConnector.cs index c5ee19007a..4ac2477861 100644 --- a/Aurora/Services/DataService/Connectors/Database/Avatar/LocalAvatarConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Avatar/LocalAvatarConnector.cs @@ -56,7 +56,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(connectionString, "Avatars", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Database/Friends/LocalFriendsConnector.cs b/Aurora/Services/DataService/Connectors/Database/Friends/LocalFriendsConnector.cs index 51c3209e95..73e0254d69 100644 --- a/Aurora/Services/DataService/Connectors/Database/Friends/LocalFriendsConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Friends/LocalFriendsConnector.cs @@ -54,7 +54,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(connectionString, "Friends", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Database/Grid/LocalGridConnector.cs b/Aurora/Services/DataService/Connectors/Database/Grid/LocalGridConnector.cs index 86ddbf11e9..14b1fa90ad 100644 --- a/Aurora/Services/DataService/Connectors/Database/Grid/LocalGridConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Grid/LocalGridConnector.cs @@ -58,7 +58,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(connectionString, "GridRegions", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Database/Inventory/LocalInventoryConnector.cs b/Aurora/Services/DataService/Connectors/Database/Inventory/LocalInventoryConnector.cs index 78a4131f14..a287bfbff6 100644 --- a/Aurora/Services/DataService/Connectors/Database/Inventory/LocalInventoryConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Inventory/LocalInventoryConnector.cs @@ -62,7 +62,7 @@ public virtual void Initialize(IGenericData GenericData, IConfigSource source, I GD.ConnectToDatabase(connectionString, "Inventory", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Database/Scheduler/LocalSchedulerConnector.cs b/Aurora/Services/DataService/Connectors/Database/Scheduler/LocalSchedulerConnector.cs index 911a159ffa..e962ddf062 100644 --- a/Aurora/Services/DataService/Connectors/Database/Scheduler/LocalSchedulerConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/Scheduler/LocalSchedulerConnector.cs @@ -75,7 +75,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); m_Gd = GenericData; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } #endregion diff --git a/Aurora/Services/DataService/Connectors/Database/UserAccount/LocalUserAccountConnector.cs b/Aurora/Services/DataService/Connectors/Database/UserAccount/LocalUserAccountConnector.cs index 3a97aadffd..45adbae4d2 100644 --- a/Aurora/Services/DataService/Connectors/Database/UserAccount/LocalUserAccountConnector.cs +++ b/Aurora/Services/DataService/Connectors/Database/UserAccount/LocalUserAccountConnector.cs @@ -58,7 +58,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(connectionString, "UserAccounts", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs b/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs index dd6ef958c5..b84a1b2595 100644 --- a/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs +++ b/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs @@ -149,7 +149,7 @@ public static List GetGenerics(UUID OwnerID, string Type, IGenericData GD, { OSDMap map = (OSDMap)OSDParser.DeserializeJson(ret); data.FromOSD(map); - T dataCopy = (T) data.Duplicate(); + T dataCopy = (T) System.Activator.CreateInstance(typeof(T)); Values.Add(dataCopy); } #else diff --git a/Aurora/Services/DataService/Connectors/Local/LocalAbuseReportsConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalAbuseReportsConnector.cs index dac2ec70b7..ed4c746322 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalAbuseReportsConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalAbuseReportsConnector.cs @@ -65,7 +65,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry // string newPass = MainConsole.Instance.PasswdPrompt("Password to access Abuse Reports"); // GD.Insert("passwords", new object[] { "abusereports", Util.Md5Hash(Util.Md5Hash(newPass)) }); //} - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalAssetConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalAssetConnector.cs index 43240da5c7..de85ebcadb 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalAssetConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalAssetConnector.cs @@ -53,7 +53,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("AssetConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalAvatarArchiverConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalAvatarArchiverConnector.cs index a81db39396..8f7b81dbd0 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalAvatarArchiverConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalAvatarArchiverConnector.cs @@ -54,7 +54,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(defaultConnectionString, "AvatarArchive", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalDirectoryServiceConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalDirectoryServiceConnector.cs index 250e3f9c53..f1c32d10b7 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalDirectoryServiceConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalDirectoryServiceConnector.cs @@ -63,7 +63,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("DirectoryServiceConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs index 7414502a39..12a4e2c530 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs @@ -54,7 +54,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("EmailConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs index 492631fadc..df77f41dde 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs @@ -59,7 +59,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("EstateConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs index 8e41bc50e1..54c80e6df2 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs @@ -67,7 +67,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(defaultConnectionString, "Generics", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalGroupsServiceConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalGroupsServiceConnector.cs index 1c7a228a4a..8ef33f265a 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalGroupsServiceConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalGroupsServiceConnector.cs @@ -63,7 +63,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("GroupsConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs index 85bfbe05e0..f08a91af0a 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs @@ -52,7 +52,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("MuteListConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs index 636899c470..7bd3bf2eb6 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs @@ -62,7 +62,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("OfflineMessagesConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs index a73bfe1c9e..655436fcf5 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs @@ -53,7 +53,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(defaultConnectionString, "Parcel", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalProfileConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalProfileConnector.cs index 6cc39ba6a5..12210e72ef 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalProfileConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalProfileConnector.cs @@ -56,7 +56,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("ProfileConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalRegionConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalRegionConnector.cs index d483cd7358..540451b2cb 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalRegionConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalRegionConnector.cs @@ -53,7 +53,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("RegionConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs index 58c8df368f..ff9ebefcbf 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs @@ -53,7 +53,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase (defaultConnectionString, "Generics", source.Configs["AuroraConnectors"].GetBoolean ("ValidateTables", true)); GD.ConnectToDatabase (defaultConnectionString, "RegionInfo", source.Configs["AuroraConnectors"].GetBoolean ("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalUserInfoConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalUserInfoConnector.cs index 73b15cc3d2..0c5b42df37 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalUserInfoConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalUserInfoConnector.cs @@ -67,7 +67,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry GD.ConnectToDatabase(connectionString, "UserInfo", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAgentConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAgentConnector.cs index 04c4f9d437..6c574ddd75 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAgentConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAgentConnector.cs @@ -51,7 +51,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("AgentConnector", "LocalConnector") == "RemoteConnector") { m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAssetConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAssetConnector.cs index 940da35415..3aaf1ee97c 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAssetConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteAssetConnector.cs @@ -50,7 +50,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("AssetConnector", "LocalConnector") == "RemoteConnector") { m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteDirectoryServiceConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteDirectoryServiceConnector.cs index a773fe20fc..ac689a10ec 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteDirectoryServiceConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteDirectoryServiceConnector.cs @@ -52,7 +52,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry "RemoteConnector") { m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEmailConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEmailConnector.cs index c14b3fd3e4..149a350a40 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEmailConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEmailConnector.cs @@ -51,7 +51,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("EmailConnector", "LocalConnector") == "RemoteConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs index b1e2533129..f375345e39 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs @@ -50,7 +50,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("EstateConnector", "LocalConnector") == "RemoteConnector") { m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteGroupsServiceConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteGroupsServiceConnector.cs index 5d1c469bab..ce65b38889 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteGroupsServiceConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteGroupsServiceConnector.cs @@ -50,7 +50,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("GroupsConnector", "LocalConnector") == "RemoteConnector") { m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs index bf10b9dabd..42db9611ea 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs @@ -50,7 +50,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor m_registry = simBase; if (source.Configs["AuroraConnectors"].GetString("MuteListConnector", "LocalConnector") == "RemoteConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteOfflineMessagesConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteOfflineMessagesConnector.cs index bd7ac12b4a..9bb09903ff 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteOfflineMessagesConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteOfflineMessagesConnector.cs @@ -51,7 +51,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("OfflineMessagesConnector", "LocalConnector") == "RemoteConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteProfileConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteProfileConnector.cs index c8c268973d..d19d4a199e 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteProfileConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteProfileConnector.cs @@ -49,7 +49,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor m_registry = simBase; if (source.Configs["AuroraConnectors"].GetString("ProfileConnector", "LocalConnector") == "RemoteConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs index 181f401753..e219909d4b 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs @@ -50,7 +50,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("RegionConnector", "LocalConnector") == "RemoteConnector") { m_registry = simBase; - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/SimianRemote/SimianAgentConnector.cs b/Aurora/Services/DataService/Connectors/SimianRemote/SimianAgentConnector.cs index 7b6a6121dd..02a1ccd0a8 100644 --- a/Aurora/Services/DataService/Connectors/SimianRemote/SimianAgentConnector.cs +++ b/Aurora/Services/DataService/Connectors/SimianRemote/SimianAgentConnector.cs @@ -50,7 +50,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("AgentConnector", "LocalConnector") == "SimianConnector") { m_ServerURIs = simBase.RequestModuleInterface().FindValueOf("RemoteServerURI"); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/SimianRemote/SimianMuteListConnector.cs b/Aurora/Services/DataService/Connectors/SimianRemote/SimianMuteListConnector.cs index 0b5934f2a1..125f79e3b8 100644 --- a/Aurora/Services/DataService/Connectors/SimianRemote/SimianMuteListConnector.cs +++ b/Aurora/Services/DataService/Connectors/SimianRemote/SimianMuteListConnector.cs @@ -47,7 +47,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("MuteListConnector", "LocalConnector") == "SimianConnector") { m_ServerURIs = simBase.RequestModuleInterface().FindValueOf("RemoteServerURI"); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/SimianRemote/SimianOfflineMessagesConnector.cs b/Aurora/Services/DataService/Connectors/SimianRemote/SimianOfflineMessagesConnector.cs index 237c32ae4a..b0a2bc22e6 100644 --- a/Aurora/Services/DataService/Connectors/SimianRemote/SimianOfflineMessagesConnector.cs +++ b/Aurora/Services/DataService/Connectors/SimianRemote/SimianOfflineMessagesConnector.cs @@ -47,7 +47,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor "SimianConnector") { m_ServerURIs = simBase.RequestModuleInterface().FindValueOf("RemoteServerURI"); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/SimianRemote/SimianProfileConnector.cs b/Aurora/Services/DataService/Connectors/SimianRemote/SimianProfileConnector.cs index 79e72066d9..d984851aec 100644 --- a/Aurora/Services/DataService/Connectors/SimianRemote/SimianProfileConnector.cs +++ b/Aurora/Services/DataService/Connectors/SimianRemote/SimianProfileConnector.cs @@ -40,7 +40,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor if (source.Configs["AuroraConnectors"].GetString("ProfileConnector", "LocalConnector") == "SimianConnector") { m_ServerURIs = simBase.RequestModuleInterface().FindValueOf("RemoteServerURI"); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/Aurora/Services/DataService/Connectors/SimianRemote/SimianRegionConnector.cs b/Aurora/Services/DataService/Connectors/SimianRemote/SimianRegionConnector.cs index 1b99bec49b..f3a1e81eb6 100644 --- a/Aurora/Services/DataService/Connectors/SimianRemote/SimianRegionConnector.cs +++ b/Aurora/Services/DataService/Connectors/SimianRemote/SimianRegionConnector.cs @@ -49,7 +49,7 @@ public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCor //If blank, no connector if (m_ServerURIs.Count != 0) - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } diff --git a/OpenSim/Services/Configuration/ConfigurationService.cs b/OpenSim/Services/Configuration/ConfigurationService.cs index 173039c701..428ba7eddc 100644 --- a/OpenSim/Services/Configuration/ConfigurationService.cs +++ b/OpenSim/Services/Configuration/ConfigurationService.cs @@ -204,6 +204,8 @@ public virtual List FindValueOf(string userID, string key) public virtual List FindValueOf(string userID, string key, bool returnAll) { + if (userID == "" || userID == OpenMetaverse.UUID.Zero.ToString()) + return FindValueOf(key); if (!returnAll) return FindValueOf(userID, key); diff --git a/OpenSim/Services/RobustCompat/RobustInventoryConnector.cs b/OpenSim/Services/RobustCompat/RobustInventoryConnector.cs index d0fa23a813..c92c3d80e8 100644 --- a/OpenSim/Services/RobustCompat/RobustInventoryConnector.cs +++ b/OpenSim/Services/RobustCompat/RobustInventoryConnector.cs @@ -59,7 +59,7 @@ public override void Initialize(IGenericData GenericData, IConfigSource source, GD.ConnectToDatabase(connectionString, "Inventory", source.Configs["AuroraConnectors"].GetBoolean("ValidateTables", true)); - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } From 216a9ea3e70ce7df18852b0688aad9c4f89045c5 Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Mon, 2 Jan 2012 22:26:07 -0500 Subject: [PATCH 12/16] Implement IDataTransferable all over the place. --- .../ClientInterfaces/AvatarArchive.cs | 24 +- .../Framework/ClientInterfaces/EventData.cs | 78 ++++- .../ClientInterfaces/GridInstantMessage.cs | 7 - .../Framework/ClientInterfaces/GroupData.cs | 299 ++++++++++++++++-- Aurora/Framework/ClientInterfaces/MuteList.cs | 9 +- .../ClientInterfaces/RegionLightShare.cs | 9 +- .../Framework/ClientInterfaces/StateSave.cs | 9 +- Aurora/Framework/ClientInterfaces/Telehub.cs | 9 +- .../DatabaseInterfaces/IEmailConnector.cs | 5 - Aurora/Framework/Modules/IDataTransferable.cs | 11 +- .../Modules/IOpenRegionSettingsModule.cs | 7 +- Aurora/Framework/PresenceInfo/IClientAPI.cs | 204 ++++++++++-- Aurora/Framework/SceneInfo/EstateSettings.cs | 162 +++++----- Aurora/Framework/SceneInfo/LandData.cs | 9 +- .../Services/ClassHelpers/Assets/AssetBase.cs | 18 +- .../Inventory/InventoryCollection.cs | 36 ++- .../Inventory/InventoryFolderBase.cs | 25 ++ .../Inventory/InventoryItemBase.cs | 59 ++++ .../Inventory/InventoryNodeBase.cs | 2 +- .../ClassHelpers/Profile/IUserProfileInfo.cs | 22 +- Aurora/Framework/Services/IAbuseReports.cs | 11 +- .../Framework/Services/IAgentInfoService.cs | 9 +- Aurora/Framework/Services/IAvatarService.cs | 87 +++-- Aurora/Framework/Services/IGridService.cs | 9 +- .../Services/IGroupsServicesConnector.cs | 70 +++- .../Framework/Services/IUserAccountService.cs | 128 ++++++-- Aurora/Framework/Utils/Util.cs | 8 + .../Profile/AvatarProfileArchiver.cs | 4 +- .../Modules/Avatar/Friends/FriendsModule.cs | 7 +- .../Modules/World/Estate/EstateInitializer.cs | 12 +- .../InventoryAccess/InventoryAccessModule.cs | 2 +- Aurora/Modules/World/Startup/Backup.cs | 2 +- .../World/Startup/RegisterRegionWithGrid.cs | 9 +- .../SimulationData/FileBasedSimulationData.cs | 2 +- .../EnvironmentSettingsModule.cs | 5 - .../Connectors/Local/LocalAgentConnector.cs | 11 +- .../Connectors/Local/LocalEstateConnector.cs | 10 +- .../RobustRemote/RemoteEstateConnector.cs | 4 +- .../RobustRemote/RemoteMuteListConnector.cs | 2 +- .../RobustRemote/RemoteRegionConnector.cs | 2 +- .../AssetCacheService/FlotsamAssetCache.cs | 2 +- .../AbuseReports/AbuseReportsConnector.cs | 8 +- .../Avatar/AvatarServiceConnector.cs | 2 +- .../Friends/FriendsServiceConnector.cs | 12 +- .../Connectors/Grid/GridServiceConnector.cs | 2 +- .../UserAccountServiceConnector.cs | 8 +- .../GridService/GridRegistrationService.cs | 7 - .../AbuseReports/AbuseReportsHandler.cs | 8 +- .../AuroraData/AuroraDataServerPostHandler.cs | 82 ++--- .../Avatar/AvatarServerPostHandler.cs | 2 +- .../Handlers/Grid/GridServerPostHandler.cs | 18 +- .../UserAccountServerPostHandler.cs | 4 +- .../Services/LLLoginService/LLLoginService.cs | 4 +- .../RobustCompat/RobustAvatarConnector.cs | 2 +- 54 files changed, 1109 insertions(+), 450 deletions(-) diff --git a/Aurora/Framework/ClientInterfaces/AvatarArchive.cs b/Aurora/Framework/ClientInterfaces/AvatarArchive.cs index 222d4cfd6f..6978fe5428 100644 --- a/Aurora/Framework/ClientInterfaces/AvatarArchive.cs +++ b/Aurora/Framework/ClientInterfaces/AvatarArchive.cs @@ -25,9 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using OpenMetaverse.StructuredData; + namespace Aurora.Framework { - public class AvatarArchive + public class AvatarArchive : IDataTransferable { /// /// XML of the archive @@ -48,5 +50,25 @@ public class AvatarArchive /// uuid of a text that shows off this archive /// public string Snapshot; + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + + map["ArchiveXML"] = ArchiveXML; + map["IsPublic"] = IsPublic; + map["Name"] = Name; + map["Snapshot"] = Snapshot; + + return map; + } + + public override void FromOSD(OSDMap map) + { + ArchiveXML = map["ArchiveXML"]; + IsPublic = map["IsPublic"]; + Name = map["Name"]; + Snapshot = map["Snapshot"]; + } } } \ No newline at end of file diff --git a/Aurora/Framework/ClientInterfaces/EventData.cs b/Aurora/Framework/ClientInterfaces/EventData.cs index 38a34e7627..2ca8f59630 100644 --- a/Aurora/Framework/ClientInterfaces/EventData.cs +++ b/Aurora/Framework/ClientInterfaces/EventData.cs @@ -27,10 +27,11 @@ using System.Collections.Generic; using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace Aurora.Framework { - public class EventData + public class EventData : IDataTransferable { public uint amount; public string category; @@ -53,24 +54,10 @@ public EventData() public EventData(Dictionary KVP) { - eventID = uint.Parse(KVP["eventID"].ToString()); - creator = KVP["creator"].ToString(); - name = KVP["name"].ToString(); - category = KVP["category"].ToString(); - description = KVP["description"].ToString(); - date = KVP["date"].ToString(); - dateUTC = uint.Parse(KVP["dateUTC"].ToString()); - duration = uint.Parse(KVP["duration"].ToString()); - cover = uint.Parse(KVP["cover"].ToString()); - amount = uint.Parse(KVP["amount"].ToString()); - simName = KVP["simName"].ToString(); - string[] Pos = KVP["globalPos"].ToString().Split(' '); - globalPos = new Vector3(float.Parse(Pos[0]), float.Parse(Pos[1]), float.Parse(Pos[2])); - eventFlags = uint.Parse(KVP["eventFlags"].ToString()); - maturity = int.Parse(KVP["maturity"].ToString()); + FromKVP(KVP); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary KVP = new Dictionary(); KVP["eventID"] = eventID; @@ -89,5 +76,62 @@ public Dictionary ToKeyValuePairs() KVP["maturity"] = maturity; return KVP; } + + public override void FromKVP(Dictionary KVP) + { + eventID = uint.Parse(KVP["eventID"].ToString()); + creator = KVP["creator"].ToString(); + name = KVP["name"].ToString(); + category = KVP["category"].ToString(); + description = KVP["description"].ToString(); + date = KVP["date"].ToString(); + dateUTC = uint.Parse(KVP["dateUTC"].ToString()); + duration = uint.Parse(KVP["duration"].ToString()); + cover = uint.Parse(KVP["cover"].ToString()); + amount = uint.Parse(KVP["amount"].ToString()); + simName = KVP["simName"].ToString(); + string[] Pos = KVP["globalPos"].ToString().Split(' '); + globalPos = new Vector3(float.Parse(Pos[0]), float.Parse(Pos[1]), float.Parse(Pos[2])); + eventFlags = uint.Parse(KVP["eventFlags"].ToString()); + maturity = int.Parse(KVP["maturity"].ToString()); + } + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + map["eventID"] = eventID; + map["creator"] = creator; + map["name"] = name; + map["category"] = category; + map["description"] = description; + map["date"] = date; + map["dateUTC"] = dateUTC; + map["duration"] = duration; + map["cover"] = cover; + map["amount"] = amount; + map["simName"] = simName; + map["globalPos"] = globalPos; + map["eventFlags"] = eventFlags; + map["maturity"] = maturity; + return map; + } + + public override void FromOSD(OSDMap map) + { + eventID = map["eventID"]; + creator = map["creator"]; + name = map["name"]; + category = map["category"]; + description = map["description"]; + date = map["date"]; + dateUTC = map["dateUTC"]; + duration = map["duration"]; + cover = map["cover"]; + amount = map["amount"]; + simName = map["simName"]; + globalPos = map["globalPos"]; + eventFlags = map["eventFlags"]; + maturity = map["maturity"]; + } } } \ No newline at end of file diff --git a/Aurora/Framework/ClientInterfaces/GridInstantMessage.cs b/Aurora/Framework/ClientInterfaces/GridInstantMessage.cs index fb1f6558c1..73dffee629 100644 --- a/Aurora/Framework/ClientInterfaces/GridInstantMessage.cs +++ b/Aurora/Framework/ClientInterfaces/GridInstantMessage.cs @@ -126,12 +126,5 @@ public override void FromOSD(OSDMap map) imSessionID = map["imSessionID"].AsUUID(); timestamp = map["timestamp"].AsUInteger(); } - - public override IDataTransferable Duplicate() - { - GridInstantMessage m = new GridInstantMessage(); - m.FromOSD(ToOSD()); - return m; - } } } \ No newline at end of file diff --git a/Aurora/Framework/ClientInterfaces/GroupData.cs b/Aurora/Framework/ClientInterfaces/GroupData.cs index ab7452bb57..bb7c8dd1c0 100644 --- a/Aurora/Framework/ClientInterfaces/GroupData.cs +++ b/Aurora/Framework/ClientInterfaces/GroupData.cs @@ -27,10 +27,11 @@ using System.Collections.Generic; using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace Aurora.Framework { - public class GroupRecord + public class GroupRecord : IDataTransferable { public bool AllowPublish = true; public string Charter; @@ -50,20 +51,10 @@ public GroupRecord() public GroupRecord(Dictionary values) { - GroupID = UUID.Parse(values["GroupID"].ToString()); - GroupName = values["GroupName"].ToString(); - AllowPublish = bool.Parse(values["AllowPublish"].ToString()); - MaturePublish = bool.Parse(values["MaturePublish"].ToString()); - Charter = values["Charter"].ToString(); - FounderID = UUID.Parse(values["FounderID"].ToString()); - GroupPicture = UUID.Parse(values["GroupPicture"].ToString()); - MembershipFee = int.Parse(values["MembershipFee"].ToString()); - OpenEnrollment = bool.Parse(values["OpenEnrollment"].ToString()); - OwnerRoleID = UUID.Parse(values["OwnerRoleID"].ToString()); - ShowInList = bool.Parse(values["ShowInList"].ToString()); + FromKVP(values); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary values = new Dictionary(); values["GroupID"] = GroupID; @@ -79,9 +70,57 @@ public Dictionary ToKeyValuePairs() values["ShowInList"] = ShowInList; return values; } + + public override OSDMap ToOSD() + { + OSDMap values = new OSDMap(); + values["GroupID"] = GroupID; + values["GroupName"] = GroupName; + values["AllowPublish"] = AllowPublish; + values["MaturePublish"] = MaturePublish; + values["Charter"] = Charter; + values["FounderID"] = FounderID; + values["GroupPicture"] = GroupPicture; + values["MembershipFee"] = MembershipFee; + values["OpenEnrollment"] = OpenEnrollment; + values["OwnerRoleID"] = OwnerRoleID; + values["ShowInList"] = ShowInList; + return values; + } + + public override void FromKVP(Dictionary values) + { + GroupID = UUID.Parse(values["GroupID"].ToString()); + GroupName = values["GroupName"].ToString(); + AllowPublish = bool.Parse(values["AllowPublish"].ToString()); + MaturePublish = bool.Parse(values["MaturePublish"].ToString()); + Charter = values["Charter"].ToString(); + FounderID = UUID.Parse(values["FounderID"].ToString()); + GroupPicture = UUID.Parse(values["GroupPicture"].ToString()); + MembershipFee = int.Parse(values["MembershipFee"].ToString()); + OpenEnrollment = bool.Parse(values["OpenEnrollment"].ToString()); + OwnerRoleID = UUID.Parse(values["OwnerRoleID"].ToString()); + ShowInList = bool.Parse(values["ShowInList"].ToString()); + } + + public override void FromOSD(OSDMap map) + { + GroupID = map["GroupID"]; + GroupName = map["GroupName"]; + AllowPublish = map["AllowPublish"]; + MaturePublish = map["MaturePublish"]; + Charter = map["Charter"]; + FounderID = map["FounderID"]; + GroupPicture = map["GroupPicture"]; + MembershipFee = map["MembershipFee"]; + OpenEnrollment = map["OpenEnrollment"]; + OwnerRoleID = map["OwnerRoleID"]; + ShowInList = map["ShowInList"]; + GroupName = map["GroupName"]; + } } - public class GroupMembershipData + public class GroupMembershipData : IDataTransferable { // Group base data public bool AcceptNotices = true; @@ -109,6 +148,11 @@ public GroupMembershipData() } public GroupMembershipData(Dictionary values) + { + FromKVP(values); + } + + public override void FromKVP(Dictionary values) { GroupID = UUID.Parse(values["GroupID"].ToString()); GroupName = values["GroupName"].ToString(); @@ -129,7 +173,7 @@ public GroupMembershipData(Dictionary values) GroupTitle = values["GroupTitle"].ToString(); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary values = new Dictionary(); values["GroupID"] = GroupID; @@ -151,6 +195,50 @@ public Dictionary ToKeyValuePairs() values["GroupTitle"] = GroupTitle; return values; } + + public override OSDMap ToOSD() + { + OSDMap values = new OSDMap(); + values["GroupID"] = GroupID; + values["GroupName"] = GroupName; + values["AllowPublish"] = AllowPublish; + values["MaturePublish"] = MaturePublish; + values["Charter"] = Charter; + values["FounderID"] = FounderID; + values["GroupPicture"] = GroupPicture; + values["MembershipFee"] = MembershipFee; + values["OpenEnrollment"] = OpenEnrollment; + values["ShowInList"] = ShowInList; + values["AcceptNotices"] = AcceptNotices; + values["Contribution"] = Contribution; + values["GroupPowers"] = GroupPowers; + values["Active"] = Active; + values["ActiveRole"] = ActiveRole; + values["ListInProfile"] = ListInProfile; + values["GroupTitle"] = GroupTitle; + return values; + } + + public override void FromOSD(OSDMap values) + { + GroupID = values["GroupID"]; + GroupName = values["GroupName"]; + AllowPublish = values["AllowPublish"]; + MaturePublish = values["MaturePublish"]; + Charter = values["Charter"]; + FounderID = values["FounderID"]; + GroupPicture = values["GroupPicture"]; + MembershipFee = values["MembershipFee"]; + OpenEnrollment = values["OpenEnrollment"]; + ShowInList = values["ShowInList"]; + AcceptNotices = values["AcceptNotices"]; + Contribution = values["Contribution"]; + GroupPowers = values["GroupPowers"]; + Active = values["Active"]; + ActiveRole = values["ActiveRole"]; + ListInProfile = values["ListInProfile"]; + GroupTitle = values["GroupTitle"]; + } } public class GroupTitlesData @@ -180,7 +268,7 @@ public Dictionary ToKeyValuePairs() } } - public class GroupProfileData + public class GroupProfileData : IDataTransferable { public bool AllowPublish; public string Charter; @@ -204,6 +292,33 @@ public GroupProfileData() } public GroupProfileData(Dictionary values) + { + FromKVP(values); + } + + public override Dictionary ToKVP() + { + Dictionary values = new Dictionary(); + values["GroupID"] = GroupID; + values["Name"] = Name; + values["Charter"] = Charter; + values["ShowInList"] = ShowInList; + values["MemberTitle"] = MemberTitle; + values["PowersMask"] = PowersMask; + values["InsigniaID"] = InsigniaID; + values["FounderID"] = FounderID; + values["MembershipFee"] = MembershipFee; + values["OpenEnrollment"] = OpenEnrollment; + values["Money"] = Money; + values["GroupMembershipCount"] = GroupMembershipCount; + values["GroupRolesCount"] = GroupRolesCount; + values["AllowPublish"] = AllowPublish; + values["MaturePublish"] = MaturePublish; + values["OwnerRole"] = OwnerRole; + return values; + } + + public override void FromKVP(Dictionary values) { GroupID = UUID.Parse(values["GroupID"].ToString()); Name = values["Name"].ToString(); @@ -223,9 +338,9 @@ public GroupProfileData(Dictionary values) OwnerRole = UUID.Parse(values["OwnerRole"].ToString()); } - public Dictionary ToKeyValuePairs() + public override OSDMap ToOSD() { - Dictionary values = new Dictionary(); + OSDMap values = new OSDMap(); values["GroupID"] = GroupID; values["Name"] = Name; values["Charter"] = Charter; @@ -244,9 +359,29 @@ public Dictionary ToKeyValuePairs() values["OwnerRole"] = OwnerRole; return values; } + + public override void FromOSD(OSDMap values) + { + GroupID = values["GroupID"]; + Name = values["Name"]; + Charter = values["Charter"]; + ShowInList = values["ShowInList"]; + MemberTitle = values["MemberTitle"]; + PowersMask = values["PowersMask"]; + InsigniaID = values["InsigniaID"]; + FounderID = values["FounderID"]; + MembershipFee = values["MembershipFee"]; + OpenEnrollment = values["OpenEnrollment"]; + Money = values["Money"]; + GroupMembershipCount = values["GroupMembershipCount"]; + GroupRolesCount = values["GroupRolesCount"]; + AllowPublish = values["AllowPublish"]; + MaturePublish = values["MaturePublish"]; + OwnerRole = values["OwnerRole"]; + } } - public class GroupMembersData + public class GroupMembersData : IDataTransferable { public bool AcceptNotices; public UUID AgentID; @@ -262,6 +397,25 @@ public GroupMembersData() } public GroupMembersData(Dictionary values) + { + FromKVP(values); + } + + public override Dictionary ToKVP() + { + Dictionary values = new Dictionary(); + values["AgentID"] = AgentID; + values["Contribution"] = Contribution; + values["OnlineStatus"] = OnlineStatus; + values["AgentPowers"] = AgentPowers; + values["Title"] = Title; + values["IsOwner"] = IsOwner; + values["ListInProfile"] = ListInProfile; + values["AcceptNotices"] = AcceptNotices; + return values; + } + + public override void FromKVP(Dictionary values) { AgentID = UUID.Parse(values["AgentID"].ToString()); Contribution = int.Parse(values["Contribution"].ToString()); @@ -273,9 +427,9 @@ public GroupMembersData(Dictionary values) AcceptNotices = bool.Parse(values["AcceptNotices"].ToString()); } - public Dictionary ToKeyValuePairs() + public override OSDMap ToOSD() { - Dictionary values = new Dictionary(); + OSDMap values = new OSDMap(); values["AgentID"] = AgentID; values["Contribution"] = Contribution; values["OnlineStatus"] = OnlineStatus; @@ -286,9 +440,21 @@ public Dictionary ToKeyValuePairs() values["AcceptNotices"] = AcceptNotices; return values; } + + public override void FromOSD(OSDMap values) + { + AgentID = values["AgentID"]; + Contribution = values["Contribution"]; + OnlineStatus = values["OnlineStatus"]; + AgentPowers = values["AgentPowers"]; + Title = values["Title"]; + IsOwner = values["IsOwner"]; + ListInProfile = values["ListInProfile"]; + AcceptNotices = values["AcceptNotices"]; + } } - public class GroupRolesData + public class GroupRolesData : IDataTransferable { public string Description; public int Members; @@ -302,6 +468,11 @@ public GroupRolesData() } public GroupRolesData(Dictionary values) + { + FromKVP(values); + } + + public override void FromKVP(Dictionary values) { RoleID = UUID.Parse(values["RoleID"].ToString()); Name = values["Name"].ToString(); @@ -311,7 +482,7 @@ public GroupRolesData(Dictionary values) Members = int.Parse(values["Members"].ToString()); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary values = new Dictionary(); values["RoleID"] = RoleID; @@ -322,9 +493,31 @@ public Dictionary ToKeyValuePairs() values["Members"] = Members; return values; } + + public override OSDMap ToOSD() + { + OSDMap values = new OSDMap(); + values["RoleID"] = RoleID; + values["Name"] = Name; + values["Title"] = Title; + values["Description"] = Description; + values["Powers"] = Powers; + values["Members"] = Members; + return values; + } + + public override void FromOSD(OSDMap map) + { + RoleID = map["RoleID"]; + Name = map["Name"]; + Title = map["Title"]; + Description = map["Description"]; + Powers = map["Powers"]; + Members = map["Members"]; + } } - public class GroupRoleMembersData + public class GroupRoleMembersData : IDataTransferable { public UUID MemberID; public UUID RoleID; @@ -334,21 +527,40 @@ public GroupRoleMembersData() } public GroupRoleMembersData(Dictionary values) + { + FromKVP(values); + } + + public override void FromKVP(Dictionary values) { RoleID = UUID.Parse(values["RoleID"].ToString()); MemberID = UUID.Parse(values["MemberID"].ToString()); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary values = new Dictionary(); values["RoleID"] = RoleID; values["MemberID"] = MemberID; return values; } + + public override OSDMap ToOSD() + { + OSDMap values = new OSDMap(); + values["RoleID"] = RoleID; + values["MemberID"] = MemberID; + return values; + } + + public override void FromOSD(OSDMap values) + { + RoleID = values["RoleID"]; + MemberID = values["MemberID"]; + } } - public class GroupNoticeData + public class GroupNoticeData : IDataTransferable { public UUID GroupID; public byte AssetType; @@ -365,6 +577,11 @@ public GroupNoticeData() } public GroupNoticeData(Dictionary values) + { + FromKVP(values); + } + + public override void FromKVP(Dictionary values) { GroupID = UUID.Parse(values["GroupID"].ToString()); NoticeID = UUID.Parse(values["NoticeID"].ToString()); @@ -378,7 +595,7 @@ public GroupNoticeData(Dictionary values) ItemName = values["ItemName"].ToString(); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary values = new Dictionary(); values["GroupID"] = NoticeID; @@ -392,6 +609,34 @@ public Dictionary ToKeyValuePairs() values["ItemName"] = ItemName; return values; } + + public override OSDMap ToOSD() + { + OSDMap values = new OSDMap(); + values["GroupID"] = NoticeID; + values["NoticeID"] = NoticeID; + values["Timestamp"] = Timestamp; + values["FromName"] = FromName; + values["Subject"] = Subject; + values["HasAttachment"] = HasAttachment; + values["AssetType"] = (int)AssetType; + values["ItemID"] = ItemID; + values["ItemName"] = ItemName; + return values; + } + + public override void FromOSD(OSDMap values) + { + GroupID = values["GroupID"]; + NoticeID = values["NoticeID"]; + Timestamp = values["Timestamp"]; + FromName = values["FromName"]; + Subject = values["Subject"]; + HasAttachment = values["HasAttachment"]; + AssetType = (byte)(int)values["AssetType"]; + ItemID = values["ItemID"]; + ItemName = values["ItemName"]; + } } public struct GroupVoteHistory diff --git a/Aurora/Framework/ClientInterfaces/MuteList.cs b/Aurora/Framework/ClientInterfaces/MuteList.cs index 2a5b43ad52..0af898a39e 100644 --- a/Aurora/Framework/ClientInterfaces/MuteList.cs +++ b/Aurora/Framework/ClientInterfaces/MuteList.cs @@ -61,7 +61,7 @@ public override OSDMap ToOSD() return map; } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -70,12 +70,5 @@ public override void FromKVP(Dictionary KVP) { FromOSD(Util.DictionaryToOSD(KVP)); } - - public override IDataTransferable Duplicate() - { - MuteList m = new MuteList(); - m.FromOSD(ToOSD()); - return m; - } } } \ No newline at end of file diff --git a/Aurora/Framework/ClientInterfaces/RegionLightShare.cs b/Aurora/Framework/ClientInterfaces/RegionLightShare.cs index d92063b55c..089e21adf5 100644 --- a/Aurora/Framework/ClientInterfaces/RegionLightShare.cs +++ b/Aurora/Framework/ClientInterfaces/RegionLightShare.cs @@ -265,16 +265,9 @@ public override void FromKVP(Dictionary KVP) FromOSD(Util.DictionaryToOSD(KVP)); } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } - - public override IDataTransferable Duplicate() - { - RegionLightShareData m = new RegionLightShareData(); - m.FromOSD(ToOSD()); - return m; - } } } \ No newline at end of file diff --git a/Aurora/Framework/ClientInterfaces/StateSave.cs b/Aurora/Framework/ClientInterfaces/StateSave.cs index 13a21ec133..c5b3536751 100644 --- a/Aurora/Framework/ClientInterfaces/StateSave.cs +++ b/Aurora/Framework/ClientInterfaces/StateSave.cs @@ -89,7 +89,7 @@ public override OSDMap ToOSD() return map; } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -98,12 +98,5 @@ public override void FromKVP(Dictionary KVP) { FromOSD(Util.DictionaryToOSD(KVP)); } - - public override IDataTransferable Duplicate() - { - StateSave m = new StateSave(); - m.FromOSD(ToOSD()); - return m; - } } } \ No newline at end of file diff --git a/Aurora/Framework/ClientInterfaces/Telehub.cs b/Aurora/Framework/ClientInterfaces/Telehub.cs index d66a686120..5350252f1c 100644 --- a/Aurora/Framework/ClientInterfaces/Telehub.cs +++ b/Aurora/Framework/ClientInterfaces/Telehub.cs @@ -132,7 +132,7 @@ public override OSDMap ToOSD() return map; } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -141,12 +141,5 @@ public override void FromKVP(Dictionary KVP) { FromOSD(Util.DictionaryToOSD(KVP)); } - - public override IDataTransferable Duplicate() - { - Telehub t = new Telehub(); - t.FromOSD(ToOSD()); - return t; - } } } \ No newline at end of file diff --git a/Aurora/Framework/DatabaseInterfaces/IEmailConnector.cs b/Aurora/Framework/DatabaseInterfaces/IEmailConnector.cs index ff602fd658..c21f105210 100644 --- a/Aurora/Framework/DatabaseInterfaces/IEmailConnector.cs +++ b/Aurora/Framework/DatabaseInterfaces/IEmailConnector.cs @@ -61,11 +61,6 @@ public override void FromOSD(OSDMap map) time = map["time"]; toPrimID = map["toPrimID"]; } - - public override IDataTransferable Duplicate() - { - return new Email(); - } } public interface IEmailConnector : IAuroraDataPlugin diff --git a/Aurora/Framework/Modules/IDataTransferable.cs b/Aurora/Framework/Modules/IDataTransferable.cs index 07152df411..d71d494fba 100644 --- a/Aurora/Framework/Modules/IDataTransferable.cs +++ b/Aurora/Framework/Modules/IDataTransferable.cs @@ -61,16 +61,7 @@ public virtual void FromKVP(Dictionary KVP) /// Deserialize this module from a Dictionary /// /// - public virtual Dictionary ToKeyValuePairs() - { - return null; - } - - /// - /// Duplicate this module - /// - /// - public virtual IDataTransferable Duplicate() + public virtual Dictionary ToKVP() { return null; } diff --git a/Aurora/Framework/Modules/IOpenRegionSettingsModule.cs b/Aurora/Framework/Modules/IOpenRegionSettingsModule.cs index 56cce682c1..908e611d9a 100644 --- a/Aurora/Framework/Modules/IOpenRegionSettingsModule.cs +++ b/Aurora/Framework/Modules/IOpenRegionSettingsModule.cs @@ -349,16 +349,11 @@ public override void FromKVP(Dictionary KVP) FromOSD(Util.DictionaryToOSD(KVP)); } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } - public override IDataTransferable Duplicate() - { - return new OpenRegionSettings(); - } - public override OSDMap ToOSD() { OSDMap body = new OSDMap diff --git a/Aurora/Framework/PresenceInfo/IClientAPI.cs b/Aurora/Framework/PresenceInfo/IClientAPI.cs index 2d732a36cf..4e8c567566 100644 --- a/Aurora/Framework/PresenceInfo/IClientAPI.cs +++ b/Aurora/Framework/PresenceInfo/IClientAPI.cs @@ -31,6 +31,7 @@ using Aurora.Framework; using OpenMetaverse; using OpenMetaverse.Packets; +using OpenMetaverse.StructuredData; namespace Aurora.Framework { @@ -580,7 +581,7 @@ public class LandObjectOwners public DateTime TimeLastRezzed; } - public class DirPlacesReplyData + public class DirPlacesReplyData : IDataTransferable { public uint Status; public bool auction; @@ -595,15 +596,10 @@ public DirPlacesReplyData() public DirPlacesReplyData(Dictionary KVP) { - Status = uint.Parse(KVP["Status"].ToString()); - dwell = float.Parse(KVP["dwell"].ToString()); - auction = bool.Parse(KVP["auction"].ToString()); - forSale = bool.Parse(KVP["forSale"].ToString()); - name = KVP["name"].ToString(); - parcelID = UUID.Parse(KVP["parcelID"].ToString()); + FromKVP(KVP); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary KVP = new Dictionary(); KVP["parcelID"] = parcelID; @@ -614,6 +610,40 @@ public Dictionary ToKeyValuePairs() KVP["Status"] = Status; return KVP; } + + public override void FromKVP(Dictionary KVP) + { + Status = uint.Parse(KVP["Status"].ToString()); + dwell = float.Parse(KVP["dwell"].ToString()); + auction = bool.Parse(KVP["auction"].ToString()); + forSale = bool.Parse(KVP["forSale"].ToString()); + name = KVP["name"].ToString(); + parcelID = UUID.Parse(KVP["parcelID"].ToString()); + } + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + + map["parcelID"] = parcelID; + map["name"] = name; + map["forSale"] = forSale; + map["auction"] = auction; + map["dwell"] = dwell; + map["Status"] = Status; + + return map; + } + + public override void FromOSD(OSDMap map) + { + Status = map["Status"]; + dwell = map["dwell"]; + auction = map["auction"]; + forSale = map["forSale"]; + name = map["name"]; + parcelID = map["parcelID"]; + } } public struct DirPeopleReplyData @@ -626,7 +656,7 @@ public struct DirPeopleReplyData public int reputation; } - public class DirEventsReplyData + public class DirEventsReplyData : IDataTransferable { public uint Status; public string date; @@ -641,6 +671,11 @@ public DirEventsReplyData() } public DirEventsReplyData(Dictionary KVP) + { + FromKVP(KVP); + } + + public override void FromKVP(Dictionary KVP) { Status = uint.Parse(KVP["Status"].ToString()); eventFlags = uint.Parse(KVP["eventFlags"].ToString()); @@ -651,7 +686,7 @@ public DirEventsReplyData(Dictionary KVP) ownerID = UUID.Parse(KVP["ownerID"].ToString()); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary KVP = new Dictionary(); KVP["ownerID"] = ownerID; @@ -663,9 +698,33 @@ public Dictionary ToKeyValuePairs() KVP["Status"] = Status; return KVP; } + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + map["ownerID"] = ownerID; + map["name"] = name; + map["eventID"] = eventID; + map["date"] = date; + map["unixTime"] = unixTime; + map["eventFlags"] = eventFlags; + map["Status"] = Status; + return map; + } + + public override void FromOSD(OSDMap map) + { + ownerID = map["ownerID"]; + name = map["name"]; + eventID = map["eventID"]; + date = map["date"]; + unixTime = map["unixTime"]; + eventFlags = map["eventFlags"]; + Status = map["Status"]; + } } - public class DirGroupsReplyData + public class DirGroupsReplyData : IDataTransferable { public UUID groupID; public string groupName; @@ -678,13 +737,10 @@ public DirGroupsReplyData() public DirGroupsReplyData(Dictionary KVP) { - groupID = UUID.Parse(KVP["groupID"].ToString()); - groupName = KVP["groupName"].ToString(); - members = int.Parse(KVP["members"].ToString()); - searchOrder = float.Parse(KVP["searchOrder"].ToString()); + FromKVP(KVP); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary KVP = new Dictionary(); KVP["groupID"] = groupID; @@ -693,9 +749,35 @@ public Dictionary ToKeyValuePairs() KVP["searchOrder"] = searchOrder; return KVP; } + + public override void FromKVP(Dictionary KVP) + { + groupID = UUID.Parse(KVP["groupID"].ToString()); + groupName = KVP["groupName"].ToString(); + members = int.Parse(KVP["members"].ToString()); + searchOrder = float.Parse(KVP["searchOrder"].ToString()); + } + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + map["groupID"] = groupID; + map["groupName"] = groupName; + map["members"] = members; + map["searchOrder"] = searchOrder; + return map; + } + + public override void FromOSD(OSDMap map) + { + groupID = map["groupID"]; + groupName = map["groupName"]; + members = map["members"]; + searchOrder = map["searchOrder"]; + } } - public class DirClassifiedReplyData + public class DirClassifiedReplyData : IDataTransferable { public uint Status; public byte classifiedFlags; @@ -711,16 +793,10 @@ public DirClassifiedReplyData() public DirClassifiedReplyData(Dictionary KVP) { - Status = uint.Parse(KVP["Status"].ToString()); - price = int.Parse(KVP["price"].ToString()); - expirationDate = uint.Parse(KVP["expirationDate"].ToString()); - creationDate = uint.Parse(KVP["creationDate"].ToString()); - classifiedFlags = byte.Parse(KVP["classifiedFlags"].ToString()); - name = KVP["name"].ToString(); - classifiedID = UUID.Parse(KVP["classifiedID"].ToString()); + FromKVP(KVP); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary KVP = new Dictionary(); KVP["classifiedID"] = classifiedID; @@ -732,9 +808,44 @@ public Dictionary ToKeyValuePairs() KVP["Status"] = Status; return KVP; } + + public override void FromKVP(Dictionary KVP) + { + Status = uint.Parse(KVP["Status"].ToString()); + price = int.Parse(KVP["price"].ToString()); + expirationDate = uint.Parse(KVP["expirationDate"].ToString()); + creationDate = uint.Parse(KVP["creationDate"].ToString()); + classifiedFlags = byte.Parse(KVP["classifiedFlags"].ToString()); + name = KVP["name"].ToString(); + classifiedID = UUID.Parse(KVP["classifiedID"].ToString()); + } + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + map["classifiedID"] = classifiedID; + map["name"] = name; + map["classifiedFlags"] = (int)classifiedFlags; + map["creationDate"] = creationDate; + map["expirationDate"] = expirationDate; + map["price"] = price; + map["Status"] = Status; + return map; + } + + public override void FromOSD(OSDMap map) + { + classifiedID = map["classifiedID"]; + name = map["name"]; + classifiedFlags = (byte)(int)map["classifiedFlags"]; + creationDate = map["creationDate"]; + expirationDate = map["expirationDate"]; + price = map["price"]; + Status = map["Status"]; + } } - public class DirLandReplyData + public class DirLandReplyData : IDataTransferable { public int actualArea; public bool auction; @@ -749,15 +860,10 @@ public DirLandReplyData() public DirLandReplyData(Dictionary KVP) { - actualArea = int.Parse(KVP["actualArea"].ToString()); - salePrice = int.Parse(KVP["salePrice"].ToString()); - auction = bool.Parse(KVP["auction"].ToString()); - forSale = bool.Parse(KVP["forSale"].ToString()); - name = KVP["name"].ToString(); - parcelID = UUID.Parse(KVP["parcelID"].ToString()); + FromKVP(KVP); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary KVP = new Dictionary(); KVP["parcelID"] = parcelID; @@ -768,6 +874,38 @@ public Dictionary ToKeyValuePairs() KVP["actualArea"] = actualArea; return KVP; } + + public override void FromKVP(Dictionary KVP) + { + actualArea = int.Parse(KVP["actualArea"].ToString()); + salePrice = int.Parse(KVP["salePrice"].ToString()); + auction = bool.Parse(KVP["auction"].ToString()); + forSale = bool.Parse(KVP["forSale"].ToString()); + name = KVP["name"].ToString(); + parcelID = UUID.Parse(KVP["parcelID"].ToString()); + } + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + map["parcelID"] = parcelID; + map["name"] = name; + map["forSale"] = forSale; + map["auction"] = auction; + map["salePrice"] = salePrice; + map["actualArea"] = actualArea; + return map; + } + + public override void FromOSD(OSDMap map) + { + parcelID = map["parcelID"]; + name = map["name"]; + forSale = map["forSale"]; + auction = map["auction"]; + salePrice = map["salePrice"]; + actualArea = map["actualArea"]; + } } public struct DirPopularReplyData diff --git a/Aurora/Framework/SceneInfo/EstateSettings.cs b/Aurora/Framework/SceneInfo/EstateSettings.cs index bd1b706120..b008a39162 100644 --- a/Aurora/Framework/SceneInfo/EstateSettings.cs +++ b/Aurora/Framework/SceneInfo/EstateSettings.cs @@ -33,7 +33,7 @@ namespace Aurora.Framework { - public class EstateSettings + public class EstateSettings : IDataTransferable { // private static readonly ILog MainConsole.Instance = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -69,76 +69,7 @@ public EstateSettings() public EstateSettings(Dictionary values) { - EstateID = (uint) int.Parse(values["EstateID"].ToString()); - EstateName = values["EstateName"].ToString(); - AbuseEmailToEstateOwner = int.Parse(values["AbuseEmailToEstateOwner"].ToString()) == 1; - DenyAnonymous = int.Parse(values["DenyAnonymous"].ToString()) == 1; - ResetHomeOnTeleport = int.Parse(values["ResetHomeOnTeleport"].ToString()) == 1; - FixedSun = int.Parse(values["FixedSun"].ToString()) == 1; - DenyTransacted = int.Parse(values["DenyTransacted"].ToString()) == 1; - BlockDwell = int.Parse(values["BlockDwell"].ToString()) == 1; - DenyIdentified = int.Parse(values["DenyIdentified"].ToString()) == 1; - AllowVoice = int.Parse(values["AllowVoice"].ToString()) == 1; - UseGlobalTime = int.Parse(values["UseGlobalTime"].ToString()) == 1; - PricePerMeter = int.Parse(values["PricePerMeter"].ToString()); - TaxFree = int.Parse(values["TaxFree"].ToString()) == 1; - AllowDirectTeleport = int.Parse(values["AllowDirectTeleport"].ToString()) == 1; - RedirectGridX = int.Parse(values["RedirectGridX"].ToString()); - RedirectGridY = int.Parse(values["RedirectGridY"].ToString()); - ParentEstateID = (uint) int.Parse(values["ParentEstateID"].ToString()); - SunPosition = double.Parse(values["SunPosition"].ToString()); - EstateSkipScripts = int.Parse(values["EstateSkipScripts"].ToString()) == 1; - BillableFactor = float.Parse(values["BillableFactor"].ToString()); - PublicAccess = int.Parse(values["PublicAccess"].ToString()) == 1; - AbuseEmail = values["AbuseEmail"].ToString(); - EstateOwner = new UUID(values["EstateOwner"].ToString()); - AllowLandmark = int.Parse(values["AllowLandmark"].ToString()) == 1; - AllowParcelChanges = int.Parse(values["AllowParcelChanges"].ToString()) == 1; - AllowSetHome = int.Parse(values["AllowSetHome"].ToString()) == 1; - DenyMinors = int.Parse(values["DenyMinors"].ToString()) == 1; - //We always try to pull this in if it exists - if (values.ContainsKey("EstatePass")) - EstatePass = values["EstatePass"].ToString(); - - Dictionary Managers = values["EstateManagers"] as Dictionary; -#if (!ISWIN) - List list = new List(); - foreach (object uuid in Managers.Values) - list.Add(new UUID(uuid.ToString())); - EstateManagers = list.ToArray(); -#else - EstateManagers = Managers.Values.Select(UUID => new UUID(UUID.ToString())).ToArray(); -#endif - - Dictionary Ban = values["EstateBans"] as Dictionary; -#if (!ISWIN) - List list1 = new List(); - foreach (object bannedUser in Ban.Values) - list1.Add(new EstateBan((Dictionary) bannedUser)); - EstateBans = list1.ToArray(); -#else - EstateBans = Ban.Values.Select(BannedUser => new EstateBan((Dictionary) BannedUser)).ToArray(); -#endif - - Dictionary Access = values["EstateAccess"] as Dictionary; -#if (!ISWIN) - List list2 = new List(); - foreach (object uuid in Access.Values) - list2.Add(new UUID(uuid.ToString())); - EstateAccess = list2.ToArray(); -#else - EstateAccess = Access.Values.Select(UUID => new UUID(UUID.ToString())).ToArray(); -#endif - - Dictionary Groups = values["EstateGroups"] as Dictionary; -#if (!ISWIN) - List list3 = new List(); - foreach (object uuid in Groups.Values) - list3.Add(new UUID(uuid.ToString())); - EstateGroups = list3.ToArray(); -#else - EstateGroups = Groups.Values.Select(UUID => new UUID(UUID.ToString())).ToArray(); -#endif + FromKVP(values); } public uint EstateID { get; set; } @@ -282,7 +213,7 @@ public UUID[] EstateGroups public event SaveDelegate OnSave; - public void FromOSD(OSD v) + public override void FromOSD(OSDMap v) { OSDMap values = (OSDMap) v; EstateID = (uint) values["EstateID"].AsInteger(); @@ -313,8 +244,7 @@ public void FromOSD(OSD v) AllowSetHome = values["AllowSetHome"].AsInteger() == 1; DenyMinors = values["DenyMinors"].AsInteger() == 1; //We always try to pull this in if it exists - if (values.ContainsKey("EstatePass")) - EstatePass = values["EstatePass"].AsString(); + EstatePass = values["EstatePass"].AsString(); OSDMap Managers = values["EstateManagers"] as OSDMap; #if (!ISWIN) @@ -357,7 +287,7 @@ public void FromOSD(OSD v) #endif } - public OSD ToOSD(bool Local) + public override OSDMap ToOSD() { OSDMap values = new OSDMap(); values["EstateID"] = (int) EstateID; @@ -387,8 +317,7 @@ public OSD ToOSD(bool Local) values["AllowLandmark"] = AllowLandmark ? 1 : 0; values["AllowParcelChanges"] = AllowParcelChanges ? 1 : 0; values["AllowSetHome"] = AllowSetHome ? 1 : 0; - if (Local) - values["EstatePass"] = EstatePass; //For security, this is not sent unless it is for local + values["EstatePass"] = EstatePass; //For security, this is not sent unless it is for local OSDMap Ban = new OSDMap(); int i = 0; @@ -429,7 +358,81 @@ public OSD ToOSD(bool Local) return values; } - public Dictionary ToKeyValuePairs(bool Local) + public override void FromKVP(Dictionary values) + { + EstateID = (uint)int.Parse(values["EstateID"].ToString()); + EstateName = values["EstateName"].ToString(); + AbuseEmailToEstateOwner = int.Parse(values["AbuseEmailToEstateOwner"].ToString()) == 1; + DenyAnonymous = int.Parse(values["DenyAnonymous"].ToString()) == 1; + ResetHomeOnTeleport = int.Parse(values["ResetHomeOnTeleport"].ToString()) == 1; + FixedSun = int.Parse(values["FixedSun"].ToString()) == 1; + DenyTransacted = int.Parse(values["DenyTransacted"].ToString()) == 1; + BlockDwell = int.Parse(values["BlockDwell"].ToString()) == 1; + DenyIdentified = int.Parse(values["DenyIdentified"].ToString()) == 1; + AllowVoice = int.Parse(values["AllowVoice"].ToString()) == 1; + UseGlobalTime = int.Parse(values["UseGlobalTime"].ToString()) == 1; + PricePerMeter = int.Parse(values["PricePerMeter"].ToString()); + TaxFree = int.Parse(values["TaxFree"].ToString()) == 1; + AllowDirectTeleport = int.Parse(values["AllowDirectTeleport"].ToString()) == 1; + RedirectGridX = int.Parse(values["RedirectGridX"].ToString()); + RedirectGridY = int.Parse(values["RedirectGridY"].ToString()); + ParentEstateID = (uint)int.Parse(values["ParentEstateID"].ToString()); + SunPosition = double.Parse(values["SunPosition"].ToString()); + EstateSkipScripts = int.Parse(values["EstateSkipScripts"].ToString()) == 1; + BillableFactor = float.Parse(values["BillableFactor"].ToString()); + PublicAccess = int.Parse(values["PublicAccess"].ToString()) == 1; + AbuseEmail = values["AbuseEmail"].ToString(); + EstateOwner = new UUID(values["EstateOwner"].ToString()); + AllowLandmark = int.Parse(values["AllowLandmark"].ToString()) == 1; + AllowParcelChanges = int.Parse(values["AllowParcelChanges"].ToString()) == 1; + AllowSetHome = int.Parse(values["AllowSetHome"].ToString()) == 1; + DenyMinors = int.Parse(values["DenyMinors"].ToString()) == 1; + //We always try to pull this in if it exists + if (values.ContainsKey("EstatePass")) + EstatePass = values["EstatePass"].ToString(); + + Dictionary Managers = values["EstateManagers"] as Dictionary; +#if (!ISWIN) + List list = new List(); + foreach (object uuid in Managers.Values) + list.Add(new UUID(uuid.ToString())); + EstateManagers = list.ToArray(); +#else + EstateManagers = Managers.Values.Select(UUID => new UUID(UUID.ToString())).ToArray(); +#endif + + Dictionary Ban = values["EstateBans"] as Dictionary; +#if (!ISWIN) + List list1 = new List(); + foreach (object bannedUser in Ban.Values) + list1.Add(new EstateBan((Dictionary)bannedUser)); + EstateBans = list1.ToArray(); +#else + EstateBans = Ban.Values.Select(BannedUser => new EstateBan((Dictionary) BannedUser)).ToArray(); +#endif + + Dictionary Access = values["EstateAccess"] as Dictionary; +#if (!ISWIN) + List list2 = new List(); + foreach (object uuid in Access.Values) + list2.Add(new UUID(uuid.ToString())); + EstateAccess = list2.ToArray(); +#else + EstateAccess = Access.Values.Select(UUID => new UUID(UUID.ToString())).ToArray(); +#endif + + Dictionary Groups = values["EstateGroups"] as Dictionary; +#if (!ISWIN) + List list3 = new List(); + foreach (object uuid in Groups.Values) + list3.Add(new UUID(uuid.ToString())); + EstateGroups = list3.ToArray(); +#else + EstateGroups = Groups.Values.Select(UUID => new UUID(UUID.ToString())).ToArray(); +#endif + } + + public override Dictionary ToKVP() { Dictionary values = new Dictionary(); values["EstateID"] = (int) EstateID; @@ -459,8 +462,7 @@ public Dictionary ToKeyValuePairs(bool Local) values["AllowLandmark"] = AllowLandmark ? 1 : 0; values["AllowParcelChanges"] = AllowParcelChanges ? 1 : 0; values["AllowSetHome"] = AllowSetHome ? 1 : 0; - if (Local) - values["EstatePass"] = EstatePass; //For security, this is not sent unless it is for local + values["EstatePass"] = EstatePass; //For security, this is not sent unless it is for local Dictionary Ban = new Dictionary(); int i = 0; diff --git a/Aurora/Framework/SceneInfo/LandData.cs b/Aurora/Framework/SceneInfo/LandData.cs index 539043ed53..8e2b5289a7 100644 --- a/Aurora/Framework/SceneInfo/LandData.cs +++ b/Aurora/Framework/SceneInfo/LandData.cs @@ -628,7 +628,7 @@ public LandData Copy() #region IDataTransferable - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -735,13 +735,6 @@ public override void FromKVP(Dictionary KVP) FromOSD(Util.DictionaryToOSD(KVP)); } - public override IDataTransferable Duplicate() - { - LandData m = new LandData(); - m.FromOSD(ToOSD()); - return m; - } - #endregion } } \ No newline at end of file diff --git a/Aurora/Framework/Services/ClassHelpers/Assets/AssetBase.cs b/Aurora/Framework/Services/ClassHelpers/Assets/AssetBase.cs index 3dc8ad05e2..4844a3d6cc 100644 --- a/Aurora/Framework/Services/ClassHelpers/Assets/AssetBase.cs +++ b/Aurora/Framework/Services/ClassHelpers/Assets/AssetBase.cs @@ -52,7 +52,7 @@ public enum AssetFlags /// Asset class. All Assets are reference by this class or a class derived from this class /// [Serializable] - public class AssetBase : IDisposable + public class AssetBase : IDataTransferable, IDisposable { private static readonly SHA256Managed SHA256Managed = new SHA256Managed(); private string idString = ""; @@ -287,6 +287,15 @@ public void Dispose() /// /// public OSDMap Pack() + { + return ToOSD(); + } + + /// + /// Pack this asset into an OSDMap + /// + /// + public override OSDMap ToOSD() { OSDMap assetMap = new OSDMap { @@ -306,6 +315,11 @@ public OSDMap Pack() return assetMap; } + public override void FromOSD(OSDMap map) + { + Unpack(map); + } + /// /// Unpack the asset from an OSDMap /// @@ -361,7 +375,7 @@ public AssetBase Unpack(OSD osd) /// A compressed (gzip) string of the data needed for the database public string CompressedPack() { - OSDMap assetMap = Pack(); + OSDMap assetMap = ToOSD(); //Serialize it with json string jsonString = OSDParser.SerializeJsonString(assetMap); diff --git a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryCollection.cs b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryCollection.cs index 8fe1d306ef..59691ba1fc 100644 --- a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryCollection.cs +++ b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryCollection.cs @@ -26,17 +26,51 @@ */ using System.Collections.Generic; +using Aurora.Framework; using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace Aurora.Framework { /// /// Used to serialize a whole inventory for transfer over the network. /// - public class InventoryCollection + public class InventoryCollection : IDataTransferable { public List Folders; public List Items; public UUID UserID; + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + + map["Items"] = new OSDArray(Items.ConvertAll((item) => item.ToOSD())); + map["Folders"] = new OSDArray(Folders.ConvertAll((folder) => folder.ToOSD())); + map["UserID"] = UserID; + + return map; + } + + public override void FromOSD(OSDMap map) + { + OSDArray items = (OSDArray)map["Items"]; + Items = items.ConvertAll((osd) => + { + InventoryItemBase item = new InventoryItemBase(); + item.FromOSD((OSDMap)osd); + return item; + } + ); + OSDArray folders = (OSDArray)map["Folders"]; + Folders = folders.ConvertAll((osd) => + { + InventoryFolderBase folder = new InventoryFolderBase(); + folder.FromOSD((OSDMap)osd); + return folder; + } + ); + UserID = map["UserID"]; + } } } \ No newline at end of file diff --git a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryFolderBase.cs b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryFolderBase.cs index 753a8dae28..483a9c8bee 100644 --- a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryFolderBase.cs +++ b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryFolderBase.cs @@ -26,6 +26,7 @@ */ using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace Aurora.Framework { @@ -72,5 +73,29 @@ public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID pa public short Type { get; set; } public ushort Version { get; set; } + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + + map["ID"] = ID; + map["Name"] = Name; + map["Owner"] = Owner; + map["Type"] = (int)Type; + map["ParentID"] = ParentID; + map["Version"] = (int)Version; + + return map; + } + + public override void FromOSD(OSDMap map) + { + ID = map["ID"]; + Name = map["Name"]; + Owner = map["Owner"]; + Type = (short)map["Type"]; + ParentID = map["ParentID"]; + Version = (ushort)(int)map["Version"]; + } } } \ No newline at end of file diff --git a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryItemBase.cs b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryItemBase.cs index 3e6a15b95d..19351e32b9 100644 --- a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryItemBase.cs +++ b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryItemBase.cs @@ -27,6 +27,7 @@ using System; using OpenMetaverse; +using OpenMetaverse.StructuredData; namespace Aurora.Framework { @@ -323,5 +324,63 @@ public object Clone() } #endregion + + #region IDataTransferable Members + + public override OSDMap ToOSD() + { + OSDMap map = new OSDMap(); + map["AssetID"] = AssetID; + map["AssetType"] = AssetType; + map["BasePermissions"] = BasePermissions; + map["CreationDate"] = CreationDate; + map["CreatorData"] = CreatorData; + map["CreatorId"] = CreatorId; + map["CreatorIdentification"] = CreatorIdentification; + map["CurrentPermissions"] = CurrentPermissions; + map["Description"] = Description; + map["EveryOnePermissions"] = EveryOnePermissions; + map["Flags"] = Flags; + map["Folder"] = Folder; + map["GroupID"] = GroupID; + map["GroupOwned"] = GroupOwned; + map["GroupPermissions"] = GroupPermissions; + map["ID"] = ID; + map["InvType"] = InvType; + map["Name"] = Name; + map["NextPermissions"] = NextPermissions; + map["Owner"] = Owner; + map["SalePrice"] = SalePrice; + map["SaleType"] = (int)SaleType; + return map; + } + + public override void FromOSD(OSDMap map) + { + this.AssetID = map["AssetID"]; + this.AssetType = map["AssetType"]; + this.BasePermissions = map["BasePermissions"]; + this.CreationDate = map["CreationDate"]; + this.CreatorData = map["CreatorData"]; + this.CreatorId = map["CreatorId"]; + this.CreatorIdentification = map["CreatorIdentification"]; + this.CurrentPermissions = map["CurrentPermissions"]; + this.Description = map["Description"]; + this.EveryOnePermissions = map["EveryOnePermissions"]; + this.Flags = map["Flags"]; + this.Folder = map["Folder"]; + this.GroupID = map["GroupID"]; + this.GroupOwned = map["GroupOwned"]; + this.GroupPermissions = map["GroupPermissions"]; + this.ID = map["ID"]; + this.InvType = map["InvType"]; + this.Name = map["Name"]; + this.NextPermissions = map["NextPermissions"]; + this.Owner = map["Owner"]; + this.SalePrice = map["SalePrice"]; + this.SaleType = (byte)(int)map["SaleType"]; + } + + #endregion } } \ No newline at end of file diff --git a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryNodeBase.cs b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryNodeBase.cs index 6d0dc86498..20e907fad4 100644 --- a/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryNodeBase.cs +++ b/Aurora/Framework/Services/ClassHelpers/Inventory/InventoryNodeBase.cs @@ -32,7 +32,7 @@ namespace Aurora.Framework /// /// Common base class for inventory nodes of different types (files, folders, etc.) /// - public class InventoryNodeBase + public class InventoryNodeBase : IDataTransferable { private string m_name = string.Empty; diff --git a/Aurora/Framework/Services/ClassHelpers/Profile/IUserProfileInfo.cs b/Aurora/Framework/Services/ClassHelpers/Profile/IUserProfileInfo.cs index 7294e2f486..e55b78d56a 100644 --- a/Aurora/Framework/Services/ClassHelpers/Profile/IUserProfileInfo.cs +++ b/Aurora/Framework/Services/ClassHelpers/Profile/IUserProfileInfo.cs @@ -91,7 +91,7 @@ public class IAgentInfo : IDataTransferable /// public UUID PrincipalID = UUID.Zero; - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -133,13 +133,6 @@ public override void FromKVP(Dictionary RetVal) { FromOSD(Util.DictionaryToOSD(RetVal)); } - - public override IDataTransferable Duplicate() - { - IAgentInfo m = new IAgentInfo(); - m.FromOSD(ToOSD()); - return m; - } } public class IUserProfileInfo : IDataTransferable @@ -253,7 +246,7 @@ public enum ProfileFlags /// public string WebURL = String.Empty; - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -351,13 +344,6 @@ public override void FromKVP(Dictionary RetVal) { FromOSD(Util.DictionaryToOSD(RetVal)); } - - public override IDataTransferable Duplicate() - { - IUserProfileInfo m = new IUserProfileInfo(); - m.FromOSD(ToOSD()); - return m; - } } public class ProfileInterests @@ -434,7 +420,7 @@ public override void FromKVP(Dictionary KVP) FromOSD(Util.DictionaryToOSD(KVP)); } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -499,7 +485,7 @@ public override void FromKVP(Dictionary KVP) FromOSD(Util.DictionaryToOSD(KVP)); } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } diff --git a/Aurora/Framework/Services/IAbuseReports.cs b/Aurora/Framework/Services/IAbuseReports.cs index 7ed694adf1..c52641e063 100644 --- a/Aurora/Framework/Services/IAbuseReports.cs +++ b/Aurora/Framework/Services/IAbuseReports.cs @@ -27,12 +27,13 @@ using System; using System.Collections.Generic; +using Aurora.Framework; using OpenMetaverse; using OpenMetaverse.StructuredData; namespace OpenSim.Services.Interfaces { - public class AbuseReport + public class AbuseReport : IDataTransferable { public string AbuseDetails; public string AbuseLocation; @@ -55,7 +56,7 @@ public AbuseReport() { } - public AbuseReport(Dictionary DicCol) + public override void FromKVP(Dictionary DicCol) { AbuseDetails = DicCol["AbuseDetails"].ToString(); AbuseLocation = DicCol["AbuseLocation"].ToString(); @@ -75,7 +76,7 @@ public AbuseReport(Dictionary DicCol) ScreenshotID = new UUID(DicCol["ScreenshotID"].ToString()); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary NewDicCol = new Dictionary(); NewDicCol["AbuseDetails"] = AbuseDetails; @@ -97,7 +98,7 @@ public Dictionary ToKeyValuePairs() return NewDicCol; } - public void FromOSD(OSDMap DicCol) + public override void FromOSD(OSDMap DicCol) { AbuseDetails = DicCol["AbuseDetails"].AsString(); AbuseLocation = DicCol["AbuseLocation"].AsString(); @@ -117,7 +118,7 @@ public void FromOSD(OSDMap DicCol) ScreenshotID = new UUID(DicCol["ScreenshotID"].AsString()); } - public OSDMap ToOSD() + public override OSDMap ToOSD() { OSDMap NewDicCol = new OSDMap(); NewDicCol["AbuseDetails"] = AbuseDetails; diff --git a/Aurora/Framework/Services/IAgentInfoService.cs b/Aurora/Framework/Services/IAgentInfoService.cs index 5b1bf846f4..2e00606596 100644 --- a/Aurora/Framework/Services/IAgentInfoService.cs +++ b/Aurora/Framework/Services/IAgentInfoService.cs @@ -112,7 +112,7 @@ public override void FromOSD(OSDMap retVal) Info = (OSDMap) retVal["Info"]; } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -121,13 +121,6 @@ public override void FromKVP(Dictionary KVP) { FromOSD(Util.DictionaryToOSD(KVP)); } - - public override IDataTransferable Duplicate() - { - UserInfo m = new UserInfo(); - m.FromOSD(ToOSD()); - return m; - } } public class AgentInfoHelpers diff --git a/Aurora/Framework/Services/IAvatarService.cs b/Aurora/Framework/Services/IAvatarService.cs index ac079c6016..392036fc28 100644 --- a/Aurora/Framework/Services/IAvatarService.cs +++ b/Aurora/Framework/Services/IAvatarService.cs @@ -90,7 +90,7 @@ public interface IAvatarService /// Each region/client that uses avatars will have a data structure /// of this type representing the avatars. /// - public class AvatarData + public class AvatarData : IDataTransferable { // This pretty much determines which name/value pairs will be // present below. The name/value pair describe a part of @@ -114,25 +114,7 @@ public AvatarData() public AvatarData(Dictionary kvp) { - Data = new Dictionary(); - - if (kvp.ContainsKey("AvatarType")) - Int32.TryParse(kvp["AvatarType"].ToString(), out AvatarType); - - foreach (KeyValuePair _kvp in kvp) - { - if (_kvp.Value != null) - { - string key = _kvp.Key; - if (_kvp.Key.StartsWith("Wearable")) - { - key = _kvp.Key.Replace("Wearable", ""); - key = key.Insert(key.Length == 2 ? 1 : 2, ":"); - key = "Wearable " + key; //Add the space back - } - Data[key] = _kvp.Value.ToString(); - } - } + FromKVP(kvp); } public AvatarData(AvatarAppearance appearance) @@ -179,7 +161,7 @@ public AvatarData(AvatarAppearance appearance) /// /// /// - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary result = new Dictionary(); @@ -203,6 +185,69 @@ public Dictionary ToKeyValuePairs() return result; } + public override OSDMap ToOSD() + { + OSDMap result = new OSDMap(); + + result["AvatarType"] = AvatarType; + + foreach (KeyValuePair _kvp in Data) + { + if (_kvp.Value != null) + { + //Remove spaces + result[_kvp.Key.Replace(" ", "").Replace(":", "")] = _kvp.Value; + } + } + return result; + } + + public override void FromKVP(Dictionary kvp) + { + Data = new Dictionary(); + + if (kvp.ContainsKey("AvatarType")) + Int32.TryParse(kvp["AvatarType"].ToString(), out AvatarType); + + foreach (KeyValuePair _kvp in kvp) + { + if (_kvp.Value != null) + { + string key = _kvp.Key; + if (_kvp.Key.StartsWith("Wearable")) + { + key = _kvp.Key.Replace("Wearable", ""); + key = key.Insert(key.Length == 2 ? 1 : 2, ":"); + key = "Wearable " + key; //Add the space back + } + Data[key] = _kvp.Value.ToString(); + } + } + } + + public override void FromOSD(OSDMap map) + { + Data = new Dictionary(); + + if (map.ContainsKey("AvatarType")) + AvatarType = map["AvatarType"]; + + foreach (KeyValuePair _kvp in map) + { + if (_kvp.Value != null) + { + string key = _kvp.Key; + if (_kvp.Key.StartsWith("Wearable")) + { + key = _kvp.Key.Replace("Wearable", ""); + key = key.Insert(key.Length == 2 ? 1 : 2, ":"); + key = "Wearable " + key; //Add the space back + } + Data[key] = _kvp.Value.ToString(); + } + } + } + public AvatarAppearance ToAvatarAppearance(UUID owner) { AvatarAppearance appearance = new AvatarAppearance(owner); diff --git a/Aurora/Framework/Services/IGridService.cs b/Aurora/Framework/Services/IGridService.cs index c8c9cc47f8..b4a68bd287 100644 --- a/Aurora/Framework/Services/IGridService.cs +++ b/Aurora/Framework/Services/IGridService.cs @@ -610,7 +610,7 @@ public override void FromOSD(OSDMap map) } } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -620,13 +620,6 @@ public override void FromKVP(Dictionary KVP) FromOSD(Util.DictionaryToOSD(KVP)); } - public override IDataTransferable Duplicate() - { - GridRegion m = new GridRegion(); - m.FromOSD(ToOSD()); - return m; - } - #endregion diff --git a/Aurora/Framework/Services/IGroupsServicesConnector.cs b/Aurora/Framework/Services/IGroupsServicesConnector.cs index e546993e42..3f60886574 100644 --- a/Aurora/Framework/Services/IGroupsServicesConnector.cs +++ b/Aurora/Framework/Services/IGroupsServicesConnector.cs @@ -134,7 +134,7 @@ public class ChatSessionMember // True if they have been requested to join the session } - public class GroupInviteInfo + public class GroupInviteInfo : IDataTransferable { public UUID AgentID = UUID.Zero; public string FromAgentName = ""; @@ -147,6 +147,22 @@ public GroupInviteInfo() } public GroupInviteInfo(Dictionary values) + { + FromKVP(values); + } + + public override Dictionary ToKVP() + { + Dictionary values = new Dictionary(); + values["GroupID"] = GroupID; + values["RoleID"] = RoleID; + values["AgentID"] = AgentID; + values["InviteID"] = InviteID; + values["FromAgentName"] = FromAgentName; + return values; + } + + public override void FromKVP(Dictionary values) { GroupID = UUID.Parse(values["GroupID"].ToString()); RoleID = UUID.Parse(values["RoleID"].ToString()); @@ -155,9 +171,9 @@ public GroupInviteInfo(Dictionary values) FromAgentName = values["FromAgentName"].ToString(); } - public Dictionary ToKeyValuePairs() + public override OSDMap ToOSD() { - Dictionary values = new Dictionary(); + OSDMap values = new OSDMap(); values["GroupID"] = GroupID; values["RoleID"] = RoleID; values["AgentID"] = AgentID; @@ -165,9 +181,18 @@ public Dictionary ToKeyValuePairs() values["FromAgentName"] = FromAgentName; return values; } + + public override void FromOSD(OSDMap values) + { + GroupID = values["GroupID"]; + RoleID = values["RoleID"]; + AgentID = values["AgentID"]; + InviteID = values["InviteID"]; + FromAgentName = values["FromAgentName"]; + } } - public class GroupNoticeInfo + public class GroupNoticeInfo : IDataTransferable { public byte[] BinaryBucket = new byte[0]; public UUID GroupID = UUID.Zero; @@ -179,6 +204,11 @@ public GroupNoticeInfo() } public GroupNoticeInfo(Dictionary values) + { + FromKVP(values); + } + + public override void FromKVP(Dictionary values) { noticeData = new GroupNoticeData(values["noticeData"] as Dictionary); GroupID = UUID.Parse(values["GroupID"].ToString()); @@ -186,15 +216,34 @@ public GroupNoticeInfo(Dictionary values) BinaryBucket = Utils.HexStringToBytes(values["BinaryBucket"].ToString(), true); } - public Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { Dictionary values = new Dictionary(); - values["noticeData"] = noticeData.ToKeyValuePairs(); + values["noticeData"] = noticeData.ToKVP(); values["GroupID"] = GroupID; values["Message"] = Message; values["BinaryBucket"] = Utils.BytesToHexString(BinaryBucket, "BinaryBucket"); return values; } + + public override OSDMap ToOSD() + { + OSDMap values = new OSDMap(); + values["noticeData"] = noticeData.ToOSD(); + values["GroupID"] = GroupID; + values["Message"] = Message; + values["BinaryBucket"] = BinaryBucket; + return values; + } + + public override void FromOSD(OSDMap values) + { + noticeData = new GroupNoticeData(); + noticeData.FromOSD((OSDMap)values["noticeData"]); + GroupID = values["GroupID"]; + Message = values["Message"]; + BinaryBucket = values["BinaryBucket"]; + } } public class GroupProposalInfo : IDataTransferable @@ -233,16 +282,9 @@ public override void FromKVP(Dictionary KVP) FromOSD(Util.DictionaryToOSD(KVP)); } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } - - public override IDataTransferable Duplicate() - { - GroupProposalInfo p = new GroupProposalInfo(); - p.FromOSD(ToOSD()); - return p; - } } } \ No newline at end of file diff --git a/Aurora/Framework/Services/IUserAccountService.cs b/Aurora/Framework/Services/IUserAccountService.cs index 23b81fdd54..f4ebce797d 100644 --- a/Aurora/Framework/Services/IUserAccountService.cs +++ b/Aurora/Framework/Services/IUserAccountService.cs @@ -34,7 +34,7 @@ namespace OpenSim.Services.Interfaces { - public class UserAccount + public class UserAccount : IDataTransferable { public int Created; public string Email; @@ -76,7 +76,48 @@ public UserAccount(UUID scopeID, UUID principalID, string name, string email) Created = Util.UnixTimeSinceEpoch(); } - public UserAccount(Dictionary kvp) + public string FirstName + { + get { return Name.Split(' ')[0]; } + } + + public string LastName + { + get + { + string[] split = Name.Split(' '); + if (split.Length > 1) + return Name.Split(' ')[1]; + else return ""; + } + } + + public override Dictionary ToKVP() + { + Dictionary result = new Dictionary(); + result["FirstName"] = FirstName; + result["LastName"] = LastName; + result["Email"] = Email; + result["PrincipalID"] = PrincipalID.ToString(); + result["ScopeID"] = ScopeID.ToString(); + result["Created"] = Created.ToString(); + result["UserLevel"] = UserLevel.ToString(); + result["UserFlags"] = UserFlags.ToString(); + result["UserTitle"] = UserTitle; + +#if (!ISWIN) + string str = string.Empty; + foreach (KeyValuePair l in ServiceURLs) + str = str + (l.Key + "*" + (l.Value ?? "") + ";"); +#else + string str = ServiceURLs.Aggregate(string.Empty, (current, kvp) => current + (kvp.Key + "*" + (kvp.Value ?? "") + ";")); +#endif + result["ServiceURLs"] = str; + + return result; + } + + public override void FromKVP(Dictionary kvp) { if (kvp.ContainsKey("FirstName") && kvp.ContainsKey("LastName")) Name = kvp["FirstName"] + " " + kvp["LastName"]; @@ -103,11 +144,11 @@ public UserAccount(Dictionary kvp) string str = kvp["ServiceURLs"].ToString(); if (str != string.Empty) { - string[] parts = str.Split(new[] {';'}); + string[] parts = str.Split(new[] { ';' }); #if (!ISWIN) foreach (string s in parts) { - string[] parts2 = s.Split(new[] {'*'}); + string[] parts2 = s.Split(new[] { '*' }); if (parts2.Length == 2) { ServiceURLs[parts2[0]] = parts2[1]; @@ -123,33 +164,17 @@ public UserAccount(Dictionary kvp) } } - public string FirstName + public override OSDMap ToOSD() { - get { return Name.Split(' ')[0]; } - } - - public string LastName - { - get - { - string[] split = Name.Split(' '); - if (split.Length > 1) - return Name.Split(' ')[1]; - else return ""; - } - } - - public Dictionary ToKeyValuePairs() - { - Dictionary result = new Dictionary(); + OSDMap result = new OSDMap(); result["FirstName"] = FirstName; result["LastName"] = LastName; result["Email"] = Email; - result["PrincipalID"] = PrincipalID.ToString(); - result["ScopeID"] = ScopeID.ToString(); - result["Created"] = Created.ToString(); - result["UserLevel"] = UserLevel.ToString(); - result["UserFlags"] = UserFlags.ToString(); + result["PrincipalID"] = PrincipalID; + result["ScopeID"] = ScopeID; + result["Created"] = Created; + result["UserLevel"] = UserLevel; + result["UserFlags"] = UserFlags; result["UserTitle"] = UserTitle; #if (!ISWIN) @@ -163,7 +188,54 @@ public Dictionary ToKeyValuePairs() return result; } - }; + + public override void FromOSD(OSDMap map) + { + if (map.ContainsKey("FirstName") && map.ContainsKey("LastName")) + Name = map["FirstName"] + " " + map["LastName"]; + if (map.ContainsKey("Name")) + Name = map["Name"].ToString(); + if (map.ContainsKey("Email")) + Email = map["Email"].ToString(); + if (map.ContainsKey("PrincipalID")) + PrincipalID = map["PrincipalID"]; + if (map.ContainsKey("ScopeID")) + ScopeID = map["ScopeID"]; + if (map.ContainsKey("UserLevel")) + UserLevel = map["UserLevel"]; + if (map.ContainsKey("UserFlags")) + UserFlags = map["UserFlags"]; + if (map.ContainsKey("UserTitle")) + UserTitle = map["UserTitle"]; + + if (map.ContainsKey("Created")) + Created = map["Created"]; + if (map.ContainsKey("ServiceURLs") && map["ServiceURLs"] != null) + { + ServiceURLs = new Dictionary(); + string str = map["ServiceURLs"].ToString(); + if (str != string.Empty) + { + string[] parts = str.Split(new[] { ';' }); +#if (!ISWIN) + foreach (string s in parts) + { + string[] parts2 = s.Split(new[] { '*' }); + if (parts2.Length == 2) + { + ServiceURLs[parts2[0]] = parts2[1]; + } + } +#else + foreach (string[] parts2 in parts.Select(s => s.Split(new[] {'*'})).Where(parts2 => parts2.Length == 2)) + { + ServiceURLs[parts2[0]] = parts2[1]; + } +#endif + } + } + } + } public interface IUserAccountService { diff --git a/Aurora/Framework/Utils/Util.cs b/Aurora/Framework/Utils/Util.cs index 9213952817..21f0bfda6d 100644 --- a/Aurora/Framework/Utils/Util.cs +++ b/Aurora/Framework/Utils/Util.cs @@ -2372,4 +2372,12 @@ public bool IsInRange(IPAddress address) #endregion } + + public static class Extensions + { + public static List ConvertAll(this OSDArray array, Converter converter) + { + return array.ToList().ConvertAll(converter); + } + } } \ No newline at end of file diff --git a/Aurora/Modules/Archivers/Profile/AvatarProfileArchiver.cs b/Aurora/Modules/Archivers/Profile/AvatarProfileArchiver.cs index f5ab8e9ef5..55ade31e4a 100644 --- a/Aurora/Modules/Archivers/Profile/AvatarProfileArchiver.cs +++ b/Aurora/Modules/Archivers/Profile/AvatarProfileArchiver.cs @@ -174,12 +174,12 @@ protected void HandleSaveAvatarProfile(string[] cmdparams) IUserProfileInfo profile = data.GetUserProfile(account.PrincipalID); if (profile != null) { - result["result"] = profile.ToKeyValuePairs(); + result["result"] = profile.ToKVP(); UPIxmlString = WebUtils.BuildXmlResponse(result); } } - result["result"] = account.ToKeyValuePairs(); + result["result"] = account.ToKVP(); string UDAxmlString = WebUtils.BuildXmlResponse(result); StreamWriter writer = new StreamWriter(cmdparams[5]); diff --git a/Aurora/Modules/Avatar/Friends/FriendsModule.cs b/Aurora/Modules/Avatar/Friends/FriendsModule.cs index 7ce6485b70..3979043cc8 100644 --- a/Aurora/Modules/Avatar/Friends/FriendsModule.cs +++ b/Aurora/Modules/Avatar/Friends/FriendsModule.cs @@ -46,6 +46,7 @@ public class FriendsModule : ISharedRegionModule, IFriendsModule protected List m_Scenes = new List(); public bool m_enabled = true; + protected bool m_firstStart = true; protected Dictionary> m_friendsToInformOfStatusChanges = new Dictionary>(); @@ -179,13 +180,13 @@ public void AddRegion(IScene scene) scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClosingClient += OnClosingClient; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; - - if (m_Scenes.Count == 1) - AsyncMessageRecievedService.OnMessageReceived += OnMessageReceived; } public void RegionLoaded(IScene scene) { + if (m_firstStart) + AsyncMessageRecievedService.OnMessageReceived += OnMessageReceived; + m_firstStart = false; } public void RemoveRegion(IScene scene) diff --git a/Aurora/Modules/World/Estate/EstateInitializer.cs b/Aurora/Modules/World/Estate/EstateInitializer.cs index e3ef2d5406..276a290110 100644 --- a/Aurora/Modules/World/Estate/EstateInitializer.cs +++ b/Aurora/Modules/World/Estate/EstateInitializer.cs @@ -127,6 +127,7 @@ private EstateSettings CreateEstateInfo(IScene scene) continue; } //We set this back if there wasn't an error because the EstateService will NOT send it back + ES.EstatePass = Password; IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin(); EstatePassword s = new EstatePassword { Password = Password }; if (g != null) //Save the pass to the database @@ -322,7 +323,7 @@ public override OSDMap ToOSD() return map; } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -331,13 +332,6 @@ public override void FromKVP(Dictionary KVP) { FromOSD(Util.DictionaryToOSD(KVP)); } - - public override IDataTransferable Duplicate() - { - EstatePassword m = new EstatePassword(); - m.FromOSD(ToOSD()); - return m; - } } public bool IsArchiving @@ -353,7 +347,7 @@ public void SaveModuleToArchive(TarArchiveWriter writer, IScene scene) if (settings == null) return; writer.WriteDir("estate"); - string xmlData = WebUtils.BuildXmlResponse(settings.ToKeyValuePairs(true)); + string xmlData = WebUtils.BuildXmlResponse(settings.ToKVP()); writer.WriteFile("estate/" + scene.RegionInfo.RegionName, xmlData); MainConsole.Instance.Debug("[Archive]: Finished writing estates to archive"); diff --git a/Aurora/Modules/World/InventoryAccess/InventoryAccessModule.cs b/Aurora/Modules/World/InventoryAccess/InventoryAccessModule.cs index 9f2d69b94e..500dc585d8 100644 --- a/Aurora/Modules/World/InventoryAccess/InventoryAccessModule.cs +++ b/Aurora/Modules/World/InventoryAccess/InventoryAccessModule.cs @@ -83,7 +83,6 @@ public virtual void AddRegion (IScene scene) return; m_scene = scene; - m_LLCLientInventoryModule = scene.RequestModuleInterface(); scene.RegisterModuleInterface(this); scene.EventManager.OnNewClient += OnNewClient; @@ -113,6 +112,7 @@ public virtual void RemoveRegion (IScene scene) public virtual void RegionLoaded (IScene scene) { + m_LLCLientInventoryModule = scene.RequestModuleInterface(); } #endregion diff --git a/Aurora/Modules/World/Startup/Backup.cs b/Aurora/Modules/World/Startup/Backup.cs index 9ba72da3ee..2c334d19aa 100644 --- a/Aurora/Modules/World/Startup/Backup.cs +++ b/Aurora/Modules/World/Startup/Backup.cs @@ -701,7 +701,7 @@ private void RetrievedAsset(string id, Object sender, AssetBase asset) private void WriteAsset(string id, AssetBase asset, TarArchiveWriter writer) { if (asset != null) - writer.WriteFile ("assets/" + asset.ID, OSDParser.SerializeJsonString(asset.Pack())); + writer.WriteFile ("assets/" + asset.ID, OSDParser.SerializeJsonString(asset.ToOSD())); else MainConsole.Instance.WarnFormat ("Could not find asset {0}", id); } diff --git a/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs b/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs index 3280b2bb7f..b5fb56b260 100644 --- a/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs +++ b/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs @@ -271,7 +271,7 @@ public override OSDMap ToOSD() return map; } - public override Dictionary ToKeyValuePairs() + public override Dictionary ToKVP() { return Util.OSDToDictionary(ToOSD()); } @@ -280,13 +280,6 @@ public override void FromKVP(Dictionary KVP) { FromOSD(Util.DictionaryToOSD(KVP)); } - - public override IDataTransferable Duplicate() - { - GridSessionID m = new GridSessionID(); - m.FromOSD(ToOSD()); - return m; - } } #endregion diff --git a/Aurora/Modules/World/Startup/SimulationData/FileBasedSimulationData.cs b/Aurora/Modules/World/Startup/SimulationData/FileBasedSimulationData.cs index d9bcdf1ff4..5b5eabb5b4 100644 --- a/Aurora/Modules/World/Startup/SimulationData/FileBasedSimulationData.cs +++ b/Aurora/Modules/World/Startup/SimulationData/FileBasedSimulationData.cs @@ -669,7 +669,7 @@ protected virtual void SaveBackup(string appendedFilePath, bool saveAssets) private void WriteAsset(string id, AssetBase asset, TarArchiveWriter writer) { if (asset != null) - writer.WriteFile("assets/" + asset.ID, OSDParser.SerializeJsonString(asset.Pack())); + writer.WriteFile("assets/" + asset.ID, OSDParser.SerializeJsonString(asset.ToOSD())); else MainConsole.Instance.WarnFormat("Could not find asset {0}", id); } diff --git a/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs b/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs index ee285ffc3b..7615bcad98 100644 --- a/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs +++ b/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs @@ -139,11 +139,6 @@ private class DatabaseWrapper : IDataTransferable { public OSD Info; - public override IDataTransferable Duplicate() - { - return new DatabaseWrapper(); - } - public override void FromOSD(OSDMap map) { Info = map["Info"]; diff --git a/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs index 5e88c63a16..b914dce724 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs @@ -34,7 +34,7 @@ namespace Aurora.Services.DataService { - public class LocalAgentConnector : IAgentConnector + public class LocalAgentConnector : ConnectorBase, IAgentConnector { private IGenericData GD; @@ -54,7 +54,7 @@ public void Initialize(IGenericData GenericData, IConfigSource source, IRegistry if (source.Configs["AuroraConnectors"].GetString("AgentConnector", "LocalConnector") == "LocalConnector") { - DataManager.DataManager.RegisterPlugin(Name, this); + DataManager.DataManager.RegisterPlugin(this); } } @@ -70,6 +70,9 @@ public string Name /// public IAgentInfo GetAgent(UUID agentID) { + object remoteValue = DoRemoteForUser(agentID, agentID); + if (remoteValue != null) + return (IAgentInfo)remoteValue; IAgentInfo agent = new IAgentInfo(); List query = null; try @@ -96,6 +99,10 @@ public IAgentInfo GetAgent(UUID agentID) /// public void UpdateAgent(IAgentInfo agent) { + object remoteValue = DoRemoteForUser(agent.PrincipalID, agent.ToOSD()); + if (remoteValue != null) + return; + List SetValues = new List {OSDParser.SerializeLLSDXmlString(agent.ToOSD())}; List SetRows = new List {"Value"}; diff --git a/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs index df77f41dde..b2cc2db931 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalEstateConnector.cs @@ -74,7 +74,11 @@ public bool LoadEstateSettings(UUID regionID, out EstateSettings settings) List estateID = GD.Query(new[] {"ID", "`Key`"}, new object[] {regionID, "EstateID"}, "estates", "`Value`"); if (estateID.Count != 0) + { settings = LoadEstateSettings(Convert.ToInt32(estateID[0])); + if(settings != null) + settings.EstatePass = "";//No sending it out, ever! + } return true; } @@ -110,7 +114,7 @@ public EstateSettings CreateEstate(EstateSettings es, UUID RegionID) es.EstateID = (uint) EstateID; List Values = new List {es.EstateID, "EstateSettings"}; - OSD map = es.ToOSD(true); + OSD map = es.ToOSD(); Values.Add(OSDParser.SerializeLLSDXmlString(map)); GD.Insert("estates", Values.ToArray()); @@ -122,6 +126,7 @@ public EstateSettings CreateEstate(EstateSettings es, UUID RegionID) }); es.OnSave += SaveEstateSettings; + es.EstatePass = "";//No sending it out, ever! return es; } @@ -149,7 +154,7 @@ public void SaveEstateSettings(EstateSettings es) } List Keys = new List {"Value"}; - List Values = new List {OSDParser.SerializeLLSDXmlString(es.ToOSD(true))}; + List Values = new List {OSDParser.SerializeLLSDXmlString(es.ToOSD())}; GD.Update("estates", Values.ToArray(), Keys.ToArray(), new[] {"ID", "`Key`"}, new object[] {es.EstateID, "EstateSettings"}); @@ -212,6 +217,7 @@ public List GetEstates(UUID OwnerID) { OSDMap estateInfo = (OSDMap)oval; EstateSettings es = LoadEstateSettings(estateInfo["EstateID"].AsInteger()); + es.EstatePass = "";//No sending it out, ever! if (es != null) result.Add(es); } diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs index f375345e39..c9294fb783 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteEstateConnector.cs @@ -112,7 +112,7 @@ public bool LoadEstateSettings(UUID regionID, out EstateSettings settings) public void SaveEstateSettings(EstateSettings es) { - Dictionary sendData = es.ToKeyValuePairs(true); + Dictionary sendData = es.ToKVP(); sendData["METHOD"] = "saveestatesettings"; @@ -137,7 +137,7 @@ public void SaveEstateSettings(EstateSettings es) public EstateSettings CreateEstate(EstateSettings es, UUID RegionID) { - Dictionary sendData = es.ToKeyValuePairs(true); + Dictionary sendData = es.ToKVP(); sendData["REGIONID"] = RegionID.ToString(); sendData["METHOD"] = "createestate"; diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs index 42db9611ea..9c4b775f0e 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteMuteListConnector.cs @@ -106,7 +106,7 @@ public MuteList[] GetMuteList(UUID PrincipalID) public void UpdateMute(MuteList mute, UUID PrincipalID) { - Dictionary sendData = mute.ToKeyValuePairs(); + Dictionary sendData = mute.ToKVP(); sendData["PRINCIPALID"] = PrincipalID.ToString(); sendData["METHOD"] = "updatemute"; diff --git a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs index e219909d4b..1f4be0e8c6 100644 --- a/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs +++ b/Aurora/Services/DataService/Connectors/RobustRemote/RemoteRegionConnector.cs @@ -61,7 +61,7 @@ public string Name public void AddTelehub(Telehub telehub, ulong RegionHandle) { - Dictionary sendData = telehub.ToKeyValuePairs(); + Dictionary sendData = telehub.ToKVP(); sendData["METHOD"] = "addtelehub"; string reqString = WebUtils.BuildQueryString(sendData); diff --git a/OpenSim/Services/AssetCacheService/FlotsamAssetCache.cs b/OpenSim/Services/AssetCacheService/FlotsamAssetCache.cs index 962350d967..a6b762d2e1 100644 --- a/OpenSim/Services/AssetCacheService/FlotsamAssetCache.cs +++ b/OpenSim/Services/AssetCacheService/FlotsamAssetCache.cs @@ -575,7 +575,7 @@ private void WriteFileCache(string filename, AssetBase asset) Directory.CreateDirectory(directory); } - File.WriteAllText(tempname, OpenMetaverse.StructuredData.OSDParser.SerializeJsonString(asset.Pack())); + File.WriteAllText(tempname, OpenMetaverse.StructuredData.OSDParser.SerializeJsonString(asset.ToOSD())); // Now that it's written, rename it so that it can be found. if (File.Exists(filename)) diff --git a/OpenSim/Services/Connectors/AbuseReports/AbuseReportsConnector.cs b/OpenSim/Services/Connectors/AbuseReports/AbuseReportsConnector.cs index 89ccac6cee..322a92c514 100644 --- a/OpenSim/Services/Connectors/AbuseReports/AbuseReportsConnector.cs +++ b/OpenSim/Services/Connectors/AbuseReports/AbuseReportsConnector.cs @@ -51,7 +51,7 @@ public void AddAbuseReport(AbuseReport abuse_report) m_registry.RequestModuleInterface().FindValueOf("AbuseReportsServerURI"); foreach (string m_ServerURI in m_ServerURIs) { - Dictionary ar = abuse_report.ToKeyValuePairs(); + Dictionary ar = abuse_report.ToKVP(); ar.Add("METHOD", "AddAbuseReport"); SynchronousRestFormsRequester.MakeRequest("POST", @@ -73,12 +73,14 @@ public AbuseReport GetAbuseReport(int Number, string Password) {{"Password", Password}, {"METHOD", "GetAbuseReport"}}; List m_ServerURIs = m_registry.RequestModuleInterface().FindValueOf("AbuseReportsServerURI"); - return new AbuseReport(WebUtils.ParseXmlResponse(SynchronousRestFormsRequester.MakeRequest("POST", + AbuseReport ar = new AbuseReport(); + ar.FromKVP(WebUtils.ParseXmlResponse(SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURIs[ 0], WebUtils. BuildQueryString (send)))); + return ar; } catch (Exception e) { @@ -117,7 +119,7 @@ public void UpdateAbuseReport(AbuseReport report, string Password) { try { - Dictionary send = report.ToKeyValuePairs(); + Dictionary send = report.ToKVP(); send.Add("Password", Password); send.Add("METHOD", "AddAbuseReport"); List m_ServerURIs = diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs index 272bded84f..ac39ca16a7 100644 --- a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs @@ -124,7 +124,7 @@ public virtual bool SetAvatar(UUID userID, AvatarData avatar) sendData["UserID"] = userID.ToString(); - Dictionary structData = avatar.ToKeyValuePairs(); + Dictionary structData = avatar.ToKVP(); foreach (KeyValuePair kvp in structData) sendData[kvp.Key] = kvp.Value.ToString(); diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs index f80636e5ce..5b6f5a08b2 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs @@ -43,6 +43,11 @@ public class FriendsServicesConnector : IFriendsService, IService { private IRegistryCore m_registry; + public virtual IFriendsService InnerService + { + get { return this; } + } + #region IFriendsService public FriendInfo[] GetFriends(UUID PrincipalID) @@ -200,12 +205,7 @@ public string Name get { return GetType().Name; } } - #region IFriendsService Members - - public virtual IFriendsService InnerService - { - get { return this; } - } + #region IService Members public void Initialize(IConfigSource config, IRegistryCore registry) { diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 4955d8f954..23e10d5bab 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -801,7 +801,7 @@ public virtual void SetRegionSafe(UUID regionID) public virtual string OldRegisterRegion(GridRegion region) { - Dictionary rinfo = region.ToKeyValuePairs(); + Dictionary rinfo = region.ToKVP(); Dictionary sendData = new Dictionary(); foreach (KeyValuePair kvp in rinfo) sendData[kvp.Key] = kvp.Value; diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 1b5badd9c4..80fc2dfabf 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs @@ -187,7 +187,8 @@ public List GetUserAccounts(UUID scopeID, string query) { if (acc is Dictionary) { - UserAccount pinfo = new UserAccount((Dictionary) acc); + UserAccount pinfo = new UserAccount(); + pinfo.FromKVP((Dictionary)acc); m_cache.Cache(pinfo.PrincipalID, pinfo); pinfo.GenericData["GridURL"] = m_ServerURI.Remove(m_ServerURI.LastIndexOf('/')); accounts.Add(pinfo); @@ -226,7 +227,7 @@ public virtual bool StoreUserAccount(UserAccount data) sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "setaccount"; - Dictionary structData = data.ToKeyValuePairs(); + Dictionary structData = data.ToKVP(); foreach (KeyValuePair kvp in structData) { @@ -268,7 +269,8 @@ private UserAccount SendAndGetReply(UUID avatarID, Dictionary se { if (replyData["result"] is Dictionary) { - account = new UserAccount((Dictionary) replyData["result"]); + account = new UserAccount(); + account.FromKVP((Dictionary)replyData["result"]); account.GenericData["GridURL"] = m_ServerURI.Remove(m_ServerURI.LastIndexOf('/')); return account; } diff --git a/OpenSim/Services/GridService/GridRegistrationService.cs b/OpenSim/Services/GridService/GridRegistrationService.cs index 185b93b9bf..f6dce80db7 100644 --- a/OpenSim/Services/GridService/GridRegistrationService.cs +++ b/OpenSim/Services/GridService/GridRegistrationService.cs @@ -484,13 +484,6 @@ public override void FromOSD(OSDMap retVal) else VersionNumber = retVal["VersionNumber"].AsInteger(); } - - public override IDataTransferable Duplicate() - { - GridRegistrationURLs url = new GridRegistrationURLs(); - url.FromOSD(ToOSD()); - return url; - } } public class LoadBalancerUrls diff --git a/OpenSim/Services/Handlers/AbuseReports/AbuseReportsHandler.cs b/OpenSim/Services/Handlers/AbuseReports/AbuseReportsHandler.cs index 6f970d6e11..b030932f29 100644 --- a/OpenSim/Services/Handlers/AbuseReports/AbuseReportsHandler.cs +++ b/OpenSim/Services/Handlers/AbuseReports/AbuseReportsHandler.cs @@ -112,7 +112,8 @@ public override byte[] Handle(string path, Stream requestData, private byte[] AddAbuseReport(Dictionary request) { - AbuseReport ar = new AbuseReport(request); + AbuseReport ar = new AbuseReport(); + ar.FromKVP(request); m_AbuseReportsService.AddAbuseReport(ar); //MainConsole.Instance.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); @@ -121,7 +122,8 @@ private byte[] AddAbuseReport(Dictionary request) private byte[] UpdateAbuseReport(Dictionary request) { - AbuseReport ar = new AbuseReport(request); + AbuseReport ar = new AbuseReport(); + ar.FromKVP(request); m_AbuseReportsService.UpdateAbuseReport(ar, request["Password"].ToString()); //MainConsole.Instance.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); @@ -132,7 +134,7 @@ private byte[] GetAbuseReport(Dictionary request) { string xmlString = WebUtils.BuildXmlResponse( m_AbuseReportsService.GetAbuseReport(int.Parse(request["Number"].ToString()), - request["Password"].ToString()).ToKeyValuePairs()); + request["Password"].ToString()).ToKVP()); //MainConsole.Instance.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(xmlString); diff --git a/OpenSim/Services/Handlers/AuroraData/AuroraDataServerPostHandler.cs b/OpenSim/Services/Handlers/AuroraData/AuroraDataServerPostHandler.cs index 752829fff3..eb500fed5e 100644 --- a/OpenSim/Services/Handlers/AuroraData/AuroraDataServerPostHandler.cs +++ b/OpenSim/Services/Handlers/AuroraData/AuroraDataServerPostHandler.cs @@ -474,7 +474,7 @@ public byte[] GetAgent(Dictionary request) if (Agent == null) result["result"] = "null"; else - result["result"] = Agent.ToKeyValuePairs(); + result["result"] = Agent.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); UTF8Encoding encoding = new UTF8Encoding(); @@ -786,7 +786,7 @@ public byte[] GetGroupRecord(Dictionary request) GroupRecord r = GroupsServiceConnector.GetGroupRecord(requestingAgentID, GroupID, GroupName); if (r != null) - result.Add("A", r.ToKeyValuePairs()); + result.Add("A", r.ToKVP()); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); @@ -804,7 +804,7 @@ public byte[] GetGroupMembershipData(Dictionary request) GroupMembershipData r = GroupsServiceConnector.GetGroupMembershipData(requestingAgentID, GroupID, AgentID); if (r != null) - result.Add("A", r.ToKeyValuePairs()); + result.Add("A", r.ToKVP()); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); @@ -821,7 +821,7 @@ public byte[] GetMemberGroupProfile(Dictionary request) UUID AgentID = UUID.Parse(request["AgentID"].ToString()); GroupProfileData r = GroupsServiceConnector.GetMemberGroupProfile(requestingAgentID, GroupID, AgentID); - result.Add("A", r.ToKeyValuePairs()); + result.Add("A", r.ToKVP()); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); @@ -871,7 +871,7 @@ public byte[] GetAgentToGroupInvite(Dictionary request) GroupInviteInfo r = GroupsServiceConnector.GetAgentToGroupInvite(requestingAgentID, inviteID); if (r != null) - result.Add("A", r.ToKeyValuePairs()); + result.Add("A", r.ToKVP()); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); @@ -887,8 +887,8 @@ public byte[] GetAgentGroupMemberData(Dictionary request) UUID GroupID = UUID.Parse(request["GroupID"].ToString()); UUID AgentID = UUID.Parse(request["AgentID"].ToString()); - GroupMembersData r = GroupsServiceConnector.GetAgentGroupMemberData(requestingAgentID, GroupID, AgentID); - result.Add("A", r.ToKeyValuePairs()); + GroupMembersData r = GroupsServiceConnector.GetAgentGroupMemberData(requestingAgentID, GroupID, AgentID); + result.Add("A", r.ToKVP()); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); @@ -904,7 +904,7 @@ public byte[] GetGroupNotice(Dictionary request) UUID noticeID = UUID.Parse(request["noticeID"].ToString()); GroupNoticeInfo r = GroupsServiceConnector.GetGroupNotice(requestingAgentID, noticeID); - result.Add("A", r.ToKeyValuePairs()); + result.Add("A", r.ToKVP()); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); @@ -924,7 +924,7 @@ public byte[] GetAgentGroupMemberships(Dictionary request) int i = 0; foreach (GroupMembershipData r in rs) { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -959,7 +959,7 @@ public byte[] GetGroupRecords(Dictionary request) int i = 0; foreach (GroupRecord r in rs) { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -984,7 +984,7 @@ public byte[] FindGroups(Dictionary request) int i = 0; foreach (DirGroupsReplyData r in rs) { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -1006,8 +1006,8 @@ public byte[] GetAgentGroupRoles(Dictionary request) List rs = GroupsServiceConnector.GetAgentGroupRoles(requestingAgentID, AgentID, GroupID); int i = 0; foreach (GroupRolesData r in rs) - { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + { + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -1028,8 +1028,8 @@ public byte[] GetGroupRoles(Dictionary request) List rs = GroupsServiceConnector.GetGroupRoles(requestingAgentID, GroupID); int i = 0; foreach (GroupRolesData r in rs) - { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + { + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -1053,8 +1053,8 @@ public byte[] GetGroupMembers(Dictionary request) foreach (GroupMembersData r in rs) { if (r != null) - { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + { + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } } @@ -1083,8 +1083,8 @@ public byte[] GetGroupRoleMembers(Dictionary request) List rs = GroupsServiceConnector.GetGroupRoleMembers(requestingAgentID, GroupID); int i = 0; foreach (GroupRoleMembersData r in rs) - { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + { + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -1107,8 +1107,8 @@ public byte[] GetGroupNotices(Dictionary request) List rs = GroupsServiceConnector.GetGroupNotices(requestingAgentID, start, count, GroupIDs); int i = 0; foreach (GroupNoticeData r in rs) - { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + { + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -1129,7 +1129,7 @@ public byte[] GetGroupInvites(Dictionary request) int i = 0; foreach (GroupInviteInfo r in rs) { - result.Add(Util.ConvertDecString(i), r.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), r.ToKVP()); i++; } @@ -1196,7 +1196,7 @@ public byte[] FindLand(Dictionary request) int i = 0; foreach (DirPlacesReplyData land in lands) { - result.Add(Util.ConvertDecString(i), land.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), land.ToKVP()); i++; } @@ -1221,7 +1221,7 @@ public byte[] FindLandForSale(Dictionary request) int i = 0; foreach (DirLandReplyData land in lands) { - result.Add(Util.ConvertDecString(i), land.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), land.ToKVP()); i++; } @@ -1243,7 +1243,7 @@ public byte[] FindEvents(Dictionary request) int i = 0; foreach (DirEventsReplyData land in lands) { - result.Add(Util.ConvertDecString(i), land.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), land.ToKVP()); i++; } @@ -1264,7 +1264,7 @@ public byte[] FindEventsInRegion(Dictionary request) int i = 0; foreach (DirEventsReplyData land in lands) { - result.Add(Util.ConvertDecString(i), land.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), land.ToKVP()); i++; } @@ -1288,7 +1288,7 @@ public byte[] FindClassifieds(Dictionary request) int i = 0; foreach (DirClassifiedReplyData land in lands) { - result.Add(Util.ConvertDecString(i), land.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), land.ToKVP()); i++; } @@ -1305,7 +1305,7 @@ public byte[] GetEventInfo(Dictionary request) string EVENTID = request["EVENTID"].ToString(); EventData eventdata = DirectoryServiceConnector.GetEventInfo(EVENTID); - result.Add("event", eventdata.ToKeyValuePairs()); + result.Add("event", eventdata.ToKVP()); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); @@ -1323,7 +1323,7 @@ public byte[] FindClassifiedsInRegion(Dictionary request) int i = 0; foreach (Classified classified in classifieds) { - result.Add(Util.ConvertDecString(i), classified.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), classified.ToKVP()); i++; } @@ -1411,7 +1411,7 @@ public byte[] GetEstatesOwner(Dictionary request) { foreach (EstateSettings estateID in EstateIDs) { - estateresult.Add(Util.ConvertDecString(i), estateID.ToKeyValuePairs(false)); + estateresult.Add(Util.ConvertDecString(i), estateID.ToKVP()); i++; } } @@ -1460,7 +1460,7 @@ public byte[] CreateEstate(Dictionary request) ES = EstateConnector.CreateEstate(ES, RegionID); //This is not a local transfer, MUST be false! - Dictionary result = ES.ToKeyValuePairs(false); + Dictionary result = ES.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); @@ -1492,7 +1492,7 @@ public byte[] LoadEstateSettings(Dictionary request) return FailureResult(); //This NEEDS to be false here, otherwise passwords will be sent unsecurely! - Dictionary result = ES.ToKeyValuePairs(false); + Dictionary result = ES.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); @@ -1583,7 +1583,7 @@ public byte[] GetMuteList(Dictionary request) int i = 0; foreach (MuteList Mute in Mutes) { - result.Add(Util.ConvertDecString(i), Mute.ToKeyValuePairs()); + result.Add(Util.ConvertDecString(i), Mute.ToKVP()); i++; } @@ -1707,18 +1707,20 @@ public class AbuseReportsHandler public byte[] AddAbuseReport(Dictionary request) { IAbuseReportsConnector m_AbuseReportsService = - DataManager.RequestPlugin("IAbuseReportsConnectorLocal"); - - AbuseReport ar = new AbuseReport(request); + DataManager.RequestPlugin("IAbuseReportsConnectorLocal"); + + AbuseReport ar = new AbuseReport(); + ar.FromKVP(request); m_AbuseReportsService.AddAbuseReport(ar); //MainConsole.Instance.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); return SuccessResult(); } - public byte[] UpdateAbuseReport(Dictionary request) - { - AbuseReport ar = new AbuseReport(request); + public byte[] UpdateAbuseReport(Dictionary request) + { + AbuseReport ar = new AbuseReport(); + ar.FromKVP(request); IAbuseReportsConnector m_AbuseReportsService = DataManager.RequestPlugin("IAbuseReportsConnectorLocal"); m_AbuseReportsService.UpdateAbuseReport(ar, request["Password"].ToString()); @@ -1733,7 +1735,7 @@ public byte[] GetAbuseReport(Dictionary request) DataManager.RequestPlugin("IAbuseReportsConnectorLocal"); string xmlString = WebUtils.BuildXmlResponse( m_AbuseReportsService.GetAbuseReport(int.Parse(request["Number"].ToString()), - request["Password"].ToString()).ToKeyValuePairs()); + request["Password"].ToString()).ToKVP()); //MainConsole.Instance.DebugFormat("[FRIENDS HANDLER]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(xmlString); diff --git a/OpenSim/Services/Handlers/Avatar/AvatarServerPostHandler.cs b/OpenSim/Services/Handlers/Avatar/AvatarServerPostHandler.cs index 58b0470e47..b813133e43 100644 --- a/OpenSim/Services/Handlers/Avatar/AvatarServerPostHandler.cs +++ b/OpenSim/Services/Handlers/Avatar/AvatarServerPostHandler.cs @@ -126,7 +126,7 @@ private byte[] GetAvatar(Dictionary request) if (avatar == null) result["result"] = "null"; else - result["result"] = avatar.ToKeyValuePairs(); + result["result"] = avatar.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); diff --git a/OpenSim/Services/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Services/Handlers/Grid/GridServerPostHandler.cs index 4d1f49ef72..3f04e33ef6 100644 --- a/OpenSim/Services/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Services/Handlers/Grid/GridServerPostHandler.cs @@ -358,7 +358,7 @@ private byte[] GetRegionByUUID(Dictionary request) if (rinfo == null) result["result"] = "null"; else - result["result"] = rinfo.ToKeyValuePairs(); + result["result"] = rinfo.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); @@ -392,7 +392,7 @@ private byte[] GetRegionByPosition(Dictionary request) if (rinfo == null) result["result"] = "null"; else - result["result"] = rinfo.ToKeyValuePairs(); + result["result"] = rinfo.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); @@ -422,7 +422,7 @@ private byte[] GetRegionByName(Dictionary request) if (rinfo == null) result["result"] = "null"; else - result["result"] = rinfo.ToKeyValuePairs(); + result["result"] = rinfo.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); @@ -463,7 +463,7 @@ private byte[] GetRegionsByName(Dictionary request) #if (!ISWIN) foreach (GridRegion rinfo in rinfos) { - Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + Dictionary rinfoDict = rinfo.ToKVP(); result["region" + i] = rinfoDict; i++; } @@ -522,7 +522,7 @@ private byte[] GetRegionRange(Dictionary request) #if (!ISWIN) foreach (GridRegion rinfo in rinfos) { - Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + Dictionary rinfoDict = rinfo.ToKVP(); result["region" + i] = rinfoDict; i++; } @@ -561,7 +561,7 @@ private byte[] GetDefaultRegions(Dictionary request) #if (!ISWIN) foreach (GridRegion rinfo in rinfos) { - Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + Dictionary rinfoDict = rinfo.ToKVP(); result["region" + i] = rinfoDict; i++; } @@ -611,7 +611,7 @@ private byte[] GetFallbackRegions(Dictionary request) #if (!ISWIN) foreach (GridRegion rinfo in rinfos) { - Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + Dictionary rinfoDict = rinfo.ToKVP(); result["region" + i] = rinfoDict; i++; } @@ -661,7 +661,7 @@ private byte[] GetSafeRegions(Dictionary request) #if (!ISWIN) foreach (GridRegion rinfo in rinfos) { - Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + Dictionary rinfoDict = rinfo.ToKVP(); result["region" + i] = rinfoDict; i++; } @@ -770,7 +770,7 @@ public byte[] FindTelehub(Dictionary request) Dictionary result = new Dictionary(); Telehub telehub = TelehubConnector.FindTelehub(regionID, 0); if (telehub != null) - result = telehub.ToKeyValuePairs(); + result = telehub.ToKVP(); string xmlString = WebUtils.BuildXmlResponse(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); diff --git a/OpenSim/Services/Handlers/UserAccounts/UserAccountServerPostHandler.cs b/OpenSim/Services/Handlers/UserAccounts/UserAccountServerPostHandler.cs index 5e4fc3c952..720c768539 100644 --- a/OpenSim/Services/Handlers/UserAccounts/UserAccountServerPostHandler.cs +++ b/OpenSim/Services/Handlers/UserAccounts/UserAccountServerPostHandler.cs @@ -142,7 +142,7 @@ private byte[] GetAccount(Dictionary request) result["result"] = "null"; else { - result["result"] = account.ToKeyValuePairs(); + result["result"] = account.ToKVP(); } return ResultToBytes(result); @@ -170,7 +170,7 @@ private byte[] GetAccounts(Dictionary request) #if(!ISWIN) foreach(UserAccount acc in accounts) { - result["account" + i] = acc.ToKeyValuePairs(); + result["account" + i] = acc.ToKVP(); i++; } #else diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index b104815144..4770952981 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -1647,12 +1647,12 @@ protected void HandleSaveAvatarProfile(string[] cmdparams) IUserProfileInfo profile = data.GetUserProfile(account.PrincipalID); if (profile != null) { - result["result"] = profile.ToKeyValuePairs(); + result["result"] = profile.ToKVP(); UPIxmlString = WebUtils.BuildXmlResponse(result); } } - result["result"] = account.ToKeyValuePairs(); + result["result"] = account.ToKVP(); string UDAxmlString = WebUtils.BuildXmlResponse(result); StreamWriter writer = new StreamWriter(cmdparams[5]); diff --git a/OpenSim/Services/RobustCompat/RobustAvatarConnector.cs b/OpenSim/Services/RobustCompat/RobustAvatarConnector.cs index 207c401dfd..639ccee285 100644 --- a/OpenSim/Services/RobustCompat/RobustAvatarConnector.cs +++ b/OpenSim/Services/RobustCompat/RobustAvatarConnector.cs @@ -38,7 +38,7 @@ public override bool SetAvatar(UUID userID, AvatarData avatar) sendData["UserID"] = userID.ToString(); - Dictionary structData = avatar.ToKeyValuePairs(); + Dictionary structData = avatar.ToKVP(); #if (!ISWIN) foreach (KeyValuePair kvp in structData) From e638f27d33a6b7eba3c4f389f13beb9a158cbe25 Mon Sep 17 00:00:00 2001 From: Skidz Tweak Date: Mon, 2 Jan 2012 23:44:23 -0600 Subject: [PATCH 13/16] Implimenting IDataTransferable in AgentCircuitData --- .../PresenceInfo/AgentCircuitData.cs | 103 ++++++++++++++---- 1 file changed, 80 insertions(+), 23 deletions(-) diff --git a/Aurora/Framework/PresenceInfo/AgentCircuitData.cs b/Aurora/Framework/PresenceInfo/AgentCircuitData.cs index 1ddd6d6215..ce7d26cb8c 100644 --- a/Aurora/Framework/PresenceInfo/AgentCircuitData.cs +++ b/Aurora/Framework/PresenceInfo/AgentCircuitData.cs @@ -38,8 +38,10 @@ namespace Aurora.Framework /// Circuit data for an agent. Connection information shared between /// regions that accept UDP connections from a client /// - public class AgentCircuitData + public class AgentCircuitData : IDataTransferable { + #region Variables + /// /// Avatar Unique Agent Identifier /// @@ -136,6 +138,57 @@ public class AgentCircuitData /// public uint teleportFlags; + #endregion + + #region IDataTransferable + + /// + /// Serialize the module to OSD + /// + /// + public override OSDMap ToOSD() + { + return PackAgentCircuitData(); + } + + /// + /// Deserialize the module from OSD + /// + /// + public override void FromOSD(OSDMap map) + { + UnpackAgentCircuitData(map); + } + + /// + /// Serialize the module to a Dictionary + /// + /// + public override void FromKVP(Dictionary KVP) + { + + } + + /// + /// Deserialize this module from a Dictionary + /// + /// + public override Dictionary ToKeyValuePairs() + { + return null; + } + + /// + /// Duplicate this module + /// + /// + public override IDataTransferable Duplicate() + { + return Copy(); + } + + #region oldFunctions + /// /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json /// @@ -188,24 +241,24 @@ public virtual OSDMap PackAgentCircuitData() public virtual AgentCircuitData Copy() { AgentCircuitData Copy = new AgentCircuitData - { - AgentID = AgentID, - Appearance = Appearance, - CapsPath = CapsPath, - child = child, - reallyischild = reallyischild, - circuitcode = circuitcode, - IPAddress = IPAddress, - SecureSessionID = SecureSessionID, - SessionID = SessionID, - startpos = startpos, - teleportFlags = teleportFlags, - OtherInformation = OtherInformation, - ServiceURLs = ServiceURLs, - firstname = firstname, - lastname = lastname, - DrawDistance = DrawDistance - }; + { + AgentID = AgentID, + Appearance = Appearance, + CapsPath = CapsPath, + child = child, + reallyischild = reallyischild, + circuitcode = circuitcode, + IPAddress = IPAddress, + SecureSessionID = SecureSessionID, + SessionID = SessionID, + startpos = startpos, + teleportFlags = teleportFlags, + OtherInformation = OtherInformation, + ServiceURLs = ServiceURLs, + firstname = firstname, + lastname = lastname, + DrawDistance = DrawDistance + }; return Copy; @@ -264,12 +317,12 @@ public virtual void UnpackAgentCircuitData(OSDMap args) if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) { - Appearance.Unpack((OSDMap) args["packed_appearance"]); + Appearance.Unpack((OSDMap)args["packed_appearance"]); // DEBUG ON //MainConsole.Instance.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); // DEBUG OFF } - // DEBUG ON + // DEBUG ON else MainConsole.Instance.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance, dne ? " + !args.ContainsKey("packed_appearance")); @@ -281,14 +334,14 @@ public virtual void UnpackAgentCircuitData(OSDMap args) } if (args.ContainsKey("otherInfo")) - OtherInformation = (OSDMap) OSDParser.DeserializeLLSDXml(args["otherInfo"].AsString()); + OtherInformation = (OSDMap)OSDParser.DeserializeLLSDXml(args["otherInfo"].AsString()); ServiceURLs = new Dictionary(); // Try parse the new way, OSDMap if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) { - OSDMap urls = (OSDMap) (args["serviceurls"]); + OSDMap urls = (OSDMap)(args["serviceurls"]); foreach (KeyValuePair kvp in urls) { ServiceURLs[kvp.Key] = kvp.Value.AsString(); @@ -296,5 +349,9 @@ public virtual void UnpackAgentCircuitData(OSDMap args) } } } + + #endregion + #endregion + } } \ No newline at end of file From d2278738e47cb9e8e12a1e5440530fe95bb90187 Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Tue, 3 Jan 2012 01:26:29 -0500 Subject: [PATCH 14/16] Add in all of the new reflection code that will soon be taking over more processing. --- .../DatabaseInterfaces/IGenericsConnector.cs | 4 +- Aurora/Framework/Utils/Util.cs | 100 ++++++++++++++---- .../Modules/World/Estate/EstateInitializer.cs | 4 +- .../OpenRegionSettingsConnector.cs | 2 +- .../World/Startup/RegisterRegionWithGrid.cs | 2 +- .../EnvironmentSettingsModule.cs | 3 +- .../Connectors/Local/GenericUtils.cs | 11 +- .../Connectors/Local/LocalEmailConnector.cs | 3 +- .../Local/LocalGenericsConnector.cs | 8 +- .../Local/LocalMuteListConnector.cs | 4 +- .../Local/LocalOfflineMessagesConnector.cs | 5 +- .../Local/LocalParcelServiceConnector.cs | 4 +- .../Local/LocalRegionInfoConnector.cs | 2 +- .../GridService/GridRegistrationService.cs | 20 ++-- 14 files changed, 117 insertions(+), 55 deletions(-) diff --git a/Aurora/Framework/DatabaseInterfaces/IGenericsConnector.cs b/Aurora/Framework/DatabaseInterfaces/IGenericsConnector.cs index ee2118ef7a..2782f05345 100644 --- a/Aurora/Framework/DatabaseInterfaces/IGenericsConnector.cs +++ b/Aurora/Framework/DatabaseInterfaces/IGenericsConnector.cs @@ -57,7 +57,7 @@ public interface IGenericsConnector : IAuroraDataPlugin /// /// a default T to copy all data into /// - T GetGeneric(UUID OwnerID, string Type, string Key, T data) where T : IDataTransferable; + T GetGeneric(UUID OwnerID, string Type, string Key) where T : IDataTransferable; /// /// Gets a list of generic T's from the database @@ -67,7 +67,7 @@ public interface IGenericsConnector : IAuroraDataPlugin /// /// a default T /// - List GetGenerics(UUID OwnerID, string Type, T data) where T : IDataTransferable; + List GetGenerics(UUID OwnerID, string Type) where T : IDataTransferable; /// /// Adds a generic IDataTransferable into the database diff --git a/Aurora/Framework/Utils/Util.cs b/Aurora/Framework/Utils/Util.cs index 21f0bfda6d..2bfb8508aa 100644 --- a/Aurora/Framework/Utils/Util.cs +++ b/Aurora/Framework/Utils/Util.cs @@ -1646,28 +1646,72 @@ public static Dictionary OSDToDictionary(OSDMap map) Dictionary retVal = new Dictionary(); foreach (string key in map.Keys) { - if (map[key].Type == OSDType.Binary) - retVal.Add(key, map[key].AsBinary()); - else if (map[key].Type == OSDType.Boolean) - retVal.Add(key, map[key].AsBoolean()); - else if (map[key].Type == OSDType.Date) - retVal.Add(key, map[key].AsDate()); - else if (map[key].Type == OSDType.Integer) - retVal.Add(key, map[key].AsInteger()); - else if (map[key].Type == OSDType.Real) - retVal.Add(key, map[key].AsReal()); - else if (map[key].Type == OSDType.String) - retVal.Add(key, map[key].AsString()); - else if (map[key].Type == OSDType.URI) - retVal.Add(key, map[key].AsUri()); - else if (map[key].Type == OSDType.UUID) - retVal.Add(key, map[key].AsUUID()); - else - retVal.Add(key, map[key].AsString()); + retVal.Add(key, OSDToObject(map[key])); } return retVal; } + public static object OSDToObject(OSD o) + { + return OSDToObject(o, null); + } + + public static object OSDToObject(OSD o, Type PossibleArrayType) + { + if (o.Type == OSDType.Array) + { + OSDArray array = (OSDArray)o; + var possArrayType = Activator.CreateInstance(PossibleArrayType); + var list = MakeList(possArrayType); + foreach (OSD oo in array) + { + list.Add(oo); + } + return list; + } + else if (o.Type == OSDType.Map) + { + OSDMap array = (OSDMap)o; + var possArrayTypeB = Activator.CreateInstance(PossibleArrayType); + var list = MakeDictionary("", possArrayTypeB); + foreach (KeyValuePair oo in array) + { + list.Add(oo.Key, oo.Value); + } + return list; + } + else if (o.Type == OSDType.Binary) + return o.AsBinary(); + else if (o.Type == OSDType.Boolean) + return o.AsBoolean(); + else if (o.Type == OSDType.Date) + return o.AsDate(); + else if (o.Type == OSDType.Integer) + return o.AsInteger(); + else if (o.Type == OSDType.Real) + return o.AsReal(); + else if (o.Type == OSDType.String) + return o.AsString(); + else if (o.Type == OSDType.URI) + return o.AsUri(); + else if (o.Type == OSDType.UUID) + return o.AsUUID(); + else + return o.AsString(); + } + + public static List MakeList(T itemOftype) + { + List newList = new List(); + return newList; + } + + public static Dictionary MakeDictionary(A itemOftypeA, B itemOfTypeB) + { + Dictionary newList = new Dictionary(); + return newList; + } + public static void UlongToInts(ulong regionHandle, out int x, out int y) { uint xx, yy; @@ -1765,6 +1809,26 @@ public static sbyte CheckMeshType(sbyte p) return p; } + public static bool IsInstanceOfGenericType(Type genericType, object instance) + { + Type type = instance.GetType(); + return IsInstanceOfGenericType(genericType, type); + } + + public static bool IsInstanceOfGenericType(Type genericType, Type type) + { + while (type != null) + { + if (type.IsGenericType && + type.GetGenericTypeDefinition() == genericType) + { + return true; + } + type = type.BaseType; + } + return false; + } + // http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/68f7ca38-5cd1-411f-b8d4-e4f7a688bc03 // By: A Million Lemmings public static string ConvertDecString(int dvalue) diff --git a/Aurora/Modules/World/Estate/EstateInitializer.cs b/Aurora/Modules/World/Estate/EstateInitializer.cs index 276a290110..1ca2614ceb 100644 --- a/Aurora/Modules/World/Estate/EstateInitializer.cs +++ b/Aurora/Modules/World/Estate/EstateInitializer.cs @@ -251,7 +251,7 @@ public void FinishStartup(IScene scene, IConfigSource source, ISimulationBase op IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin(); EstatePassword s = null; if (g != null) - s = g.GetGeneric(scene.RegionInfo.RegionID, "EstatePassword", ES.EstateID.ToString(), new EstatePassword()); + s = g.GetGeneric(scene.RegionInfo.RegionID, "EstatePassword", ES.EstateID.ToString()); if (s != null) ES.EstatePass = s.Password; @@ -297,7 +297,7 @@ protected void ChangeEstate(string[] cmd) IGenericsConnector g = Aurora.DataManager.DataManager.RequestPlugin(); EstatePassword s = null; if (g != null) - s = g.GetGeneric(scene.RegionInfo.RegionID, "EstatePassword", scene.RegionInfo.EstateSettings.EstateID.ToString(), new EstatePassword()); + s = g.GetGeneric(scene.RegionInfo.RegionID, "EstatePassword", scene.RegionInfo.EstateSettings.EstateID.ToString()); if (s != null) scene.RegionInfo.EstateSettings.EstatePass = s.Password; } diff --git a/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs b/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs index ee49244298..f6b10ef68b 100644 --- a/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs +++ b/Aurora/Modules/World/OpenRegionSettingsModule/OpenRegionSettingsConnector.cs @@ -38,7 +38,7 @@ public OpenRegionSettings GetSettings(UUID regionID) if (connector != null) { - settings = connector.GetGeneric(regionID, "OpenRegionSettings", "OpenRegionSettings", new OpenRegionSettings()) ?? + settings = connector.GetGeneric(regionID, "OpenRegionSettings", "OpenRegionSettings") ?? new OpenRegionSettings(); } return settings; diff --git a/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs b/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs index b5fb56b260..62e3f7d451 100644 --- a/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs +++ b/Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs @@ -76,7 +76,7 @@ public bool RegisterRegionWithGrid(IScene scene, bool returnResponseFirstTime) GridSessionID s = null; IGridService GridService = scene.RequestModuleInterface(); if (g != null) //Get the sessionID from the database if possible - s = g.GetGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID", new GridSessionID()); + s = g.GetGeneric(scene.RegionInfo.RegionID, "GridSessionID", "GridSessionID"); if (s == null) { diff --git a/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs b/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs index 7615bcad98..8858e221a9 100644 --- a/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs +++ b/Aurora/Modules/World/WindLightSettings/EnvironmentSettingsModule.cs @@ -122,8 +122,7 @@ private Hashtable EnvironmentSettings(Hashtable m_dhttpMethod, UUID agentID) IGenericsConnector gc = DataManager.DataManager.RequestPlugin(); if (gc != null) { - DatabaseWrapper d = gc.GetGeneric(m_scene.RegionInfo.RegionID, "EnvironmentSettings", "", - new DatabaseWrapper()); + DatabaseWrapper d = gc.GetGeneric(m_scene.RegionInfo.RegionID, "EnvironmentSettings", ""); if (d != null) m_info = d.Info; } diff --git a/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs b/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs index b84a1b2595..7ec3e4429a 100644 --- a/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs +++ b/Aurora/Services/DataService/Connectors/Local/GenericUtils.cs @@ -60,7 +60,7 @@ public class GenericUtils /// /// a default T to copy all data into /// - public static T GetGeneric(UUID OwnerID, string Type, string Key, IGenericData GD, T data) + public static T GetGeneric(UUID OwnerID, string Type, string Key, IGenericData GD) where T : IDataTransferable { List retVal = GD.Query(new[] {"OwnerID", "Type", "`Key`"}, new object[] {OwnerID, Type, Key}, @@ -69,7 +69,8 @@ public static T GetGeneric(UUID OwnerID, string Type, string Key, IGenericDat if (retVal.Count == 0) return null; - OSDMap map = (OSDMap) OSDParser.DeserializeJson(retVal[0]); + OSDMap map = (OSDMap)OSDParser.DeserializeJson(retVal[0]); + T data = (T)System.Activator.CreateInstance(typeof(T)); data.FromOSD(map); return data; } @@ -138,7 +139,7 @@ public static int GetGenericCount(UUID OwnerID, IGenericData GD) /// /// a default T /// - public static List GetGenerics(UUID OwnerID, string Type, IGenericData GD, T data) + public static List GetGenerics(UUID OwnerID, string Type, IGenericData GD) where T : IDataTransferable { List Values = new List(); @@ -148,9 +149,9 @@ public static List GetGenerics(UUID OwnerID, string Type, IGenericData GD, foreach (string ret in retVal) { OSDMap map = (OSDMap)OSDParser.DeserializeJson(ret); + T data = (T)System.Activator.CreateInstance(typeof(T)); data.FromOSD(map); - T dataCopy = (T) System.Activator.CreateInstance(typeof(T)); - Values.Add(dataCopy); + Values.Add(data); } #else foreach (OSDMap map in retVal.Select(ret => (OSDMap)OSDParser.DeserializeJson(ret))) diff --git a/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs index 12a4e2c530..32dec45c82 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalEmailConnector.cs @@ -71,8 +71,7 @@ public string Name public List GetEmails(UUID objectID) { //Get all the messages - List emails = GenericUtils.GetGenerics(objectID, "Emails", GD, - new Email()); + List emails = GenericUtils.GetGenerics(objectID, "Emails", GD); GenericUtils.RemoveGeneric(objectID, "Emails", GD); return emails; } diff --git a/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs index 54c80e6df2..bbacf8c961 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalGenericsConnector.cs @@ -85,9 +85,9 @@ public string Name /// /// a default T to copy all data into /// - public T GetGeneric(UUID OwnerID, string Type, string Key, T data) where T : IDataTransferable + public T GetGeneric(UUID OwnerID, string Type, string Key) where T : IDataTransferable { - return GenericUtils.GetGeneric(OwnerID, Type, Key, GD, data); + return GenericUtils.GetGeneric(OwnerID, Type, Key, GD); } /// @@ -98,9 +98,9 @@ public T GetGeneric(UUID OwnerID, string Type, string Key, T data) where T : /// /// a default T /// - public List GetGenerics(UUID OwnerID, string Type, T data) where T : IDataTransferable + public List GetGenerics(UUID OwnerID, string Type) where T : IDataTransferable { - return GenericUtils.GetGenerics(OwnerID, Type, GD, data); + return GenericUtils.GetGenerics(OwnerID, Type, GD); } /// diff --git a/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs index f08a91af0a..24ff33a371 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalMuteListConnector.cs @@ -68,7 +68,7 @@ public string Name /// public MuteList[] GetMuteList(UUID AgentID) { - return GenericUtils.GetGenerics(AgentID, "MuteList", GD, new MuteList()).ToArray(); + return GenericUtils.GetGenerics(AgentID, "MuteList", GD).ToArray(); } /// @@ -99,7 +99,7 @@ public void DeleteMute(UUID muteID, UUID AgentID) /// public bool IsMuted(UUID AgentID, UUID PossibleMuteID) { - return GenericUtils.GetGeneric(AgentID, "MuteList", PossibleMuteID.ToString(), GD, new MuteList()) != null; + return GenericUtils.GetGeneric(AgentID, "MuteList", PossibleMuteID.ToString(), GD) != null; } #endregion diff --git a/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs index 7bd3bf2eb6..48e5d414c6 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalOfflineMessagesConnector.cs @@ -79,9 +79,8 @@ public string Name public GridInstantMessage[] GetOfflineMessages(UUID agentID) { //Get all the messages - List Messages = GenericUtils.GetGenerics(agentID, "OfflineMessages", GD, - new GridInstantMessage()); - Messages.AddRange(GenericUtils.GetGenerics(agentID, "GroupOfflineMessages", GD, new GridInstantMessage())); + List Messages = GenericUtils.GetGenerics(agentID, "OfflineMessages", GD); + Messages.AddRange(GenericUtils.GetGenerics(agentID, "GroupOfflineMessages", GD)); //Clear them out now that we have them GenericUtils.RemoveGeneric(agentID, "OfflineMessages", GD); GenericUtils.RemoveGeneric(agentID, "GroupOfflineMessages", GD); diff --git a/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs index 655436fcf5..3d71e279fd 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalParcelServiceConnector.cs @@ -81,7 +81,7 @@ public void StoreLandObject(LandData args) /// public LandData GetLandData(UUID RegionID, UUID ParcelID) { - LandData data = GenericUtils.GetGeneric(RegionID, "LandData", ParcelID.ToString(), GD, new LandData()); + LandData data = GenericUtils.GetGeneric(RegionID, "LandData", ParcelID.ToString(), GD); //Stored seperately, so rebuild it BuildParcelAccessList(data); return data; @@ -98,7 +98,7 @@ public List LoadLandObjects(UUID regionID) List AllLandObjects = new List(); try { - AllLandObjects = GenericUtils.GetGenerics(regionID, "LandData", GD, new LandData()); + AllLandObjects = GenericUtils.GetGenerics(regionID, "LandData", GD); } catch (Exception ex) { diff --git a/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs index ff9ebefcbf..71705159bf 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalRegionInfoConnector.cs @@ -143,7 +143,7 @@ public Dictionary LoadRegionWindlightSettings(UUID { Dictionary RetVal = new Dictionary(); RegionLightShareData RWLD = new RegionLightShareData(); - List RWLDs = GenericUtils.GetGenerics(regionUUID, "RegionWindLightData", GD, RWLD); + List RWLDs = GenericUtils.GetGenerics(regionUUID, "RegionWindLightData", GD); foreach (RegionLightShareData lsd in RWLDs) { if(!RetVal.ContainsKey(lsd.minEffectiveAltitude)) diff --git a/OpenSim/Services/GridService/GridRegistrationService.cs b/OpenSim/Services/GridService/GridRegistrationService.cs index f6dce80db7..99ef4f98ef 100644 --- a/OpenSim/Services/GridService/GridRegistrationService.cs +++ b/OpenSim/Services/GridService/GridRegistrationService.cs @@ -222,8 +222,8 @@ protected void LoadFromDatabase() if (!m_useRegistrationService) return; - List urls = m_genericsConnector.GetGenerics( - UUID.Zero, "GridRegistrationUrls", new GridRegistrationURLs()); + List urls = m_genericsConnector.GetGenerics( + UUID.Zero, "GridRegistrationUrls"); foreach (GridRegistrationURLs url in urls) { @@ -259,8 +259,8 @@ protected void LoadFromDatabase() public OSDMap GetUrlForRegisteringClient(string SessionID) { - GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, - "GridRegistrationUrls", SessionID, new GridRegistrationURLs ()); + GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, + "GridRegistrationUrls", SessionID); OSDMap retVal = new OSDMap(); if (urls != null) { @@ -362,8 +362,8 @@ public void RemoveUrlsForClient(string SessionID) if (!m_useRegistrationService) return; - GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, - "GridRegistrationUrls", SessionID, new GridRegistrationURLs ()); + GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, + "GridRegistrationUrls", SessionID); if (urls != null) { MainConsole.Instance.WarnFormat ("[GridRegService]: Removing URLs for {0}", SessionID); @@ -390,8 +390,8 @@ public void UpdateUrlsForClient(string SessionID) if (!m_useRegistrationService) return; - GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, - "GridRegistrationUrls", SessionID, new GridRegistrationURLs ()); + GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, + "GridRegistrationUrls", SessionID); InnerUpdateUrlsForClient(urls); } @@ -420,8 +420,8 @@ public bool CheckThreatLevel(string SessionID, string function, ThreatLevel defa if (!m_useRegistrationService) return true; - GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, - "GridRegistrationUrls", SessionID, new GridRegistrationURLs ()); + GridRegistrationURLs urls = m_genericsConnector.GetGeneric(UUID.Zero, + "GridRegistrationUrls", SessionID); if (urls != null) { //Past time for it to expire From 5d3cbc6b6f5b08efcf3817ff5b6edf2db75a8661 Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Tue, 3 Jan 2012 01:27:54 -0500 Subject: [PATCH 15/16] Add the basic pieces of the new remote connector code to come. --- .../Connectors/Local/ConnectorBase.cs | 106 ++++++++ .../Connectors/Local/LocalAgentConnector.cs | 8 +- .../Handlers/AuroraData/ServerHandler.cs | 248 ++++++++++++++++++ 3 files changed, 358 insertions(+), 4 deletions(-) create mode 100644 Aurora/Services/DataService/Connectors/Local/ConnectorBase.cs create mode 100644 OpenSim/Services/Handlers/AuroraData/ServerHandler.cs diff --git a/Aurora/Services/DataService/Connectors/Local/ConnectorBase.cs b/Aurora/Services/DataService/Connectors/Local/ConnectorBase.cs new file mode 100644 index 0000000000..3a974fdb1c --- /dev/null +++ b/Aurora/Services/DataService/Connectors/Local/ConnectorBase.cs @@ -0,0 +1,106 @@ +/* + * Copyright (c) Contributors, http://aurora-sim.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Aurora-Sim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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.Diagnostics; +using System.Data; +using System.Reflection; +using Aurora.Framework; +using Aurora.Framework.Servers.HttpServer; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Services.Interfaces; +using OpenMetaverse.StructuredData; + +namespace Aurora.Services.DataService +{ + public class ConnectorBase + { + protected IRegistryCore m_registry; + protected IConfigurationService m_configService; + protected string m_name; + + public void Init(IRegistryCore registry, string name) + { + m_registry = registry; + m_configService = m_registry.RequestModuleInterface(); + m_name = name; + } + + public object DoRemote(params OSD[] o) + { + return DoRemoteForUser(UUID.Zero, o); + } + + public object DoRemoteForUser(UUID userID, params OSD[] o) + { + StackTrace stackTrace = new StackTrace(); + MethodInfo method = (MethodInfo)stackTrace.GetFrame(1).GetMethod(); + string methodName = method.Name; + OSDMap map = new OSDMap(); + map["Method"] = methodName; + int i = 0; + foreach(ParameterInfo info in method.GetParameters()) + { + map.Add(info.Name, o[i]); + i++; + } + List m_ServerURIs = + m_configService.FindValueOf(userID.ToString(), "ServerURI", false); + OSDMap response = null; + foreach (string uri in m_ServerURIs) + { + if (GetOSDMap(uri, map, out response)) + break; + } + if (!response) + return null; + object inst = Activator.CreateInstance(method.ReturnType); + if (inst is IDataTransferable) + { + IDataTransferable instance = (IDataTransferable)inst; + instance.FromOSD(response); + return instance; + } + else + return response["Value"]; + } + + public bool GetOSDMap(string url, OSDMap map, out OSDMap response) + { + response = null; + string resp = SynchronousRestFormsRequester.MakeRequest("POST", + url, + OSDParser.SerializeJsonString(map)); + if (resp == "") + return false; + response = (OSDMap)OSDParser.DeserializeJson(resp); + return response["Success"]; + } + } +} \ No newline at end of file diff --git a/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs b/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs index b914dce724..98f06761f3 100644 --- a/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs +++ b/Aurora/Services/DataService/Connectors/Local/LocalAgentConnector.cs @@ -70,9 +70,9 @@ public string Name /// public IAgentInfo GetAgent(UUID agentID) { - object remoteValue = DoRemoteForUser(agentID, agentID); + /*object remoteValue = DoRemoteForUser(agentID, agentID); if (remoteValue != null) - return (IAgentInfo)remoteValue; + return (IAgentInfo)remoteValue;*/ IAgentInfo agent = new IAgentInfo(); List query = null; try @@ -99,9 +99,9 @@ public IAgentInfo GetAgent(UUID agentID) /// public void UpdateAgent(IAgentInfo agent) { - object remoteValue = DoRemoteForUser(agent.PrincipalID, agent.ToOSD()); + /*object remoteValue = DoRemoteForUser(agent.PrincipalID, agent.ToOSD()); if (remoteValue != null) - return; + return;*/ List SetValues = new List {OSDParser.SerializeLLSDXmlString(agent.ToOSD())}; List SetRows = new List {"Value"}; diff --git a/OpenSim/Services/Handlers/AuroraData/ServerHandler.cs b/OpenSim/Services/Handlers/AuroraData/ServerHandler.cs new file mode 100644 index 0000000000..6d4ab420e5 --- /dev/null +++ b/OpenSim/Services/Handlers/AuroraData/ServerHandler.cs @@ -0,0 +1,248 @@ +/* + * Copyright (c) Contributors, http://aurora-sim.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Aurora-Sim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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.Text; +using Aurora.Simulation.Base; +using Nini.Config; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using Aurora.Framework; +using Aurora.Framework.Servers.HttpServer; +using OpenSim.Services.Interfaces; + +namespace OpenSim.Services +{ + public class ServerConnector : IService, IGridRegistrationUrlModule + { + private IRegistryCore m_registry; + + public string Name + { + get { return GetType().Name; } + } + + #region IGridRegistrationUrlModule Members + + public string UrlName + { + get { return "ServerURI"; } + } + + public void AddExistingUrlForClient(string SessionID, string url, uint port) + { + IHttpServer server = m_registry.RequestModuleInterface().GetHttpServer(port); + + server.AddStreamHandler(new ServerHandler(url, SessionID, m_registry)); + } + + public string GetUrlForRegisteringClient(string SessionID, uint port) + { + IHttpServer server = m_registry.RequestModuleInterface().GetHttpServer(port); + string url = "/server" + UUID.Random(); + + server.AddStreamHandler(new ServerHandler(url, SessionID, m_registry)); + + return url; + } + + public void RemoveUrlForClient(string sessionID, string url, uint port) + { + IHttpServer server = m_registry.RequestModuleInterface().GetHttpServer(port); + server.RemoveHTTPHandler("POST", url); + } + + #endregion + + #region IService Members + + public void Initialize(IConfigSource config, IRegistryCore registry) + { + } + + public void Start(IConfigSource config, IRegistryCore registry) + { + IConfig handlerConfig = config.Configs["Handlers"]; + if (handlerConfig.GetString("ServerHandler", Name) != Name) + return; + + m_registry = registry; + + m_registry.RequestModuleInterface().RegisterModule(this); + } + + public void FinishedStartup() + { + } + + #endregion + } + + public class MethodImplementation + { + public MethodInfo Method; + public IAuroraDataPlugin Reference; + } + + public class ServerHandler : BaseStreamHandler + { + protected string m_SessionID; + protected IRegistryCore m_registry; + protected static Dictionary m_methods = new Dictionary(); + + public ServerHandler(string url, string SessionID, IRegistryCore registry) : + base("POST", url) + { + m_SessionID = SessionID; + m_registry = registry; + foreach(IAuroraDataPlugin plugin in Aurora.DataManager.DataManager.GetPlugins()) + { + foreach (MethodInfo method in plugin.GetType().GetMethods()) + { + if (!m_methods.ContainsKey(method.Name)) + m_methods.Add(method.Name, new MethodImplementation() { Method = method, Reference = plugin }); + } + } + } + + public override byte[] Handle(string path, Stream requestData, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + StreamReader sr = new StreamReader(requestData); + string body = sr.ReadToEnd(); + sr.Close(); + body = body.Trim(); + + OSDMap args = WebUtils.GetOSDMap(body); + if (args.ContainsKey("Method")) + { + IGridRegistrationService urlModule = + m_registry.RequestModuleInterface(); + string method = args["Method"].AsString(); + + MethodImplementation methodInfo; + if (m_methods.TryGetValue(method, out methodInfo)) + { + ParameterInfo[] paramInfo = methodInfo.Method.GetParameters(); + object[] parameters = new object[paramInfo.Length]; + int paramNum = 0; + foreach (ParameterInfo param in paramInfo) + if (Util.IsInstanceOfGenericType(typeof(List<>), param.ParameterType)) + parameters[paramNum++] = MakeListFromArray((OSDArray)args[param.Name], param); + else if (Util.IsInstanceOfGenericType(typeof(Dictionary<,>), param.ParameterType)) + parameters[paramNum++] = MakeDictionaryFromArray((OSDMap)args[param.Name], param); + else + parameters[paramNum++] = args[param.Name]; + object o = methodInfo.Method.Invoke(methodInfo.Reference, parameters); + OSDMap response = new OSDMap(); + if (o == null)//void method + response["Value"] = true; + else + response["Value"] = MakeOSD(o, methodInfo); + response["Success"] = true; + return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(response)); + } + } + + return new byte[0]; + } + + private OSD MakeOSD(object o, MethodImplementation methodInfo) + { + if (o is OSD) + return (OSD)o; + if (o is IDataTransferable) + return ((IDataTransferable)o).ToOSD(); + if (Util.IsInstanceOfGenericType(typeof(List<>), methodInfo.Method.ReturnParameter.ParameterType)) + { + OSDArray array = new OSDArray(); + var list = Util.MakeList(Activator.CreateInstance(methodInfo.Method.ReturnParameter.ParameterType.GetGenericArguments()[0])); + System.Collections.IList collection = (System.Collections.IList)o; + foreach (object item in collection) + { + array.Add(MakeOSD(item, methodInfo)); + } + return array; + } + else if (Util.IsInstanceOfGenericType(typeof(Dictionary<,>), methodInfo.Method.ReturnParameter.ParameterType)) + { + OSDMap array = new OSDMap(); + var list = Util.MakeDictionary(Activator.CreateInstance(methodInfo.Method.ReturnParameter.ParameterType.GetGenericArguments()[0]), + Activator.CreateInstance(methodInfo.Method.ReturnParameter.ParameterType.GetGenericArguments()[1])); + System.Collections.IDictionary collection = (System.Collections.IDictionary)o; + foreach (KeyValuePair item in collection) + { + array.Add(item.Key.ToString(), MakeOSD(item, methodInfo)); + } + return array; + } + return null; + } + + private object MakeListFromArray(OSDArray array, ParameterInfo param) + { + Type t = param.ParameterType.GetGenericArguments()[0]; + System.Collections.IList list = (System.Collections.IList)Util.OSDToObject(array, t); + if (t.BaseType == typeof(IDataTransferable)) + { + IDataTransferable defaultInstance = (IDataTransferable)Activator.CreateInstance(t); + var newList = Util.MakeList(defaultInstance); + foreach (object o in list) + { + defaultInstance.FromOSD((OSDMap)o); + newList.Add(defaultInstance); + defaultInstance = (IDataTransferable)Activator.CreateInstance(t); + } + return newList; + } + + return list; + } + + private object MakeDictionaryFromArray(OSDMap array, ParameterInfo param) + { + var list = (System.Collections.IDictionary)Util.OSDToObject(array, param.ParameterType.GetGenericArguments()[1]); + Type t = param.ParameterType.GetGenericArguments()[0]; + if (t.BaseType == typeof(IDataTransferable)) + { + IDataTransferable defaultInstance = (IDataTransferable)Activator.CreateInstance(t); + var newList = Util.MakeDictionary("", defaultInstance); + foreach (KeyValuePair o in list) + { + defaultInstance.FromOSD((OSDMap)o.Value); + newList.Add(o.Key.ToString(), defaultInstance); + defaultInstance = (IDataTransferable)Activator.CreateInstance(t); + } + return newList; + } + return list; + } + } +} \ No newline at end of file From 09df83ef7365202d26bbad6d4aa1915506e5d15a Mon Sep 17 00:00:00 2001 From: Revolution Smythe Date: Tue, 3 Jan 2012 01:34:12 -0500 Subject: [PATCH 16/16] Fix build with my changes. --- .../ClientInterfaces/ChildAgentDataUpdate.cs | 25 +++++++++++++++-- .../PresenceInfo/AgentCircuitData.cs | 28 +------------------ 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Aurora/Framework/ClientInterfaces/ChildAgentDataUpdate.cs b/Aurora/Framework/ClientInterfaces/ChildAgentDataUpdate.cs index d118c40f4b..44da327162 100644 --- a/Aurora/Framework/ClientInterfaces/ChildAgentDataUpdate.cs +++ b/Aurora/Framework/ClientInterfaces/ChildAgentDataUpdate.cs @@ -28,6 +28,7 @@ using System; using System.Linq; using System.Reflection; +using Aurora.Framework; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -44,7 +45,7 @@ public interface IAgentData /// /// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms. /// - public class AgentPosition : IAgentData + public class AgentPosition : IDataTransferable, IAgentData { public Vector3 AtAxis; public Vector3 Center; @@ -61,6 +62,11 @@ public class AgentPosition : IAgentData public UUID AgentID { get; set; } + public override OSDMap ToOSD() + { + return Pack(); + } + public OSDMap Pack() { OSDMap args = new OSDMap(); @@ -83,6 +89,11 @@ public OSDMap Pack() return args; } + public override void FromOSD(OSDMap map) + { + Unpack(map); + } + public void Unpack(OSDMap args) { if (args.ContainsKey("region_handle")) @@ -218,7 +229,7 @@ public void UnpackUpdateMessage(OSDMap args) } } - public class AgentData : IAgentData + public class AgentData : IDataTransferable, IAgentData { public UUID ActiveGroupID; public Byte AgentAccess; @@ -266,6 +277,11 @@ public class AgentData : IAgentData // Scripted + public override OSDMap ToOSD() + { + return Pack(); + } + public virtual OSDMap Pack() { // DEBUG ON @@ -335,6 +351,11 @@ public virtual OSDMap Pack() return args; } + public override void FromOSD(OSDMap map) + { + Unpack(map); + } + /// /// Deserialization of agent data. /// Avoiding reflection makes it painful to write, but that's the price! diff --git a/Aurora/Framework/PresenceInfo/AgentCircuitData.cs b/Aurora/Framework/PresenceInfo/AgentCircuitData.cs index ce7d26cb8c..7c59abb835 100644 --- a/Aurora/Framework/PresenceInfo/AgentCircuitData.cs +++ b/Aurora/Framework/PresenceInfo/AgentCircuitData.cs @@ -160,33 +160,6 @@ public override void FromOSD(OSDMap map) UnpackAgentCircuitData(map); } - /// - /// Serialize the module to a Dictionary - /// - /// - public override void FromKVP(Dictionary KVP) - { - - } - - /// - /// Deserialize this module from a Dictionary - /// - /// - public override Dictionary ToKeyValuePairs() - { - return null; - } - - /// - /// Duplicate this module - /// - /// - public override IDataTransferable Duplicate() - { - return Copy(); - } - #region oldFunctions /// @@ -351,6 +324,7 @@ public virtual void UnpackAgentCircuitData(OSDMap args) } #endregion + #endregion }