private void contextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (listBoxChat.SelectedItem == null) { return; } ChatText temp = (ChatText)listBoxChat.SelectedItem; if (e.ClickedItem.Text == "Slett") { listBoxChat.Items.RemoveAt(listBoxChat.SelectedIndex); UpdateText(); } else if (e.ClickedItem.Text == "Utesteng IP") { if (!Base_offscreen.CheckBlacklist(temp.ip)) { Base_offscreen.blackList.Add(temp.ip); } for (int i = 0; i < listBoxChat.Items.Count; i++) { if (((ChatText)listBoxChat.Items[i]).ip == temp.ip) { listBoxChat.Items.RemoveAt(i); } } UpdateText(); } }
public string CheckIP(string content, ref string ip) { content = content.Remove(0, content.IndexOf("[") + 1); ip = content.Remove(content.IndexOf("]")); if (Base_offscreen.CheckBlacklist(ip)) { return(""); } else { return(content.Remove(0, content.IndexOf("]") + 1)); } }