Esempio n. 1
0
        /// <summary>
        ///     The parse command line.
        /// </summary>
        private static void ParseCommandLine()
        {
            try
            {
                Options = CommandLine.Parse <CleanOptions>();
            }
            catch (CommandLineHelpException exception)
            {
                Console.WriteLine(exception.ArgumentHelp.GetHelpText(Console.BufferWidth));
                Environment.Exit(1);
            }
            catch (CommandLineArgumentInvalidException exception)
            {
                CommandLine.WriteLineColor(ConsoleColor.Red, exception.ArgumentHelp.Message);
                CommandLine.WriteLineColor(ConsoleColor.Cyan, exception.ArgumentHelp.GetHelpText(Console.BufferWidth));

                CommandLine.Pause();
                Environment.Exit(1);
            }
            catch (Exception exception)
            {
                CommandLine.WriteLineColor(ConsoleColor.Red, exception.Message);
                CommandLine.Pause();
                Environment.Exit(1);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     The parse command line.
        /// </summary>
        private static void ParseCommandLine()
        {
            try
            {
                Options = CommandLine.Parse<CleanOptions>();
            }
            catch (CommandLineHelpException exception)
            {
                Console.WriteLine(exception.ArgumentHelp.GetHelpText(Console.BufferWidth));
                Environment.Exit(1);
            }
            catch (CommandLineArgumentInvalidException exception)
            {
                CommandLine.WriteLineColor(ConsoleColor.Red, exception.ArgumentHelp.Message);
                CommandLine.WriteLineColor(ConsoleColor.Cyan, exception.ArgumentHelp.GetHelpText(Console.BufferWidth));

                CommandLine.Pause();
                Environment.Exit(1);
            }
            catch (Exception exception)
            {
                CommandLine.WriteLineColor(ConsoleColor.Red, exception.Message);
                CommandLine.Pause();
                Environment.Exit(1);
            }
        }