public HelpCommand(FeaturesCommand featuresCommand, ChangelogCommand changelogCommand, AboutCommand aboutCommand, ThanksToCommand thanksToCommand, BugReportingCommand bugReportingCommand) : base(MenuStrings.helpToolStripMenuItem1_Text) { ChildrenCommands = new List <IToolbarCommand> { featuresCommand, changelogCommand, null, aboutCommand, null, thanksToCommand, bugReportingCommand }; }
public static Command CreateActivatorCommand(InstallProcessControl parent, InstallOperation operation) { FeaturesCommand cmd = new FeaturesCommand(parent, FeatureActivator.ActivationDirection.Activate, operation); return(cmd); }
public static Command CreateDeactivatorCommand(InstallProcessControl parent, InstallOperation operation) { FeaturesCommand cmd = new FeaturesCommand(parent, FeatureActivator.ActivationDirection.Deactivate, operation); return cmd; }
public static void Main(string[] args) { //DateTime now = DateTime.Now; args = @"simulate -b 5 -n 1 -t rel -i ..\..\..\etc\$$year$$-runs.txt -j ..\..\..\etc\$$year$$-judgments.txt -e mout -p meta=..\..\..\etc\metadata.txt".Replace("$$year$$", args[0]).Split(); if (args.Length > 0) { // Check CLI command name string commandName = args[0].ToLower(); AbstractCommand command = null; switch (commandName) { case "-h": Allcea.PrintMainUsage(null); Environment.Exit(0); break; case "estimate": command = new EstimateCommand(); break; case "evaluate": command = new EvaluateCommand(); break; case "next": command = new NextCommand(); break; case "simulate": command = new SimulateCommand(); break; case "features": command = new FeaturesCommand(); break; default: Console.Error.WriteLine("'" + commandName + "' is not a valid Allcea command. See '" + Allcea.CLI_NAME_AND_VERSION + " -h'."); Environment.Exit(1); break; } // Parse CLI options Options options = command.Options; // help? Cannot wait to parse CLI options because it will throw exception before if (options.HasOption("h") && args.Contains("-h")) { Allcea.PrintUsage(null, commandName, options, command.OptionsFooter); } else { try { Parser parser = new BasicParser(); CommandLine cmd = parser.Parse(options, args.Skip(1).ToArray()); // If we have extra CLI options the Parse method doesn't throw exception. Handle here if (cmd.Args == null || cmd.Args.Length != 0) { throw new ParseException("Unused option(s): " + string.Join(",", cmd.Args)); } // Run command command.CheckOptions(cmd); command.Run(); } catch (ParseException pe) { Console.Error.WriteLine((pe.Message.EndsWith(".") ? pe.Message : pe.Message + ".") + " See '" + Allcea.CLI_NAME_AND_VERSION + " " + commandName + " -h'."); Environment.Exit(1); } catch (Exception ex) { Console.Error.WriteLine(ex.Message); Environment.Exit(1); } } } else { // No CLI options Allcea.PrintMainUsage(null); Environment.Exit(1); } //Console.Error.WriteLine(DateTime.Now.Subtract(now).TotalMilliseconds); }