Ejemplo n.º 1
0
        /// <summary>
        /// Returns the current player environment from locally stored information.
        /// </summary>
        /// <param name="defaultTo"></param>
        /// <returns></returns>
        public static PlayerEnvironment GetCurrentEnvironment(PlayerEnvironmentType defaultsTo = PlayerEnvironmentType.ProdB)
        {
            InstalledGame installedGame = new InstalledGame("");
            string        prodUri       = installedGame.GetProdUri();

            return(prodUri == null?GetEnvironment(defaultsTo) : GetEnvironment(prodUri));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            InstalledGame     installedGame = new InstalledGame("D:\\Games\\MTGA");
            PlayerCredentials credentials   = new PlayerCredentials(installedGame.GetRefreshToken());

            // PlayerCredentials credentials = new PlayerCredentials("username", "password");
            Console.WriteLine("Authenticating...");
            bool verified = credentials.VerifyAsyncTask().GetAwaiter().GetResult();

            if (verified)
            {
                Console.WriteLine("Logged in!");
                _ticket = credentials.AccessToken;
                installedGame.SaveRefreshToken(credentials.RefreshToken);
            }
            else
            {
                Console.WriteLine("Invalid credentials!");
                Console.ReadKey();
                return;
            }

            DoYourThing();
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static async Task Login()
        {
            InstalledGame game  = new InstalledGame("");
            string        token = game.GetRefreshToken();

            PlayerCredentials credentials;

            if (token != null)
            {
                credentials = new PlayerCredentials(token);
            }
            else
            {
                Console.WriteLine("Please login (or try to launch the game once)");
                Console.Write("Email: ");
                string email = Console.ReadLine();
                Console.Write("Password: "******"[!] Authentication failed!");

                // if we tried to login using a token, it's probably expired
                if (token != null)
                {
                    Console.WriteLine("Please launch your game, login once and then run this tool again!");
                }

                Console.ReadKey();
                Environment.Exit(0);
            }

            _ticket = credentials.AccessToken;
        }
Ejemplo n.º 4
0
 public TestInstalledGame()
 {
     _installedGame = new InstalledGame("D:\\Games\\MTGA");
 }