Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EnigmaMachine
- {
- class Driver
- {
- static void Main(string[] args)
- {
- GetMenu menu = new GetMenu();
- GetMenu.DisplayMenu();
- }
- }
- class GetMenu
- {
- static Boolean exit;
- public static void DisplayMenu()
- {
- while(!exit)
- {
- ReadMenu();
- int choice = ReceiveInput();
- PerformAction(choice);
- }
- }
- public static void ReadMenu()
- {
- String line;
- try
- {
- StreamReader sr = new StreamReader("H:\\MainScreen.txt");
- line = sr.ReadLine();
- while(line != null)
- {
- Console.WriteLine(line);
- line = sr.ReadLine();
- }
- sr.Close();
- Console.ReadLine();
- }
- catch (Exception e)
- {
- Console.WriteLine("Exception: " + e.Message);
- }
- finally
- {
- Console.WriteLine("Executing finally block.");
- }
- }
- private static int ReceiveInput()
- {
- int choice = -1;
- while(choice < 0 || choice > 7)
- {
- try
- {
- choice = Int32.Parse(Console.ReadLine());
- }
- catch (FormatException e)
- {
- Console.WriteLine("Invalid selection. Please try again.");
- }
- }
- return choice;
- }
- private static void PerformAction(int choice)
- {
- switch(choice)
- {
- case 0:
- exit = true;
- Console.WriteLine("Thank you for using the Enigma Machine.");
- break;
- case 1:
- }
- }
- }
- class Interpreter
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement