Exemple #1
0
        /// <summary>
        /// Stores data like assets and item templates. Defaults to an in-memory cache, but can be implemented as writing to disk by the platform
        /// </summary>
        // public IDataCache DataCache { get; set; } = new MemoryDataCache();
        // public Templates Templates { get; private set; }

        internal Session(ILoginProvider loginProvider, AccessToken accessToken, GeoCoordinate geoCoordinate, DeviceWrapper deviceWrapper, GetPlayerMessage.Types.PlayerLocale playerLocale)
        {
            if (!ValidLoginProviders.Contains(loginProvider.ProviderId))
            {
                throw new ArgumentException("LoginProvider ID must be one of the following: " + string.Join(", ", ValidLoginProviders));
            }
            Logger = new Logger();

            State = SessionState.Stopped;

            Device = deviceWrapper;

            var handler = new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
                UseProxy = Device.Proxy != null,
                Proxy    = Device.Proxy
            };

            HttpClient = new HttpClient(handler);

            HttpClient.DefaultRequestHeaders.UserAgent.TryParseAdd(Constants.ApiUserAgent);
            HttpClient.DefaultRequestHeaders.ExpectContinue = false;

            AccessToken   = accessToken;
            LoginProvider = loginProvider;
            Player        = new Player(this, geoCoordinate, playerLocale);
            Map           = new Map(this);
            Templates     = new Templates(this);
            RpcClient     = new RpcClient(this);
            _heartbeat    = new HeartbeatDispatcher(this);
        }
Exemple #2
0
 internal Session(AccessToken accessToken, string password, GeoCoordinate geoCoordinate)
 {
     AccessToken = accessToken;
     Password    = password;
     Player      = new Player(geoCoordinate);
     Map         = new Map();
     Templates   = new Templates();
     RpcClient   = new RpcClient(this);
     _heartbeat  = new HeartbeatDispatcher(this);
 }
        public DynamoDbLockerManagerTests(DynamoDbDockerSetup dockerSetup)
        {
            _dockerSetup = dockerSetup;
            var cfg = new AmazonDynamoDBConfig {
                ServiceURL = DynamoDbDockerSetup.ConnectionString
            };
            var provisioner         = new LockTableProvisioner(DynamoDbDockerSetup.Credentials, cfg, "lock-tests", new NullLoggerFactory());
            var tracker             = new LocalLockTracker();
            var heartbeatDispatcher = new HeartbeatDispatcher(DynamoDbDockerSetup.Credentials, cfg, tracker, "lock-tests", new NullLoggerFactory());

            _subject = new DynamoDbLockManager(DynamoDbDockerSetup.Credentials, cfg, "lock-tests", provisioner, heartbeatDispatcher, tracker, new NullLoggerFactory(), _leaseTime, _heartbeat);
        }
Exemple #4
0
        internal Session(AccessToken accessToken, string password, GeoCoordinate geoCoordinate, Device device = null)
        {
            if (device == null)
            {
                device = DeviceInfo.GetDeviceByName("nexus5");
            }

            AccessToken = accessToken;
            Password    = password;
            Device      = device;
            Player      = new Player(geoCoordinate);
            Map         = new Map(this);
            Templates   = new Templates();
            RpcClient   = new RpcClient(this);
            _heartbeat  = new HeartbeatDispatcher(this);
        }
Exemple #5
0
        /// <summary>
        /// Stores data like assets and item templates. Defaults to an in-memory cache, but can be implemented as writing to disk by the platform
        /// </summary>
        // public IDataCache DataCache { get; set; } = new MemoryDataCache();
        // public Templates Templates { get; private set; }

        internal Session(ILoginProvider loginProvider, AccessToken accessToken, GeoCoordinate geoCoordinate, DeviceInfo deviceInfo = null)
        {
            if (!ValidLoginProviders.Contains(loginProvider.ProviderId))
            {
                throw new ArgumentException($"LoginProvider ID must be one of the following: {string.Join(", ", ValidLoginProviders)}");
            }

            HttpClient = new HttpClient(new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            });
            HttpClient.DefaultRequestHeaders.UserAgent.TryParseAdd("Niantic App");
            HttpClient.DefaultRequestHeaders.ExpectContinue = false;

            DeviceInfo    = deviceInfo ?? DeviceInfoUtil.GetRandomDevice(this);
            AccessToken   = accessToken;
            LoginProvider = loginProvider;
            Player        = new Player(geoCoordinate);
            Map           = new Map(this);
            RpcClient     = new RpcClient(this);
            _heartbeat    = new HeartbeatDispatcher(this);
        }