private void btnKick_Click(object sender, EventArgs e) { string[] IP = txtConnection.Text.Split(':'); if (IsValidIPAddress(IP[0])) { Query.RCONQuery sQuery = new Query.RCONQuery(IP[0], Convert.ToInt32(IP[1]), txtPassword.Text); sQuery.Send("kick " + playerID[lstPlayers.SelectedIndex - 2]); lstRCON.Items.Clear(); int count = sQuery.Recieve(); lstRCON.Items.AddRange(sQuery.Store(count)); } else { MessageBox.Show("Invalid server IP"); } }
public void SendRCONQuery(string query, bool message = false) { string[] IP = txtConnection.Text.Split(':'); if (IsValidIPAddress(IP[0])) { Query.RCONQuery sQuery = new Query.RCONQuery(IP[0], Convert.ToInt32(IP[1]), txtPassword.Text); sQuery.Send(query); if (message == true) { lstRCON2.Items.Clear(); int count = sQuery.Recieve(); lstRCON2.Items.AddRange(sQuery.Store(count)); } } else { MessageBox.Show("Invalid server IP"); } }