private void button_delete_Click(object sender, EventArgs e) { if (Datastores.dbused) { switch (MessageBox.Show("Are you sure you want to delete the selected text from the database?", "Remove from database?", MessageBoxButtons.YesNoCancel)) { case DialogResult.Yes: string query = SQLcreator.CreateDeleteQuery(localized_texts.map[text_id], ""); MySqlCommand c = new MySqlCommand(query, SQLConnection.conn); try { c.ExecuteNonQuery(); localized_texts.map.Remove(text_id); UpdateListBox(false); if (customlistBoxtexts.Items.Count != 0) { customlistBoxtexts.SelectedIndex = 0; } else { customlistBoxtexts.SelectedIndex = -1; } } catch (Exception ex) { MessageBox.Show(ex.Message); } break; case DialogResult.No: localized_texts.map.Remove(text_id); UpdateListBox(false); if (customlistBoxtexts.Items.Count != 0) { customlistBoxtexts.SelectedIndex = 0; } else { customlistBoxtexts.SelectedIndex = -1; } break; case DialogResult.Cancel: break; } } else { localized_texts.map.Remove(text_id); UpdateListBox(false); if (customlistBoxtexts.Items.Count != 0) { customlistBoxtexts.SelectedIndex = 0; } else { customlistBoxtexts.SelectedIndex = -1; } } }
public static string PrintCreatureToWindow(uint creature_id) { string value = ""; value = SQLcreator.WriteCreatureToWindow(npcList[creature_id]); return(value); }
public static string PrintScriptToWindow(uint id, string table) { string value = ""; value = SQLcreator.WriteScriptToWindow(scriptList[id], table); return(value); }
public static bool PrintALLCreaturesToFile(string file) { foreach (KeyValuePair <uint, creature> item in npcList) { SQLcreator.WriteCreatureToFile(item.Value, file, true); } return(true); }
public static string PrintToQueryWindow(uint script_id) { string value = ""; value = SQLcreator.WriteSummonToWindow(map[script_id]); return(value); }
public static bool PrintALLScriptsToFile(string file, string table) { foreach (KeyValuePair <uint, db_script> item in scriptList) { SQLcreator.WriteScriptToFile(item.Value, file, true, table); } return(true); }
public static string PrintToQueryWindow(int script_id) { string value = ""; value = SQLcreator.WriteLocalizedTextToWindow(map[script_id]); return(value); }
public static bool PrintALLSummonsToFile(string file) { foreach (KeyValuePair <uint, summon> item in map) { SQLcreator.WriteSummonToFile(item.Value, file, true); } return(true); }
public static bool PrintALLLocalsToFile(string file) { foreach (KeyValuePair <int, localized_text> item in map) { SQLcreator.WriteLocalizedTextToFile(item.Value, file, true); } return(true); }
private void testToolStripMenuItem_Click(object sender, EventArgs e) { if (Datastores.dbused && (npclistbox.SelectedIndex != -1)) { switch (MessageBox.Show("Do you want to Remove it from Database Now? (Executing delete Query", "Remove from Database?", MessageBoxButtons.YesNoCancel)) { case DialogResult.Yes: string query = SQLcreator.CreateDeleteQuery(creatures.GetCreature(System.Convert.ToUInt32(this.npclistbox.Items[npclistbox.SelectedIndex])), ""); MySqlCommand c = new MySqlCommand(query, SQLConnection.conn); try { if (npclistbox.SelectedIndex != -1) { foreach (Form item in MdiChildren) { if (item is NPCEditor) { if ((item as NPCEditor).Id == System.Convert.ToInt32(this.npclistbox.Items[npclistbox.SelectedIndex])) { (item as NPCEditor).Close(); } } } c.ExecuteNonQuery(); creatures.DelCreature(System.Convert.ToUInt32(this.npclistbox.Items[npclistbox.SelectedIndex])); UpdateNPCListBox(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } break; case DialogResult.No: if (npclistbox.SelectedIndex != -1) { foreach (Form item in MdiChildren) { if (item is NPCEditor) { if ((item as NPCEditor).Id == System.Convert.ToInt32(this.npclistbox.Items[npclistbox.SelectedIndex])) { (item as NPCEditor).Close(); } } } creatures.DelCreature(System.Convert.ToUInt32(this.npclistbox.Items[npclistbox.SelectedIndex])); UpdateNPCListBox(); } break; case DialogResult.Cancel: break; } } else { if (npclistbox.SelectedIndex != -1) { //foreach (Form item in MdiChildren) //{ // if (item is NPCEditor) // { // if ((item as NPCEditor).npc_id == System.Convert.ToInt32(this.npclistbox.Items[npcofflistbox.SelectedIndex])) // { // (item as NPCEditor).Close(); // } // } //} //creatures.DelCreature(System.Convert.ToUInt32(this.npclistbox.Items[npcofflistbox.SelectedIndex])); //UpdateNPCListBox(false); } } }
public static bool PrintCreatureToFile(uint creature_id, string file) { SQLcreator.WriteCreatureToFile(npcList[creature_id], file, false); return(true); }
public static bool PrintSummonToFile(uint creature_id, string file) { SQLcreator.WriteSummonToFile(map[creature_id], file, false); return(true); }
public static bool PrintScriptToFile(uint id, string file, string table) { SQLcreator.WriteScriptToFile(scriptList[id], file, false, table); return(true); }
public static bool PrintLocalToFile(int creature_id, string file) { SQLcreator.WriteLocalizedTextToFile(map[creature_id], file, false); return(true); }