Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="authUser"></param>
 /// <param name="position"></param>
 /// <param name="deviceProfile"></param>
 /// <param name="startTime"></param>
 /// <remarks>
 /// @robertmclaws: We're not tracking teh start time in this class internally because we're resetting the PokemonGoApiClient with
 /// every login, so the startTime shoudl be the time from last reset.
 /// </remarks>
 public RequestBuilder(AuthenticatedUser authUser, GeoCoordinate position, IDeviceProfile deviceProfile, DateTimeOffset startTime)
 {
     AuthenticatedUser = authUser;
     CurrentPosition   = position;
     DeviceProfile     = deviceProfile;
     StartTime         = startTime;
 }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="deviceProfile"></param>
        /// <param name="authenticatedUser"></param>
        public PokemonGoApiClient(IApiSettings settings, IDeviceProfile deviceProfile, AuthenticatedUser authenticatedUser = null) : this()
        {
            StartTime = DateTimeOffset.UtcNow;
            CancellationTokenSource = new CancellationTokenSource();
            RequestQueue            = new BlockingCollection <RequestEnvelope>();

            Player    = new PlayerClient(this);
            Download  = new DownloadClient(this);
            Inventory = new InventoryClient(this);
            Map       = new MapClient(this);
            Fort      = new FortClient(this);
            Encounter = new EncounterClient(this);

            ApiSettings   = settings;
            DeviceProfile = deviceProfile;

            SetAuthenticationProvider();
            AuthenticatedUser = authenticatedUser;
            Player.SetCoordinates(ApiSettings.DefaultPosition.Latitude, ApiSettings.DefaultPosition.Longitude, ApiSettings.DefaultPosition.Accuracy);
        }
Exemple #3
0
        public static void WriteBootLoaderToDisk(string DiskId, IDeviceProfile deviceProfile)
        {
            var          chunkSize = 131072;
            DeviceStream ds        = new DeviceStream(DiskId, FileAccess.ReadWrite);

            ds.Seek(0, SeekOrigin.Begin);
            byte[] bootloader = File.ReadAllBytes(deviceProfile.Bootloader());

            var sectors = bootloader.Count() / chunkSize;

            DateTime startTime = DateTime.Now;

            using (BinaryReader br = new BinaryReader(new MemoryStream(bootloader)))
                for (int i = 0; i < sectors; i++)
                {
                    var buff = br.ReadBytes(chunkSize);
                    ds.Write(buff, 0, chunkSize);
                    Logging.ShowProgress((UInt64)bootloader.Count(), startTime, (UInt64)((i + 1) * chunkSize), (UInt64)((i + 1) * chunkSize), false);
                }
            Logging.Log("");

            ds.Dispose();
        }