void AddClient(TcpClient client) { for (int x = 0; x < _.clients.Count; x++) { if (_.clients[x].tcp.Client.Equals(client.Client)) { return; } } var item = new ListViewItem("ID: " + ++idIncrement + ", IP: " + client.Client.RemoteEndPoint); var cl = new Client(idIncrement, client, item); _.clients.Add(cl); Invoke(new MethodInvoker(() => list_clients.Items.Add(item))); ToLog("ID " + cl.id + " (" + cl.tcp.Client.RemoteEndPoint + ") ready for duty!"); }
void RemoveClient(Client client) { Invoke(new MethodInvoker(() => list_clients.Items.Remove(client.lvi))); _.clients.Remove(client); ToLog("ID " + client.id + (client.tcp.Client.RemoteEndPoint != null ? "(" + client.tcp.Client.RemoteEndPoint + ")" : "") + " has deserted!"); }
public void Init(Client Client) { client = Client; Text = "CMD (" + Client.tcp.Client.RemoteEndPoint + ")"; }