public static void SelectAIText() { if (!IsConnected) { System.Windows.Forms.MessageBox.Show("No connection to database, please check settings", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string query = "SELECT * FROM creature_ai_texts;"; using (_conn = new MySqlConnection(ConnectionString)) { _command = new MySqlCommand(query, _conn); _conn.Open(); _AIText.Clear(); using (var reader = _command.ExecuteReader()) { while (reader.Read()) { TextAI script = new TextAI(); script.ID = reader[0].ToInt32(); script.ContentDefault = reader[1].ToString(); script.ContentLocale[0] = reader[2].ToString(); script.ContentLocale[1] = reader[3].ToString(); script.ContentLocale[2] = reader[4].ToString(); script.ContentLocale[3] = reader[5].ToString(); script.ContentLocale[4] = reader[6].ToString(); script.ContentLocale[5] = reader[7].ToString(); script.ContentLocale[6] = reader[8].ToString(); script.ContentLocale[7] = reader[9].ToString(); script.Sound = reader[10].ToInt32(); script.Type = reader[11].ToInt32(); script.Lenguage = reader[12].ToInt32(); script.Emote = reader[13].ToInt32(); script.Comment = reader[14].ToString(); _AIText.Add(script); } } _conn.Close(); } }
private void _lvText_SelectedIndexChanged(object sender, EventArgs e) { if (_lvText.SelectedIndices.Count > 0) { TextAI text = MySQLConnenct.AIText[_lvText.SelectedIndices[0]]; int loc = _cbLocale.SelectedIndex == 0 ? 0 : _cbLocale.SelectedIndex - 1; _tbTextID.Text = text.ID.ToString(); _tbTextContentDefault.Text = text.ContentDefault; _tbTextContentLocales.Text = text.ContentLocale[loc]; _cbSoundEntry.SetValue(text.Sound); _cbMessageType.SetValue(text.Type); _cbLenguage.SetValue(text.Lenguage); _cbTextEmote.SetValue(text.Emote); _tbCommentAITexts.Text = text.Comment; } }
public static void SelectAIText() { if (!IsConnected) { return; } string query = "SELECT * FROM creature_ai_texts;"; using (_conn = new MySqlConnection(ConnectionString)) { _command = new MySqlCommand(query, _conn); _conn.Open(); _AIText.Clear(); using (var reader = _command.ExecuteReader()) { while (reader.Read()) { TextAI script = new TextAI(); script.ID = reader[0].ToInt32(); script.ContentDefault = reader[1].ToString(); script.ContentLocale[0] = reader[2].ToString(); script.ContentLocale[1] = reader[3].ToString(); script.ContentLocale[2] = reader[4].ToString(); script.ContentLocale[3] = reader[5].ToString(); script.ContentLocale[4] = reader[6].ToString(); script.ContentLocale[5] = reader[7].ToString(); script.ContentLocale[6] = reader[8].ToString(); script.ContentLocale[7] = reader[9].ToString(); script.Sound = reader[10].ToInt32(); script.Type = reader[11].ToInt32(); script.Lenguage = reader[12].ToInt32(); script.Emote = reader[13].ToInt32(); script.Comment = reader[14].ToString(); _AIText.Add(script); } } } }
public static void SelectAIText() { if (!IsConnected) return; string query = "SELECT * FROM creature_ai_texts;"; using (_conn = new MySqlConnection(ConnectionString)) { _command = new MySqlCommand(query, _conn); _conn.Open(); _AIText.Clear(); using (var reader = _command.ExecuteReader()) { while (reader.Read()) { TextAI script = new TextAI(); script.ID = reader[0].ToInt32(); script.ContentDefault = reader[1].ToString(); script.ContentLocale[0] = reader[2].ToString(); script.ContentLocale[1] = reader[3].ToString(); script.ContentLocale[2] = reader[4].ToString(); script.ContentLocale[3] = reader[5].ToString(); script.ContentLocale[4] = reader[6].ToString(); script.ContentLocale[5] = reader[7].ToString(); script.ContentLocale[6] = reader[8].ToString(); script.ContentLocale[7] = reader[9].ToString(); script.Sound = reader[10].ToInt32(); script.Type = reader[11].ToInt32(); script.Lenguage = reader[12].ToInt32(); script.Emote = reader[13].ToInt32(); script.Comment = reader[14].ToString(); _AIText.Add(script); } } } }