コード例 #1
0
 protected override CMS.IO.FileInfo[] GetFilesInternal(string searchPattern, CMS.IO.SearchOption searchOption)
 {
     return(new Directory().GetFiles(FullName, searchPattern, searchOption).Select(f => new FileInfo(f)).ToArray());
 }
コード例 #2
0
        /// <summary>
        /// Returns an enumerable collection of directory names that match a search pattern in a specified path,
        /// and optionally searches subdirectories.
        /// </summary>
        private IEnumerable <string> EnumerateDirectoriesCore(string path, string searchPattern, CMS.IO.SearchOption searchOption)
        {
            IEnumerable <string> first = null;

            if (ExistsInFileSystem(path))
            {
                first = System.IO.Directory
                        .EnumerateDirectories(path, searchPattern, (System.IO.SearchOption)searchOption)
                        .Select(d => d.ToLowerInvariant());
            }
            path = PathHelper.GetValidPath(path);
            Func <string, bool>  searchCondition = this.GetSearchCondition(searchPattern);
            IEnumerable <string> second          = this.Provider
                                                   .GetObjectsList(path, ObjectTypeEnum.Directories, searchOption == CMS.IO.SearchOption.AllDirectories, true, true)
                                                   .Select(d => d.TrimEnd('\\'))
                                                   .Where(d => searchCondition(CMS.IO.Path.GetFileName(d)))
                                                   .Select(d => d.ToLowerInvariant());

            if (first != null)
            {
                return(first.Union(second, StringComparer.Ordinal));
            }
            return(second);
        }
コード例 #3
0
 /// <summary>
 /// Gets the names of the subdirectories (including their paths) that match the specified search pattern in the current directory,
 /// and optionally searches subdirectories.
 /// </summary>
 /// <param name="path">The relative or absolute path to the directory to search. This string is not case-sensitive.</param>
 /// <param name="searchPattern">Search pattern.</param>
 /// <param name="searchOption">One of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.</param>
 /// <returns>An array of the full names (including paths) of the subdirectories that match the specified criteria, or an empty array if no directories are found.</returns>
 public override string[] GetDirectories(string path, string searchPattern, CMS.IO.SearchOption searchOption)
 {
     string[] array = this.EnumerateDirectoriesCore(path, searchPattern, searchOption).ToArray();
     FileDebug.LogFileOperation(path, nameof(GetDirectories), -1, array.Length.ToString(), null, "Custom Amazon");
     return(array);
 }
コード例 #4
0
 /// <summary>
 /// Returns an enumerable collection of directory names that match a search pattern in a specified path,
 /// and optionally searches subdirectories.
 /// </summary>
 /// <param name="path">The relative or absolute path to the directory to search. This string is not case-sensitive.</param>
 /// <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 should include all subdirectories.</param>
 /// <returns>An enumerable collection of the full names (including paths) for the directories in the directory specified by <paramref name="path" /> and that match the specified search pattern and option.</returns>
 public override IEnumerable <string> EnumerateDirectories(string path, string searchPattern, CMS.IO.SearchOption searchOption)
 {
     FileDebug.LogFileOperation(path, nameof(EnumerateDirectories), -1, null, null, "Custom Amazon");
     return(this.EnumerateDirectoriesCore(path, searchPattern, searchOption));
 }