Beispiel #1
0
        public void ShowMenu()
        {
            DirFile.Say(DirFile.BR);
            DirFile.Say(menu);

            if (int.TryParse(Console.ReadLine(), out int choice))
            {
                if (choice == 1)
                {
                    Encrypt(); SetContent(); ShowMenu();
                }                                                        ///Three inline statements for 1 and 2
                else if (choice == 2)
                {
                    Decrypt(); SetContent(); ShowMenu();
                }
                else if (choice == 3)
                {
                    ReadFile(); ShowMenu();
                }
                else if (choice == 4)
                {
                    DirFile.Say("Peace Out..."); Console.ReadKey();
                }
                else
                {
                    DirFile.Say("Invalid choice");
                    ShowMenu();
                }
            }
            else
            {
                DirFile.Say("Invalid choice"); ShowMenu();
            }
        }
Beispiel #2
0
 public void ReadFile()
 {
     DirFile.Say(DirFile.BR);
     foreach (var line in FileLines)
     {
         DirFile.Say(line);
     }
 }
Beispiel #3
0
        public void Decrypt()
        {
            string changedLine;

            using (var writer = new StreamWriter(CurFile.FullName, false, Encoding.Unicode))
            {
                foreach (var line in FileLines)
                {
                    changedLine = DecryptLine(line);
                    writer.WriteLine(changedLine);
                }
                DirFile.Say("Decryption Done");
            }
        }