private void button3_Click(object sender, EventArgs e) { colorDialog1.ShowDialog(); myform.windowColor = colorDialog1.Color; RegistryControl Reg = new RegistryControl(); Reg.SaveSetting("SH", "Minebot SMP", "ter", colorDialog1.Color.R.ToString()); Reg.SaveSetting("SH", "Minebot SMP", "teg", colorDialog1.Color.G.ToString()); Reg.SaveSetting("SH", "Minebot SMP", "teb", colorDialog1.Color.B.ToString()); myform.loadColors(); }
private void checkBox2_CheckedChanged(object sender, EventArgs e) { RegistryControl Reg = new RegistryControl(); Reg.SaveSetting("SH", "Minebot SMP", "flat", checkBox2.Checked.ToString()); myform.loadColors(); }
private void btnRemAdmin_Click(object sender, EventArgs e) { RegistryControl Reg = new RegistryControl(); string selected = (string)lstAdmins.SelectedItem; string admins = (string)Reg.GetSetting("SH", "Minebot SMP", "Admins", ""); if (selected == null) { return; } admins = admins.Replace(selected + "|", ""); Reg.SaveSetting("SH", "Minebot SMP", "Admins", admins); lstAdmins.Items.Clear(); myform.admins.Clear(); string[] mysplits = admins.Split('|'); for (int i = 0; i < mysplits.Length; i++) { if (mysplits[i] != "") { myform.admins.Add(mysplits[i]); lstAdmins.Items.Add(mysplits[i]); } } if (!myform.admins.Contains("Minebot")) { myform.admins.Add("Minebot"); lstAdmins.Items.Add("Minebot"); } }
private void btnAddAdmin_Click(object sender, EventArgs e) { RegistryControl Reg = new RegistryControl(); string name = Interaction.InputBox("What is the admin's in-game username?", "Username"); string admins = (string)Reg.GetSetting("SH", "Minebot SMP", "Admins", ""); admins += name + "|"; Reg.SaveSetting("SH", "Minebot SMP", "Admins", admins); myform.admins.Clear(); lstAdmins.Items.Clear(); string[] mysplits = admins.Split('|'); for (int i = 0; i < mysplits.Length; i++) { if (mysplits[i] != "") { myform.admins.Add(mysplits[i]); lstAdmins.Items.Add(mysplits[i]); } } if (!myform.admins.Contains("Minebot")) { myform.admins.Add("Minebot"); lstAdmins.Items.Add("Minebot"); } }
private void btnAddFav_Click(object sender, EventArgs e) { // As much as I wanted to stay away from VB Methods, there is no equivelant of this in C#. string name = Interaction.InputBox("What is the name for your server?", "Server Name"); string ip = Interaction.InputBox("What is the server's IP?", "Server IP"); string port = Interaction.InputBox("What is the server's port?", "Server Port"); RegistryControl reg = new RegistryControl(); string Favorites = (string)reg.GetSetting("SH", "Minebot SMP", "Fav", ""); Favorites += name + "|" + ip + "|" + port + "="; reg.SaveSetting("SH", "Minebot SMP", "Fav", Favorites); lstFav.Items.Clear(); if (Favorites.Contains("=") && Favorites.Contains("|")) { string[] Favsplit = Favorites.Split('='); for (int i = 0; i < (Favsplit.Length); i++) { if (Favsplit[i] != "") { favs.Add(Favsplit[i]); lstFav.Items.Add(Favsplit[i].Split('|')[0]); } } } }
private void btnRemFav_Click(object sender, EventArgs e) { string name = lstFav.GetItemText(lstFav.SelectedItem); if (name == "" || name == null) { MessageBox.Show("No item selected."); return; } RegistryControl reg = new RegistryControl(); string fullstring; string Favorites = (string)reg.GetSetting("SH", "Minebot SMP", "Fav", ""); string temp = Favorites.Substring(0, Favorites.IndexOf(name)); if (temp.Length != 0) { fullstring = Favorites.Replace(temp, ""); } else { fullstring = Favorites; } fullstring = fullstring.Substring(0, fullstring.IndexOf("=") + 1); Favorites = Favorites.Replace(fullstring, ""); reg.SaveSetting("SH", "Minebot SMP", "Fav", Favorites); lstFav.Items.Clear(); if (Favorites.Contains("=") && Favorites.Contains("|")) { string[] Favsplit = Favorites.Split('='); for (int i = 0; i < (Favsplit.Length); i++) { if (Favsplit[i] != "") { favs.Add(Favsplit[i]); lstFav.Items.Add(Favsplit[i].Split('|')[0]); } } } }
private void txtPrefix_TextChanged(object sender, EventArgs e) { RegistryControl reg = new RegistryControl(); reg.SaveSetting("SH", "Minebot SMP", "prefix", txtPrefix.Text); }
private void txtIrcNick_TextChanged(object sender, EventArgs e) { RegistryControl Reg = new RegistryControl(); Reg.SaveSetting("SH", "Minebot SMP", "ircName", txtIrcNick.Text); }
private void txtPW_TextChanged(object sender, EventArgs e) { RegistryControl Reg = new RegistryControl(); Reg.SaveSetting("SH", "Minebot SMP", "Password", txtPW.Text); }
private void cbOnline_CheckedChanged(object sender, EventArgs e) { RegistryControl Reg = new RegistryControl(); Reg.SaveSetting("SH", "Minebot SMP", "Online", cbOnline.Checked.ToString()); }