コード例 #1
0
        public override void Execute()
        {
            base.Execute();

            List <string>      singleOptionList = ProcessStatusOptions.GetSingleOptions();
            CommandLineOptions cloptions        = CommandLineParser.Parse(Arguments.ToArray <string>(), singleOptionList.ToArray());

            options = ParseOptions(cloptions);
            CheckOptions(options);

            if (options.IsSetHelp)
            {
                RaiseCommandLineUsage(this, ProcessStatusOptions.Usage);
            }
            else if (options.IsSetVersion)
            {
                RaiseCommandLineUsage(this, Version);
            }
            else
            {
                StartProcessStatus();
            }

            Terminate();
        }
コード例 #2
0
 private static void CheckOptions(ProcessStatusCommandLineOptions checkedOptions)
 {
     if (!checkedOptions.IsSetHelp && !checkedOptions.IsSetVersion)
     {
         ;
     }
 }
コード例 #3
0
        private static ProcessStatusCommandLineOptions ParseOptions(CommandLineOptions commandLineOptions)
        {
            if (commandLineOptions == null)
            {
                throw new CommandLineException(string.Format(CultureInfo.CurrentCulture,
                                                             "Option used in invalid context -- {0}", "must specify a option."));
            }

            ProcessStatusCommandLineOptions targetOptions = new ProcessStatusCommandLineOptions();

            if (commandLineOptions.Arguments.Count >= 0)
            {
                foreach (var arg in commandLineOptions.Arguments.Keys)
                {
                    ProcessStatusOptionType optionType = ProcessStatusOptions.GetOptionType(arg);
                    if (optionType == ProcessStatusOptionType.None)
                    {
                        throw new CommandLineException(
                                  string.Format(CultureInfo.CurrentCulture, "Option used in invalid context -- {0}",
                                                string.Format(CultureInfo.CurrentCulture, "cannot parse the command line argument : [{0}].", arg)));
                    }

                    switch (optionType)
                    {
                    case ProcessStatusOptionType.Help:
                        targetOptions.IsSetHelp = true;
                        break;

                    case ProcessStatusOptionType.Version:
                        targetOptions.IsSetVersion = true;
                        break;
                    }
                }
            }

            return(targetOptions);
        }
コード例 #4
0
        public override void Execute()
        {
            base.Execute();

              List<string> singleOptionList = ProcessStatusOptions.GetSingleOptions();
              CommandLineOptions cloptions = CommandLineParser.Parse(Arguments.ToArray<string>(), singleOptionList.ToArray());
              options = ParseOptions(cloptions);
              CheckOptions(options);

              if (options.IsSetHelp)
              {
            RaiseCommandLineUsage(this, ProcessStatusOptions.Usage);
              }
              else if (options.IsSetVersion)
              {
            RaiseCommandLineUsage(this, Version);
              }
              else
              {
            StartProcessStatus();
              }

              Terminate();
        }
コード例 #5
0
        private static ProcessStatusCommandLineOptions ParseOptions(CommandLineOptions commandLineOptions)
        {
            if (commandLineOptions == null)
            throw new CommandLineException(string.Format(CultureInfo.CurrentCulture,
              "Option used in invalid context -- {0}", "must specify a option."));

              ProcessStatusCommandLineOptions targetOptions = new ProcessStatusCommandLineOptions();

              if (commandLineOptions.Arguments.Count >= 0)
              {
            foreach (var arg in commandLineOptions.Arguments.Keys)
            {
              ProcessStatusOptionType optionType = ProcessStatusOptions.GetOptionType(arg);
              if (optionType == ProcessStatusOptionType.None)
            throw new CommandLineException(
              string.Format(CultureInfo.CurrentCulture, "Option used in invalid context -- {0}",
              string.Format(CultureInfo.CurrentCulture, "cannot parse the command line argument : [{0}].", arg)));

              switch (optionType)
              {
            case ProcessStatusOptionType.Help:
              targetOptions.IsSetHelp = true;
              break;
            case ProcessStatusOptionType.Version:
              targetOptions.IsSetVersion = true;
              break;
              }
            }
              }

              return targetOptions;
        }
コード例 #6
0
 private static void CheckOptions(ProcessStatusCommandLineOptions checkedOptions)
 {
     if (!checkedOptions.IsSetHelp && !checkedOptions.IsSetVersion)
       {
     ;
       }
 }