Beispiel #1
0
        internal MercuryUser GetUser(string userId, HostedMercuryServer server)
        {
            if (_users == null)
            {
                return(null);
            }

            if (!_users.ContainsKey(userId))
            {
                return(null);
            }

            var user = new MercuryUser(_users[userId]);

            user.SetServer(server);

            return(user);
        }
Beispiel #2
0
        internal virtual MercuryUser GetUserWithConnectionId(string connectionId, HostedMercuryServer server)
        {
            if (_users == null)
            {
                return(null);
            }

            foreach (var user in _users)
            {
                if (user.Value.HasConnectionId(connectionId))
                {
                    var result = new MercuryUser(user.Value);
                    result.SetServer(server);
                    return(result);
                }
            }

            return(null);
        }
Beispiel #3
0
        internal void AddUserConnectionId(string connectionId, string userId)
        {
            MercuryUser user;

            if (_users == null)
            {
                _users = new Dictionary <string, MercuryUser>();
            }

            if (_users.ContainsKey(userId))
            {
                user = _users[userId];
            }
            else
            {
                user = new MercuryUser(userId, null);
            }

            user.AddConnectionId(connectionId);
        }