Ejemplo n.º 1
0
        protected virtual FileSystemSearch CreateSearch()
        {
            var filter = new FileSystemFilter(
                name: Options.NameFilter,
                part: Options.NamePart,
                extension: Options.ExtensionFilter,
                content: Options.ContentFilter,
                properties: Options.FilePropertyFilter,
                attributes: Options.Attributes,
                attributesToSkip: Options.AttributesToSkip,
                emptyOption: Options.EmptyOption);

            NameFilter?directoryFilter = null;

            if (Options.DirectoryFilter != null)
            {
                directoryFilter = new NameFilter(
                    name: Options.DirectoryFilter,
                    part: Options.DirectoryNamePart);
            }

            var options = new FileSystemSearchOptions(
                searchTarget: Options.SearchTarget,
                recurseSubdirectories: Options.RecurseSubdirectories,
                defaultEncoding: Options.DefaultEncoding);

            return(new FileSystemSearch(
                       filter: filter,
                       directoryFilter: directoryFilter,
                       searchProgress: ProgressReporter,
                       options: options));
        }
Ejemplo n.º 2
0
        public void M2()
        {
            var name = new Filter("pattern", RegexOptions.IgnoreCase);

            var filter = new FileSystemFilter(name);

            //FileSystemSearch.Replace("directoryPath", filter, recurseSubdirectories: false);
        }
Ejemplo n.º 3
0
        public void M()
        {
            var regex = new Regex("pattern", RegexOptions.IgnoreCase);

            var name = new Filter(regex);

            var filter = new FileSystemFilter(name);

            var searchOptions = new FileSystemSearchOptions(recurseSubdirectories: false);

            var search = new FileSystemSearch(filter, options: searchOptions);

            search.Replace("directoryPath", ReplaceOptions.Empty);
        }