Guest User

Untitled

a guest
Aug 24th, 2016
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. #region using directives
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. using PokemonGo.RocketAPI;
  10. using POGOProtos;
  11. using POGOProtos.Enums;
  12. using POGOProtos.Inventory.Item;
  13. using PokemonGo.RocketAPI.Enums;
  14. using POGOProtos.Data;
  15. using POGOProtos.Data.Player;
  16. using POGOProtos.Enums;
  17. using POGOProtos.Inventory;
  18. using POGOProtos.Inventory.Item;
  19. using POGOProtos.Map.Fort;
  20. using POGOProtos.Map.Pokemon;
  21. using POGOProtos.Networking.Responses;
  22. using PokemonGo.RocketAPI.Enums;
  23. using PokemonGo.RocketAPI.Exceptions;
  24. using PokemonGo.RocketAPI.Extensions;
  25. using PokemonGo.RocketAPI.Helpers;
  26. using POGOProtos.Settings;
  27. using PoTestLogin;
  28.  
  29. #endregion
  30.  
  31. namespace PoTestLogin {
  32. class test
  33. {
  34. public static ISettings Setting;
  35. public static test Instance;
  36. public static Settings ClientSettings;
  37. private static Client _client;
  38. public void mainform()
  39. {
  40. ClientSettings = Settings.Instance;
  41. Instance = this;
  42.  
  43.  
  44.  
  45. }
  46.  
  47.  
  48. public static void Main()
  49. {
  50. Setting.AuthType = AuthType.Google;
  51. Setting.DefaultAltitude = 10;
  52. Setting.DefaultLatitude = 40.767445685;
  53. Setting.DefaultLongitude = -73.970697559;
  54. Setting.GoogleUsername = "";
  55. Setting.GooglePassword = "";
  56.  
  57. Execute();
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. }
  65. public async static void Execute()
  66. {
  67. Console.Write("Enter Google Username: ");
  68. var Login = Console.ReadLine();
  69. Login = Settings.Instance.AuthType.ToString();
  70. Console.WriteLine(Settings.Instance.AuthType);
  71. Console.Write("Enter Google Username: ");
  72. string username = Console.ReadLine();
  73. username = Settings.Instance.GoogleUsername;
  74. Console.WriteLine(Settings.Instance.GoogleUsername);
  75. Console.Write("Enter Google Password: ");
  76. string pass = Console.ReadLine();
  77. pass = Settings.Instance.GooglePassword;
  78. Console.WriteLine(Settings.Instance.GooglePassword);
  79. _client = new Client(Setting, new ApiFailureStrategy());
  80. try
  81. {
  82. switch (Setting.AuthType)
  83. {
  84. case AuthType.Ptc:
  85. Console.WriteLine("Login Type: PTC");
  86. break;
  87. case AuthType.Google:
  88. Console.WriteLine("Login Type:Google");
  89. break;
  90. }
  91. await _client.Login.DoLogin();
  92. var profile = await _client.Player.GetPlayer();
  93. var mapobject = await _client.Map.GetMapObjects();
  94. Console.WriteLine(profile);
  95. Console.ReadLine();
  96.  
  97. }
  98. catch (TaskCanceledException)
  99. {
  100. Console.Write( "Task Canceled Exception - Restarting");
  101. //if (!_stopping) Execute();
  102. }
  103. catch (UriFormatException)
  104. {
  105. Console.Write( "System URI Format Exception - Restarting");
  106. //if (!_stopping) Execute();
  107. }
  108. catch (ArgumentOutOfRangeException)
  109. {
  110. Console.Write( "ArgumentOutOfRangeException - Restarting");
  111. //if (!_stopping) Execute();
  112. }
  113. catch (ArgumentNullException)
  114. {
  115. Console.Write( "Argument Null Refference - Restarting");
  116. //if (!_stopping) Execute();
  117. }
  118. catch (NullReferenceException)
  119. {
  120. Console.Write( "Null Refference - Restarting");
  121. //if (!_stopping) Execute();
  122. }
  123. catch (AccessTokenExpiredException)
  124. {
  125. Console.Write("Access Token Expired - Restarting");
  126. //if (!_stopping) Execute();
  127. }
  128. catch (GoogleException)
  129. {
  130. Console.Write( "Please check your google login information again");
  131. }
  132. catch (LoginFailedException)
  133. {
  134. Console.Write( "Login failed, please check your ptc login information again");
  135. }
  136. catch (InvalidResponseException)
  137. {
  138. Console.Write( "Invalid response - Restarting");
  139. //if (!_stopping) Execute();
  140. }
  141. catch (Exception ex)
  142. {
  143. Console.Write( ex.ToString());
  144. //if (!_stopping) Execute();
  145. }
  146. }
  147.  
  148. }
  149.  
  150. }
Add Comment
Please, Sign In to add comment