Beispiel #1
0
        public void DoCommand(Command command)
        {
            switch (command.type)
            {
            case CommandType.DESCRIBE:
                DescribeCommand describeCommand = (DescribeCommand)command;
                describeCommand.Execute(mapController, describeCommand.id != null ? FindEntity(describeCommand.id) : null);
                break;

            case CommandType.SELECT:
                SelectCommand selectCommand = (SelectCommand)command;
                selectCommand.Execute(mapController, GetPlayerById(selectCommand.playerId));
                break;

            case CommandType.PERFORMACTION:
                PerformActionCommand performActionCommand = (PerformActionCommand)command;
                performActionCommand.Execute(mapController, GetPlayerById(performActionCommand.playerId), GetPlayerById(performActionCommand.playerId).selectedEntity);
                break;

            case CommandType.ENDTURN:
                EndTurnCommand endTurnCommand = (EndTurnCommand)command;
                endTurnCommand.Execute(turnController);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        public override void Run(string[] args)
        {
            options = new CmdParserOptionSet()
            {
                { "h|help", "Display this help information. To see online help, use: git help <command>", v => OfflineHelp() },
                { "all", "Instead of using only the annotated tags, use any ref found in `", v => cmd.All = true },
                { "tags", "Instead of using only the annotated tags, use any tag found in `", v => cmd.Tags = true },
                { "contains", "Instead of finding the tag that predates the commit, find the tag that comes after the commit, and thus contains it", v => cmd.Contains = true },
                { "abbrev=", "Instead of using the default 7 hexadecimal digits as the abbreviated object name, use <n> digits, or as many digits as needed to form a unique object name", v => cmd.Abbrev = v },
                { "candidates=", "Instead of considering only the 10 most recent tags as candidates to describe the input committish consider up to <n> candidates", v => cmd.Candidates = v },
                { "exact-match", "Only output exact matches (a tag directly references the supplied commit)", v => cmd.ExactMatch = true },
                { "debug", "Verbosely display information about the searching strategy being employed to standard error", v => cmd.Debug = true },
                { "long", "Always output the long format (the tag, the number of commits and the abbreviated commit name) even when it matches a tag", v => cmd.Long = true },
                { "match=", "Only consider tags matching the given pattern (can be used to avoid leaking private tags made from the repository)", v => cmd.Match = v },
                { "always", "Show uniquely abbreviated commit object as fallback", v => cmd.Always = true },
            };

            try
            {
                List <String> arguments = ParseOptions(args);
                if (arguments.Count > 0)
                {
                    cmd.Arguments = arguments;
                    cmd.Execute();
                }
                else
                {
                    OfflineHelp();
                }
            }
            catch (Exception e)
            {
                cmd.OutputStream.WriteLine(e.Message);
            }
        }