Esempio n. 1
0
        private void showPeersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lstPeerInfo.SelectedItems.Count > 0)
            {
                EndPoint[] peerEPs;

                switch (lstPeerInfo.SelectedItems[0].Text)
                {
                case "IPv4 DHT":
                    peerEPs = _network.DhtGetIPv4Peers();
                    break;

                case "IPv6 DHT":
                    peerEPs = _network.DhtGetIPv6Peers();
                    break;

                case "LAN DHT":
                    peerEPs = _network.DhtGetLanPeers();
                    break;

                case "Tor DHT":
                    peerEPs = _network.DhtGetTorPeers();
                    break;

                case "IPv4 Tcp Relay":
                    peerEPs = _network.TcpRelayGetIPv4Peers();
                    break;

                case "IPv6 Tcp Relay":
                    peerEPs = _network.TcpRelayGetIPv6Peers();
                    break;

                default:
                    return;
                }

                string peers = "";

                foreach (EndPoint peerEP in peerEPs)
                {
                    peers += peerEP.ToString() + "\r\n";
                }

                if (peers == "")
                {
                    MessageBox.Show("No peer returned by " + lstPeerInfo.SelectedItems[0].Text + ".", "No Peer Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(peers, "Peers List", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }