internal static void Replace( string directoryPath, FileSystemFilter filter, ReplaceOptions?replaceOptions = null, SearchTarget searchTarget = SearchTarget.Files, bool recurseSubdirectories = true, bool dryRun = false, CancellationToken cancellationToken = default) { var searchOptions = new FileSystemSearchOptions( searchTarget: searchTarget, recurseSubdirectories: recurseSubdirectories); var search = new FileSystemSearch( filter, directoryFilter: null, searchProgress: null, options: searchOptions); search.Replace( directoryPath, replaceOptions, progress: null, dryRun: dryRun, cancellationToken: cancellationToken); }
public FileSystemSearch( FileSystemFilter filter, NameFilter?directoryFilter = null, IProgress <SearchProgress>?searchProgress = null, FileSystemSearchOptions?options = null) { Filter = filter ?? throw new ArgumentNullException(nameof(filter)); if (directoryFilter?.Part == FileNamePart.Extension) { throw new ArgumentException($"Directory filter has invalid part '{FileNamePart.Extension}'.", nameof(directoryFilter)); } DirectoryFilter = directoryFilter; SearchProgress = searchProgress; Options = options ?? FileSystemSearchOptions.Default; }