Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        static Dictionary <PoGoAccount, List <Region> > DistributeWork(List <PoGoAccount> accounts, IEnumerable <Region> regions)
        {
            Dictionary <PoGoAccount, List <Region> > distributedWork = new Dictionary <PoGoAccount, List <Region> >();
            List <Region> regionsToDistribute = regions.OrderByDescending(r => r.Locations.Count).ToList();

            while (regionsToDistribute.Count > 0)
            {
                if (accounts.Count > distributedWork.Keys.Count)
                {
                    distributedWork.Add(accounts.First(a => !distributedWork.Keys.Contains(a)), new List <Region> {
                        regionsToDistribute.First()
                    });
                    regionsToDistribute.RemoveAt(0);
                }
                else
                {
                    PoGoAccount lightestLoad = distributedWork.Keys.OrderBy(a => distributedWork[a].SelectMany(r => r.Locations).Count()).First();
                    distributedWork[lightestLoad].Add(regionsToDistribute.First());
                    regionsToDistribute.RemoveAt(0);
                }
            }

            return(distributedWork);
        }
Beispiel #4
0
 public static string GetAccountName(PoGoAccount account)
 {
     return((!account.PTCUsername.IsNullOrEmpty() ? account.PTCUsername : account.GAUsername).Split('@')[0]);
 }