/// <summary>Returns files of the current directory.</summary>
 /// <param name="searchPattern">Search pattern.</param>
 /// <param name="searchOption">Search option.</param>
 protected override CMS.IO.FileInfo[] GetFilesInternal(string searchPattern, CMS.IO.SearchOption searchOption)
 {
     return(this.EnumerateFilesInternal(searchPattern, searchOption).ToArray());
 }
 /// <summary>
 /// Returns an array of directories in the current DirectoryInfo matching the given search criteria and using a value
 /// to determine whether to search subdirectories.
 /// </summary>
 /// <param name="searchPattern">Search pattern.</param>
 /// <param name="searchOption">Specifies whether to search the current directory, or the current directory and all subdirectories.</param>
 protected override CMS.IO.DirectoryInfo[] GetDirectoriesInternal(string searchPattern, CMS.IO.SearchOption searchOption)
 {
     return(this.EnumerateDirectoriesInternal(searchPattern, searchOption).ToArray());
 }
        /// <summary>
        /// Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.
        /// </summary>
        /// <param name="searchPattern">Search pattern.</param>
        /// <param name="searchOption">One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.</param>
        /// <returns>An enumerable collection of directories that matches <paramref name="searchPattern" /> and <paramref name="searchOption" />.</returns>
        protected override IEnumerable <CMS.IO.FileInfo> EnumerateFilesInternal(string searchPattern, CMS.IO.SearchOption searchOption)
        {
            IEnumerable <CMS.IO.FileInfo> first = CMS.IO.Directory
                                                  .EnumerateFiles(this.FullName, searchPattern)
                                                  .Select(f => new FileInfo(f));

            if (searchOption == CMS.IO.SearchOption.AllDirectories)
            {
                IEnumerable <string> source = CMS.IO.Directory.EnumerateDirectories(this.FullName);
                first = first.Concat(source.SelectMany(d => new DirectoryInfo(d).EnumerateFiles(searchPattern, searchOption)));
            }
            return(first);
        }
 /// <summary>
 /// Returns an enumerable collection of file information that matches a specified search pattern and search subdirectory option.
 /// </summary>
 /// <param name="searchPattern">Search pattern.</param>
 /// <param name="searchOption">One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.</param>
 /// <returns>An enumerable collection of files that matches <paramref name="searchPattern" /> and <paramref name="searchOption" />.</returns>
 protected override IEnumerable <CMS.IO.DirectoryInfo> EnumerateDirectoriesInternal(string searchPattern, CMS.IO.SearchOption searchOption)
 {
     return(CMS.IO.Directory.EnumerateDirectories(this.FullName, searchPattern, searchOption)
            .Select(d => new DirectoryInfo(d)));
 }