Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region using directives
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using PokemonGo.RocketAPI;
- using POGOProtos;
- using POGOProtos.Enums;
- using POGOProtos.Inventory.Item;
- using PokemonGo.RocketAPI.Enums;
- using POGOProtos.Data;
- using POGOProtos.Data.Player;
- using POGOProtos.Enums;
- using POGOProtos.Inventory;
- using POGOProtos.Inventory.Item;
- using POGOProtos.Map.Fort;
- using POGOProtos.Map.Pokemon;
- using POGOProtos.Networking.Responses;
- using PokemonGo.RocketAPI.Enums;
- using PokemonGo.RocketAPI.Exceptions;
- using PokemonGo.RocketAPI.Extensions;
- using PokemonGo.RocketAPI.Helpers;
- using POGOProtos.Settings;
- using PoTestLogin;
- #endregion
- namespace PoTestLogin {
- class test
- {
- public static ISettings Setting;
- public static test Instance;
- public static Settings ClientSettings;
- private static Client _client;
- public void mainform()
- {
- ClientSettings = Settings.Instance;
- Instance = this;
- }
- public static void Main()
- {
- Setting.AuthType = AuthType.Google;
- Setting.DefaultAltitude = 10;
- Setting.DefaultLatitude = 40.767445685;
- Setting.DefaultLongitude = -73.970697559;
- Setting.GoogleUsername = "";
- Setting.GooglePassword = "";
- Execute();
- }
- public async static void Execute()
- {
- Console.Write("Enter Google Username: ");
- var Login = Console.ReadLine();
- Login = Settings.Instance.AuthType.ToString();
- Console.WriteLine(Settings.Instance.AuthType);
- Console.Write("Enter Google Username: ");
- string username = Console.ReadLine();
- username = Settings.Instance.GoogleUsername;
- Console.WriteLine(Settings.Instance.GoogleUsername);
- Console.Write("Enter Google Password: ");
- string pass = Console.ReadLine();
- pass = Settings.Instance.GooglePassword;
- Console.WriteLine(Settings.Instance.GooglePassword);
- _client = new Client(Setting, new ApiFailureStrategy());
- try
- {
- switch (Setting.AuthType)
- {
- case AuthType.Ptc:
- Console.WriteLine("Login Type: PTC");
- break;
- case AuthType.Google:
- Console.WriteLine("Login Type:Google");
- break;
- }
- await _client.Login.DoLogin();
- var profile = await _client.Player.GetPlayer();
- var mapobject = await _client.Map.GetMapObjects();
- Console.WriteLine(profile);
- Console.ReadLine();
- }
- catch (TaskCanceledException)
- {
- Console.Write( "Task Canceled Exception - Restarting");
- //if (!_stopping) Execute();
- }
- catch (UriFormatException)
- {
- Console.Write( "System URI Format Exception - Restarting");
- //if (!_stopping) Execute();
- }
- catch (ArgumentOutOfRangeException)
- {
- Console.Write( "ArgumentOutOfRangeException - Restarting");
- //if (!_stopping) Execute();
- }
- catch (ArgumentNullException)
- {
- Console.Write( "Argument Null Refference - Restarting");
- //if (!_stopping) Execute();
- }
- catch (NullReferenceException)
- {
- Console.Write( "Null Refference - Restarting");
- //if (!_stopping) Execute();
- }
- catch (AccessTokenExpiredException)
- {
- Console.Write("Access Token Expired - Restarting");
- //if (!_stopping) Execute();
- }
- catch (GoogleException)
- {
- Console.Write( "Please check your google login information again");
- }
- catch (LoginFailedException)
- {
- Console.Write( "Login failed, please check your ptc login information again");
- }
- catch (InvalidResponseException)
- {
- Console.Write( "Invalid response - Restarting");
- //if (!_stopping) Execute();
- }
- catch (Exception ex)
- {
- Console.Write( ex.ToString());
- //if (!_stopping) Execute();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment