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); }
public bool LogoutUser(ActiveUser user) { NotifyLogoutUser(user); return(_onlineUsers.Remove(user)); }