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); }
private SocketUDP getSocket(IPEndPoint ip) { string id = ToolForIp.getChildIp(ip.Address.ToString(), 3); SocketUDP udp; clientDic.TryGetValue(id, out udp); return(udp); }
private SocketUDP getClient(IPEndPoint ip) { lock (clientDic) { string id = ToolForIp.getChildIp(ip.Address.ToString(), 3); SocketUDP client; clientDic.TryGetValue(id, out client); return(client); } }
private void addClient(string ip, SocketUDP udp) { lock (clientDic) { string id = ToolForIp.getChildIp(ip, 3); if (!clientDic.ContainsKey(id)) { clientDic.Add(id, udp); } } }
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); }