예제 #1
0
        public bool LoginAccount(string username, string password)
        {
            bool successfulLogin = false;

            AccountsConfig.account accountSelected = new AccountsConfig.account();
            foreach (AccountsConfig.account a in config.accounts)
            {
                //Disect the accounts and select an account
                if (a.username == username)
                {
                    accountSelected = a;
                }
            }

            if (accountSelected.username != null)
            {
                if (accountSelected.password == password)
                {
                    loggedAccount = accountSelected;
                    CustomConsole.SendLogType("Logged in", CustomConsole.MessageQuality.SUCESS);
                    successfulLogin = true;
                }
                else
                {
                    CustomConsole.SendLogType("Incorrect Password please try again", CustomConsole.MessageQuality.ERROR);
                    successfulLogin = false;
                }
            }
            else
            {
                CustomConsole.SendLogType("No account was found please retry", CustomConsole.MessageQuality.ERROR);
                successfulLogin = false;
            }
            return(successfulLogin);
        }
예제 #2
0
        public void CreateAccount(string name, string password, bool autologin)
        {
            //Get the original object
            CustomConsole.SendLogType("Creating Account...", CustomConsole.MessageQuality.WARNING);
            List <AccountsConfig.account> accounts = config.accounts;

            AccountsConfig.account newaccount = new AccountsConfig.account();
            newaccount.username  = name;
            newaccount.password  = password;
            newaccount.autologin = autologin;
            accounts.Add(newaccount);
            config.SaveConfig();
            CustomConsole.SendLogType("Created Account!", CustomConsole.MessageQuality.SUCESS);
        }