Exemple #1
0
        static void Main(string[] args)
        {
            exampleApp.Connect();

            Console.Title = "Authenty.ME | Professional Licensing Solution";

            Console.WriteLine();
            Console.WriteLine("1. Login");
            Console.WriteLine("2. Register");
            Console.WriteLine("3. License-Login (AIO)");
            Console.WriteLine("4. Extend Subscription Time");

            Console.Write("> ");

            switch (Console.ReadLine())
            {
            case "1":

                Console.WriteLine();

                Console.Write("Username: "******"Password: "******"\nLogged In!");

                    Console.WriteLine("\nWait 5 seconds please ...");

                    Thread.Sleep(5000);

                    MethodLoggedIn();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Invalid Username Or Password");
                }

                break;

            case "2":

                Console.WriteLine();

                Console.Write("Username: "******"Email: ");
                string emailToRegister = Console.ReadLine();

                Console.Write("Create a Password: "******"License: ");
                string licenseToRegister = Console.ReadLine();

                if (exampleApp.Register(usernameToRegister, passwordToRegister, emailToRegister, licenseToRegister))
                {
                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("\nSuccessfully Registered !");

                    // Here you can do what you would do if he were logged in, there will be no need to re-log

                    Console.WriteLine("\nWait 5 seconds please ...");

                    Thread.Sleep(5000);

                    MethodLoggedIn();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Invalid Username Or Password");
                }

                break;

            case "3":

                Console.WriteLine();

                Console.Write("License: ");
                string license = Console.ReadLine();

                if (exampleApp.LicenseLogin(license))
                {
                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("\nLogged In!");

                    Console.WriteLine("\nWait 5 seconds please ...");

                    Thread.Sleep(5000);

                    MethodLoggedIn();
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Invalid License");
                }

                break;

            case "4":

                Console.WriteLine();

                Console.Write("Username: "******"Username: "******"LicenseKey: ");
                string licenseKey = Console.ReadLine();     // It will take the time of the license and it will be added to the user, the license after being used, will be unusable.

                if (exampleApp.ExtendSubscription(usernameAccount, passwordAccount, licenseKey))
                {
                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Your account time has been extended!");

                    Console.ReadLine();

                    Environment.Exit(0);
                }

                break;

            default: throw new Exception("Invalid option");
            }

            Console.ReadLine();
        }