コード例 #1
0
        private void findButton_Click(object sender, EventArgs e)
        {
            // Disable Controls
            directoryPickerButton.Enabled     = false;
            searchFileContentCheckBox.Enabled = false;
            findButton.Enabled = false;

            string sourcePath = startDirectoryTextBox.Text.Trim();

            finder.StartDirectory    = new DirectoryInfo(sourcePath);
            finder.SearchFileContent = searchFileContentCheckBox.Checked;
            finder.Start();

            if (patternFilterComboBox.SelectedIndex != 0)
            {
                PatternDefinition pattern = (PatternDefinition)patternFilterComboBox.SelectedItem;
                finder.Filter(pattern);
            }

            WriteResultsToListBox();

            // Enable Controls
            directoryPickerButton.Enabled     = true;
            searchFileContentCheckBox.Enabled = true;
            findButton.Enabled            = true;
            patternFilterComboBox.Enabled = true;
        }
コード例 #2
0
 public void AddPossiblePattern(PatternDefinition pattern)
 {
     if (!possiblePatterns.Contains(pattern))
     {
         possiblePatterns.Add(pattern);
     }
 }
コード例 #3
0
 public void Filter(PatternDefinition pattern)
 {
     results.Clear();
     foreach (PatternFinderResult result in internalResults)
     {
         if (result.PossiblePatterns.Contains(pattern))
         {
             results.Add(result);
         }
     }
 }
コード例 #4
0
 private void patternFilterComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (resultsListBox.Items.Count == 0) // Nothing to filter
     {
         return;
     }
     if (patternFilterComboBox.SelectedIndex == 0) // Reset filter
     {
         finder.ResetFilter();
     }
     else // Do filter
     {
         PatternDefinition pattern = (PatternDefinition)patternFilterComboBox.SelectedItem;
         finder.Filter(pattern);
     }
     WriteResultsToListBox();
 }