Пример #1
0
        public ActiveUser LoginUser(string username, string password, string address)
        {
            string user = username.Trim();

            if (!_usersRegistered.ContainsKey(user) ||
                !_usersRegistered[user].CheckPassword((password)))
            {
                return(null);
            }

            RegisteredUser regUser = _usersRegistered[user];
            ActiveUser     newUser = new ActiveUser(regUser.Username, regUser.RealName, address);

            if (!_onlineUsers.Contains(newUser))
            {
                if (!_onlineUsers.Add(newUser))
                {
                    return(null);
                }
                NotifyActiveUser(newUser);
            }

            return(newUser);
        }
Пример #2
0
 public bool LogoutUser(ActiveUser user)
 {
     NotifyLogoutUser(user);
     return(_onlineUsers.Remove(user));
 }