コード例 #1
0
ファイル: InventoryService.cs プロジェクト: JAllard/AuroraWeb
 private void Dump(InventoryTreeNode node, string _ident)
 {
     Console.WriteLine(_ident + node.Name);
     if (node.Children != null)
     {
         foreach (InventoryTreeNode n in node.Children)
             Dump(n, _ident + "\t");
     }
 }
コード例 #2
0
ファイル: InventoryService.cs プロジェクト: JAllard/AuroraWeb
        private void FillIn(InventoryTreeNode root, List<XInventoryFolder> folders, List<XInventoryItem> items)
        {
            List<XInventoryItem> childrenItems = items.FindAll(delegate(XInventoryItem i) { return i.parentFolderID == root.ID; });
            List<XInventoryFolder> childrenFolders = folders.FindAll(delegate(XInventoryFolder f) { return f.parentFolderID == root.ID; });

            if (childrenItems != null)
                foreach (XInventoryItem it in childrenItems)
                {
                    root.Children.Add(new InventoryTreeNode(it.inventoryID, it.inventoryName, (AssetType)it.invType, root.Depth + 1, false));
                    items.Remove(it);
                }
            if (childrenFolders != null)
                foreach (XInventoryFolder fo in childrenFolders)
                {
                    InventoryTreeNode node = new InventoryTreeNode(fo.folderID, fo.folderName, (AssetType)fo.type, root.Depth + 1, true);
                    root.Children.Add(node);
                    folders.Remove(fo);
                    // Recurse
                    FillIn(node, folders, items);
                }
        }
コード例 #3
0
ファイル: InventoryService.cs プロジェクト: JAllard/AuroraWeb
        public InventoryTreeNode GetInventoryTree(UUID userID)
        {
            XInventoryFolder[] folders = m_Database.GetFolders(new string[] { "agentID" }, new string[] { userID.ToString() });
            XInventoryItem[] items = m_Database.GetItems(new string[] { "avatarID" }, new string[] { userID.ToString() });

            List<XInventoryFolder> folderList = null;
            if (folders != null)
                folderList = new List<XInventoryFolder>(folders);
            else
                folderList = new List<XInventoryFolder>();

            List<XInventoryItem> itemList = null;
            if (items != null)
                itemList = new List<XInventoryItem>(items);
            else
                itemList = new List<XInventoryItem>();

            InventoryTreeNode root = new InventoryTreeNode(UUID.Zero, String.Empty, AssetType.Unknown, 0, true);
            FillIn(root, folderList, itemList);

            //Dump(root, string.Empty);
            return root;
        }