示例#1
0
文件: Login.cs 项目: ytn3rd/POGOLib
 /// <summary>
 ///     Login with a stored <see cref="AccessToken" />.
 /// </summary>
 /// <param name="accessToken"></param>
 /// <param name="password">The password is needed for reauthentication.</param>
 /// <param name="initialLatitude">The initial latitude you will spawn at after logging into PokémonGo.</param>
 /// <param name="initialLongitude">The initial longitude you will spawn at after logging into PokémonGo.</param>
 /// <returns></returns>
 public static Session GetSession(AccessToken accessToken, string password, double initialLatitude,
     double initialLongitude)
 {
     if (accessToken.IsExpired)
     {
         throw new Exception("AccessToken is expired.");
     }
     Log.Debug("Authenticated from cache.");
     return new Session(accessToken, password, new GeoCoordinate(initialLatitude, initialLongitude));
 }
示例#2
0
文件: Session.cs 项目: ytn3rd/POGOLib
 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);
 }
示例#3
0
文件: Program.cs 项目: ytn3rd/POGOLib
        private static void SaveAccessToken(AccessToken accessToken)
        {
            var fileName = Path.Combine(Environment.CurrentDirectory, "cache", $"{accessToken.Uid}.json");

            File.WriteAllText(fileName, JsonConvert.SerializeObject(accessToken, Formatting.Indented));
        }