コード例 #1
0
 public UIClientItem(IPEndPoint ip)
 {
     this.ip            = ip;
     this.viewItem      = new ListViewItem();
     this.viewItem.Text = ToolForIp.getChildIp(ip.Address.ToString(), 4);
     //this.id = Convert.ToInt32(sid);
 }
コード例 #2
0
        private SocketUDP getSocket(IPEndPoint ip)
        {
            string    id = ToolForIp.getChildIp(ip.Address.ToString(), 3);
            SocketUDP udp;

            clientDic.TryGetValue(id, out udp);
            return(udp);
        }
コード例 #3
0
 private SocketUDP getClient(IPEndPoint ip)
 {
     lock (clientDic)
     {
         string    id = ToolForIp.getChildIp(ip.Address.ToString(), 3);
         SocketUDP client;
         clientDic.TryGetValue(id, out client);
         return(client);
     }
 }
コード例 #4
0
 private void addClient(string ip, SocketUDP udp)
 {
     lock (clientDic)
     {
         string id = ToolForIp.getChildIp(ip, 3);
         if (!clientDic.ContainsKey(id))
         {
             clientDic.Add(id, udp);
         }
     }
 }
コード例 #5
0
        public static List <KeyValuePair <IPEndPoint, T> > sort <T>(this Dictionary <IPEndPoint, T> dic)
        {
            List <KeyValuePair <IPEndPoint, T> > keyValuePairs = dic.ToList();

            keyValuePairs.Sort((a, b) =>
            {
                int aId = Convert.ToInt32(ToolForIp.getChildIp(a.Key.Address.ToString(), 4));
                int bId = Convert.ToInt32(ToolForIp.getChildIp(b.Key.Address.ToString(), 4));
                var o   = aId - bId;
                return(o);
            });
            return(keyValuePairs);
        }