SSQLE  1.0
Simple SQL Editor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SSQLE.ConnectionManager Class Reference

Class representing a manager for connections in SQL editor. More...

Inheritance diagram for SSQLE.ConnectionManager:

Classes

class  ProfilePathPair
 Pair of profile name and profile path to be used in connections frop down list. More...
 

Public Member Functions

 ConnectionManager ()
 Constructs new ConnectionManager. More...
 

Static Public Member Functions

static bool ValidateTextBoxForIdentifier (TextBox textBox)
 Checks whether given textBox text contains valid identifier. More...
 

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Private Member Functions

void UpdateComboBoxItems ()
 Updates items in drop down ComboBox. Is called when connection profile is modified or deleted. More...
 
void cm_profiles_SelectedIndexChanged (object sender, EventArgs e)
 Handler, that is called whenever drop down ComboBox selected index changes. More...
 
void UpdateTextComponents ()
 Updates text TextBox with values from Settings. More...
 
void cm_save_Click (object sender, EventArgs e)
 Handler, that is called when user clicks Save button. More...
 
void UpdateComboBoxSelectedIndex ()
 Changes selected drop down ComboBox inded when connection is modified, so that it still points to the same connection profile. More...
 
void SaveToSettings ()
 Saves current values to settings and encrypts the password. More...
 
void cm_delete_Click (object sender, EventArgs e)
 Handler, that is called when user clicks Delete button. More...
 
void cm_connect_Click (object sender, EventArgs e)
 Handler, that is called when user clicks Connect button. It validates connection parameters and takes care of closing this, and showing Editor form. More...
 
bool ValidateInput (bool validateName=true)
 Validates input the user entered into TextBoxes. Validation of the name is not required when arguments are used to connect, but not to save the connection. More...
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 

Static Private Member Functions

static bool ValidateTextBoxForSid (TextBox textBox)
 Checks whether given textBox text contains valid SID. Decays to ValidateTextBoxForIdentifier. More...
 
static bool ValidateTextBoxForHostname (TextBox textBox)
 Checks whether given textBox text contains valid hostname. More...
 
static bool ValidateTextBoxForPort (TextBox textBox)
 Checks whether given textBox text contains valid port, that is number between PortMin and PortMax inclusive. More...
 

Private Attributes

const int PortMin = 0
 Minimal value for port argument. More...
 
const int PortMax = 65535
 Maximal value for port argument. More...
 
System.ComponentModel.IContainer components = null
 Required designer variable. More...
 
System.Windows.Forms.Label cm_host_lbl
 
System.Windows.Forms.TextBox cm_host
 
System.Windows.Forms.Button cm_connect
 
System.Windows.Forms.ComboBox cm_profiles
 
System.Windows.Forms.TextBox cm_name
 
System.Windows.Forms.Label cm_name_lbl
 
System.Windows.Forms.TextBox cm_pass
 
System.Windows.Forms.Label cm_pass_lbl
 
System.Windows.Forms.TextBox cm_sid
 
System.Windows.Forms.Label cm_sid_lbl
 
System.Windows.Forms.TextBox cm_port
 
System.Windows.Forms.Label cm_port_lbl
 
System.Windows.Forms.Button cm_save
 
System.Windows.Forms.Button cm_delete
 
System.Windows.Forms.TextBox cm_user
 
System.Windows.Forms.Label cm_user_lbl
 

Static Private Attributes

static readonly Regex IdentifierPattern = new Regex("[a-zA-Z0-9_]+")
 Regular expression pattern used to validate identifier. Identifier has to be at least one character long and must contain only alpha numeric characters and underscore. More...
 
static readonly Regex HostnamePattern = new Regex("([a-zA-Z_0-9-]+)((\\.|::?)[a-zA-Z_0-9-]+)*")
 Regular expression pattern used to validate hostname. Matches hostname, IPv4 or IPV6 address More...
 

Detailed Description

Class representing a manager for connections in SQL editor.

Constructor & Destructor Documentation

SSQLE.ConnectionManager.ConnectionManager ( )

Constructs new ConnectionManager.

Member Function Documentation

void SSQLE.ConnectionManager.cm_connect_Click ( object  sender,
EventArgs  e 
)
private

Handler, that is called when user clicks Connect button. It validates connection parameters and takes care of closing this, and showing Editor form.

Parameters
senderButton that triggered the event.
eEvent arguments.
void SSQLE.ConnectionManager.cm_delete_Click ( object  sender,
EventArgs  e 
)
private

Handler, that is called when user clicks Delete button.

Parameters
senderButton that triggered the event.
eEvent arguments.
void SSQLE.ConnectionManager.cm_profiles_SelectedIndexChanged ( object  sender,
EventArgs  e 
)
private

Handler, that is called whenever drop down ComboBox selected index changes.

Parameters
senderComboBox that triggered this event.
eEvent arguments.
void SSQLE.ConnectionManager.cm_save_Click ( object  sender,
EventArgs  e 
)
private

Handler, that is called when user clicks Save button.

Parameters
senderButton that triggered the event.
eEvent arguments.
override void SSQLE.ConnectionManager.Dispose ( bool  disposing)
protected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.
void SSQLE.ConnectionManager.InitializeComponent ( )
private

Required method for Designer support - do not modify the contents of this method with the code editor.

void SSQLE.ConnectionManager.SaveToSettings ( )
private

Saves current values to settings and encrypts the password.

void SSQLE.ConnectionManager.UpdateComboBoxItems ( )
private

Updates items in drop down ComboBox. Is called when connection profile is modified or deleted.

void SSQLE.ConnectionManager.UpdateComboBoxSelectedIndex ( )
private

Changes selected drop down ComboBox inded when connection is modified, so that it still points to the same connection profile.

void SSQLE.ConnectionManager.UpdateTextComponents ( )
private

Updates text TextBox with values from Settings.

bool SSQLE.ConnectionManager.ValidateInput ( bool  validateName = true)
private

Validates input the user entered into TextBoxes. Validation of the name is not required when arguments are used to connect, but not to save the connection.

Parameters
validateNameWhether validation of the name is required.
Returns
True iff all arguments are valid according to their rules.
See also
ValidateTextBoxForIdentifier, ValidateTextBoxForHostname, ValidateTextBoxForSid, ValidateTextBoxForPort
static bool SSQLE.ConnectionManager.ValidateTextBoxForHostname ( TextBox  textBox)
staticprivate

Checks whether given textBox text contains valid hostname.

Parameters
textBoxTextBox to check
Returns
True if text is valid, false otherwise.

HostnamePattern

static bool SSQLE.ConnectionManager.ValidateTextBoxForIdentifier ( TextBox  textBox)
static

Checks whether given textBox text contains valid identifier.

Parameters
textBoxTextBox to check
Returns
True if text is valid, false otherwise.

IdentifierPattern

static bool SSQLE.ConnectionManager.ValidateTextBoxForPort ( TextBox  textBox)
staticprivate

Checks whether given textBox text contains valid port, that is number between PortMin and PortMax inclusive.

Parameters
textBoxTextBox to check
Returns
True if text is valid, false otherwise.

PortMin PortMax

static bool SSQLE.ConnectionManager.ValidateTextBoxForSid ( TextBox  textBox)
staticprivate

Checks whether given textBox text contains valid SID. Decays to ValidateTextBoxForIdentifier.

Parameters
textBoxTextBox to check
Returns
True if text is valid, false otherwise.

Member Data Documentation

System.Windows.Forms.Button SSQLE.ConnectionManager.cm_connect
private
System.Windows.Forms.Button SSQLE.ConnectionManager.cm_delete
private
System.Windows.Forms.TextBox SSQLE.ConnectionManager.cm_host
private
System.Windows.Forms.Label SSQLE.ConnectionManager.cm_host_lbl
private
System.Windows.Forms.TextBox SSQLE.ConnectionManager.cm_name
private
System.Windows.Forms.Label SSQLE.ConnectionManager.cm_name_lbl
private
System.Windows.Forms.TextBox SSQLE.ConnectionManager.cm_pass
private
System.Windows.Forms.Label SSQLE.ConnectionManager.cm_pass_lbl
private
System.Windows.Forms.TextBox SSQLE.ConnectionManager.cm_port
private
System.Windows.Forms.Label SSQLE.ConnectionManager.cm_port_lbl
private
System.Windows.Forms.ComboBox SSQLE.ConnectionManager.cm_profiles
private
System.Windows.Forms.Button SSQLE.ConnectionManager.cm_save
private
System.Windows.Forms.TextBox SSQLE.ConnectionManager.cm_sid
private
System.Windows.Forms.Label SSQLE.ConnectionManager.cm_sid_lbl
private
System.Windows.Forms.TextBox SSQLE.ConnectionManager.cm_user
private
System.Windows.Forms.Label SSQLE.ConnectionManager.cm_user_lbl
private
System.ComponentModel.IContainer SSQLE.ConnectionManager.components = null
private

Required designer variable.

readonly Regex SSQLE.ConnectionManager.HostnamePattern = new Regex("([a-zA-Z_0-9-]+)((\\.|::?)[a-zA-Z_0-9-]+)*")
staticprivate

Regular expression pattern used to validate hostname. Matches hostname, IPv4 or IPV6 address

It is not perfect, but it is sufficent to reject nonsense.

readonly Regex SSQLE.ConnectionManager.IdentifierPattern = new Regex("[a-zA-Z0-9_]+")
staticprivate

Regular expression pattern used to validate identifier. Identifier has to be at least one character long and must contain only alpha numeric characters and underscore.

const int SSQLE.ConnectionManager.PortMax = 65535
private

Maximal value for port argument.

const int SSQLE.ConnectionManager.PortMin = 0
private

Minimal value for port argument.


The documentation for this class was generated from the following files: