Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void login()
- {
- string username = "xrx"; //username
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("Username: ");
- Console.ForegroundColor = ConsoleColor.White;
- string userfield = Console.ReadLine();
- if (userfield == username)
- {
- password();
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Invalid Username!");
- Console.ForegroundColor = ConsoleColor.White;
- login();
- }
- }
- static void logged()
- {
- bool logged = true;
- Console.WriteLine("Welcome to xrx Interface!");
- Console.WriteLine("How i can help you today?");
- Console.WriteLine("Type ''help'' to see whats available");
- while (logged)
- {
- string[] cmds = new string[3] { "help", "logoff", "about" };
- string[] cmdresponse = new string[2] { "y", "n" };
- string cmdline = Console.ReadLine();
- if (cmdline == cmds[0])
- {
- Console.WriteLine("Available Commands: {0} {1} {2}", cmds);
- }
- else if (cmdline == cmds[1])
- {
- Console.WriteLine("Are you sure? (y or n)");
- cmdline = Console.ReadLine();
- if (cmdline == cmdresponse[0])
- {
- login();
- }
- }
- else if (cmdline == cmds[2])
- {
- Console.WriteLine("Created by xrx on 21/11/2016");
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Command Not Found!");
- Console.ForegroundColor = ConsoleColor.White;
- }
- }
- }
- static void password()
- {
- string password = "xrx1";
- Console.ForegroundColor = ConsoleColor.Yellow;
- Console.WriteLine("Password: ");
- Console.ForegroundColor = ConsoleColor.Black;
- string pwfield = Console.ReadLine();
- Console.ForegroundColor = ConsoleColor.White;
- if (pwfield == password)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Access Granted!");
- Console.ForegroundColor = ConsoleColor.White;
- logged();
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Invalid Password!");
- Console.ForegroundColor = ConsoleColor.White;
- login();
- }
- }
- static void Main(string[] args)
- {
- Console.Title = "xrx interface v1.1";
- login();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement