aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Caches/InventoryFolder.cs
blob: 364a1840b4ca07459f259f5698f1087d549c1f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Data;

namespace OpenSim.Region.Caches
{
    public class InventoryFolder : InventoryFolderBase
    {
        public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>();
        public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();

        public InventoryFolder()
        {
        }

        public InventoryFolder HasSubFolder(LLUUID folderID)
        {
            InventoryFolder returnFolder = null;
            if (this.SubFolders.ContainsKey(folderID))
            {
                returnFolder = this.SubFolders[folderID];
            }
            else
            {
                foreach (InventoryFolder folder in this.SubFolders.Values)
                {
                   returnFolder = folder.HasSubFolder(folderID);
                   if (returnFolder != null)
                   {
                       break;
                   }
                }
            }
            return returnFolder;
        }

        public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
        {
            InventoryFolder subFold = new InventoryFolder();
            subFold.name = folderName;
            subFold.folderID = folderID;
            subFold.type = type;
            subFold.parentID = this.folderID;
            subFold.agentID = this.agentID;
            this.SubFolders.Add(subFold.folderID, subFold);
            return subFold;
        }
    }
}