- bscodegrep_src.zip
- app.config
- BSCodeGrep.csproj
- BSCodeGrep.csproj.user
- Classes
- folder_explore copy.ico
- Forms
- icons
- add.png
- application_form.png
- arrow_right.png
- BSLogo.jpg
- delete.png
- exclamation.png
- find.png
- folder.png
- folder_explore copy.ico
- folder_explore.png
- folder_page.png
- information.png
- lightning.png
- magnifier.png
- note_edit.png
- package_system.png
- page_save.png
- script_go.png
- star.png
- Program.cs
- Properties
- vs2008_add-in.zip
- BSCodeGrep.exe
- BSCodeGrep.pdb
- CodeSearchAddIn.AddIn
- CodeSearchAddIn.dll
- BSCodeGrep.zip
- BSCodeGrep
- branches
- 0.9 VS Add-In
- BSCodeGrep
- app.config
- BSCodeGrep.csproj
- Classes
- folder_explore copy.ico
- Forms
- icons
- add.png
- application_form.png
- arrow_right.png
- delete.png
- find.png
- folder.png
- folder_explore copy.ico
- folder_explore.png
- folder_page.png
- information.png
- lightning.png
- magnifier.png
- note_edit.png
- package_system.png
- star.png
- Program.cs
- Properties
- CodeSearchAddIn.sln
- CodeSearchAddIn
- tags
- trunk
- BSCodeGrep.sln
- BSCodeGrep
- app.config
- bin
- BSCodeGrep.csproj
- Classes
- folder_explore copy.ico
- Forms
- icons
- add.png
- application_form.png
- arrow_right.png
- delete.png
- find.png
- folder.png
- folder_explore copy.ico
- folder_explore.png
- folder_page.png
- information.png
- lightning.png
- magnifier.png
- note_edit.png
- package_system.png
- script_go.png
- star.png
- Program.cs
- Properties
|
// BaileySoft Super Code Search
// Copyright (c) 2008, BSLTD
// nealbailey@hotmail.com - All rights reserved.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace BSCodeGrep
{
public partial class Form2 : Form
{
#region constructors
public Form2()
{
InitializeComponent();
m_uso = new IOWorker.SearchSettings();
LoadUserSettings();
}
#endregion
#region public properties
public IOWorker.SearchSettings Uso
{
get { return m_uso; }
}
#endregion
#region private methods
private void LoadUserSettings()
{
_appSettings = new CAppSettings();
_appSettings.Reload();
_appSettings.SearchPaths.Reverse();
_appSettings.SearchFilters.Reverse();
_appSettings.SearchPatterns.Reverse();
_appSettings.ReplacementStrings.Reverse();
comboBox1.Items.AddRange(_appSettings.SearchPaths.ToArray());
comboBox2.Items.AddRange(_appSettings.SearchFilters.ToArray());
comboBox3.Items.AddRange(_appSettings.SearchPatterns.ToArray());
comboBox4.Items.AddRange(_appSettings.ReplacementStrings.ToArray());
}
private bool ValidateAndPersistControls()
{
bool isValid = false;
if (comboBox1.Text != "" || comboBox2.Text != "" || comboBox3.Text != "")
{
if (!comboBox1.Items.Contains(comboBox1.Text) && !String.IsNullOrEmpty(comboBox1.Text))
{
comboBox1.Items.Insert(0, comboBox1.Text);
_appSettings.SearchPaths.Add(comboBox1.Text);
if (comboBox1.Text.Substring(comboBox1.Text.Length - 1) == "\\")
comboBox1.Text = comboBox1.Text.Remove(comboBox1.Text.Length - 1);
}
if (!comboBox2.Items.Contains(comboBox2.Text) && !String.IsNullOrEmpty(comboBox2.Text))
{
comboBox2.Items.Insert(0, comboBox2.Text);
_appSettings.SearchFilters.Add(comboBox2.Text);
}
if (!comboBox3.Items.Contains(comboBox3.Text) && !String.IsNullOrEmpty(comboBox3.Text))
{
comboBox3.Items.Insert(0, comboBox3.Text);
_appSettings.SearchPatterns.Add(comboBox3.Text);
}
if (!comboBox4.Items.Contains(comboBox4.Text) && !String.IsNullOrEmpty(comboBox4.Text))
{
comboBox4.Items.Insert(0, comboBox4.Text);
_appSettings.ReplacementStrings.Add(comboBox4.Text);
}
_appSettings.Save();
isValid = true;
}
return isValid;
}
#endregion
#region private events
//Browse Folder Dialog Button
private void button1_Click(object sender, EventArgs e)
{
folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
folderBrowserDialog1.Description = "Starting Search Location";
folderBrowserDialog1.ShowNewFolderButton = false;
DialogResult result = folderBrowserDialog1.ShowDialog();
if (result == DialogResult.OK)
{
comboBox1.Text = folderBrowserDialog1.SelectedPath;
}
}
//Apply Button Clicked
private void button2_Click(object sender, EventArgs e)
{
if (ValidateAndPersistControls())
{
string[] filters;
if (comboBox2.Text.IndexOf(" ") > -1)
filters = comboBox2.Text.Split(' ');
else
filters = new string[] { comboBox2.Text };
m_uso.SearchPath = comboBox1.Text;
m_uso.SearchFilters = filters;
m_uso.SearchPattern = comboBox3.Text;
m_uso.NamesOnly = false;
m_uso.CaseInsensative = false;
m_uso.Replacement = comboBox4.Text;
m_uso.Scope = IOWorker.RegExSearchScope.SINGLE_LINE;
if (checkBox1.Checked)
m_uso.CaseInsensative = true;
if (checkBox2.Checked)
m_uso.NamesOnly = true;
if (checkBox3.Checked)
m_uso.Scope = IOWorker.RegExSearchScope.MULTI_LINE;
}
this.Hide();
}
//Clear User Settings History
private void button3_Click(object sender, EventArgs e)
{
_appSettings.SearchPaths.Clear();
_appSettings.SearchFilters.Clear();
_appSettings.SearchPatterns.Clear();
_appSettings.ReplacementStrings.Clear();
_appSettings.Save();
comboBox1.Items.Clear();
comboBox2.Items.Clear();
comboBox3.Items.Clear();
comboBox1.Text = "";
comboBox2.Text = "";
comboBox3.Text = "";
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
checkBox3.Checked = false;
checkBox4.Checked = false;
}
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
if (checkBox3.Checked)
{
checkBox4.Checked = false;
checkBox2.Checked = false;
}
}
private void checkBox4_CheckedChanged(object sender, EventArgs e)
{
if (checkBox4.Checked)
{
checkBox2.Checked = false;
checkBox3.Checked = false;
}
}
#endregion
#region private fields
private CAppSettings _appSettings = null;
private IOWorker.SearchSettings m_uso;
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm a professional .NET software developer and proud military veteran. I've been in the software business for 20+ years now and if there's one lesson I have learned over the years, its that in this industry you have to be prepared to be humbled from time to time and never stop learning!