private void OnClientMessageReceived(object sender, IPacket packet) { ClientNode node = (ClientNode)sender; if (packet.GetType() == typeof(IdentificationPacket)) { if (listClients.InvokeRequired) { listClients.Invoke((MethodInvoker)(() => { OnClientMessageReceived(sender, packet); })); return; } IdentificationPacket ident = (IdentificationPacket)packet; foreach (ListViewItem item in listClients.Items) { if (item.Tag == node) { item.Text = ident.Name; item.SubItems.AddRange(new string[] { node.GetClientIdentifier(), ident.MachineName, ident.OperatingSystem, ident.RAM, ident.Version }); break; } } } }
public static void HandleCommand(ClientNode client, IdentificationPacket packet) { Console.WriteLine(client.GetClientIdentifier() + " identified as " + packet.Name + " and is running " + packet.OperatingSystem); }