public ActionIfFileExistsEnum ActionIfFileExists(string arg)
        {
            while (true)
            {
                Console.CursorVisible = true;
                Console.Write($"\r\n{arg} alreasy exists. Overwrite? (Y)es|(N)o|(A)ll|(C)ancel ");
                var key = Console.ReadKey();

                Console.WriteLine();

                switch (key.Key)
                {
                case ConsoleKey.Y:

                    return(ActionIfFileExistsEnum.Overwrite);

                case ConsoleKey.N:
                    return(ActionIfFileExistsEnum.Skip);

                case ConsoleKey.A:
                    OverwriteIfExists = true;
                    OverwriteAllSelected?.Invoke();
                    return(ActionIfFileExistsEnum.OverwriteAll);

                case ConsoleKey.C:
                    Cancelled = true;
                    CancelSelected?.Invoke();
                    return(ActionIfFileExistsEnum.Abort);
                }
            }
        }
Beispiel #2
0
        private void InitializeCommands()
        {
            _confirmCommand = new Command(
                new Action(delegate
            {
                ConfirmSelected?.Invoke(this, null);
            }),
                null);

            _cancelCommand = new Command(
                new Action(delegate
            {
                CancelSelected?.Invoke(this, null);
            }),
                null);
        }
Beispiel #3
0
 private void OnCancel()
 {
     CancelSelected?.Invoke(this, EventArgs.Empty);
 }