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; }
public void AddPossiblePattern(PatternDefinition pattern) { if (!possiblePatterns.Contains(pattern)) { possiblePatterns.Add(pattern); } }
public void Filter(PatternDefinition pattern) { results.Clear(); foreach (PatternFinderResult result in internalResults) { if (result.PossiblePatterns.Contains(pattern)) { results.Add(result); } } }
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(); }