diff options
Diffstat (limited to 'OpenSim/Framework/General/InventoryItemBase.cs')
-rw-r--r-- | OpenSim/Framework/General/InventoryItemBase.cs | 546 |
1 files changed, 273 insertions, 273 deletions
diff --git a/OpenSim/Framework/General/InventoryItemBase.cs b/OpenSim/Framework/General/InventoryItemBase.cs index f782913..331013f 100644 --- a/OpenSim/Framework/General/InventoryItemBase.cs +++ b/OpenSim/Framework/General/InventoryItemBase.cs | |||
@@ -1,273 +1,273 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Xml.Serialization; | 29 | using System.Xml.Serialization; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | 33 | ||
34 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Inventory Item - contains all the properties associated with an individual inventory piece. | 37 | /// Inventory Item - contains all the properties associated with an individual inventory piece. |
38 | /// </summary> | 38 | /// </summary> |
39 | public class InventoryItemBase | 39 | public class InventoryItemBase |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// A UUID containing the ID for the inventory item itself | 42 | /// A UUID containing the ID for the inventory item itself |
43 | /// </summary> | 43 | /// </summary> |
44 | public LLUUID inventoryID; | 44 | public LLUUID inventoryID; |
45 | 45 | ||
46 | /// <summary> | 46 | /// <summary> |
47 | /// The UUID of the associated asset on the asset server | 47 | /// The UUID of the associated asset on the asset server |
48 | /// </summary> | 48 | /// </summary> |
49 | public LLUUID assetID; | 49 | public LLUUID assetID; |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) | 52 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) |
53 | /// </summary> | 53 | /// </summary> |
54 | public int assetType; | 54 | public int assetType; |
55 | 55 | ||
56 | /// <summary> | 56 | /// <summary> |
57 | /// The type of inventory item. (Can be slightly different to the asset type | 57 | /// The type of inventory item. (Can be slightly different to the asset type |
58 | /// </summary> | 58 | /// </summary> |
59 | public int invType; | 59 | public int invType; |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// The folder this item is contained in | 62 | /// The folder this item is contained in |
63 | /// </summary> | 63 | /// </summary> |
64 | public LLUUID parentFolderID; | 64 | public LLUUID parentFolderID; |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// The owner of this inventory item | 67 | /// The owner of this inventory item |
68 | /// </summary> | 68 | /// </summary> |
69 | public LLUUID avatarID; | 69 | public LLUUID avatarID; |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// The creator of this item | 72 | /// The creator of this item |
73 | /// </summary> | 73 | /// </summary> |
74 | public LLUUID creatorsID; | 74 | public LLUUID creatorsID; |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// The name of the inventory item (must be less than 64 characters) | 77 | /// The name of the inventory item (must be less than 64 characters) |
78 | /// </summary> | 78 | /// </summary> |
79 | public string inventoryName; | 79 | public string inventoryName; |
80 | 80 | ||
81 | /// <summary> | 81 | /// <summary> |
82 | /// The description of the inventory item (must be less than 64 characters) | 82 | /// The description of the inventory item (must be less than 64 characters) |
83 | /// </summary> | 83 | /// </summary> |
84 | public string inventoryDescription; | 84 | public string inventoryDescription; |
85 | 85 | ||
86 | /// <summary> | 86 | /// <summary> |
87 | /// A mask containing the permissions for the next owner (cannot be enforced) | 87 | /// A mask containing the permissions for the next owner (cannot be enforced) |
88 | /// </summary> | 88 | /// </summary> |
89 | public uint inventoryNextPermissions; | 89 | public uint inventoryNextPermissions; |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// A mask containing permissions for the current owner (cannot be enforced) | 92 | /// A mask containing permissions for the current owner (cannot be enforced) |
93 | /// </summary> | 93 | /// </summary> |
94 | public uint inventoryCurrentPermissions; | 94 | public uint inventoryCurrentPermissions; |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// | 97 | /// |
98 | /// </summary> | 98 | /// </summary> |
99 | public uint inventoryBasePermissions; | 99 | public uint inventoryBasePermissions; |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// | 102 | /// |
103 | /// </summary> | 103 | /// </summary> |
104 | public uint inventoryEveryOnePermissions; | 104 | public uint inventoryEveryOnePermissions; |
105 | } | 105 | } |
106 | 106 | ||
107 | /// <summary> | 107 | /// <summary> |
108 | /// A Class for folders which contain users inventory | 108 | /// A Class for folders which contain users inventory |
109 | /// </summary> | 109 | /// </summary> |
110 | public class InventoryFolderBase | 110 | public class InventoryFolderBase |
111 | { | 111 | { |
112 | /// <summary> | 112 | /// <summary> |
113 | /// The name of the folder (64 characters or less) | 113 | /// The name of the folder (64 characters or less) |
114 | /// </summary> | 114 | /// </summary> |
115 | public string name; | 115 | public string name; |
116 | 116 | ||
117 | /// <summary> | 117 | /// <summary> |
118 | /// The agent who's inventory this is contained by | 118 | /// The agent who's inventory this is contained by |
119 | /// </summary> | 119 | /// </summary> |
120 | public LLUUID agentID; | 120 | public LLUUID agentID; |
121 | 121 | ||
122 | /// <summary> | 122 | /// <summary> |
123 | /// The folder this folder is contained in | 123 | /// The folder this folder is contained in |
124 | /// </summary> | 124 | /// </summary> |
125 | public LLUUID parentID; | 125 | public LLUUID parentID; |
126 | 126 | ||
127 | /// <summary> | 127 | /// <summary> |
128 | /// The UUID for this folder | 128 | /// The UUID for this folder |
129 | /// </summary> | 129 | /// </summary> |
130 | public LLUUID folderID; | 130 | public LLUUID folderID; |
131 | 131 | ||
132 | /// <summary> | 132 | /// <summary> |
133 | /// Tyep of Items normally stored in this folder | 133 | /// Tyep of Items normally stored in this folder |
134 | /// </summary> | 134 | /// </summary> |
135 | public short type; | 135 | public short type; |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
138 | /// | 138 | /// |
139 | /// </summary> | 139 | /// </summary> |
140 | public ushort version; | 140 | public ushort version; |
141 | } | 141 | } |
142 | 142 | ||
143 | /// <summary> | 143 | /// <summary> |
144 | /// An interface for accessing inventory data from a storage server | 144 | /// An interface for accessing inventory data from a storage server |
145 | /// </summary> | 145 | /// </summary> |
146 | public interface IInventoryData | 146 | public interface IInventoryData |
147 | { | 147 | { |
148 | /// <summary> | 148 | /// <summary> |
149 | /// Initialises the interface | 149 | /// Initialises the interface |
150 | /// </summary> | 150 | /// </summary> |
151 | void Initialise(); | 151 | void Initialise(); |
152 | 152 | ||
153 | /// <summary> | 153 | /// <summary> |
154 | /// Closes the interface | 154 | /// Closes the interface |
155 | /// </summary> | 155 | /// </summary> |
156 | void Close(); | 156 | void Close(); |
157 | 157 | ||
158 | /// <summary> | 158 | /// <summary> |
159 | /// The plugin being loaded | 159 | /// The plugin being loaded |
160 | /// </summary> | 160 | /// </summary> |
161 | /// <returns>A string containing the plugin name</returns> | 161 | /// <returns>A string containing the plugin name</returns> |
162 | string getName(); | 162 | string getName(); |
163 | 163 | ||
164 | /// <summary> | 164 | /// <summary> |
165 | /// The plugins version | 165 | /// The plugins version |
166 | /// </summary> | 166 | /// </summary> |
167 | /// <returns>A string containing the plugin version</returns> | 167 | /// <returns>A string containing the plugin version</returns> |
168 | string getVersion(); | 168 | string getVersion(); |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// Returns a list of inventory items contained within the specified folder | 171 | /// Returns a list of inventory items contained within the specified folder |
172 | /// </summary> | 172 | /// </summary> |
173 | /// <param name="folderID">The UUID of the target folder</param> | 173 | /// <param name="folderID">The UUID of the target folder</param> |
174 | /// <returns>A List of InventoryItemBase items</returns> | 174 | /// <returns>A List of InventoryItemBase items</returns> |
175 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); | 175 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); |
176 | 176 | ||
177 | /// <summary> | 177 | /// <summary> |
178 | /// Returns a list of the root folders within a users inventory | 178 | /// Returns a list of the root folders within a users inventory |
179 | /// </summary> | 179 | /// </summary> |
180 | /// <param name="user">The user whos inventory is to be searched</param> | 180 | /// <param name="user">The user whos inventory is to be searched</param> |
181 | /// <returns>A list of folder objects</returns> | 181 | /// <returns>A list of folder objects</returns> |
182 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); | 182 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); |
183 | 183 | ||
184 | /// <summary> | 184 | /// <summary> |
185 | /// Returns the users inventory root folder. | 185 | /// Returns the users inventory root folder. |
186 | /// </summary> | 186 | /// </summary> |
187 | /// <param name="user">The UUID of the user who is having inventory being returned</param> | 187 | /// <param name="user">The UUID of the user who is having inventory being returned</param> |
188 | /// <returns>Root inventory folder</returns> | 188 | /// <returns>Root inventory folder</returns> |
189 | InventoryFolderBase getUserRootFolder(LLUUID user); | 189 | InventoryFolderBase getUserRootFolder(LLUUID user); |
190 | 190 | ||
191 | /// <summary> | 191 | /// <summary> |
192 | /// Returns a list of inventory folders contained in the folder 'parentID' | 192 | /// Returns a list of inventory folders contained in the folder 'parentID' |
193 | /// </summary> | 193 | /// </summary> |
194 | /// <param name="parentID">The folder to get subfolders for</param> | 194 | /// <param name="parentID">The folder to get subfolders for</param> |
195 | /// <returns>A list of inventory folders</returns> | 195 | /// <returns>A list of inventory folders</returns> |
196 | List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); | 196 | List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); |
197 | 197 | ||
198 | /// <summary> | 198 | /// <summary> |
199 | /// Returns an inventory item by its UUID | 199 | /// Returns an inventory item by its UUID |
200 | /// </summary> | 200 | /// </summary> |
201 | /// <param name="item">The UUID of the item to be returned</param> | 201 | /// <param name="item">The UUID of the item to be returned</param> |
202 | /// <returns>A class containing item information</returns> | 202 | /// <returns>A class containing item information</returns> |
203 | InventoryItemBase getInventoryItem(LLUUID item); | 203 | InventoryItemBase getInventoryItem(LLUUID item); |
204 | 204 | ||
205 | /// <summary> | 205 | /// <summary> |
206 | /// Returns a specified inventory folder by its UUID | 206 | /// Returns a specified inventory folder by its UUID |
207 | /// </summary> | 207 | /// </summary> |
208 | /// <param name="folder">The UUID of the folder to be returned</param> | 208 | /// <param name="folder">The UUID of the folder to be returned</param> |
209 | /// <returns>A class containing folder information</returns> | 209 | /// <returns>A class containing folder information</returns> |
210 | InventoryFolderBase getInventoryFolder(LLUUID folder); | 210 | InventoryFolderBase getInventoryFolder(LLUUID folder); |
211 | 211 | ||
212 | /// <summary> | 212 | /// <summary> |
213 | /// Creates a new inventory item based on item | 213 | /// Creates a new inventory item based on item |
214 | /// </summary> | 214 | /// </summary> |
215 | /// <param name="item">The item to be created</param> | 215 | /// <param name="item">The item to be created</param> |
216 | void addInventoryItem(InventoryItemBase item); | 216 | void addInventoryItem(InventoryItemBase item); |
217 | 217 | ||
218 | /// <summary> | 218 | /// <summary> |
219 | /// Updates an inventory item with item (updates based on ID) | 219 | /// Updates an inventory item with item (updates based on ID) |
220 | /// </summary> | 220 | /// </summary> |
221 | /// <param name="item">The updated item</param> | 221 | /// <param name="item">The updated item</param> |
222 | void updateInventoryItem(InventoryItemBase item); | 222 | void updateInventoryItem(InventoryItemBase item); |
223 | 223 | ||
224 | /// <summary> | 224 | /// <summary> |
225 | /// | 225 | /// |
226 | /// </summary> | 226 | /// </summary> |
227 | /// <param name="item"></param> | 227 | /// <param name="item"></param> |
228 | void deleteInventoryItem(LLUUID item); | 228 | void deleteInventoryItem(LLUUID item); |
229 | 229 | ||
230 | /// <summary> | 230 | /// <summary> |
231 | /// Adds a new folder specified by folder | 231 | /// Adds a new folder specified by folder |
232 | /// </summary> | 232 | /// </summary> |
233 | /// <param name="folder">The inventory folder</param> | 233 | /// <param name="folder">The inventory folder</param> |
234 | void addInventoryFolder(InventoryFolderBase folder); | 234 | void addInventoryFolder(InventoryFolderBase folder); |
235 | 235 | ||
236 | /// <summary> | 236 | /// <summary> |
237 | /// Updates a folder based on its ID with folder | 237 | /// Updates a folder based on its ID with folder |
238 | /// </summary> | 238 | /// </summary> |
239 | /// <param name="folder">The inventory folder</param> | 239 | /// <param name="folder">The inventory folder</param> |
240 | void updateInventoryFolder(InventoryFolderBase folder); | 240 | void updateInventoryFolder(InventoryFolderBase folder); |
241 | 241 | ||
242 | /// <summary> | 242 | /// <summary> |
243 | /// Deletes a folder based on its ID with folder | 243 | /// Deletes a folder based on its ID with folder |
244 | /// </summary> | 244 | /// </summary> |
245 | /// <param name="folder">The id of the folder</param> | 245 | /// <param name="folder">The id of the folder</param> |
246 | void deleteInventoryFolder(LLUUID folder); | 246 | void deleteInventoryFolder(LLUUID folder); |
247 | } | 247 | } |
248 | 248 | ||
249 | /* | 249 | /* |
250 | * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder | 250 | * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder |
251 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize | 251 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize |
252 | * into this simpler class, and then use that. | 252 | * into this simpler class, and then use that. |
253 | */ | 253 | */ |
254 | [XmlRoot(ElementName = "inventory", IsNullable = true)] | 254 | [XmlRoot(ElementName = "inventory", IsNullable = true)] |
255 | public class SerializableInventory | 255 | public class SerializableInventory |
256 | { | 256 | { |
257 | [XmlRoot(ElementName = "folder", IsNullable = true)] | 257 | [XmlRoot(ElementName = "folder", IsNullable = true)] |
258 | public class SerializableFolder : InventoryFolderBase | 258 | public class SerializableFolder : InventoryFolderBase |
259 | { | 259 | { |
260 | [XmlArray(ElementName = "folders", IsNullable = true)] | 260 | [XmlArray(ElementName = "folders", IsNullable = true)] |
261 | [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializableFolder))] | 261 | [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializableFolder))] |
262 | public ArrayList SubFolders; | 262 | public ArrayList SubFolders; |
263 | 263 | ||
264 | [XmlArray(ElementName = "items", IsNullable = true)] | 264 | [XmlArray(ElementName = "items", IsNullable = true)] |
265 | [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))] | 265 | [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))] |
266 | public ArrayList Items; | 266 | public ArrayList Items; |
267 | } | 267 | } |
268 | 268 | ||
269 | [XmlElement(ElementName = "folder", IsNullable = true)] | 269 | [XmlElement(ElementName = "folder", IsNullable = true)] |
270 | public SerializableFolder root; | 270 | public SerializableFolder root; |
271 | } | 271 | } |
272 | 272 | ||
273 | } | 273 | } |