示例#1
0
        private void VerifyThenRun()
        {
            try
            {
                if (!CommandLineParameterBase.ShowHelp)
                {
                    if (CommandLineParameterBase.VerifyArguments())
                    {
                        try
                        {
                            RunBase();
                            return;
                        }
                        catch (Exception exception)
                        {
                            Console.Error.WriteLine();
                            Console.Error.WriteLine("Exiting program with exception: {0}", exception.Message);
                            Console.Out.WriteLine("===== DETAIL ======");
                            Console.Out.WriteLine(exception);
                        }
                    }
                }

                ShowHelp();
            }
            catch (InvalidOperationException)
            {
                ShowHelp();
            }
        }
示例#2
0
 public CommandLineParser(CommandLineParameterBase argumentSource)
 {
     Arguments       = new List <CommandLineArgument>();
     ArgumentsSource = argumentSource;
     ArgumentsMap    = GetPropertyMap();
 }
示例#3
0
 protected CommandLineProgramBase(CommandLineParameterBase commandLineParameterBase, string[] args)
 {
     CommandLineParameterBase = commandLineParameterBase;
     CommandLineParameterBase.LoadArguments(args);
     VerifyThenRun();
 }
示例#4
0
 public void ShowHelp()
 {
     ShowLogo();
     CommandLineParameterBase.ShowUsage();
 }