Beispiel #1
0
        /// <inheritdoc />
        public override void Handle(string[] args)
        {
            InvariantDictionary <ICommand> commands = this.GetCommands();

            // build output
            StringBuilder help = new();

            if (!args.Any())
            {
                help.AppendLine(
                    "The 'patch' command is the entry point for Content Patcher commands. These are "
                    + "intended for troubleshooting and aren't intended for players. You use it by specifying a more "
                    + "specific command (like 'help' in 'patch help'). Here are the available commands:\n\n"
                    );
                foreach (var entry in commands.OrderByHuman(p => p.Key))
                {
                    help.AppendLine(entry.Value.Description);
                    help.AppendLine();
                    help.AppendLine();
                }
            }
            else if (commands.TryGetValue(args[0], out ICommand command))
            {
                help.AppendLine(command.Description);
            }
            else
            {
                help.AppendLine($"Unknown command 'patch {args[0]}'. Type 'patch help' for available commands.");
            }

            // write output
            this.Monitor.Log(help.ToString().Trim(), LogLevel.Info);
        }