/// <summary>Constructs the <see cref="AllDepthsPathEnumerator"/>.</summary> /// /// <param name="search">The information about the search.</param> public AllDepthsPathEnumerator(SearchInfo search) { this.search = search; currentState = new EnumerationPathState(search); currentEnumerator = currentState.Enumerator; stateQueue = new Queue <EnumerationPathState>(); stateQueue.Enqueue(currentState); }
/// <summary>Constructs the <see cref="AllSubdirectoriesPathEnumerator"/>.</summary> /// /// <param name="search">The information about the search.</param> public AllSubdirectoriesPathEnumerator(SearchInfo search) { this.search = search; currentState = new EnumerationPathState(search); currentEnumerator = currentState.Enumerator; stateStack = new Stack <EnumerationPathState>(); stateStack.Push(currentState); }
/// <summary>Constructs the <see cref="AllDirectoriesInfoEnumerator"/>.</summary> /// /// <param name="search">The information about the search.</param> public AllDirectoriesInfoEnumerator(SearchInfo search) { this.search = search; currentState = new EnumerationInfoState(search); currentEnumerator = currentState.Enumerator; stateList = new List <EnumerationInfoState> { currentState }; stateIndex = 0; }
/// <summary>Constructs the <see cref="SearchInfo"/> enumerable.</summary> /// /// <param name="path"> /// The relative or absolute path to the directory to search. This string is not case-sensitive. /// </param> /// <param name="baseSearch">The base search state to base this state off of.</param> public SearchInfo(string path, SearchInfo baseSearch) { Path = path; SearchPattern = baseSearch.SearchPattern; Files = baseSearch.Files; Subdirs = baseSearch.Subdirs; SearchOrder = baseSearch.SearchOrder; IgnoreCase = baseSearch.IgnoreCase; Regex = baseSearch.Regex; IsCustomRegex = baseSearch.IsCustomRegex; }
/// <summary>Constructs the <see cref="FilePathEnumerable"/>.</summary> /// /// <param name="path"> /// The relative or absolute path to the directory to search. This string is not case-sensitive. /// </param> /// <param name="searchPattern"> /// The search string to match against file-system entries in path. This parameter can contain a /// combination of valid literal path and wildcard (* and ?) characters (see Remarks), but doesn't /// support regular expressions. /// </param> /// <param name="files">True if files are returned.</param> /// <param name="subdirs">True if directories are returned.</param> /// <param name="searchOrder">How subdirectories should be searched, if at all.</param> /// <param name="ignoreCase">True if pattern casing should be ignored.</param> public FilePathEnumerable(string path, string searchPattern, bool files, bool subdirs, SearchOrder searchOrder, bool ignoreCase) { if (!Enum.IsDefined(typeof(SearchOrder), searchOrder)) { throw new ArgumentException(nameof(searchOrder)); } if (!files && !subdirs) { throw new ArgumentException($"{nameof(files)} or {nameof(subdirs)} must be true!"); } search = new SearchInfo(path, searchPattern, files, subdirs, searchOrder, ignoreCase); }
/// <summary>Constructs the <see cref="CurrentInfoEnumerator"/>.</summary> /// /// <param name="search">The information about the search.</param> public CurrentInfoEnumerator(SearchInfo search) { this.search = search; }
/// <summary>Constructs the <see cref="FilePathEnumerable"/>.</summary> /// /// <param name="path"> /// The relative or absolute path to the directory to search. This string is not case-sensitive. /// </param> /// <param name="regex">The regex expression to match with.</param> /// <param name="files">True if files are returned.</param> /// <param name="subdirs">True if directories are returned.</param> /// <param name="searchOrder">How subdirectories should be searched, if at all.</param> /// <param name="ignoreCase">True if pattern casing should be ignored.</param> public FilePathEnumerable(string path, Regex regex, bool files, bool subdirs, SearchOrder searchOrder) { search = new SearchInfo(path, regex, files, subdirs, searchOrder); }
/// <summary>Constructs the <see cref="FileInfoEnumerable"/>.</summary> /// /// <param name="path"> /// The relative or absolute path to the directory to search. This string is not case-sensitive. /// </param> /// <param name="searchPattern"> /// The search string to match against file-system entries in path. This parameter can contain a /// combination of valid literal path and wildcard (* and ?) characters (see Remarks), but doesn't /// support regular expressions. /// </param> /// <param name="files">True if files are returned.</param> /// <param name="subdirs">True if directories are returned.</param> /// <param name="searchOrder">How subdirectories should be searched, if at all.</param> /// <param name="ignoreCase">True if pattern casing should be ignored.</param> public FileInfoEnumerable(string path, string searchPattern, bool files, bool subdirs, SearchOrder searchOrder, bool ignoreCase) { search = new SearchInfo(path, searchPattern, files, subdirs, searchOrder, ignoreCase); }