diff options
author | Sean Dague | 2008-04-07 18:28:48 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-07 18:28:48 +0000 |
commit | 79222a0b45eca74c32cda95cc0857ac860ab6d19 (patch) | |
tree | 86654770a4a4c4e756d78440ad19ec90038c93ad /OpenSim/Framework | |
parent | added swag #1 on Inventory NHibernate implementation. There (diff) | |
download | opensim-SC-79222a0b45eca74c32cda95cc0857ac860ab6d19.zip opensim-SC-79222a0b45eca74c32cda95cc0857ac860ab6d19.tar.gz opensim-SC-79222a0b45eca74c32cda95cc0857ac860ab6d19.tar.bz2 opensim-SC-79222a0b45eca74c32cda95cc0857ac860ab6d19.tar.xz |
break out the 5 classes that were
InventoryItemBase into seperate .cs files 1 per class
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/IInventoryData.cs | 154 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryCollection.cs | 53 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryFolderBase.cs | 70 | ||||
-rw-r--r-- | OpenSim/Framework/InventoryItemBase.cs | 197 | ||||
-rw-r--r-- | OpenSim/Framework/SerializableInventory.cs | 56 |
5 files changed, 333 insertions, 197 deletions
diff --git a/OpenSim/Framework/IInventoryData.cs b/OpenSim/Framework/IInventoryData.cs new file mode 100644 index 0000000..cfba135 --- /dev/null +++ b/OpenSim/Framework/IInventoryData.cs | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Xml.Serialization; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// An interface for accessing inventory data from a storage server | ||
37 | /// </summary> | ||
38 | public interface IInventoryData | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Initialises the interface | ||
42 | /// </summary> | ||
43 | void Initialise(); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Closes the interface | ||
47 | /// </summary> | ||
48 | void Close(); | ||
49 | |||
50 | /// <summary> | ||
51 | /// The plugin being loaded | ||
52 | /// </summary> | ||
53 | /// <returns>A string containing the plugin name</returns> | ||
54 | string getName(); | ||
55 | |||
56 | /// <summary> | ||
57 | /// The plugins version | ||
58 | /// </summary> | ||
59 | /// <returns>A string containing the plugin version</returns> | ||
60 | string getVersion(); | ||
61 | |||
62 | /// <summary> | ||
63 | /// Returns all child folders in the hierarchy from the parent folder and down. | ||
64 | /// Does not return the parent folder itself. | ||
65 | /// </summary> | ||
66 | /// <param name="parentID">The folder to get subfolders for</param> | ||
67 | /// <returns>A list of inventory folders</returns> | ||
68 | List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID); | ||
69 | |||
70 | /// <summary> | ||
71 | /// Returns a list of inventory items contained within the specified folder | ||
72 | /// </summary> | ||
73 | /// <param name="folderID">The UUID of the target folder</param> | ||
74 | /// <returns>A List of InventoryItemBase items</returns> | ||
75 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); | ||
76 | |||
77 | /// <summary> | ||
78 | /// Returns a list of the root folders within a users inventory | ||
79 | /// </summary> | ||
80 | /// <param name="user">The user whos inventory is to be searched</param> | ||
81 | /// <returns>A list of folder objects</returns> | ||
82 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); | ||
83 | |||
84 | /// <summary> | ||
85 | /// Returns the users inventory root folder. | ||
86 | /// </summary> | ||
87 | /// <param name="user">The UUID of the user who is having inventory being returned</param> | ||
88 | /// <returns>Root inventory folder, null if no root inventory folder was found</returns> | ||
89 | InventoryFolderBase getUserRootFolder(LLUUID user); | ||
90 | |||
91 | /// <summary> | ||
92 | /// Returns a list of inventory folders contained in the folder 'parentID' | ||
93 | /// </summary> | ||
94 | /// <param name="parentID">The folder to get subfolders for</param> | ||
95 | /// <returns>A list of inventory folders</returns> | ||
96 | List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); | ||
97 | |||
98 | /// <summary> | ||
99 | /// Returns an inventory item by its UUID | ||
100 | /// </summary> | ||
101 | /// <param name="item">The UUID of the item to be returned</param> | ||
102 | /// <returns>A class containing item information</returns> | ||
103 | InventoryItemBase getInventoryItem(LLUUID item); | ||
104 | |||
105 | /// <summary> | ||
106 | /// Returns a specified inventory folder by its UUID | ||
107 | /// </summary> | ||
108 | /// <param name="folder">The UUID of the folder to be returned</param> | ||
109 | /// <returns>A class containing folder information</returns> | ||
110 | InventoryFolderBase getInventoryFolder(LLUUID folder); | ||
111 | |||
112 | /// <summary> | ||
113 | /// Creates a new inventory item based on item | ||
114 | /// </summary> | ||
115 | /// <param name="item">The item to be created</param> | ||
116 | void addInventoryItem(InventoryItemBase item); | ||
117 | |||
118 | /// <summary> | ||
119 | /// Updates an inventory item with item (updates based on ID) | ||
120 | /// </summary> | ||
121 | /// <param name="item">The updated item</param> | ||
122 | void updateInventoryItem(InventoryItemBase item); | ||
123 | |||
124 | /// <summary> | ||
125 | /// | ||
126 | /// </summary> | ||
127 | /// <param name="item"></param> | ||
128 | void deleteInventoryItem(LLUUID item); | ||
129 | |||
130 | /// <summary> | ||
131 | /// Adds a new folder specified by folder | ||
132 | /// </summary> | ||
133 | /// <param name="folder">The inventory folder</param> | ||
134 | void addInventoryFolder(InventoryFolderBase folder); | ||
135 | |||
136 | /// <summary> | ||
137 | /// Updates a folder based on its ID with folder | ||
138 | /// </summary> | ||
139 | /// <param name="folder">The inventory folder</param> | ||
140 | void updateInventoryFolder(InventoryFolderBase folder); | ||
141 | |||
142 | /// <summary> | ||
143 | /// Updates a folder based on its ID with folder | ||
144 | /// </summary> | ||
145 | /// <param name="folder">The inventory folder</param> | ||
146 | void moveInventoryFolder(InventoryFolderBase folder); | ||
147 | |||
148 | /// <summary> | ||
149 | /// Deletes a folder based on its ID with folder | ||
150 | /// </summary> | ||
151 | /// <param name="folder">The id of the folder</param> | ||
152 | void deleteInventoryFolder(LLUUID folder); | ||
153 | } | ||
154 | } | ||
diff --git a/OpenSim/Framework/InventoryCollection.cs b/OpenSim/Framework/InventoryCollection.cs new file mode 100644 index 0000000..98e8bb6 --- /dev/null +++ b/OpenSim/Framework/InventoryCollection.cs | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Xml.Serialization; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | public class InventoryCollection | ||
36 | { | ||
37 | public List<InventoryFolderBase> Folders; | ||
38 | public List<InventoryItemBase> AllItems; | ||
39 | public LLUUID UserID; | ||
40 | |||
41 | public InventoryCollection() | ||
42 | { | ||
43 | Folders = new List<InventoryFolderBase>(); | ||
44 | AllItems = new List<InventoryItemBase>(); | ||
45 | } | ||
46 | |||
47 | public InventoryCollection(List<InventoryFolderBase> folders, List<InventoryItemBase> allItems) | ||
48 | { | ||
49 | Folders = folders; | ||
50 | AllItems = allItems; | ||
51 | } | ||
52 | } | ||
53 | } | ||
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs new file mode 100644 index 0000000..bf43577 --- /dev/null +++ b/OpenSim/Framework/InventoryFolderBase.cs | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Xml.Serialization; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A Class for folders which contain users inventory | ||
37 | /// </summary> | ||
38 | public class InventoryFolderBase | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// The name of the folder (64 characters or less) | ||
42 | /// </summary> | ||
43 | public string name; | ||
44 | |||
45 | /// <summary> | ||
46 | /// The agent who's inventory this is contained by | ||
47 | /// </summary> | ||
48 | public LLUUID agentID; | ||
49 | |||
50 | /// <summary> | ||
51 | /// The folder this folder is contained in | ||
52 | /// </summary> | ||
53 | public LLUUID parentID; | ||
54 | |||
55 | /// <summary> | ||
56 | /// The UUID for this folder | ||
57 | /// </summary> | ||
58 | public LLUUID folderID; | ||
59 | |||
60 | /// <summary> | ||
61 | /// Type of items normally stored in this folder | ||
62 | /// </summary> | ||
63 | public short type; | ||
64 | |||
65 | /// <summary> | ||
66 | /// | ||
67 | /// </summary> | ||
68 | public ushort version; | ||
69 | } | ||
70 | } | ||
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 1d0246b..7d146e7 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs | |||
@@ -102,201 +102,4 @@ namespace OpenSim.Framework | |||
102 | /// </summary> | 102 | /// </summary> |
103 | public uint inventoryEveryOnePermissions; | 103 | public uint inventoryEveryOnePermissions; |
104 | } | 104 | } |
105 | |||
106 | /// <summary> | ||
107 | /// A Class for folders which contain users inventory | ||
108 | /// </summary> | ||
109 | public class InventoryFolderBase | ||
110 | { | ||
111 | /// <summary> | ||
112 | /// The name of the folder (64 characters or less) | ||
113 | /// </summary> | ||
114 | public string name; | ||
115 | |||
116 | /// <summary> | ||
117 | /// The agent who's inventory this is contained by | ||
118 | /// </summary> | ||
119 | public LLUUID agentID; | ||
120 | |||
121 | /// <summary> | ||
122 | /// The folder this folder is contained in | ||
123 | /// </summary> | ||
124 | public LLUUID parentID; | ||
125 | |||
126 | /// <summary> | ||
127 | /// The UUID for this folder | ||
128 | /// </summary> | ||
129 | public LLUUID folderID; | ||
130 | |||
131 | /// <summary> | ||
132 | /// Type of items normally stored in this folder | ||
133 | /// </summary> | ||
134 | public short type; | ||
135 | |||
136 | /// <summary> | ||
137 | /// | ||
138 | /// </summary> | ||
139 | public ushort version; | ||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// An interface for accessing inventory data from a storage server | ||
144 | /// </summary> | ||
145 | public interface IInventoryData | ||
146 | { | ||
147 | /// <summary> | ||
148 | /// Initialises the interface | ||
149 | /// </summary> | ||
150 | void Initialise(); | ||
151 | |||
152 | /// <summary> | ||
153 | /// Closes the interface | ||
154 | /// </summary> | ||
155 | void Close(); | ||
156 | |||
157 | /// <summary> | ||
158 | /// The plugin being loaded | ||
159 | /// </summary> | ||
160 | /// <returns>A string containing the plugin name</returns> | ||
161 | string getName(); | ||
162 | |||
163 | /// <summary> | ||
164 | /// The plugins version | ||
165 | /// </summary> | ||
166 | /// <returns>A string containing the plugin version</returns> | ||
167 | string getVersion(); | ||
168 | |||
169 | /// <summary> | ||
170 | /// Returns all child folders in the hierarchy from the parent folder and down. | ||
171 | /// Does not return the parent folder itself. | ||
172 | /// </summary> | ||
173 | /// <param name="parentID">The folder to get subfolders for</param> | ||
174 | /// <returns>A list of inventory folders</returns> | ||
175 | List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID); | ||
176 | |||
177 | /// <summary> | ||
178 | /// Returns a list of inventory items contained within the specified folder | ||
179 | /// </summary> | ||
180 | /// <param name="folderID">The UUID of the target folder</param> | ||
181 | /// <returns>A List of InventoryItemBase items</returns> | ||
182 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); | ||
183 | |||
184 | /// <summary> | ||
185 | /// Returns a list of the root folders within a users inventory | ||
186 | /// </summary> | ||
187 | /// <param name="user">The user whos inventory is to be searched</param> | ||
188 | /// <returns>A list of folder objects</returns> | ||
189 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); | ||
190 | |||
191 | /// <summary> | ||
192 | /// Returns the users inventory root folder. | ||
193 | /// </summary> | ||
194 | /// <param name="user">The UUID of the user who is having inventory being returned</param> | ||
195 | /// <returns>Root inventory folder, null if no root inventory folder was found</returns> | ||
196 | InventoryFolderBase getUserRootFolder(LLUUID user); | ||
197 | |||
198 | /// <summary> | ||
199 | /// Returns a list of inventory folders contained in the folder 'parentID' | ||
200 | /// </summary> | ||
201 | /// <param name="parentID">The folder to get subfolders for</param> | ||
202 | /// <returns>A list of inventory folders</returns> | ||
203 | List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); | ||
204 | |||
205 | /// <summary> | ||
206 | /// Returns an inventory item by its UUID | ||
207 | /// </summary> | ||
208 | /// <param name="item">The UUID of the item to be returned</param> | ||
209 | /// <returns>A class containing item information</returns> | ||
210 | InventoryItemBase getInventoryItem(LLUUID item); | ||
211 | |||
212 | /// <summary> | ||
213 | /// Returns a specified inventory folder by its UUID | ||
214 | /// </summary> | ||
215 | /// <param name="folder">The UUID of the folder to be returned</param> | ||
216 | /// <returns>A class containing folder information</returns> | ||
217 | InventoryFolderBase getInventoryFolder(LLUUID folder); | ||
218 | |||
219 | /// <summary> | ||
220 | /// Creates a new inventory item based on item | ||
221 | /// </summary> | ||
222 | /// <param name="item">The item to be created</param> | ||
223 | void addInventoryItem(InventoryItemBase item); | ||
224 | |||
225 | /// <summary> | ||
226 | /// Updates an inventory item with item (updates based on ID) | ||
227 | /// </summary> | ||
228 | /// <param name="item">The updated item</param> | ||
229 | void updateInventoryItem(InventoryItemBase item); | ||
230 | |||
231 | /// <summary> | ||
232 | /// | ||
233 | /// </summary> | ||
234 | /// <param name="item"></param> | ||
235 | void deleteInventoryItem(LLUUID item); | ||
236 | |||
237 | /// <summary> | ||
238 | /// Adds a new folder specified by folder | ||
239 | /// </summary> | ||
240 | /// <param name="folder">The inventory folder</param> | ||
241 | void addInventoryFolder(InventoryFolderBase folder); | ||
242 | |||
243 | /// <summary> | ||
244 | /// Updates a folder based on its ID with folder | ||
245 | /// </summary> | ||
246 | /// <param name="folder">The inventory folder</param> | ||
247 | void updateInventoryFolder(InventoryFolderBase folder); | ||
248 | |||
249 | /// <summary> | ||
250 | /// Updates a folder based on its ID with folder | ||
251 | /// </summary> | ||
252 | /// <param name="folder">The inventory folder</param> | ||
253 | void moveInventoryFolder(InventoryFolderBase folder); | ||
254 | |||
255 | /// <summary> | ||
256 | /// Deletes a folder based on its ID with folder | ||
257 | /// </summary> | ||
258 | /// <param name="folder">The id of the folder</param> | ||
259 | void deleteInventoryFolder(LLUUID folder); | ||
260 | } | ||
261 | |||
262 | public class InventoryCollection | ||
263 | { | ||
264 | public List<InventoryFolderBase> Folders; | ||
265 | public List<InventoryItemBase> AllItems; | ||
266 | public LLUUID UserID; | ||
267 | |||
268 | public InventoryCollection() | ||
269 | { | ||
270 | Folders = new List<InventoryFolderBase>(); | ||
271 | AllItems = new List<InventoryItemBase>(); | ||
272 | } | ||
273 | |||
274 | public InventoryCollection(List<InventoryFolderBase> folders, List<InventoryItemBase> allItems) | ||
275 | { | ||
276 | Folders = folders; | ||
277 | AllItems = allItems; | ||
278 | } | ||
279 | } | ||
280 | |||
281 | /* | ||
282 | * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder | ||
283 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize | ||
284 | * into this simpler class, and then use that. | ||
285 | */ | ||
286 | |||
287 | [XmlRoot(ElementName = "inventory", IsNullable = true)] | ||
288 | public class SerializableInventory | ||
289 | { | ||
290 | [XmlRoot(ElementName = "folder", IsNullable = true)] | ||
291 | public class SerializableFolder : InventoryFolderBase | ||
292 | { | ||
293 | [XmlArray(ElementName = "folders", IsNullable = true)] [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof (SerializableFolder))] public | ||
294 | ArrayList SubFolders; | ||
295 | |||
296 | [XmlArray(ElementName = "items", IsNullable = true)] [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof (InventoryItemBase))] public ArrayList | ||
297 | Items; | ||
298 | } | ||
299 | |||
300 | [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root; | ||
301 | } | ||
302 | } | 105 | } |
diff --git a/OpenSim/Framework/SerializableInventory.cs b/OpenSim/Framework/SerializableInventory.cs new file mode 100644 index 0000000..529f91e --- /dev/null +++ b/OpenSim/Framework/SerializableInventory.cs | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Xml.Serialization; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.Framework | ||
34 | { | ||
35 | /* | ||
36 | * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder | ||
37 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize | ||
38 | * into this simpler class, and then use that. | ||
39 | */ | ||
40 | |||
41 | [XmlRoot(ElementName = "inventory", IsNullable = true)] | ||
42 | public class SerializableInventory | ||
43 | { | ||
44 | [XmlRoot(ElementName = "folder", IsNullable = true)] | ||
45 | public class SerializableFolder : InventoryFolderBase | ||
46 | { | ||
47 | [XmlArray(ElementName = "folders", IsNullable = true)] [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof (SerializableFolder))] public | ||
48 | ArrayList SubFolders; | ||
49 | |||
50 | [XmlArray(ElementName = "items", IsNullable = true)] [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof (InventoryItemBase))] public ArrayList | ||
51 | Items; | ||
52 | } | ||
53 | |||
54 | [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root; | ||
55 | } | ||
56 | } | ||