コード例 #1
0
        public override Task OnReconnected()
        {
            var client = ClientConnected.Factory(Context);

            if (!_connections.Contains(client))
            {
                if (!client.IsClientDotNet())
                {
                    var lstSame = _connections.Same(client);
                    lstSame.ForEach(p => _connections.Remove(p));
                    _connections.Add(client);
                    OnConnectionsChanged();
                }
                else
                {
                    _connectionControl = client;
                }
            }
            return(base.OnReconnected());
        }
コード例 #2
0
 public bool IsSame(ClientConnected other)
 {
     return(this.Ip == other.Ip && this.Referer == other.Referer && this.UserAgent == other.UserAgent);
 }
コード例 #3
0
 protected bool Equals(ClientConnected other)
 {
     return(string.Equals(Id, other.Id));
 }
コード例 #4
0
ファイル: Extends.cs プロジェクト: auriou/JsConsole.Net
 public static List <ClientConnected> Same(this IEnumerable <ClientConnected> list, ClientConnected clientConnected)
 {
     //var returnList = new List<ClientConnected>();
     //foreach (var connected in list.ToList())
     //{
     //    if(connected.IsSame(clientConnected))
     //        returnList.Add(connected);
     //    else
     //    {
     //        Debug.WriteLine(clientConnected + "\n" + connected);
     //    }
     //}
     //return returnList;
     return(list.Where(p => p.IsSame(clientConnected)).ToList());
 }