internal static IEnumerable <string> InternalEnumeratePaths( string path, string searchPattern, SearchTarget searchTarget, EnumerationOptions options) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (searchPattern == null) { throw new ArgumentNullException(nameof(searchPattern)); } FileSystemEnumerableFactory.NormalizeInputs(ref path, ref searchPattern, options); switch (searchTarget) { case SearchTarget.Files: return(FileSystemEnumerableFactory.UserFiles(path, searchPattern, options)); case SearchTarget.Directories: return(FileSystemEnumerableFactory.UserDirectories(path, searchPattern, options)); case SearchTarget.Both: return(FileSystemEnumerableFactory.UserEntries(path, searchPattern, options)); default: throw new ArgumentOutOfRangeException(nameof(searchTarget)); } }
internal static IEnumerable <FileSystemInfo> InternalEnumerateInfos( string path, string searchPattern, SearchTarget searchTarget, EnumerationOptions options) { Debug.Assert(path != null); if (searchPattern == null) { throw new ArgumentNullException(nameof(searchPattern)); } FileSystemEnumerableFactory.NormalizeInputs(ref path, ref searchPattern, options); switch (searchTarget) { case SearchTarget.Directories: return(FileSystemEnumerableFactory.DirectoryInfos(path, searchPattern, options)); case SearchTarget.Files: return(FileSystemEnumerableFactory.FileInfos(path, searchPattern, options)); case SearchTarget.Both: return(FileSystemEnumerableFactory.FileSystemInfos(path, searchPattern, options)); default: throw new ArgumentException(SR.ArgumentOutOfRange_Enum, nameof(searchTarget)); } }
internal static IEnumerable <string> InternalEnumeratePaths( string path, string searchPattern, SearchTarget searchTarget, EnumerationOptions options) { ArgumentNullException.ThrowIfNull(path); ArgumentNullException.ThrowIfNull(searchPattern); FileSystemEnumerableFactory.NormalizeInputs(ref path, ref searchPattern, options.MatchType); return(searchTarget switch { SearchTarget.Files => FileSystemEnumerableFactory.UserFiles(path, searchPattern, options), SearchTarget.Directories => FileSystemEnumerableFactory.UserDirectories(path, searchPattern, options), SearchTarget.Both => FileSystemEnumerableFactory.UserEntries(path, searchPattern, options), _ => throw new ArgumentOutOfRangeException(nameof(searchTarget)), });
private IEnumerable <FileSystemInfo> InternalEnumerateInfos( string path, string searchPattern, SearchTarget searchTarget, EnumerationOptions options) { ArgumentNullException.ThrowIfNull(searchPattern); Debug.Assert(path != null); _isNormalized &= FileSystemEnumerableFactory.NormalizeInputs(ref path, ref searchPattern, options.MatchType); return(searchTarget switch { SearchTarget.Directories => FileSystemEnumerableFactory.DirectoryInfos(path, searchPattern, options, _isNormalized), SearchTarget.Files => FileSystemEnumerableFactory.FileInfos(path, searchPattern, options, _isNormalized), SearchTarget.Both => FileSystemEnumerableFactory.FileSystemInfos(path, searchPattern, options, _isNormalized), _ => throw new ArgumentException(SR.ArgumentOutOfRange_Enum, nameof(searchTarget)), });