예제 #1
0
        /// <summary>
        /// Gets everything (folders and items) inside a folder
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="folderID"></param>
        /// <returns></returns>
        public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
        {
            InventoryFolderImpl folder = null;
            InventoryCollection inv    = new InventoryCollection();

            inv.UserID = m_Library.Owner;

            if (folderID != m_Library.ID)
            {
                folder = m_Library.FindFolder(folderID);
                if (folder == null)
                {
                    inv.Folders = new List <InventoryFolderBase>();
                    inv.Items   = new List <InventoryItemBase>();
                    return(inv);
                }
            }
            else
            {
                folder = m_Library;
            }

            inv.Folders = folder.RequestListOfFolders();
            inv.Items   = folder.RequestListOfItems();

            m_log.DebugFormat("[LIBRARY MODULE]: Got content for folder {0}", folder.Name);
            return(inv);
        }
예제 #2
0
        /// <summary>
        /// Read a library inventory item metadata from a loaded configuration
        /// </summary>
        /// <param name="source"></param>
        private void ReadItemFromConfig(IConfig config, string path)
        {
            InventoryItemBase item = new InventoryItemBase();

            item.Owner               = m_service.LibraryOwner;
            item.CreatorId           = m_service.LibraryOwner.ToString();
            item.ID                  = new UUID(config.GetString("inventoryID", m_service.LibraryRootFolder.ID.ToString()));
            item.AssetID             = new UUID(config.GetString("assetID", item.ID.ToString()));
            item.Folder              = new UUID(config.GetString("folderID", m_service.LibraryRootFolder.ID.ToString()));
            item.Name                = config.GetString("name", String.Empty);
            item.Description         = config.GetString("description", item.Name);
            item.InvType             = config.GetInt("inventoryType", 0);
            item.AssetType           = config.GetInt("assetType", item.InvType);
            item.CurrentPermissions  = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF);
            item.NextPermissions     = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF);
            item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF);
            item.BasePermissions     = (uint)config.GetLong("basePermissions", 0x7FFFFFFF);
            item.Flags               = (uint)config.GetInt("flags", 0);

            m_inventoryService.AddItem(item);
            if (item.Folder == m_service.LibraryRootFolder.ID)
            {
                m_folder.Items.Add(item.ID, item);
            }
            else
            {
                m_folder.FindFolder(item.Folder).Items.Add(item.ID, item);
            }
        }
        /// <summary>
        /// Add a new folder to the user's inventory
        /// </summary>
        /// <param name="folder"></param>
        /// <returns>true if the folder was successfully added</returns>
        public bool AddFolder(InventoryFolderBase folder)
        {
            //m_log.DebugFormat("[LIBRARY MODULE]: Adding folder {0} ({1}) to {2}", folder.Name, folder.ID, folder.ParentID);
            InventoryFolderImpl parent = m_Library;

            if (m_Library.ID != folder.ParentID)
            {
                parent = m_Library.FindFolder(folder.ParentID);
            }

            if (parent == null)
            {
                m_log.DebugFormat("[LIBRARY MODULE]: could not add folder {0} because parent folder {1} not found", folder.Name, folder.ParentID);
                return(false);
            }

            parent.CreateChildFolder(folder.ID, folder.Name, (ushort)folder.Type);

            return(true);
        }