public string MySqlConnectionString()//Methode: MySQL Verbindungs Daten { string[] ConnectionData = null; string user = null, key = null; if (File.Exists(@"./settings.ini")) { ConnectionData = File.ReadAllText(@"./settings.ini").Split(';'); Crypto_AES crypto = new Crypto_AES(); //Methode zu Verschlusselung von Daten user = crypto.decrypt(ConnectionData[3]); //der entschlüsselte User key = crypto.decrypt(ConnectionData[4]); //das entschlüsselte Password } else { MessageBox.Show("Es wurde noch keine Datenbank angeben. Bitte geben Sie eine Datenbank an!", "Datenkank angeben", MessageBoxButtons.OK, MessageBoxIcon.Information); Environment.Exit(0); } if (ConnectionData[0] == "MySQL" || ConnectionData[0] == "MariaDB") { string myConnectionString = "SERVER=" + ConnectionData[1] + ";DATABASE=" + ConnectionData[2] + ";UID=" + user + ";PASSWORD="******";Charset=utf8"; return(myConnectionString); } return(null); }
private void DB_Setings_Load(object sender, EventArgs e) { if (File.Exists(@"./settings.ini")) { string[] ConnectionData = File.ReadAllText(@"./settings.ini").Split(';'); //Array erzeugen mit den Daten zum aufbau einer Verbindung mit einer Datenbank Crypto_AES crypto = new Crypto_AES(); //Methode zu Verschlusselung von Daten wtxtDB_Typ.Text = ConnectionData[0]; txtDB_IP.Text = ConnectionData[1]; txtDB.Text = ConnectionData[2]; txtUser.Text = crypto.decrypt(ConnectionData[3]); txtKey.Text = crypto.decrypt(ConnectionData[4]); } }