Example #1
0
        public static void ConsoleInterface()
        {
            Console.WriteLine("Hello, this is a backup system for text files.");

            bool isInput = true;

            while (isInput)
            {
                Console.WriteLine("What mode of operation to include?"
                                  + Environment.NewLine + "\t 1: watcher mode"
                                  + Environment.NewLine + "\t 2: rollback changes"
                                  + Environment.NewLine + "\t 3: exit from the program");
                if (int.TryParse(Console.ReadLine(), out int result))
                {
                    switch (result)
                    {
                    case 1:
                    {
                        Watcher.Run();
                        break;
                    }

                    case 2:
                    {
                        string           dateTimeForBackup = ChooseDateAndTimeForBackup();
                        FileEditingClass fileEditingClass  = new FileEditingClass();
                        fileEditingClass.Backup(dateTimeForBackup);
                        break;
                    }

                    case 3:
                    {
                        isInput = false;
                        break;
                    }

                    default:
                    {
                        Console.WriteLine("Unknown command!");
                        break;
                    }
                    }
                }
            }
        }