Example #1
0
        private void Write_Click(object sender, EventArgs e)
        {
            uint[] SpellFamilyFlags = _tvFamilyTree.GetMask();
            // spell comment
            var comment = String.Format("-- ({0}) {1}", ProcInfo.SpellProc.ID, ProcInfo.SpellProc.SpellNameRank);
            // drop query
            var drop = String.Format("DELETE FROM `spell_proc_event` WHERE `entry` IN ({0});", ProcInfo.SpellProc.ID);
            // insert query
            var insert = String.Format("INSERT INTO `spell_proc_event` VALUES ({0}, 0x{1:X2}, 0x{2:X2}, 0x{3:X8}, 0x{4:X8}, 0x{5:X8}, 0x{6:X8}, 0x{7:X8}, 0x{8:X8}, 0x{9:X8}, 0x{10:X8}, 0x{11:X8}, 0x{12:X8}, 0x{13:X8}, {14}, {15}, {16});",
                                       ProcInfo.SpellProc.ID,
                                       _clbSchools.GetFlagsValue(),
                                       _cbProcFitstSpellFamily.SelectedValue.ToUInt32(),
                                       SpellFamilyFlags[0],
                                       0, 0,
                                       SpellFamilyFlags[1],
                                       0, 0,
                                       SpellFamilyFlags[2],
                                       0, 0,// пока что так, пока не пойму как...
                                       _clbProcFlags.GetFlagsValue(),
                                       _clbProcFlagEx.GetFlagsValue(),
                                       _tbPPM.Text.Replace(',', '.'),
                                       _tbChance.Text.Replace(',', '.'),
                                       _tbCooldown.Text.Replace(',', '.'));

            _rtbSqlLog.AppendText(comment + "\r\n" + drop + "\r\n" + insert + "\r\n\r\n");
            _rtbSqlLog.ColorizeCode();
            if (MySQLConnect.Connected)
            {
                MySQLConnect.Insert(drop + insert);
            }

            ((Button)sender).Enabled = false;
        }
Example #2
0
        private void _bSaveSettings_Click(object sender, EventArgs e)
        {
            Settings.Default.Host         = _tbHost.Text;
            Settings.Default.Port         = _tbPort.Text;
            Settings.Default.User         = _tbUser.Text;
            Settings.Default.Pass         = _tbPass.Text;
            Settings.Default.Db_mangos    = _tbBase.Text;
            Settings.Default.UseDbConnect = _cbUseDBConnect.Checked;

            MySQLConnect.TestConnect();

            if (((Button)sender).Text != "Save")
            {
                if (MySQLConnect.Connected)
                {
                    MessageBox.Show("Connection is successfully!", "MySQL Connections!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Connection is failed!", "ERROR!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            if (((Button)sender).Text == "Save")
            {
                Settings.Default.Save();
                Close();
            }
        }
Example #3
0
 private void SqlToBase_Click(object sender, EventArgs e)
 {
     if (MySQLConnect.Connected)
     {
         MySQLConnect.Insert(_rtbSqlLog.Text);
     }
     else
     {
         MessageBox.Show("Can't connect to database!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #4
0
        private void _Connected_Click(object sender, EventArgs e)
        {
            MySQLConnect.TestConnect();

            if (MySQLConnect.Connected)
            {
                MessageBox.Show("Connection is successfully!", "MySQL Connections!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Connection is failed!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            ConnStatus();
        }
Example #5
0
        private void ConnStatus()
        {
            MySQLConnect.TestConnect();

            if (MySQLConnect.Connected)
            {
                _dbConnect.Text      = "Connection is successfully";
                _dbConnect.ForeColor = Color.Green;
                // read db data
                DBC.ItemTemplate = MySQLConnect.SelectItems();
            }
            else
            {
                _dbConnect.Text      = "No DB Connected";
                _dbConnect.ForeColor = Color.Red;
            }
        }
Example #6
0
        private void Select_Click(object sender, EventArgs e)
        {
            if (!MySQLConnect.Connected)
            {
                MessageBox.Show("Can't connect to database!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            StringBuilder sb      = new StringBuilder("WHERE  ");
            string        compare = _cbBinaryCompare.Checked ? "&" : "=";

            if (_cbSqlSpellFamily.SelectedValue.ToInt32() != -1)
            {
                sb.AppendFormat(" SpellFamilyName = {0} &&", _cbSqlSpellFamily.SelectedValue.ToInt32());
            }

            sb.AppendFormatIfNotNull(" SchoolMask {1} {0} &&", _tbSqlSchool.Text.ToInt32(), compare);
            sb.AppendFormatIfNotNull(" procFlags {1} {0} &&", _tbSqlProc.Text.ToInt32(), compare);
            sb.AppendFormatIfNotNull(" procEx {1} {0} &&", _tbSqlProcEx.Text.ToInt32(), compare);
            sb.AppendFormatIfNotNull(" entry {1} {0} &&", _tbSqlSpellid.Text.ToInt32(), compare);

            String subquery = sb.ToString().Remove(sb.Length - 2, 2);

            subquery = subquery == "WHERE" ? "" : subquery;

            String query = String.Format("SELECT * FROM `spell_proc_event` {0} ORDER BY entry", subquery);

            MySQLConnect.SelectProc(query);

            _lvDataList.VirtualListSize = MySQLConnect.SpellProcEvent.Count;
            if (_lvDataList.SelectedIndices.Count > 0)
            {
                _lvDataList.Items[_lvDataList.SelectedIndices[0]].Selected = false;
            }

            // check bad spell and drop
            foreach (String str in MySQLConnect.Dropped)
            {
                _rtbSqlLog.AppendText(str);
            }
        }