aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
blob: b8d884718cc96eb58baa601d4292126abc66fa34 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Data;
using libsecondlife;

namespace OpenSim.Framework.Communications.Caches
{
    public class CachedUserInfo
    {
        public UserProfileData UserProfile;
        //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>();
        public InventoryFolder RootFolder;

        public CachedUserInfo()
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="folderInfo"></param>
        public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
        {
            if (userID == UserProfile.UUID)
            {
                if (this.RootFolder == null)
                {
                    if (folderInfo.parentID == LLUUID.Zero)
                    {
                        this.RootFolder = folderInfo;
                    }
                }
                else
                {
                    if (this.RootFolder.folderID == folderInfo.parentID)
                    {
                        this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
                    }
                    else
                    {
                        InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID);
                        if (pFolder != null)
                        {
                            pFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
                        }
                    }
                }
            }
        }

        public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
        {
            if (userID == UserProfile.UUID)
            {
                if (this.RootFolder != null)
                {
                    if (itemInfo.parentFolderID == this.RootFolder.folderID)
                    {
                        this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo);
                    }
                    else
                    {
                        InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID);
                        if (pFolder != null)
                        {
                            pFolder.Items.Add(itemInfo.inventoryID, itemInfo);
                        }
                    }
                }

            }
        }
    }
}