Exemplo n.º 1
0
        private void connBtn_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                sshconn = true;
                try
                {
                    using (var client = new SshClient(hostTxt.Text, uidTxt.Text, passwordTxt.Text))
                    {
                        client.Connect();
                        client.Disconnect();
                        MessageBox.Show("logged in!");
                    }
                    LuiceEditor editor = new LuiceEditor(this);
                    editor.Show();
                }
                catch
                {
                    MessageBox.Show("error: check again the data that you inserted and retry.");
                }
            }
            else
            {
                sshconn = false;
                string connection1 = "Server=" + hostTxt.Text + ";Port=" + portTxt.Text + ";Database=" + authTxt.Text + ";UID=" + uidTxt.Text + ";Password="******";";
                string connection2 = "Server=" + hostTxt.Text + ";Port=" + portTxt.Text + ";Database=" + charTxt.Text + ";UID=" + uidTxt.Text + ";Password="******";";
                string connection3 = "Server=" + hostTxt.Text + ";Port=" + portTxt.Text + ";Database=" + worldTxt.Text + ";UID=" + uidTxt.Text + ";Password="******";";
                MySqlConnection conn1 = new MySqlConnection(connection1);
                MySqlConnection conn2 = new MySqlConnection(connection2);
                MySqlConnection conn3 = new MySqlConnection(connection3);

                try
                {
                    //this is needed only to check if inserted data is correct
                    conn1.Open();
                    conn2.Open();
                    conn3.Open();
                    //closing test connections
                    conn1.Close();
                    conn2.Close();
                    conn3.Close();
                    MessageBox.Show("logged in!");
                    //passing method from form1 to LuiceEditor Form
                    LuiceEditor editor = new LuiceEditor(this);
                    editor.Show();
                }
                catch
                {
                    MessageBox.Show("error: check again the data that you inserted and retry.");
                }
                
            }
            
        }
Exemplo n.º 2
0
        private void connBtn_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                sshconn = true;
                try
                {
                    using (var client = new SshClient(hostTxt.Text, uidTxt.Text, passwordTxt.Text))
                    {
                        client.Connect();
                        client.Disconnect();
                        MessageBox.Show("logged in!");
                    }
                    LuiceEditor editor = new LuiceEditor(this);
                    editor.Show();
                }
                catch
                {
                    MessageBox.Show("error: check again the data that you inserted and retry.");
                }
            }
            else
            {
                sshconn = false;
                string          connection1 = "Server=" + hostTxt.Text + ";Port=" + portTxt.Text + ";Database=" + authTxt.Text + ";UID=" + uidTxt.Text + ";Password="******";";
                string          connection2 = "Server=" + hostTxt.Text + ";Port=" + portTxt.Text + ";Database=" + charTxt.Text + ";UID=" + uidTxt.Text + ";Password="******";";
                string          connection3 = "Server=" + hostTxt.Text + ";Port=" + portTxt.Text + ";Database=" + worldTxt.Text + ";UID=" + uidTxt.Text + ";Password="******";";
                MySqlConnection conn1       = new MySqlConnection(connection1);
                MySqlConnection conn2       = new MySqlConnection(connection2);
                MySqlConnection conn3       = new MySqlConnection(connection3);

                try
                {
                    //this is needed only to check if inserted data is correct
                    conn1.Open();
                    conn2.Open();
                    conn3.Open();
                    //closing test connections
                    conn1.Close();
                    conn2.Close();
                    conn3.Close();
                    MessageBox.Show("logged in!");
                    //passing method from form1 to LuiceEditor Form
                    LuiceEditor editor = new LuiceEditor(this);
                    editor.Show();
                }
                catch
                {
                    MessageBox.Show("error: check again the data that you inserted and retry.");
                }
            }
        }