public void TestFind()
 {
     FindFileOptions o = new FindFileOptions(@"testfiles\files1", new string[] {}, new string[] {});
     var f = new FileMatcher(o);
     var r = new List<string>(f.Filter());
     Assert.Equal(3, r.Count);
 }
Exemple #2
0
 public Finder(FindFileOptions fileOptions, FindLineOptions lineOptions)
 {
     this.fileOptions = fileOptions;
     this.lineOptions = lineOptions;
 }
        private void RunReplace()
        {
            SavePrefsToRegistry();
            SetButtonsEnabled(false);

            var fileOptions = new FindFileOptions(
                comboSearchPath.Text,
                Util.ParseSearchExtensions(comboSearchExtensions.Text),
                Util.SplitDirectoryExcludes(comboExcludeDirectories.Text));

            var lineOptions = new FindLineOptions(
                SearchText,
                checkMatchCase.Checked,
                checkUseRegex.Checked,
                comboReplaceWith.Text);

            RunFinderAsync(fileOptions, lineOptions);
        }
        private void RunFinderAsync(FindFileOptions fileOptions, FindLineOptions lineOptions)
        {
            var finder = new Finder(fileOptions, lineOptions);
            finder.FileScanned += OnFinderOnFileScanned;

            // Do the find in the background
            var b = new BackgroundWorker();
            b.DoWork += delegate { finder.Find(); };
            b.RunWorkerCompleted += delegate { SafeInvoke(WorkerFinished); };
            b.RunWorkerAsync();
        }