mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
- code refactoring
- made more and more easily extensible: * commands automatically loaded from plugins dlls * declarative and automatic command parameter parsing * common code moved to base classes - other fixes svn path=/trunk/; revision=33344
This commit is contained in:
parent
e3407fdd9c
commit
d7b2077ed8
42 changed files with 2263 additions and 1689 deletions
51
irc/TechBot/TechBot.Library/Commands/HelpCommand.cs
Normal file
51
irc/TechBot/TechBot.Library/Commands/HelpCommand.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("help", Help = "!help")]
|
||||
public class HelpCommand : Command
|
||||
{
|
||||
private string m_CommandName = null;
|
||||
|
||||
public HelpCommand()
|
||||
{
|
||||
}
|
||||
|
||||
[CommandParameter("Name", "The command name to show help")]
|
||||
public string CommandName
|
||||
{
|
||||
get { return m_CommandName; }
|
||||
set { m_CommandName = value; }
|
||||
}
|
||||
|
||||
public override void ExecuteCommand()
|
||||
{
|
||||
if (CommandName == null)
|
||||
{
|
||||
Say("I support the following commands:");
|
||||
|
||||
foreach (CommandBuilder command in TechBot.Commands)
|
||||
{
|
||||
Say("!{0} - {1}",
|
||||
command.Name,
|
||||
command.Description);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CommandBuilder cmdBuilder = TechBot.Commands.Find(CommandName);
|
||||
|
||||
if (cmdBuilder == null)
|
||||
{
|
||||
Say("Command '{0}' is not recognized. Type '!help' to show all available commands", CommandName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Say("Command '{0}' help:", CommandName);
|
||||
Say("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue