예제 #1
0
파일: Program.cs 프로젝트: jableader/cshite
        static bool IsValidLoginAccount(string name, string pw)
        {
            const string loginFile = "login.txt";

            if (!File.Exists(loginFile))
            {
                ConsoleScreen.ShowError("Bad Config", "login.txt file could not be found. Please place into the program directory.");
                Environment.Exit(-1);
            }

            return(File.ReadLines(loginFile).Contains(name + "|" + pw)); // No salts & hashes here
        }
예제 #2
0
파일: Program.cs 프로젝트: jableader/cshite
        static void Login()
        {
            while (true)
            {
                var screen = new ConsoleScreen(Art.AsHeader(Title, Art.BitCoin));
                screen.AddText("Login to start");
                screen.AddBlankLines();

                var username = screen.AddInput("User name: ", Validate.AsString());
                var password = screen.AddPassword("Password: "******"Login Error", "Username-password combination was not valid.");
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: jableader/cshite
        static void Deposit(Bank bank)
        {
            var screen = new ConsoleScreen("Deposit");

            screen.AddText("Enter the details", TextJustification.Center);

            var account = screen.AddInput("Account Number: ", Validate.AsAccount(bank));
            var deposit = screen.AddInput("Amount: $", Validate.Money());

            if (screen.Show())
            {
                if ((account.Response.Balance + deposit.Response) <= Bank.MaxAccountBalance)
                {
                    bank.Transact(account.Response, deposit.Response);
                    ShowSuccess(account.Response);
                }
                else
                {
                    ConsoleScreen.ShowError("Balance too high", "Sorry, our insurance provider will not allow us to store that much money for one individual. We recommend purchasing a vault from one of our competitors.");
                }
            }
        }