/// <summary>
        ///     Removes the given child subfolder.
        /// </summary>
        /// <param name="folderID"></param>
        /// <returns>
        ///     The folder removed, or null if the folder was not present.
        /// </returns>
        public InventoryFolderImpl RemoveChildFolder(UUID folderID)
        {
            InventoryFolderImpl removedFolder = null;

            lock (m_childFolders) {
                if (m_childFolders.ContainsKey(folderID))
                {
                    removedFolder = m_childFolders [folderID];
                    m_childFolders.Remove(folderID);
                }
            }

            return(removedFolder);
        }
        /// <summary>
        ///     Create a new subfolder.
        /// </summary>
        /// <param name="folderID"></param>
        /// <param name="folderName"></param>
        /// <param name="type"></param>
        /// <returns>The newly created subfolder.  Returns null if the folder already exists</returns>
        public InventoryFolderImpl CreateChildFolder(UUID folderID, string folderName, ushort type)
        {
            lock (m_childFolders) {
                if (!m_childFolders.ContainsKey(folderID))
                {
                    InventoryFolderImpl subFold = new InventoryFolderImpl {
                        Name     = folderName,
                        ID       = folderID,
                        Type     = (short)type,
                        ParentID = ID,
                        Owner    = Owner
                    };
                    m_childFolders.Add(subFold.ID, subFold);

                    return(subFold);
                }
            }

            return(null);
        }
 /// <summary>
 ///     Add a folder that already exists.
 /// </summary>
 /// <param name="folder"></param>
 public void AddChildFolder(InventoryFolderImpl folder)
 {
     lock (m_childFolders)
     {
         folder.ParentID = ID;
         m_childFolders[folder.ID] = folder;
     }
 }
        /// <summary>
        /// Read a library inventory folder from a loaded configuration
        /// </summary>
        /// <param name="source"></param>
        void ReadFolderFromConfig(IConfig config, string path)
        {
            var folderInfo = new InventoryFolderImpl();

            folderInfo.ID = new UUID(config.GetString("folderID", UUID.Random().ToString()));
            folderInfo.Name = config.GetString("name", "unknown");
            folderInfo.ParentID = new UUID (config.GetString ("parentFolderID", UUID.Zero.ToString ()));
            folderInfo.Type = (short)config.GetInt("type", 8);

            folderInfo.Owner = m_service.LibraryOwner;
            folderInfo.Version = 1;

            m_inventoryService.AddFolder(folderInfo);
        }
        /// <summary>
        ///     Create a new subfolder.
        /// </summary>
        /// <param name="folderID"></param>
        /// <param name="folderName"></param>
        /// <param name="type"></param>
        /// <returns>The newly created subfolder.  Returns null if the folder already exists</returns>
        public InventoryFolderImpl CreateChildFolder(UUID folderID, string folderName, ushort type)
        {
            lock (m_childFolders)
            {
                if (!m_childFolders.ContainsKey(folderID))
                {
                    InventoryFolderImpl subFold = new InventoryFolderImpl
                                                      {
                                                          Name = folderName,
                                                          ID = folderID,
                                                          Type = (short) type,
                                                          ParentID = this.ID,
                                                          Owner = Owner
                                                      };
                    m_childFolders.Add(subFold.ID, subFold);

                    return subFold;
                }
            }

            return null;
        }