Ejemplo n.º 1
0
        internal void DisplayMenu(string path)
        {
            //Options for various tasks a user can perform
            Console.WriteLine("\nExit: x\tInsert Line: i\tUpdate Line: u\tNew File: n\tOpen: o");
            Console.Write("\nOption: ");
            string choice = Console.ReadLine();

            switch (choice)
            {
            case "x":     //User pressed x
            {
                Environment.Exit(0);
                break;
            }

            case "i":     //User pressed i
            {
                InsertFileLine file = new InsertFileLine(path);
                file.InsertLine();
                break;
            }

            case "u":     //User pressed u
            {
                UpdateFile file = new UpdateFile(path);
                file.UpdateLine();
                break;
            }

            case "n":     //User pressed n
            {
                NewFile file = new NewFile();
                file.createNewFile();
                break;
            }

            case "o":     //User pressed o
            {
                OpenFile file = new OpenFile();
                file.displayFile();
                break;
            }

            default:
            {
                Console.WriteLine("\nInvalid Input");
                DisplayMenu(path);
                break;
            }
            }
        }