mirror of
https://github.com/reactos/reactos.git
synced 2024-10-11 03:36:34 +00:00
52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
|
using System;
|
||
|
|
||
|
namespace TechBot.Library
|
||
|
{
|
||
|
public abstract class Command
|
||
|
{
|
||
|
protected TechBotService m_TechBotService = null;
|
||
|
protected MessageContext m_Context = null;
|
||
|
|
||
|
public TechBotService TechBot
|
||
|
{
|
||
|
get { return m_TechBotService; }
|
||
|
set { m_TechBotService = value; }
|
||
|
}
|
||
|
|
||
|
public MessageContext Context
|
||
|
{
|
||
|
get { return m_Context; }
|
||
|
set { m_Context = value; }
|
||
|
}
|
||
|
|
||
|
public string Name
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
CommandAttribute commandAttribute = (CommandAttribute)
|
||
|
Attribute.GetCustomAttribute(GetType(), typeof(CommandAttribute));
|
||
|
|
||
|
return commandAttribute.Name;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void ParseParameters(string paramaters)
|
||
|
{
|
||
|
ParametersParser parser = new ParametersParser(paramaters, this);
|
||
|
parser.Parse();
|
||
|
}
|
||
|
|
||
|
protected virtual void Say(string message)
|
||
|
{
|
||
|
TechBot.ServiceOutput.WriteLine(Context, message);
|
||
|
}
|
||
|
|
||
|
protected virtual void Say(string format , params object[] args)
|
||
|
{
|
||
|
TechBot.ServiceOutput.WriteLine(Context, String.Format(format, args));
|
||
|
}
|
||
|
|
||
|
public abstract void ExecuteCommand();
|
||
|
}
|
||
|
}
|