コード例 #1
0
        /// <summary>
        /// Gets allowed children of an item
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="indexBy">The index by.</param>
        /// <returns>IEnumerable{BaseItem}.</returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public virtual IEnumerable <BaseItem> GetChildren(User user, string indexBy = null)
        {
            if (user == null)
            {
                throw new ArgumentNullException();
            }

            //the true root should return our users root folder children
            if (IsPhysicalRoot)
            {
                return(user.RootFolder.GetChildren(user, indexBy));
            }

            IEnumerable <BaseItem> result = null;

            if (!string.IsNullOrEmpty(indexBy))
            {
                result = GetIndexedChildren(user, indexBy);
            }

            // If indexed is false or the indexing function is null
            if (result == null)
            {
                result = ActualChildren.Where(c => c.IsVisible(user));
            }

            return(result);
        }
コード例 #2
0
        protected void RemoveChildrenInternal(IEnumerable <BaseItem> children)
        {
            var ids = children.Select(i => i.Id).ToList();

            lock (_childrenSyncLock)
            {
                _children = ActualChildren.Where(i => !ids.Contains(i.Id)).ToList();
            }
        }
コード例 #3
0
ファイル: Folder.cs プロジェクト: ilovejs/MediaBrowser
 public IEnumerable <BaseItem> GetHiddenChildren()
 {
     return(ActualChildren.Where(i => i.IsHidden));
 }