private void btnSave_Click(object sender, EventArgs e) { try { string[] nl = { "SqlConnectionString", "CreatedBy", "CreatedDate" }; string[] vl = { Kryptos.Encrypt(SqlConnectionString, Kryptos.GetHardwareID()), Environment.UserName, DateTime.Now.ToString("F") }; XmlConfigurator.Write("Connections\\" + txtConnectionName.Text + ".config", nl, vl); if (File.Exists("Connections\\" + txtConnectionName.Text + ".config")) { MessageBox.Show("Connection Saved", "New Connection", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
// Encrypts a string using laim.utility public static string Encrypt(string value) { return(Kryptos.Encrypt(value, Kryptos.GetHardwareID())); }