コード例 #1
0
        private void RemovePeerFromDictionaries(PeerData peer, string reason)
        {
            if (peer != null)
            {
                if (PeersTx.ContainsKey(peer.SubnetworkIP))
                {
                    PeersTx.Remove(peer.SubnetworkIP);
                }
                if (PeersRxSupport.ContainsKey(peer.GetSupportEndpoint()))
                {
                    PeersRxSupport.Remove(peer.GetSupportEndpoint());
                }
                if (PeersRxTransmission.ContainsKey(peer.GetSupportEndpoint()))
                {
                    PeersRxTransmission.Remove(peer.GetTransmissionEndpoint());
                }

                OnPeerListChanged(this, new PeerListChangedEventArgs(PeersRxSupport.Values.ToArray()));
                if (reason != null)
                {
                    Logger.Instance.LogMsg("Usunięto użytkownika (" + reason + "): " + peer.ToString());
                }
                else
                {
                    Logger.Instance.LogMsg("Usunięto użytkownika: " + peer.ToString());
                }
            }
        }
コード例 #2
0
        private void AddPeerToDictionaries(PeerData peer)
        {
            if (peer != null)
            {
                PeersTx.Add(peer.SubnetworkIP, peer);
                PeersRxSupport.Add(peer.GetSupportEndpoint(), peer);
                PeersRxTransmission.Add(peer.GetTransmissionEndpoint(), peer);

                OnPeerListChanged(this, new PeerListChangedEventArgs(PeersRxSupport.Values.ToArray()));
                Logger.Instance.LogMsg("Dodano użytkownika: " + peer.ToString());
            }
        }