aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
diff options
context:
space:
mode:
authorMW2007-07-22 13:31:08 +0000
committerMW2007-07-22 13:31:08 +0000
commit276011a0a149c5ea81dd106137889c840c10b738 (patch)
tree69145783615e0fde4f4e927fba603b8ebdc321b4 /OpenSim/Framework/Communications/Cache/InventoryFolder.cs
parent* Some work in progress code: Inventory cache, start of inventory server/serv... (diff)
downloadopensim-SC_OLD-276011a0a149c5ea81dd106137889c840c10b738.zip
opensim-SC_OLD-276011a0a149c5ea81dd106137889c840c10b738.tar.gz
opensim-SC_OLD-276011a0a149c5ea81dd106137889c840c10b738.tar.bz2
opensim-SC_OLD-276011a0a149c5ea81dd106137889c840c10b738.tar.xz
Think I've recovered my deleted files, so hopefully it works now.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolder.cs109
1 files changed, 109 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
new file mode 100644
index 0000000..8670eb0
--- /dev/null
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -0,0 +1,109 @@
1/*
2* Copyright (c) Contributors, http://www.openmetaverse.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*/
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Data;
36using OpenSim.Framework.Types;
37using OpenSim.Framework.Utilities;
38
39namespace OpenSim.Framework.Communications.Caches
40{
41 public class InventoryFolder : InventoryFolderBase
42 {
43 // Fields
44 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
45 public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>();
46
47 // Methods
48 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
49 {
50 InventoryFolder subFold = new InventoryFolder();
51 subFold.name = folderName;
52 subFold.folderID = folderID;
53 subFold.type = type;
54 subFold.parentID = this.folderID;
55 subFold.agentID = this.agentID;
56 this.SubFolders.Add(subFold.folderID, subFold);
57 return subFold;
58 }
59
60 public InventoryItemBase HasItem(LLUUID itemID)
61 {
62 InventoryItemBase base2 = null;
63 if (this.Items.ContainsKey(itemID))
64 {
65 return this.Items[itemID];
66 }
67 foreach (InventoryFolder folder in this.SubFolders.Values)
68 {
69 base2 = folder.HasItem(itemID);
70 if (base2 != null)
71 {
72 break;
73 }
74 }
75 return base2;
76 }
77
78 public InventoryFolder HasSubFolder(LLUUID folderID)
79 {
80 InventoryFolder returnFolder = null;
81 if (this.SubFolders.ContainsKey(folderID))
82 {
83 returnFolder = this.SubFolders[folderID];
84 }
85 else
86 {
87 foreach (InventoryFolder folder in this.SubFolders.Values)
88 {
89 returnFolder = folder.HasSubFolder(folderID);
90 if (returnFolder != null)
91 {
92 break;
93 }
94 }
95 }
96 return returnFolder;
97 }
98
99 public List<InventoryItemBase> RequestListOfItems()
100 {
101 List<InventoryItemBase> itemList = new List<InventoryItemBase>();
102 foreach (InventoryItemBase item in this.Items.Values)
103 {
104 itemList.Add(item);
105 }
106 return itemList;
107 }
108 }
109}