diff options
Start of the OpenSim library , for now only contains a few textures.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/InventoryFolder.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/InventoryFolder.cs | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs index 8670eb0..300a6e3 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs | |||
@@ -1,109 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using System.IO; | 32 | using System.IO; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Data; | 35 | using OpenSim.Framework.Data; |
36 | using OpenSim.Framework.Types; | 36 | using OpenSim.Framework.Types; |
37 | using OpenSim.Framework.Utilities; | 37 | using OpenSim.Framework.Utilities; |
38 | 38 | ||
39 | namespace OpenSim.Framework.Communications.Caches | 39 | namespace OpenSim.Framework.Communications.Caches |
40 | { | 40 | { |
41 | public class InventoryFolder : InventoryFolderBase | 41 | public class InventoryFolder : InventoryFolderBase |
42 | { | 42 | { |
43 | // Fields | 43 | // Fields |
44 | public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); | 44 | public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); |
45 | public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>(); | 45 | public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>(); |
46 | 46 | ||
47 | // Methods | 47 | // Methods |
48 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) | 48 | public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) |
49 | { | 49 | { |
50 | InventoryFolder subFold = new InventoryFolder(); | 50 | InventoryFolder subFold = new InventoryFolder(); |
51 | subFold.name = folderName; | 51 | subFold.name = folderName; |
52 | subFold.folderID = folderID; | 52 | subFold.folderID = folderID; |
53 | subFold.type = type; | 53 | subFold.type = (short) type; |
54 | subFold.parentID = this.folderID; | 54 | subFold.parentID = this.folderID; |
55 | subFold.agentID = this.agentID; | 55 | subFold.agentID = this.agentID; |
56 | this.SubFolders.Add(subFold.folderID, subFold); | 56 | this.SubFolders.Add(subFold.folderID, subFold); |
57 | return subFold; | 57 | return subFold; |
58 | } | 58 | } |
59 | 59 | ||
60 | public InventoryItemBase HasItem(LLUUID itemID) | 60 | public InventoryItemBase HasItem(LLUUID itemID) |
61 | { | 61 | { |
62 | InventoryItemBase base2 = null; | 62 | InventoryItemBase base2 = null; |
63 | if (this.Items.ContainsKey(itemID)) | 63 | if (this.Items.ContainsKey(itemID)) |
64 | { | 64 | { |
65 | return this.Items[itemID]; | 65 | return this.Items[itemID]; |
66 | } | 66 | } |
67 | foreach (InventoryFolder folder in this.SubFolders.Values) | 67 | foreach (InventoryFolder folder in this.SubFolders.Values) |
68 | { | 68 | { |
69 | base2 = folder.HasItem(itemID); | 69 | base2 = folder.HasItem(itemID); |
70 | if (base2 != null) | 70 | if (base2 != null) |
71 | { | 71 | { |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | return base2; | 75 | return base2; |
76 | } | 76 | } |
77 | 77 | ||
78 | public InventoryFolder HasSubFolder(LLUUID folderID) | 78 | public InventoryFolder HasSubFolder(LLUUID folderID) |
79 | { | 79 | { |
80 | InventoryFolder returnFolder = null; | 80 | InventoryFolder returnFolder = null; |
81 | if (this.SubFolders.ContainsKey(folderID)) | 81 | if (this.SubFolders.ContainsKey(folderID)) |
82 | { | 82 | { |
83 | returnFolder = this.SubFolders[folderID]; | 83 | returnFolder = this.SubFolders[folderID]; |
84 | } | 84 | } |
85 | else | 85 | else |
86 | { | 86 | { |
87 | foreach (InventoryFolder folder in this.SubFolders.Values) | 87 | foreach (InventoryFolder folder in this.SubFolders.Values) |
88 | { | 88 | { |
89 | returnFolder = folder.HasSubFolder(folderID); | 89 | returnFolder = folder.HasSubFolder(folderID); |
90 | if (returnFolder != null) | 90 | if (returnFolder != null) |
91 | { | 91 | { |
92 | break; | 92 | break; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | } | 95 | } |
96 | return returnFolder; | 96 | return returnFolder; |
97 | } | 97 | } |
98 | 98 | ||
99 | public List<InventoryItemBase> RequestListOfItems() | 99 | public List<InventoryItemBase> RequestListOfItems() |
100 | { | 100 | { |
101 | List<InventoryItemBase> itemList = new List<InventoryItemBase>(); | 101 | List<InventoryItemBase> itemList = new List<InventoryItemBase>(); |
102 | foreach (InventoryItemBase item in this.Items.Values) | 102 | foreach (InventoryItemBase item in this.Items.Values) |
103 | { | 103 | { |
104 | itemList.Add(item); | 104 | itemList.Add(item); |
105 | } | 105 | } |
106 | return itemList; | 106 | return itemList; |
107 | } | 107 | } |
108 | } | 108 | } |
109 | } | 109 | } |