Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            buttonASC.Checked = true;

            limitTB.Text = "100";

            label3.Text = "Count: ";

            timer1.Enabled = true;

            radioButton1.Checked = true;

            dbDroplist    = TestToConnectMySQLServer.FillData(showDB, connection);
            tableDroplist = TestToConnectMySQLServer.FillData(showTables + db, connection);


            foreach (DataRow _ in dbDroplist.Rows)
            {
                string db = _["Database"].ToString();

                comboBox3.Items.Add(db);
            }


            comboBox3.SelectedItem = db;
        }
Esempio n. 2
0
        private void GetTable()
        {
            CreateSQL();

            connection = TestToConnectMySQLServer.OpenConnection(Form2.server, Form2.port, db, Form2.userID, Form2.password);

            if (checkBox1.Checked)
            {
                searchList = TestToConnectMySQLServer.FillData(dbSQLEditor, connection);
            }
            else
            {
                searchList = TestToConnectMySQLServer.FillData(dbSQL, connection);
            }
        }
Esempio n. 3
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                useSQLEditor = true;
                connection   = TestToConnectMySQLServer.OpenConnection(Form2.server, Form2.port, db, Form2.userID, Form2.password);
            }

            else
            {
                useSQLEditor = false;
            }


            CreateSQL();

            Form5 form5 = new Form5();

            form5.Show();
        }
Esempio n. 4
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            db = comboBox3.SelectedItem.ToString();

            comboBox1.Items.Clear();
            comboBox2.Items.Clear();

            radioButton1.Checked = true;

            checkedListBox1.Items.Clear();
            dataGridView2.DataSource = null;

            tableDroplist = TestToConnectMySQLServer.FillData(showTables + db, connection);

            foreach (DataRow _ in tableDroplist.Rows)
            {
                string table = _["Tables_in_" + db].ToString();

                comboBox1.Items.Add(table);
            }
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true)
            {
                File.WriteAllText(path_Server, textBox1.Text);
                File.WriteAllText(path_Port, textBox2.Text);
                File.WriteAllText(path_Database, textBox3.Text);



                byte[] userID   = Encoding.UTF8.GetBytes(textBox4.Text);
                byte[] password = Encoding.UTF8.GetBytes(textBox5.Text);

                byte[] entropy = new byte[20];

                using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
                {
                    rng.GetBytes(entropy);
                }

                byte[] cipherUserID   = ProtectedData.Protect(userID, entropy, DataProtectionScope.CurrentUser);
                byte[] cipherPassword = ProtectedData.Protect(password, entropy, DataProtectionScope.CurrentUser);

                File.WriteAllBytes(path_entropy, entropy);
                File.WriteAllBytes(path_UserID, cipherUserID);
                File.WriteAllBytes(path_Password, cipherPassword);
            }

            connection = TestToConnectMySQLServer.OpenConnection(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text);

            try
            {
                string accessPaths = GlobalCryptography.Decrypt(File.ReadAllText(path_access));

                string[] accessPath = accessPaths.Split('\n');

                bool pathExist = false;

                foreach (string _ in accessPath)
                {
                    if (_ == Directory.GetCurrentDirectory())
                    {
                        pathExist = true;
                    }
                }

                if (connection.State == ConnectionState.Open && pathExist)
                {
                    server   = textBox1.Text;
                    port     = textBox2.Text;
                    db       = textBox3.Text;
                    userID   = textBox4.Text;
                    password = textBox5.Text;


                    Hide();

                    Form1 f1 = new Form1();

                    f1.Show();

                    File.AppendAllText(path_logger, DateTime.Now + "|" + WindowsIdentity.GetCurrent().Name + "|" + Environment.MachineName + "|" + Directory.GetCurrentDirectory() + "\n");
                }

                else
                {
                    MessageBox.Show("Current Path is Not Allowed", "Information");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 6
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            setConditionTable = new DataTable();
            setConditionTable.Rows.Add();
            setConditionTable.Rows.Add();

            comboBox2.Items.Clear();

            radioButton1.Checked = true;

            dbTable = comboBox1.SelectedItem.ToString();

            string dbFields = "show fields from " + dbTable + " from " + db;

            tableFields = TestToConnectMySQLServer.FillData(dbFields, connection);

            DataTable dataTable = tableFields.Copy();

            foreach (DataColumn _ in tableFields.Columns)
            {
                if (_.ColumnName != "Field")
                {
                    dataTable.Columns.Remove(_.ColumnName);
                }
            }

            dataGridView2.DataSource = dataTable.DefaultView;

            checkedListBox1.Items.Clear();

            int i = 0;

            foreach (DataRow dataRow in tableFields.Rows)
            {
                setConditionTable.Columns.Add(dataRow["Field"].ToString(), typeof(string));


                checkedListBox1.Items.Add(dataRow["Field"]);
                checkedListBox1.SetItemChecked(i++, true);

                comboBox2.Items.Add(dataRow["Field"]);
            }



            foreach (DataRow dataRow in tableFields.Rows)
            {
                comboBox2.SelectedItem = dataRow["Field"].ToString();

                if (dataRow["Field"].ToString() == "Time")
                {
                    comboBox2.SelectedItem = dataRow["Field"].ToString();
                    break;
                }
                else if (dataRow["Field"].ToString() == "ID")
                {
                    comboBox2.SelectedItem = dataRow["Field"].ToString();
                    break;
                }
                else if (dataRow["Field"].ToString() == "Id")
                {
                    comboBox2.SelectedItem = dataRow["Field"].ToString();
                    break;
                }
                else
                {
                }
            }
        }