From f43681510725f5b95fcb864a1f3e4b744fcaf992 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 7 Apr 2008 23:15:35 +0000 Subject: Refactor InventoryItemBase to do the following: * wrap fields as Properties * rename some fields/properties to more sensible names * set style to PropName to match more standard C# approach --- .../Communications/Cache/CachedUserInfo.cs | 14 ++--- .../Communications/Cache/LibraryRootFolder.cs | 60 +++++++++++----------- .../Framework/Communications/Capabilities/Caps.cs | 46 ++++++++--------- .../Communications/InventoryServiceBase.cs | 2 +- 4 files changed, 61 insertions(+), 61 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index f2dd2bf..cb1eb5a 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -171,21 +171,21 @@ namespace OpenSim.Framework.Communications.Cache { if ((userID == UserProfile.UUID) && (RootFolder != null)) { - if (itemInfo.parentFolderID == RootFolder.folderID) + if (itemInfo.Folder == RootFolder.folderID) { - if (!RootFolder.Items.ContainsKey(itemInfo.inventoryID)) + if (!RootFolder.Items.ContainsKey(itemInfo.ID)) { - RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); + RootFolder.Items.Add(itemInfo.ID, itemInfo); } } else { - InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID); + InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.Folder); if (folder != null) { - if (!folder.Items.ContainsKey(itemInfo.inventoryID)) + if (!folder.Items.ContainsKey(itemInfo.ID)) { - folder.Items.Add(itemInfo.inventoryID, itemInfo); + folder.Items.Add(itemInfo.ID, itemInfo); } } } @@ -214,7 +214,7 @@ namespace OpenSim.Framework.Communications.Cache bool result = false; if ((userID == UserProfile.UUID) && (RootFolder != null)) { - result = RootFolder.DeleteItem(item.inventoryID); + result = RootFolder.DeleteItem(item.ID); if (result) { m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index b624b15..12a07eb 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs @@ -116,19 +116,19 @@ namespace OpenSim.Framework.Communications.Cache int assetType, int invType, LLUUID parentFolderID) { InventoryItemBase item = new InventoryItemBase(); - item.avatarID = libOwner; - item.creatorsID = libOwner; - item.inventoryID = inventoryID; - item.assetID = assetID; - item.inventoryDescription = description; - item.inventoryName = name; - item.assetType = assetType; - item.invType = invType; - item.parentFolderID = parentFolderID; - item.inventoryBasePermissions = 0x7FFFFFFF; - item.inventoryEveryOnePermissions = 0x7FFFFFFF; - item.inventoryCurrentPermissions = 0x7FFFFFFF; - item.inventoryNextPermissions = 0x7FFFFFFF; + item.Owner = libOwner; + item.Creator = libOwner; + item.ID = inventoryID; + item.AssetID = assetID; + item.Description = description; + item.Name = name; + item.AssetType = assetType; + item.InvType = invType; + item.Folder = parentFolderID; + item.BasePermissions = 0x7FFFFFFF; + item.EveryOnePermissions = 0x7FFFFFFF; + item.CurrentPermissions = 0x7FFFFFFF; + item.NextPermissions = 0x7FFFFFFF; return item; } @@ -204,31 +204,31 @@ namespace OpenSim.Framework.Communications.Cache private void ReadItemFromConfig(IConfig config) { InventoryItemBase item = new InventoryItemBase(); - item.avatarID = libOwner; - item.creatorsID = libOwner; - item.inventoryID = new LLUUID(config.GetString("inventoryID", folderID.ToString())); - item.assetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString())); - item.parentFolderID = new LLUUID(config.GetString("folderID", folderID.ToString())); - item.inventoryDescription = config.GetString("description", System.String.Empty); - item.inventoryName = config.GetString("name", System.String.Empty); - item.assetType = config.GetInt("assetType", 0); - item.invType = config.GetInt("inventoryType", 0); - item.inventoryCurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); - item.inventoryNextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); - item.inventoryEveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); - item.inventoryBasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); + item.Owner = libOwner; + item.Creator = libOwner; + item.ID = new LLUUID(config.GetString("inventoryID", folderID.ToString())); + item.AssetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString())); + item.Folder = new LLUUID(config.GetString("folderID", folderID.ToString())); + item.Description = config.GetString("description", System.String.Empty); + item.Name = config.GetString("name", System.String.Empty); + item.AssetType = config.GetInt("assetType", 0); + item.InvType = config.GetInt("inventoryType", 0); + item.CurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); + item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); + item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); + item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); - if (libraryFolders.ContainsKey(item.parentFolderID)) + if (libraryFolders.ContainsKey(item.Folder)) { - InventoryFolderImpl parentFolder = libraryFolders[item.parentFolderID]; + InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; - parentFolder.Items.Add(item.inventoryID, item); + parentFolder.Items.Add(item.ID, item); } else { m_log.WarnFormat( "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", - item.inventoryName, item.inventoryID, item.parentFolderID); + item.Name, item.ID, item.Folder); } } diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 00de14d..315daab 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -294,14 +294,14 @@ namespace OpenSim.Region.Capabilities private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) { LLSDInventoryItem llsdItem = new LLSDInventoryItem(); - llsdItem.asset_id = invItem.assetID; + llsdItem.asset_id = invItem.AssetID; llsdItem.created_at = 1000; - llsdItem.desc = invItem.inventoryDescription; + llsdItem.desc = invItem.Description; llsdItem.flags = 0; - llsdItem.item_id = invItem.inventoryID; - llsdItem.name = invItem.inventoryName; - llsdItem.parent_id = invItem.parentFolderID; - llsdItem.type = Enum.GetName(typeof(AssetType), invItem.assetType).ToLower(); + llsdItem.item_id = invItem.ID; + llsdItem.name = invItem.Name; + llsdItem.parent_id = invItem.Folder; + llsdItem.type = Enum.GetName(typeof(AssetType), invItem.AssetType).ToLower(); // XXX Temporary fix for 'objects not appearing in inventory' problem. The asset type from libsecondlife is // returning "primitive" when it should returning "object"! It looks like this is fixed in the latest libsecondlife, @@ -311,17 +311,17 @@ namespace OpenSim.Region.Capabilities llsdItem.type = "object"; } - llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.invType).ToLower(); + llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.InvType).ToLower(); llsdItem.permissions = new LLSDPermissions(); - llsdItem.permissions.creator_id = invItem.creatorsID; - llsdItem.permissions.base_mask = (int)invItem.inventoryCurrentPermissions; - llsdItem.permissions.everyone_mask = (int)invItem.inventoryEveryOnePermissions; + llsdItem.permissions.creator_id = invItem.Creator; + llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; + llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; llsdItem.permissions.group_id = LLUUID.Zero; llsdItem.permissions.group_mask = 0; llsdItem.permissions.is_owner_group = false; - llsdItem.permissions.next_owner_mask = (int)invItem.inventoryNextPermissions; + llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; llsdItem.permissions.owner_id = m_agentID; // FixMe - llsdItem.permissions.owner_mask = (int)invItem.inventoryCurrentPermissions; + llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; llsdItem.sale_info = new LLSDSaleInfo(); llsdItem.sale_info.sale_price = 10; llsdItem.sale_info.sale_type = "not"; @@ -587,17 +587,17 @@ namespace OpenSim.Region.Capabilities m_assetCache.AddAsset(asset); InventoryItemBase item = new InventoryItemBase(); - item.avatarID = m_agentID; - item.creatorsID = m_agentID; - item.inventoryID = inventoryItem; - item.assetID = asset.FullID; - item.inventoryDescription = assetDescription; - item.inventoryName = assetName; - item.assetType = assType; - item.invType = inType; - item.parentFolderID = parentFolder; - item.inventoryCurrentPermissions = 2147483647; - item.inventoryNextPermissions = 2147483647; + item.Owner = m_agentID; + item.Creator = m_agentID; + item.ID = inventoryItem; + item.AssetID = asset.FullID; + item.Description = assetDescription; + item.Name = assetName; + item.AssetType = assType; + item.InvType = inType; + item.Folder = parentFolder; + item.CurrentPermissions = 2147483647; + item.NextPermissions = 2147483647; if (AddNewInventoryItem != null) { diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index feb0cca..f41bd27 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -218,7 +218,7 @@ namespace OpenSim.Framework.Communications { foreach (KeyValuePair plugin in m_plugins) { - plugin.Value.deleteInventoryItem(item.inventoryID); + plugin.Value.deleteInventoryItem(item.ID); } } -- cgit v1.1