diff options
author | Sean Dague | 2008-04-07 23:15:35 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-07 23:15:35 +0000 |
commit | f43681510725f5b95fcb864a1f3e4b744fcaf992 (patch) | |
tree | 2d34caa75488d1c608d1a21b4888cb0f264a6cba /OpenSim/Framework | |
parent | needed to add 4 characters to support the dashes (diff) | |
download | opensim-SC-f43681510725f5b95fcb864a1f3e4b744fcaf992.zip opensim-SC-f43681510725f5b95fcb864a1f3e4b744fcaf992.tar.gz opensim-SC-f43681510725f5b95fcb864a1f3e4b744fcaf992.tar.bz2 opensim-SC-f43681510725f5b95fcb864a1f3e4b744fcaf992.tar.xz |
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
Diffstat (limited to 'OpenSim/Framework')
5 files changed, 193 insertions, 74 deletions
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 | |||
171 | { | 171 | { |
172 | if ((userID == UserProfile.UUID) && (RootFolder != null)) | 172 | if ((userID == UserProfile.UUID) && (RootFolder != null)) |
173 | { | 173 | { |
174 | if (itemInfo.parentFolderID == RootFolder.folderID) | 174 | if (itemInfo.Folder == RootFolder.folderID) |
175 | { | 175 | { |
176 | if (!RootFolder.Items.ContainsKey(itemInfo.inventoryID)) | 176 | if (!RootFolder.Items.ContainsKey(itemInfo.ID)) |
177 | { | 177 | { |
178 | RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); | 178 | RootFolder.Items.Add(itemInfo.ID, itemInfo); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | else | 181 | else |
182 | { | 182 | { |
183 | InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID); | 183 | InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.Folder); |
184 | if (folder != null) | 184 | if (folder != null) |
185 | { | 185 | { |
186 | if (!folder.Items.ContainsKey(itemInfo.inventoryID)) | 186 | if (!folder.Items.ContainsKey(itemInfo.ID)) |
187 | { | 187 | { |
188 | folder.Items.Add(itemInfo.inventoryID, itemInfo); | 188 | folder.Items.Add(itemInfo.ID, itemInfo); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } | 191 | } |
@@ -214,7 +214,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
214 | bool result = false; | 214 | bool result = false; |
215 | if ((userID == UserProfile.UUID) && (RootFolder != null)) | 215 | if ((userID == UserProfile.UUID) && (RootFolder != null)) |
216 | { | 216 | { |
217 | result = RootFolder.DeleteItem(item.inventoryID); | 217 | result = RootFolder.DeleteItem(item.ID); |
218 | if (result) | 218 | if (result) |
219 | { | 219 | { |
220 | m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); | 220 | 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 | |||
116 | int assetType, int invType, LLUUID parentFolderID) | 116 | int assetType, int invType, LLUUID parentFolderID) |
117 | { | 117 | { |
118 | InventoryItemBase item = new InventoryItemBase(); | 118 | InventoryItemBase item = new InventoryItemBase(); |
119 | item.avatarID = libOwner; | 119 | item.Owner = libOwner; |
120 | item.creatorsID = libOwner; | 120 | item.Creator = libOwner; |
121 | item.inventoryID = inventoryID; | 121 | item.ID = inventoryID; |
122 | item.assetID = assetID; | 122 | item.AssetID = assetID; |
123 | item.inventoryDescription = description; | 123 | item.Description = description; |
124 | item.inventoryName = name; | 124 | item.Name = name; |
125 | item.assetType = assetType; | 125 | item.AssetType = assetType; |
126 | item.invType = invType; | 126 | item.InvType = invType; |
127 | item.parentFolderID = parentFolderID; | 127 | item.Folder = parentFolderID; |
128 | item.inventoryBasePermissions = 0x7FFFFFFF; | 128 | item.BasePermissions = 0x7FFFFFFF; |
129 | item.inventoryEveryOnePermissions = 0x7FFFFFFF; | 129 | item.EveryOnePermissions = 0x7FFFFFFF; |
130 | item.inventoryCurrentPermissions = 0x7FFFFFFF; | 130 | item.CurrentPermissions = 0x7FFFFFFF; |
131 | item.inventoryNextPermissions = 0x7FFFFFFF; | 131 | item.NextPermissions = 0x7FFFFFFF; |
132 | return item; | 132 | return item; |
133 | } | 133 | } |
134 | 134 | ||
@@ -204,31 +204,31 @@ namespace OpenSim.Framework.Communications.Cache | |||
204 | private void ReadItemFromConfig(IConfig config) | 204 | private void ReadItemFromConfig(IConfig config) |
205 | { | 205 | { |
206 | InventoryItemBase item = new InventoryItemBase(); | 206 | InventoryItemBase item = new InventoryItemBase(); |
207 | item.avatarID = libOwner; | 207 | item.Owner = libOwner; |
208 | item.creatorsID = libOwner; | 208 | item.Creator = libOwner; |
209 | item.inventoryID = new LLUUID(config.GetString("inventoryID", folderID.ToString())); | 209 | item.ID = new LLUUID(config.GetString("inventoryID", folderID.ToString())); |
210 | item.assetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString())); | 210 | item.AssetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString())); |
211 | item.parentFolderID = new LLUUID(config.GetString("folderID", folderID.ToString())); | 211 | item.Folder = new LLUUID(config.GetString("folderID", folderID.ToString())); |
212 | item.inventoryDescription = config.GetString("description", System.String.Empty); | 212 | item.Description = config.GetString("description", System.String.Empty); |
213 | item.inventoryName = config.GetString("name", System.String.Empty); | 213 | item.Name = config.GetString("name", System.String.Empty); |
214 | item.assetType = config.GetInt("assetType", 0); | 214 | item.AssetType = config.GetInt("assetType", 0); |
215 | item.invType = config.GetInt("inventoryType", 0); | 215 | item.InvType = config.GetInt("inventoryType", 0); |
216 | item.inventoryCurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); | 216 | item.CurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); |
217 | item.inventoryNextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); | 217 | item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); |
218 | item.inventoryEveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); | 218 | item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); |
219 | item.inventoryBasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); | 219 | item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); |
220 | 220 | ||
221 | if (libraryFolders.ContainsKey(item.parentFolderID)) | 221 | if (libraryFolders.ContainsKey(item.Folder)) |
222 | { | 222 | { |
223 | InventoryFolderImpl parentFolder = libraryFolders[item.parentFolderID]; | 223 | InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; |
224 | 224 | ||
225 | parentFolder.Items.Add(item.inventoryID, item); | 225 | parentFolder.Items.Add(item.ID, item); |
226 | } | 226 | } |
227 | else | 227 | else |
228 | { | 228 | { |
229 | m_log.WarnFormat( | 229 | m_log.WarnFormat( |
230 | "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", | 230 | "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", |
231 | item.inventoryName, item.inventoryID, item.parentFolderID); | 231 | item.Name, item.ID, item.Folder); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
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 | |||
294 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) | 294 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) |
295 | { | 295 | { |
296 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); | 296 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); |
297 | llsdItem.asset_id = invItem.assetID; | 297 | llsdItem.asset_id = invItem.AssetID; |
298 | llsdItem.created_at = 1000; | 298 | llsdItem.created_at = 1000; |
299 | llsdItem.desc = invItem.inventoryDescription; | 299 | llsdItem.desc = invItem.Description; |
300 | llsdItem.flags = 0; | 300 | llsdItem.flags = 0; |
301 | llsdItem.item_id = invItem.inventoryID; | 301 | llsdItem.item_id = invItem.ID; |
302 | llsdItem.name = invItem.inventoryName; | 302 | llsdItem.name = invItem.Name; |
303 | llsdItem.parent_id = invItem.parentFolderID; | 303 | llsdItem.parent_id = invItem.Folder; |
304 | llsdItem.type = Enum.GetName(typeof(AssetType), invItem.assetType).ToLower(); | 304 | llsdItem.type = Enum.GetName(typeof(AssetType), invItem.AssetType).ToLower(); |
305 | 305 | ||
306 | // XXX Temporary fix for 'objects not appearing in inventory' problem. The asset type from libsecondlife is | 306 | // XXX Temporary fix for 'objects not appearing in inventory' problem. The asset type from libsecondlife is |
307 | // returning "primitive" when it should returning "object"! It looks like this is fixed in the latest libsecondlife, | 307 | // 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 | |||
311 | llsdItem.type = "object"; | 311 | llsdItem.type = "object"; |
312 | } | 312 | } |
313 | 313 | ||
314 | llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.invType).ToLower(); | 314 | llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.InvType).ToLower(); |
315 | llsdItem.permissions = new LLSDPermissions(); | 315 | llsdItem.permissions = new LLSDPermissions(); |
316 | llsdItem.permissions.creator_id = invItem.creatorsID; | 316 | llsdItem.permissions.creator_id = invItem.Creator; |
317 | llsdItem.permissions.base_mask = (int)invItem.inventoryCurrentPermissions; | 317 | llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; |
318 | llsdItem.permissions.everyone_mask = (int)invItem.inventoryEveryOnePermissions; | 318 | llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; |
319 | llsdItem.permissions.group_id = LLUUID.Zero; | 319 | llsdItem.permissions.group_id = LLUUID.Zero; |
320 | llsdItem.permissions.group_mask = 0; | 320 | llsdItem.permissions.group_mask = 0; |
321 | llsdItem.permissions.is_owner_group = false; | 321 | llsdItem.permissions.is_owner_group = false; |
322 | llsdItem.permissions.next_owner_mask = (int)invItem.inventoryNextPermissions; | 322 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; |
323 | llsdItem.permissions.owner_id = m_agentID; // FixMe | 323 | llsdItem.permissions.owner_id = m_agentID; // FixMe |
324 | llsdItem.permissions.owner_mask = (int)invItem.inventoryCurrentPermissions; | 324 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; |
325 | llsdItem.sale_info = new LLSDSaleInfo(); | 325 | llsdItem.sale_info = new LLSDSaleInfo(); |
326 | llsdItem.sale_info.sale_price = 10; | 326 | llsdItem.sale_info.sale_price = 10; |
327 | llsdItem.sale_info.sale_type = "not"; | 327 | llsdItem.sale_info.sale_type = "not"; |
@@ -587,17 +587,17 @@ namespace OpenSim.Region.Capabilities | |||
587 | m_assetCache.AddAsset(asset); | 587 | m_assetCache.AddAsset(asset); |
588 | 588 | ||
589 | InventoryItemBase item = new InventoryItemBase(); | 589 | InventoryItemBase item = new InventoryItemBase(); |
590 | item.avatarID = m_agentID; | 590 | item.Owner = m_agentID; |
591 | item.creatorsID = m_agentID; | 591 | item.Creator = m_agentID; |
592 | item.inventoryID = inventoryItem; | 592 | item.ID = inventoryItem; |
593 | item.assetID = asset.FullID; | 593 | item.AssetID = asset.FullID; |
594 | item.inventoryDescription = assetDescription; | 594 | item.Description = assetDescription; |
595 | item.inventoryName = assetName; | 595 | item.Name = assetName; |
596 | item.assetType = assType; | 596 | item.AssetType = assType; |
597 | item.invType = inType; | 597 | item.InvType = inType; |
598 | item.parentFolderID = parentFolder; | 598 | item.Folder = parentFolder; |
599 | item.inventoryCurrentPermissions = 2147483647; | 599 | item.CurrentPermissions = 2147483647; |
600 | item.inventoryNextPermissions = 2147483647; | 600 | item.NextPermissions = 2147483647; |
601 | 601 | ||
602 | if (AddNewInventoryItem != null) | 602 | if (AddNewInventoryItem != null) |
603 | { | 603 | { |
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 | |||
218 | { | 218 | { |
219 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 219 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) |
220 | { | 220 | { |
221 | plugin.Value.deleteInventoryItem(item.inventoryID); | 221 | plugin.Value.deleteInventoryItem(item.ID); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 7d146e7..03b47ca 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -40,66 +40,185 @@ namespace OpenSim.Framework | |||
40 | /// <summary> | 40 | /// <summary> |
41 | /// A UUID containing the ID for the inventory item itself | 41 | /// A UUID containing the ID for the inventory item itself |
42 | /// </summary> | 42 | /// </summary> |
43 | public LLUUID inventoryID; | 43 | private LLUUID _id; |
44 | 44 | ||
45 | /// <summary> | 45 | /// <summary> |
46 | /// The UUID of the associated asset on the asset server | 46 | /// The UUID of the associated asset on the asset server |
47 | /// </summary> | 47 | /// </summary> |
48 | public LLUUID assetID; | 48 | private LLUUID _assetID; |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) | 51 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) |
52 | /// </summary> | 52 | /// </summary> |
53 | public int assetType; | 53 | private int _assetType; |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// The type of inventory item. (Can be slightly different to the asset type | 56 | /// The type of inventory item. (Can be slightly different to the asset type |
57 | /// </summary> | 57 | /// </summary> |
58 | public int invType; | 58 | private int _invType; |
59 | 59 | ||
60 | /// <summary> | 60 | /// <summary> |
61 | /// The folder this item is contained in | 61 | /// The folder this item is contained in |
62 | /// </summary> | 62 | /// </summary> |
63 | public LLUUID parentFolderID; | 63 | private LLUUID _folder; |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// The owner of this inventory item | 66 | /// The owner of this inventory item |
67 | /// </summary> | 67 | /// </summary> |
68 | public LLUUID avatarID; | 68 | private LLUUID _owner; |
69 | 69 | ||
70 | /// <summary> | 70 | /// <summary> |
71 | /// The creator of this item | 71 | /// The creator of this item |
72 | /// </summary> | 72 | /// </summary> |
73 | public LLUUID creatorsID; | 73 | private LLUUID _creator; |
74 | 74 | ||
75 | /// <summary> | 75 | /// <summary> |
76 | /// The name of the inventory item (must be less than 64 characters) | 76 | /// The name of the inventory item (must be less than 64 characters) |
77 | /// </summary> | 77 | /// </summary> |
78 | public string inventoryName; | 78 | private string _name; |
79 | 79 | ||
80 | /// <summary> | 80 | /// <summary> |
81 | /// The description of the inventory item (must be less than 64 characters) | 81 | /// The description of the inventory item (must be less than 64 characters) |
82 | /// </summary> | 82 | /// </summary> |
83 | public string inventoryDescription; | 83 | private string _description; |
84 | 84 | ||
85 | /// <summary> | 85 | /// <summary> |
86 | /// A mask containing the permissions for the next owner (cannot be enforced) | 86 | /// A mask containing the permissions for the next owner (cannot be enforced) |
87 | /// </summary> | 87 | /// </summary> |
88 | public uint inventoryNextPermissions; | 88 | private uint _nextPermissions; |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// A mask containing permissions for the current owner (cannot be enforced) | 91 | /// A mask containing permissions for the current owner (cannot be enforced) |
92 | /// </summary> | 92 | /// </summary> |
93 | public uint inventoryCurrentPermissions; | 93 | private uint _currentPermissions; |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// | 96 | /// |
97 | /// </summary> | 97 | /// </summary> |
98 | public uint inventoryBasePermissions; | 98 | private uint _basePermissions; |
99 | 99 | ||
100 | /// <summary> | 100 | /// <summary> |
101 | /// | 101 | /// |
102 | /// </summary> | 102 | /// </summary> |
103 | public uint inventoryEveryOnePermissions; | 103 | private uint _everyOnePermissions; |
104 | |||
105 | public LLUUID ID { | ||
106 | get { | ||
107 | return _id; | ||
108 | } | ||
109 | set { | ||
110 | _id = value; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | |||
115 | |||
116 | public int InvType { | ||
117 | get { | ||
118 | return _invType; | ||
119 | } | ||
120 | set { | ||
121 | _invType = value; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public LLUUID Folder { | ||
126 | get { | ||
127 | return _folder; | ||
128 | } | ||
129 | set { | ||
130 | _folder = value; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | public LLUUID Owner { | ||
135 | get { | ||
136 | return _owner; | ||
137 | } | ||
138 | set { | ||
139 | _owner = value; | ||
140 | } | ||
141 | } | ||
142 | |||
143 | public LLUUID Creator { | ||
144 | get { | ||
145 | return _creator; | ||
146 | } | ||
147 | set { | ||
148 | _creator = value; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | public string Name { | ||
153 | get { | ||
154 | return _name; | ||
155 | } | ||
156 | set { | ||
157 | _name = value; | ||
158 | } | ||
159 | } | ||
160 | |||
161 | public string Description { | ||
162 | get { | ||
163 | return _description; | ||
164 | } | ||
165 | set { | ||
166 | _description = value; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | public uint NextPermissions { | ||
171 | get { | ||
172 | return _nextPermissions; | ||
173 | } | ||
174 | set { | ||
175 | _nextPermissions = value; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | public uint CurrentPermissions { | ||
180 | get { | ||
181 | return _currentPermissions; | ||
182 | } | ||
183 | set { | ||
184 | _currentPermissions = value; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | public uint BasePermissions { | ||
189 | get { | ||
190 | return _basePermissions; | ||
191 | } | ||
192 | set { | ||
193 | _basePermissions = value; | ||
194 | } | ||
195 | } | ||
196 | |||
197 | public uint EveryOnePermissions { | ||
198 | get { | ||
199 | return _everyOnePermissions; | ||
200 | } | ||
201 | set { | ||
202 | _everyOnePermissions = value; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | public int AssetType { | ||
207 | get { | ||
208 | return _assetType; | ||
209 | } | ||
210 | set { | ||
211 | _assetType = value; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | public LLUUID AssetID { | ||
216 | get { | ||
217 | return _assetID; | ||
218 | } | ||
219 | set { | ||
220 | _assetID = value; | ||
221 | } | ||
222 | } | ||
104 | } | 223 | } |
105 | } | 224 | } |