mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
* refactor the code to make it more OOP and extensible
* remove old outdated SD project files * make it use some .NET 2.0 features as generic collections and settings svn path=/trunk/; revision=31130
This commit is contained in:
parent
588f8770cd
commit
82b5e2eb8b
31 changed files with 687 additions and 491 deletions
|
@ -3,38 +3,33 @@ using System.Collections;
|
|||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
public class HelpCommand : BaseCommand, ICommand
|
||||
public class HelpCommand : Command
|
||||
{
|
||||
private IServiceOutput serviceOutput;
|
||||
private ArrayList commands;
|
||||
|
||||
public HelpCommand(IServiceOutput serviceOutput,
|
||||
ArrayList commands)
|
||||
public HelpCommand(TechBotService techBot)
|
||||
: base(techBot)
|
||||
{
|
||||
this.serviceOutput = serviceOutput;
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
public bool CanHandle(string commandName)
|
||||
{
|
||||
return CanHandle(commandName,
|
||||
new string[] { "help" });
|
||||
}
|
||||
|
||||
public void Handle(MessageContext context,
|
||||
string commandName,
|
||||
string parameters)
|
||||
{
|
||||
serviceOutput.WriteLine(context,
|
||||
"I support the following commands:");
|
||||
foreach (ICommand command in commands)
|
||||
{
|
||||
serviceOutput.WriteLine(context,
|
||||
command.Help());
|
||||
}
|
||||
}
|
||||
|
||||
public string Help()
|
||||
public override string[] AvailableCommands
|
||||
{
|
||||
get { return new string[] { "help" }; }
|
||||
}
|
||||
|
||||
public override void Handle(
|
||||
MessageContext context,
|
||||
string commandName,
|
||||
string parameters)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(context, "I support the following commands:");
|
||||
|
||||
foreach (Command command in TechBot.Commands)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(context,
|
||||
command.Help());
|
||||
}
|
||||
}
|
||||
|
||||
public override string Help()
|
||||
{
|
||||
return "!help";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue