\r
namespace TechBot.Library\r
{\r
- public class ApiCommand : BaseCommand, ICommand\r
+ public class ApiCommand : Command\r
{\r
private const bool IsVerbose = false;\r
\r
private HtmlHelpSystem chm;\r
- private IServiceOutput serviceOutput;\r
private string chmPath;\r
private string mainChm;\r
- \r
- public ApiCommand(IServiceOutput serviceOutput,\r
- string chmPath,\r
- string mainChm)\r
+\r
+ public ApiCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- this.serviceOutput = serviceOutput;\r
- this.chmPath = chmPath;\r
- this.mainChm = mainChm;\r
Run();\r
}\r
\r
string message)\r
{\r
if (IsVerbose)\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
message);\r
}\r
\r
Console.WriteLine(String.Format("Loaded {0} CHMs",\r
chm.FileList.Length));\r
}\r
- \r
+\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "api" }; }\r
+ }\r
+\r
+ /*\r
public bool CanHandle(string commandName)\r
{\r
return CanHandle(commandName,\r
new string[] { "api" });\r
}\r
+*/\r
\r
- public void Handle(MessageContext context,\r
+ public override void Handle(MessageContext context,\r
string commandName,\r
string parameters)\r
{\r
Search(context,\r
parameters);\r
}\r
- \r
- public string Help()\r
+\r
+ public override string Help()\r
{\r
return "!api <apiname>";\r
}\r
if (prototype == null || prototype.Trim().Equals(String.Empty))\r
return false;\r
string formattedPrototype = FormatPrototype(prototype);\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
formattedPrototype);\r
return true;\r
}\r
if (prototype == null || prototype.Trim().Equals(String.Empty))\r
continue;\r
string formattedPrototype = FormatPrototype(prototype);\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
formattedPrototype);\r
return true;\r
}\r
private void DisplayNoResult(MessageContext context,\r
string keyword)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("I don't know about keyword {0}",\r
keyword));\r
}\r
\r
private void DisplayNoKeyword(MessageContext context)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
"Please give me a keyword.");\r
}\r
\r