Пример #1
0
        private void HandleNoBackupFile()
        {
            var yes = new MenuOption {
                IsSelected = true, Text = "Yes"
            };
            var no = new MenuOption {
                Text = "No"
            };

            Logger.Warn("Could not find any backup file!");

            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Could not find any backup file!");
            Console.ForegroundColor = ForegroundColor;
            Console.WriteLine();
            Console.WriteLine("Would you like to reset all configuration values possibly changed by SEB?");

            ShowMenu(new List <MenuOption> {
                yes, no
            });

            if (yes.IsSelected)
            {
                next = new Reset(Context);
            }

            Logger.Info($"The user chose {(yes.IsSelected ? "" : "not ")}to perform a reset.");
        }
Пример #2
0
        private bool TryGetUserInfo(out string userName, out string sid)
        {
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("IMPORTANT: Some configuration values are user specific. In order to reset these values, the user specified below needs to be logged in!");
            Console.ForegroundColor = ForegroundColor;
            Console.WriteLine();
            Console.WriteLine("Please enter the name of the user for which to reset all configuration values:");

            userName = ReadLine();

            StartProgressAnimation();
            var success = Context.UserInfo.TryGetSidForUser(userName, out sid);

            StopProgressAnimation();

            while (!success)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"Could not find user '{userName}'!");
                Console.ForegroundColor = ForegroundColor;

                var tryAgain = new MenuOption {
                    IsSelected = true, Text = "Try again"
                };
                var mainMenu = new MenuOption {
                    Text = "Return to main menu"
                };

                ShowMenu(new List <MenuOption> {
                    tryAgain, mainMenu
                });

                if (mainMenu.IsSelected)
                {
                    break;
                }

                ClearLine(Console.CursorTop - 1);
                ClearLine(Console.CursorTop - 1);
                ClearLine(Console.CursorTop - 1);
                ClearLine(Console.CursorTop - 1);

                userName = ReadLine();
                success  = Context.UserInfo.TryGetSidForUser(userName, out sid);
            }

            return(success);
        }