Guest User

Untitled

a guest
Jan 13th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.20 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static string username;
  11.         static string password;
  12.  
  13.         static void DoLogin()
  14.         {
  15.             // Whatever should happend when you login
  16.             Console.Out.WriteLine("Logged in as " + username + "!");
  17.             return;
  18.         }
  19.  
  20.         static void DoLogout()
  21.         {
  22.             // Whatever should happend when you logout
  23.             Console.Out.WriteLine("You have successfully logged out!");
  24.             return;
  25.         }
  26.  
  27.         static void GetLogin()
  28.         {
  29.             Console.Out.Write("Enter Username: ");
  30.             username = Console.In.ReadLine();
  31.             Console.Out.Write("Enter Password: ");
  32.             password = Console.In.ReadLine();
  33.             DoLogin();
  34.             return;
  35.         }
  36.         static bool GetInput()
  37.         {
  38.             Console.Out.Write(">>> ");
  39.             string Text = Console.In.ReadLine();
  40.             switch (Text)
  41.             {
  42.                 /* Incase you don't know the switch statement, it's like if, else if, else.
  43.                  * Typing case "String here":
  44.                  *          Code to occur if Text equlals the case
  45.                  *          break;
  46.                  * Or default:
  47.                  *      Code to occur if it didn't match any of them (else)
  48.                  *      break;
  49.                  */
  50.                 case "exit":
  51.                     return false;
  52.                 case "logout":
  53.                     DoLogout();
  54.                     GetLogin();
  55.                     break;
  56.                 default:
  57.                     Console.Out.Write("Unknown command entered!\n");
  58.                     break;
  59.             }
  60.             return true;
  61.         }
  62.         static void Main(string[] args)
  63.         {
  64.             Console.Out.Write("--- Onion Steam Version 1.0 ---\n\n");
  65.             GetLogin();
  66.             input:
  67.                 bool i = GetInput();
  68.             if (!i)
  69.             {
  70.                 return;
  71.             }
  72.             else
  73.             {
  74.                 goto input;
  75.             }
  76.         }
  77.     }
  78. }
Add Comment
Please, Sign In to add comment