Пример #1
0
        public bool SignIn(IClientConnection connection, MidgeCredentials userCredentials)
        {
            if (_onlineUsers.TryGetValue(connection, out var user))
            {
                if (user != null)
                {
                    OnUserSignOut(new MidgeUserEventArgs(user));
                }

                var newUser = new MidgeUser(userCredentials, connection.Ip, DateTime.Now);

                _onlineUsers[connection] = newUser;
                OnUserSignIn(new MidgeUserEventArgs(newUser));

                return(true);
            }

            return(false);
        }
Пример #2
0
 public MidgeUser(MidgeCredentials credentials, IPAddress ip, DateTime signInDateTime)
 {
     Credentials    = credentials;
     Ip             = ip;
     SignInDateTime = signInDateTime;
 }