コード例 #1
0
ファイル: PlayerConnection.cs プロジェクト: kfazi/AgarIo
        public PlayerConnection(LoginDto loginDto, IPlayerCommandFactory playerCommandFactory, IPlayerRepository playerRepository, IGame game)
        {
            _playerCommandFactory = playerCommandFactory;
            _playerRepository = playerRepository;
            _game = game;

            _loginDto = loginDto;

            _dataToSend = new BufferBlock<string>();
        }
コード例 #2
0
ファイル: ConnectionListener.cs プロジェクト: kfazi/AgarIo
        private bool TryAuthorize(LoginDto loginDto)
        {
            if (loginDto.IsAdmin)
            {
                return loginDto.Login == _adminCredentials.AdminLogin && loginDto.Password == _adminCredentials.AdminPassword;
            }

            var player = _playerRepository.Players.FirstOrDefault(x => x.Name == loginDto.Login);
            if (player == null)
            {
                return true;
            }

            return player.Password == loginDto.Password;
        }
コード例 #3
0
    private void SendLoginData(TextReader reader, TextWriter writer, string userName, string password)
    {
        var loginDto = new LoginDto { Login = userName, Password = password, IsAdmin = true };
        var loginJson = loginDto.ToJson();

        writer.WriteLine(loginJson);
        reader.ReadLine();
    }