示例#1
0
        /// <summary>
        /// Gets the files and sub-folders in the current folder.
        /// </summary>
        /// <returns>
        /// A list of the files and folders
        ///     in the current folder.
        ///     The list is of type <see cref="IReadOnlyList&lt;IStorageItem&gt;"/>.
        ///     Each item in the list is represented by an <see cref="IStorageItem"/> object.
        /// </returns>
        public IReadOnlyCollection <IStorageItem> GetItems
            (SearchOption option = SearchOption.TopDirectoryOnly)
        {
            IEnumerable <IStorageItem> files   = GetFiles(option);
            IEnumerable <IStorageItem> folders = GetFolders(option);

            return(files.Concat(folders).NaturalOrderBy(i => i.Path).ToList().AsReadOnly());
        }
示例#2
0
        /// <summary>
        /// Gets the sub-folders in the current folder.
        /// </summary>
        /// <returns>
        /// A list of the sub-folders
        ///     in the current folder.
        ///     The list is of type <see cref="IReadOnlyList&lt;IFolder&gt;"/>
        ///     . Each folder in the list is represented by a <see cref="IFolder"/> object.
        /// </returns>
        public IReadOnlyCollection <IFolder> GetFolders
            (SearchOption option = SearchOption.TopDirectoryOnly)
        {
            var baseFolders = BaseStorageItem.EnumerateDirectories("*", (SysIO.SearchOption)option);

            return(baseFolders.Select(baseFolder => new Folder(baseFolder)).
                   NaturalOrderBy(f => f.Path).ToList().AsReadOnly());
        }