public static Configuration ReadConfiguration(string signature, string fileName = "Configuration.json") { PokewatchLogger.Log("[!]Reading configuration from " + fileName + ".", signature); Configuration config; try { string json = File.ReadAllText("Configuration.json"); config = new JavaScriptSerializer().Deserialize <Configuration>(json); } catch (Exception ex) { PokewatchLogger.Log("[-]Unable to load config.", signature); PokewatchLogger.Log(ex.Message, signature); return(null); } return(config); }
public static Session SignIn(PoGoAccount account, Location defaultLocation) { if ((account.PTCUsername.IsNullOrEmpty() || account.PTCPassword.IsNullOrEmpty()) && (account.GAPassword.IsNullOrEmpty() || account.GAUsername.IsNullOrEmpty())) { PokewatchLogger.Log("[-]Username and password must be supplied for either PTC or Google.", GetAccountName(account)); return(null); } if (!account.PTCUsername.IsNullOrEmpty() && !account.PTCPassword.IsNullOrEmpty()) { try { PokewatchLogger.Log("[!]Attempting to sign in to PokemonGo as " + account.PTCUsername + " using PTC.", GetAccountName(account)); var loginProvider = new PtcLoginProvider(account.PTCUsername, account.PTCPassword); var pogoSession = Login.GetSession(loginProvider, defaultLocation.Latitude, defaultLocation.Longitude).Result; PokewatchLogger.Log("[+]Sucessfully logged in to PokemonGo using PTC.", GetAccountName(account)); return(pogoSession); } catch { PokewatchLogger.Log("[-]Unable to log in using PTC.", GetAccountName(account)); } } if (!account.GAUsername.IsNullOrEmpty() && !account.GAPassword.IsNullOrEmpty()) { PokewatchLogger.Log("[-]Google login is disabled for a bit, sorry! - AeonLucid", GetAccountName(account)); // try // { // PokewatchLogger.Log("[!]Attempting to sign in to PokemonGo as " + account.GAUsername + " using Google.", GetAccountName(account)); // var pogoSession = Login.GetSession(account.GAUsername, account.GAPassword, LoginProvider.GoogleAuth, defaultLocation.Latitude, defaultLocation.Longitude); // PokewatchLogger.Log("[+]Sucessfully logged in to PokemonGo using Google.", GetAccountName(account)); // return pogoSession; // } // catch // { // PokewatchLogger.Log("[-]Unable to log in using Google.", GetAccountName(account)); // } } return(null); }
public static Session SignIn(PoGoAccount account, Location defaultLocation) { if ((account.PTCUsername.IsNullOrEmpty() || account.PTCPassword.IsNullOrEmpty()) && (account.GAPassword.IsNullOrEmpty() || account.GAUsername.IsNullOrEmpty())) { PokewatchLogger.Log("[-]Username and password must be supplied for either PTC or Google.", GetAccountName(account)); return(null); } if (!account.PTCUsername.IsNullOrEmpty() && !account.PTCPassword.IsNullOrEmpty()) { try { PokewatchLogger.Log("[!]Attempting to sign in to PokemonGo as " + account.PTCUsername + " using PTC.", GetAccountName(account)); var pogoSession = Login.GetSession(account.PTCUsername, account.PTCPassword, LoginProvider.PokemonTrainerClub, defaultLocation.Latitude, defaultLocation.Longitude); PokewatchLogger.Log("[+]Sucessfully logged in to PokemonGo using PTC.", GetAccountName(account)); return(pogoSession); } catch { PokewatchLogger.Log("[-]Unable to log in using PTC.", GetAccountName(account)); } } if (!account.GAUsername.IsNullOrEmpty() && !account.GAPassword.IsNullOrEmpty()) { try { PokewatchLogger.Log("[!]Attempting to sign in to PokemonGo as " + account.GAUsername + " using Google.", GetAccountName(account)); var pogoSession = Login.GetSession(account.GAUsername, account.GAPassword, LoginProvider.GoogleAuth, defaultLocation.Latitude, defaultLocation.Longitude); PokewatchLogger.Log("[+]Sucessfully logged in to PokemonGo using Google.", GetAccountName(account)); return(pogoSession); } catch { PokewatchLogger.Log("[-]Unable to log in using Google.", GetAccountName(account)); } } return(null); }