<add key="IRCBotPassword" value="MyPassword" />\r
<add key="ChmPath" value="C:\IRC\TechBot\CHM" />\r
<add key="MainChm" value="kmarch.chm" />\r
- <add key="NtstatusXml" value="ntstatus.xml" />\r
- <add key="WinerrorXml" value="winerror.xml" />\r
- <add key="HresultXml" value="hresult.xml" />\r
- <add key="WmXml" value="wm.xml" />\r
- <add key="SvnCommand" value="svn co svn://svn.reactos.org/trunk/reactos" />\r
<add key="BugUrl" value="http://www.reactos.org/bugzilla/show_bug.cgi?id={0}" />\r
<add key="WineBugUrl" value="http://bugs.winehq.org/show_bug.cgi?id={0}" />\r
<add key="SambaBugUrl" value="https://bugzilla.samba.org/show_bug.cgi?id={0}" />\r
IRCBotPassword,\r
ChmPath,\r
MainChm,\r
- NtstatusXml,\r
- WinerrorXml,\r
- HresultXml,\r
- WmXml,\r
- SvnCommand,\r
+ //NtstatusXml,\r
+ //WinerrorXml,\r
+ //HresultXml,\r
+ //WmXml,\r
+ //SvnCommand,\r
BugUrl,\r
WineBugUrl,\r
SambaBugUrl);\r
System.Console.WriteLine("TechBot running console service...");\r
TechBotService service = new TechBotService(new ConsoleServiceOutput(),\r
ChmPath,\r
- MainChm,\r
- NtstatusXml,\r
- WinerrorXml,\r
- HresultXml,\r
- WmXml,\r
- SvnCommand,\r
- BugUrl,\r
- WineBugUrl,\r
- SambaBugUrl);\r
+ MainChm);\r
+ //NtstatusXml,\r
+ //WinerrorXml,\r
+ //HresultXml,\r
+ //WmXml,\r
+ //SvnCommand,\r
+ //BugUrl,\r
+ //WineBugUrl,\r
+ //SambaBugUrl);\r
service.Run();\r
while (true)\r
{\r
<Name>TechBot.Library</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
\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
\r
namespace TechBot.Library\r
{\r
- public class BugCommand : BaseCommand, ICommand\r
+ public abstract class BugCommand : Command//, ICommand\r
{\r
- private IServiceOutput serviceOutput;\r
- private string RosBugUrl;\r
- private string WineBugUrl;\r
- private string SambaBugUrl;\r
-\r
- public BugCommand(IServiceOutput serviceOutput,\r
- string RosBugUrl,\r
- string WineBugUrl,\r
- string SambaBugUrl)\r
- {\r
- this.serviceOutput = serviceOutput;\r
- this.RosBugUrl = RosBugUrl;\r
- this.WineBugUrl = WineBugUrl;\r
- this.SambaBugUrl = SambaBugUrl;\r
- }\r
- \r
- public bool CanHandle(string commandName)\r
+ public BugCommand(TechBotService techBot) : base (techBot)\r
{\r
- return CanHandle(commandName,\r
- new string[] { "bug" });\r
}\r
\r
- public void Handle(MessageContext context,\r
- string commandName,\r
- string parameters)\r
- {\r
- string bugText = parameters;\r
- if (bugText.Equals(String.Empty))\r
- {\r
- serviceOutput.WriteLine(context,\r
- "Please provide a valid bug number.");\r
- return;\r
- }\r
+ public override void Handle(MessageContext context,\r
+ string commandName,\r
+ string parameters)\r
+ {\r
+ string bugText = parameters;\r
+ if (bugText.Equals(String.Empty))\r
+ {\r
+ TechBot.ServiceOutput.WriteLine(context,\r
+ "Please provide a valid bug number.");\r
+ return;\r
+ }\r
\r
- NumberParser np = new NumberParser();\r
- long bug = np.Parse(bugText);\r
- if (np.Error)\r
- {\r
- serviceOutput.WriteLine(context,\r
- String.Format("{0} is not a valid bug number.",\r
- bugText));\r
- return;\r
- }\r
- \r
- string bugUrl = this.RosBugUrl;\r
+ NumberParser np = new NumberParser();\r
+ long bug = np.Parse(bugText);\r
+ if (np.Error)\r
+ {\r
+ TechBot.ServiceOutput.WriteLine(context,\r
+ String.Format("{0} is not a valid bug number.",\r
+ bugText));\r
+ return;\r
+ }\r
\r
- if (context is ChannelMessageContext)\r
- {\r
- ChannelMessageContext channelContext = context as ChannelMessageContext;\r
- if (channelContext.Channel.Name == "winehackers")\r
- bugUrl = this.WineBugUrl;\r
- else if (channelContext.Channel.Name == "samba-technical")\r
- bugUrl = this.SambaBugUrl;\r
- }\r
- \r
- serviceOutput.WriteLine(context,\r
- String.Format(bugUrl, bug));\r
- }\r
- \r
- public string Help()\r
- {\r
- return "!bug <number>";\r
- }\r
+ /*\r
+ string bugUrl = this.RosBugUrl;\r
+\r
+ if (context is ChannelMessageContext)\r
+ {\r
+ ChannelMessageContext channelContext = context as ChannelMessageContext;\r
+ if (channelContext.Channel.Name == "winehackers")\r
+ bugUrl = this.WineBugUrl;\r
+ else if (channelContext.Channel.Name == "samba-technical")\r
+ bugUrl = this.SambaBugUrl;\r
+ }*/\r
+\r
+ TechBot.ServiceOutput.WriteLine(context, String.Format(BugUrl, bug));\r
+ }\r
+\r
+ protected abstract string BugUrl { get; }\r
}\r
}\r
--- /dev/null
+using System;
+
+namespace TechBot.Library
+{
+ /*
+ public interface ICommand
+ {
+ bool CanHandle(string commandName);
+ void Handle(MessageContext context,
+ string commandName,
+ string parameters);
+ //string Help();
+ }*/
+
+ public abstract class Command
+ {
+ protected TechBotService m_TechBotService = null;
+
+ public Command(TechBotService techbot)
+ {
+ m_TechBotService = techbot;
+ }
+
+ public TechBotService TechBot
+ {
+ get { return m_TechBotService; }
+ }
+
+ public abstract string[] AvailableCommands { get; }
+
+ public abstract void Handle(MessageContext context,
+ string commandName,
+ string parameters);
+
+ /*
+ protected bool CanHandle(string commandName,
+ string[] availableCommands)
+ {
+ foreach (string availableCommand in availableCommands)
+ {
+ if (String.Compare(availableCommand, commandName, true) == 0)
+ return true;
+ }
+ return false;
+ }
+ */
+
+ public virtual string Help()
+ {
+ return "No help is available for this command";
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Xml;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TechBot.Library
+{
+ public abstract class XmlCommand : Command
+ {
+ protected XmlDocument m_XmlDocument;
+
+ public XmlCommand(TechBotService techBot)
+ : base(techBot)
+ {
+ m_XmlDocument = new XmlDocument();
+ m_XmlDocument.Load(XmlFile);
+ }
+
+ public abstract string XmlFile { get; }
+
+ public XmlDocument XmlDocument
+ {
+ get { return m_XmlDocument; }
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<project name="TechBot.Library" default="build">\r
-\r
- <property name="output.dir" value="..\bin" />\r
-\r
- <target name="build" description="Build component">\r
- <mkdir dir="${output.dir}" />\r
- <csc target="library"\r
- output="${output.dir}\TechBot.Library.dll"\r
- optimize="true"\r
- debug="true"\r
- doc="${output.dir}\TechBot.Library.xml"\r
- warninglevel="0">\r
- <sources>\r
- <include name="*.cs" />\r
- </sources>\r
- <references>\r
- <include name="${output.dir}\CHMLibrary.dll" />\r
- <include name="${output.dir}\TechBot.IRCLibrary.dll" />\r
- </references>\r
- </csc>\r
- </target>\r
-\r
-</project>\r
\r
namespace TechBot.Library\r
{\r
- public class ErrorCommand : BaseCommand, ICommand\r
+ public class ErrorCommand : Command\r
{\r
- private IServiceOutput serviceOutput;\r
private NtStatusCommand ntStatus;\r
private WinerrorCommand winerror;\r
- private HresultCommand hresult;\r
+ private HResultCommand hresult;\r
\r
- public ErrorCommand(IServiceOutput serviceOutput, string ntstatusXml,\r
- string winerrorXml, string hresultXml)\r
+ public ErrorCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- this.serviceOutput = serviceOutput;\r
- this.ntStatus = new NtStatusCommand(serviceOutput,\r
- ntstatusXml);\r
- this.winerror = new WinerrorCommand(serviceOutput,\r
- winerrorXml);\r
- this.hresult = new HresultCommand(serviceOutput,\r
- hresultXml);\r
+ this.ntStatus = new NtStatusCommand(techBot);\r
+ this.winerror = new WinerrorCommand(techBot);\r
+ this.hresult = new HResultCommand(techBot);\r
}\r
\r
+ /*\r
public bool CanHandle(string commandName)\r
{\r
return CanHandle(commandName,\r
new string[] { "error" });\r
}\r
+ */\r
+\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "error" }; }\r
+ }\r
\r
private static int GetSeverity(long error)\r
{\r
return code.ToString();\r
}\r
\r
- public void Handle(MessageContext context,\r
+ public override void Handle(MessageContext context,\r
string commandName,\r
string parameters)\r
{\r
string originalErrorText = parameters.Trim();\r
if (originalErrorText.Equals(String.Empty))\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
"Please provide an Error Code.");\r
return;\r
}\r
long error = np.Parse(errorText);\r
if (np.Error)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is not a valid Error Code.",\r
originalErrorText));\r
return;\r
goto retry;\r
}\r
\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("I don't know about Error Code {0}.",\r
originalErrorText));\r
}\r
else if (descriptions.Count == 1)\r
{\r
string description = (string)descriptions[0];\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is {1}.",\r
originalErrorText,\r
description));\r
}\r
else\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} could be:",\r
originalErrorText));\r
\r
foreach(string description in descriptions)\r
- serviceOutput.WriteLine(context, String.Format("\t{0}", description));\r
+ TechBot.ServiceOutput.WriteLine(context, String.Format("\t{0}", description));\r
}\r
}\r
- \r
- public string Help()\r
+\r
+ public override string Help()\r
{\r
return "!error <value>";\r
}\r
\r
namespace TechBot.Library\r
{\r
- public class HelpCommand : BaseCommand, ICommand\r
+ public class HelpCommand : Command\r
{\r
- private IServiceOutput serviceOutput;\r
- private ArrayList commands;\r
- \r
- public HelpCommand(IServiceOutput serviceOutput,\r
- ArrayList commands)\r
+ public HelpCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- this.serviceOutput = serviceOutput;\r
- this.commands = commands;\r
}\r
\r
- public bool CanHandle(string commandName)\r
- {\r
- return CanHandle(commandName,\r
- new string[] { "help" });\r
- }\r
- \r
- public void Handle(MessageContext context,\r
- string commandName,\r
- string parameters)\r
- {\r
- serviceOutput.WriteLine(context,\r
- "I support the following commands:");\r
- foreach (ICommand command in commands)\r
- {\r
- serviceOutput.WriteLine(context,\r
- command.Help());\r
- }\r
- }\r
- \r
- public string Help()\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "help" }; }\r
+ }\r
+\r
+ public override void Handle(\r
+ MessageContext context,\r
+ string commandName,\r
+ string parameters)\r
+ {\r
+ TechBot.ServiceOutput.WriteLine(context, "I support the following commands:");\r
+\r
+ foreach (Command command in TechBot.Commands)\r
+ {\r
+ TechBot.ServiceOutput.WriteLine(context,\r
+ command.Help());\r
+ }\r
+ }\r
+\r
+ public override string Help()\r
{\r
return "!help";\r
}\r
\r
namespace TechBot.Library\r
{\r
- public class HresultCommand : BaseCommand, ICommand\r
+ public class HResultCommand : XmlCommand\r
{\r
- private IServiceOutput serviceOutput;\r
- private XmlDocument hresultXmlDocument;\r
-\r
- public HresultCommand(IServiceOutput serviceOutput,\r
- string hresultXml)\r
+ public HResultCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- this.serviceOutput = serviceOutput;\r
- hresultXmlDocument = new XmlDocument();\r
- hresultXmlDocument.Load(hresultXml);\r
}\r
- \r
+\r
+ public override string XmlFile\r
+ {\r
+ get { return Settings.Default.HResultXml; }\r
+ }\r
+\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "hresult" }; }\r
+ }\r
+\r
+ /*\r
public bool CanHandle(string commandName)\r
{\r
return CanHandle(commandName,\r
new string[] { "hresult" });\r
}\r
+ */\r
\r
- public void Handle(MessageContext context,\r
+ public override void Handle(MessageContext context,\r
string commandName,\r
string parameters)\r
{\r
string hresultText = parameters;\r
if (hresultText.Equals(String.Empty))\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
"Please provide a valid HRESULT value.");\r
return;\r
}\r
long hresult = np.Parse(hresultText);\r
if (np.Error)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is not a valid HRESULT value.",\r
hresultText));\r
return;\r
string description = GetHresultDescription(hresult);\r
if (description != null)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is {1}.",\r
hresultText,\r
description));\r
}\r
else\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("I don't know about HRESULT {0}.",\r
hresultText));\r
}\r
}\r
\r
- public string Help()\r
+ public override string Help()\r
{\r
return "!hresult <value>";\r
}\r
\r
public string GetHresultDescription(long hresult)\r
{\r
- XmlElement root = hresultXmlDocument.DocumentElement;\r
+ XmlElement root = base.m_XmlDocument.DocumentElement;\r
XmlNode node = root.SelectSingleNode(String.Format("Hresult[@value='{0}']",\r
hresult.ToString("X8")));\r
if (node != null)\r
+++ /dev/null
-using System;\r
-\r
-namespace TechBot.Library\r
-{\r
- public interface ICommand\r
- {\r
- bool CanHandle(string commandName);\r
- void Handle(MessageContext context,\r
- string commandName,\r
- string parameters);\r
- string Help();\r
- }\r
-\r
- \r
- \r
- public class BaseCommand\r
- {\r
- protected bool CanHandle(string commandName,\r
- string[] availableCommands)\r
- {\r
- foreach (string availableCommand in availableCommands)\r
- {\r
- if (String.Compare(availableCommand, commandName, true) == 0)\r
- return true;\r
- }\r
- return false;\r
- }\r
- }\r
-}\r
using System;\r
+using System.Text;\r
using System.Collections;\r
using System.Threading;\r
+\r
using TechBot.IRCLibrary;\r
\r
namespace TechBot.Library\r
private string wmXml;\r
private string svnCommand;\r
private string bugUrl, WineBugUrl, SambaBugUrl;\r
- private IrcClient client;\r
+ private IrcClient m_IrcClient;\r
private ArrayList channels = new ArrayList(); /* IrcChannel */\r
private TechBotService service;\r
private bool isStopped = false;\r
string password,\r
string chmPath,\r
string mainChm,\r
- string ntstatusXml,\r
- string winerrorXml,\r
- string hresultXml,\r
- string wmXml,\r
- string svnCommand,\r
+ //string ntstatusXml,\r
+ //string winerrorXml,\r
+ //string hresultXml,\r
+ //string wmXml,\r
+ //string svnCommand,\r
string BugUrl,\r
string WineBugUrl,\r
string SambaBugUrl)\r
this.SambaBugUrl = SambaBugUrl;\r
}\r
\r
- public void Run()\r
- {\r
- service = new TechBotService(this,\r
- chmPath,\r
- mainChm,\r
- ntstatusXml,\r
- winerrorXml,\r
- hresultXml,\r
- wmXml,\r
- svnCommand,\r
- bugUrl,\r
- WineBugUrl,\r
- SambaBugUrl);\r
- service.Run();\r
+ public void Run()\r
+ {\r
+ service = new TechBotService(this,\r
+ chmPath,\r
+ mainChm);\r
+ //ntstatusXml,\r
+ //winerrorXml,\r
+ //hresultXml,\r
+ //wmXml,\r
+ //svnCommand,\r
+ //bugUrl,\r
+ //WineBugUrl,\r
+ //SambaBugUrl);\r
+ service.Run();\r
\r
- client = new IrcClient();\r
- client.Encoding = System.Text.Encoding.GetEncoding("iso-8859-1");\r
- client.MessageReceived += new MessageReceivedHandler(client_MessageReceived);\r
- client.ChannelUserDatabaseChanged += new ChannelUserDatabaseChangedHandler(client_ChannelUserDatabaseChanged);\r
- System.Console.WriteLine(String.Format("Connecting to {0} port {1}",\r
- hostname, port));\r
- client.Connect(hostname, port);\r
- System.Console.WriteLine("Connected...");\r
- client.Register(botname, password, null);\r
- System.Console.WriteLine(String.Format("Registered as {0}...", botname));\r
- JoinChannels();\r
- \r
- while (!isStopped)\r
- {\r
- Thread.Sleep(1000);\r
- }\r
+ m_IrcClient = new IrcClient();\r
+ m_IrcClient.Encoding = Encoding.GetEncoding("iso-8859-1");\r
+ m_IrcClient.MessageReceived += new MessageReceivedHandler(client_MessageReceived);\r
+ m_IrcClient.ChannelUserDatabaseChanged += new ChannelUserDatabaseChangedHandler(client_ChannelUserDatabaseChanged);\r
+ Console.WriteLine("Connecting to {0} port {1}",\r
+ hostname,\r
+ port);\r
+ m_IrcClient.Connect(hostname, port);\r
+ Console.WriteLine("Connected...");\r
+ m_IrcClient.Register(botname, password, null);\r
+ Console.WriteLine("Registered as {0}...", botname);\r
+ JoinChannels();\r
\r
- PartChannels();\r
- client.Diconnect();\r
- System.Console.WriteLine("Disconnected...");\r
- }\r
+ while (!isStopped)\r
+ {\r
+ Thread.Sleep(1000);\r
+ }\r
+\r
+ PartChannels();\r
+ m_IrcClient.Diconnect();\r
+ Console.WriteLine("Disconnected...");\r
+ }\r
\r
public void Stop()\r
{\r
{\r
foreach (string channelname in channelnames.Split(new char[] { ';' }))\r
{\r
- IrcChannel channel = client.JoinChannel(channelname);\r
+ IrcChannel channel = m_IrcClient.JoinChannel(channelname);\r
channels.Add(channel);\r
System.Console.WriteLine(String.Format("Joined channel #{0}...",\r
channel.Name));\r
{\r
foreach (IrcChannel channel in channels)\r
{\r
- client.PartChannel(channel, "Caught in the bitstream...");\r
+ m_IrcClient.PartChannel(channel, "Caught in the bitstream...");\r
System.Console.WriteLine(String.Format("Parted channel #{0}...",\r
channel.Name));\r
}\r
else if (GetTargetNickname(message,\r
out nickname))\r
{\r
- IrcUser targetUser = new IrcUser(client,\r
+ IrcUser targetUser = new IrcUser(m_IrcClient,\r
nickname);\r
if (String.Compare(targetUser.Nickname, botname, true) == 0)\r
{\r
- IrcUser sourceUser = new IrcUser(client,\r
+ IrcUser sourceUser = new IrcUser(m_IrcClient,\r
message.PrefixNickname);\r
context = new UserMessageContext(sourceUser);\r
return true;\r
\r
namespace TechBot.Library\r
{\r
- public class NtStatusCommand : BaseCommand, ICommand\r
+ public class NtStatusCommand : XmlCommand\r
{\r
- private IServiceOutput serviceOutput;\r
- private string ntstatusXml;\r
- private XmlDocument ntstatusXmlDocument;\r
-\r
- public NtStatusCommand(IServiceOutput serviceOutput,\r
- string ntstatusXml)\r
+ public NtStatusCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- this.serviceOutput = serviceOutput;\r
- this.ntstatusXml = ntstatusXml;\r
- ntstatusXmlDocument = new XmlDocument();\r
- ntstatusXmlDocument.Load(ntstatusXml);\r
}\r
- \r
+\r
+ public override string XmlFile\r
+ {\r
+ get { return Settings.Default.NtStatusXml; }\r
+ }\r
+\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "ntstatus" }; }\r
+ }\r
+/* \r
public bool CanHandle(string commandName)\r
{\r
return CanHandle(commandName,\r
new string[] { "ntstatus" });\r
}\r
-\r
- public void Handle(MessageContext context,\r
+*/\r
+ public override void Handle(MessageContext context,\r
string commandName,\r
string parameters)\r
{\r
string ntstatusText = parameters;\r
if (ntstatusText.Equals(String.Empty))\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
"Please provide a valid NTSTATUS value.");\r
return;\r
}\r
long ntstatus = np.Parse(ntstatusText);\r
if (np.Error)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is not a valid NTSTATUS value.",\r
ntstatusText));\r
return;\r
string description = GetNtstatusDescription(ntstatus);\r
if (description != null)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is {1}.",\r
ntstatusText,\r
description));\r
}\r
else\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("I don't know about NTSTATUS {0}.",\r
ntstatusText));\r
}\r
}\r
- \r
- public string Help()\r
+\r
+ public override string Help()\r
{\r
return "!ntstatus <value>";\r
}\r
\r
public string GetNtstatusDescription(long ntstatus)\r
{\r
- XmlElement root = ntstatusXmlDocument.DocumentElement;\r
+ XmlElement root = base.m_XmlDocument.DocumentElement;\r
XmlNode node = root.SelectSingleNode(String.Format("Ntstatus[@value='{0}']",\r
ntstatus.ToString("X8")));\r
if (node != null)\r
-using System.Reflection;\r
-using System.Runtime.CompilerServices;\r
-\r
-// Information about this assembly is defined by the following\r
-// attributes.\r
-//\r
-// change them to the information which is associated with the assembly\r
-// you compile.\r
-\r
-[assembly: AssemblyTitle("")]\r
-[assembly: AssemblyDescription("")]\r
-[assembly: AssemblyConfiguration("")]\r
-[assembly: AssemblyCompany("")]\r
-[assembly: AssemblyProduct("")]\r
-[assembly: AssemblyCopyright("")]\r
-[assembly: AssemblyTrademark("")]\r
-[assembly: AssemblyCulture("")]\r
-\r
-// The assembly version has following format :\r
-//\r
-// Major.Minor.Build.Revision\r
-//\r
-// You can specify all values by your own or you can build default build and revision\r
-// numbers with the '*' character (the default):\r
-\r
-[assembly: AssemblyVersion("1.0.*")]\r
-\r
-// The following attributes specify the key for the sign of your assembly. See the\r
-// .NET Framework documentation for more information about signing.\r
-// This is not required, if you don't want signing let these attributes like they're.\r
-[assembly: AssemblyDelaySign(false)]\r
-[assembly: AssemblyKeyFile("")]\r
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TechBot.Library
+{
+ class ReactOSBugUrl : BugCommand
+ {
+ public ReactOSBugUrl(TechBotService techBot)
+ : base(techBot)
+ {
+ }
+
+ public override string[] AvailableCommands
+ {
+ get { return new string[] { "rosbug" }; }
+ }
+
+ protected override string BugUrl
+ {
+ get { return "http://www.reactos.org/bugzilla/show_bug.cgi?id={0}"; }
+ }
+
+ public override string Help()
+ {
+ return "!rosbug <number>";
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TechBot.Library
+{
+ class SambaBugUrl : BugCommand
+ {
+ public SambaBugUrl(TechBotService techBot)
+ : base(techBot)
+ {
+ }
+
+ public override string[] AvailableCommands
+ {
+ get { return new string[] { "sambabug" }; }
+ }
+
+ protected override string BugUrl
+ {
+ get { return "https://bugzilla.samba.org/show_bug.cgi?id={0}"; }
+ }
+
+ public override string Help()
+ {
+ return "!sambabug <number>";
+ }
+ }
+}
--- /dev/null
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.832
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace TechBot.Library {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("C:\\Ros\\current\\irc\\TechBot\\Resources\\ntstatus.xml")]
+ public string NtStatusXml {
+ get {
+ return ((string)(this["NtStatusXml"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("C:\\Ros\\current\\irc\\TechBot\\Resources\\winerror.xml")]
+ public string WinErrorXml {
+ get {
+ return ((string)(this["WinErrorXml"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("C:\\Ros\\current\\irc\\TechBot\\Resources\\hresult.xml")]
+ public string HResultXml {
+ get {
+ return ((string)(this["HResultXml"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("C:\\Ros\\current\\irc\\TechBot\\Resources\\wm.xml")]
+ public string WMXml {
+ get {
+ return ((string)(this["WMXml"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("svn://svn.reactos.org/trunk/reactos")]
+ public string SVNRoot {
+ get {
+ return ((string)(this["SVNRoot"]));
+ }
+ }
+ }
+}
--- /dev/null
+namespace TechBot.Library {
+
+
+ // This class allows you to handle specific events on the settings class:
+ // The SettingChanging event is raised before a setting's value is changed.
+ // The PropertyChanged event is raised after a setting's value is changed.
+ // The SettingsLoaded event is raised after the setting values are loaded.
+ // The SettingsSaving event is raised before the setting values are saved.
+ internal sealed partial class Settings {
+
+ public Settings() {
+ // // To add event handlers for saving and changing settings, uncomment the lines below:
+ //
+ // this.SettingChanging += this.SettingChangingEventHandler;
+ //
+ // this.SettingsSaving += this.SettingsSavingEventHandler;
+ //
+ }
+
+ private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
+ // Add code to handle the SettingChangingEvent event here.
+ }
+
+ private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
+ // Add code to handle the SettingsSaving event here.
+ }
+ }
+}
--- /dev/null
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TechBot.Library" GeneratedClassName="Settings">
+ <Profiles />
+ <Settings>
+ <Setting Name="NtStatusXml" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">C:\Ros\current\irc\TechBot\Resources\ntstatus.xml</Value>
+ </Setting>
+ <Setting Name="WinErrorXml" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">C:\Ros\current\irc\TechBot\Resources\winerror.xml</Value>
+ </Setting>
+ <Setting Name="HResultXml" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">C:\Ros\current\irc\TechBot\Resources\hresult.xml</Value>
+ </Setting>
+ <Setting Name="WMXml" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">C:\Ros\current\irc\TechBot\Resources\wm.xml</Value>
+ </Setting>
+ <Setting Name="SVNRoot" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">svn://svn.reactos.org/trunk/reactos</Value>
+ </Setting>
+ </Settings>
+</SettingsFile>
\ No newline at end of file
\r
namespace TechBot.Library\r
{\r
- public class SvnCommand : BaseCommand, ICommand\r
+ public class SvnCommand : Command\r
{\r
- private IServiceOutput serviceOutput;\r
- private string svnCommand;\r
+ private string m_SvnRoot;\r
\r
- public SvnCommand(IServiceOutput serviceOutput,\r
- string svnCommand)\r
+ public SvnCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- this.serviceOutput = serviceOutput;\r
- this.svnCommand = svnCommand;\r
- }\r
- \r
- public bool CanHandle(string commandName)\r
- {\r
- return CanHandle(commandName,\r
- new string[] { "svn" });\r
+ m_SvnRoot = Settings.Default.SVNRoot;\r
}\r
\r
- public void Handle(MessageContext context,\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "svn" }; }\r
+ }\r
+ \r
+ public override void Handle(MessageContext context,\r
string commandName,\r
string parameters)\r
{\r
- serviceOutput.WriteLine(context,\r
- svnCommand);\r
+ TechBot.ServiceOutput.WriteLine(context, string.Format("svn co {0}" , m_SvnRoot));\r
}\r
- \r
- public string Help()\r
+\r
+ public override string Help()\r
{\r
return "!svn";\r
}\r
+++ /dev/null
-<Combine fileversion="1.0" name="TechBot.Library" description="">\r
- <StartMode startupentry="TechBot.Library" single="True">\r
- <Execute entry="TechBot.Library" type="None" />\r
- </StartMode>\r
- <Entries>\r
- <Entry filename=".\.\TechBot.Library.prjx" />\r
- </Entries>\r
- <Configurations active="Debug">\r
- <Configuration name="Release">\r
- <Entry name="TechBot.Library" configurationname="Debug" build="False" />\r
- </Configuration>\r
- <Configuration name="Debug">\r
- <Entry name="TechBot.Library" configurationname="Debug" build="False" />\r
- </Configuration>\r
- </Configurations>\r
-</Combine>
\ No newline at end of file
-->
<ItemGroup>
<Compile Include="ApiCommand.cs" />
- <Compile Include="AssemblyInfo.cs" />
<Compile Include="BugCommand.cs" />
+ <Compile Include="Commands\Base\XmlCommand.cs" />
+ <Compile Include="SambaBugUrl.cs" />
+ <Compile Include="WineBugUrl.cs" />
<Compile Include="ErrorCommand.cs" />
<Compile Include="HelpCommand.cs" />
<Compile Include="HresultCommand.cs" />
<Compile Include="MessageContext.cs" />
<Compile Include="NtStatusCommand.cs" />
<Compile Include="NumberParser.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="ReactOSBugUrl.cs" />
<Compile Include="ServiceOutput.cs" />
+ <Compile Include="Settings.cs" />
+ <Compile Include="Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ <DependentUpon>Settings.settings</DependentUpon>
+ </Compile>
<Compile Include="SvnCommand.cs" />
<Compile Include="TechBotService.cs" />
<Compile Include="WinerrorCommand.cs" />
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Folder Include="Properties\" />
+ <None Include="app.config" />
+ <None Include="Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
</ItemGroup>
</Project>
\ No newline at end of file
+++ /dev/null
-<Project name="TechBot.Library" standardNamespace="TechBot.Library" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">\r
- <Contents>\r
- <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\Default.build" subtype="Code" buildaction="Nothing" dependson="" data="" />\r
- <File name=".\TechBotService.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\ServiceOutput.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\IrcService.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\ApiCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\ICommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\HelpCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\NtStatusCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\NumberParser.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\HresultCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\WinerrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\ErrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\SvnCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\BugCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\WmCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- <File name=".\MessageContext.cs" subtype="Code" buildaction="Compile" dependson="" data="" />\r
- </Contents>\r
- <References>\r
- <Reference type="Project" refto="CHMLibrary" localcopy="True" />\r
- <Reference type="Project" refto="TechBot.IRCLibrary" localcopy="True" />\r
- </References>\r
- <DeploymentInformation target="" script="" strategy="File" />\r
- <Configuration runwithwarnings="True" name="Debug">\r
- <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />\r
- <Execution commandlineparameters="" consolepause="False" />\r
- <Output directory="..\bin\Debug" assembly="TechBot.Library" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />\r
- </Configuration>\r
- <Configurations active="Debug">\r
- <Configuration runwithwarnings="True" name="Debug">\r
- <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />\r
- <Execution commandlineparameters="" consolepause="False" />\r
- <Output directory="..\bin\Debug" assembly="TechBot.Library" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />\r
- </Configuration>\r
- <Configuration runwithwarnings="True" name="Release">\r
- <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />\r
- <Execution commandlineparameters="" consolepause="False" />\r
- <Output directory="..\bin\Release" assembly="TechBot.Library" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />\r
- </Configuration>\r
- </Configurations>\r
-</Project>\r
using System;\r
using System.Collections;\r
+using System.Collections.Generic;\r
using System.IO;\r
using System.Data;\r
using System.Threading;\r
private string wmXml;\r
private string svnCommand;\r
private string bugUrl, WineBugUrl, SambaBugUrl;\r
- private ArrayList commands = new ArrayList();\r
+ private List<Command> commands = new List<Command>();\r
\r
public TechBotService(IServiceOutput serviceOutput,\r
string chmPath,\r
- string mainChm,\r
- string ntstatusXml,\r
- string winerrorXml,\r
- string hresultXml,\r
- string wmXml,\r
- string svnCommand,\r
- string bugUrl,\r
- string WineBugUrl,\r
- string SambaBugUrl)\r
+ string mainChm)\r
+ //string ntstatusXml,\r
+ //string winerrorXml,\r
+ //string hresultXml,\r
+ //string wmXml,\r
+ //string svnCommand,\r
+ //string bugUrl,\r
+ //string WineBugUrl,\r
+ //string SambaBugUrl)\r
{\r
this.serviceOutput = serviceOutput;\r
this.chmPath = chmPath;\r
this.WineBugUrl = WineBugUrl;\r
this.SambaBugUrl = SambaBugUrl;\r
}\r
- \r
- public void Run()\r
- {\r
- commands.Add(new HelpCommand(serviceOutput,\r
- commands));\r
- /*commands.Add(new ApiCommand(serviceOutput,\r
- chmPath,\r
- mainChm));*/\r
- commands.Add(new NtStatusCommand(serviceOutput,\r
- ntstatusXml));\r
- commands.Add(new WinerrorCommand(serviceOutput,\r
- winerrorXml));\r
- commands.Add(new HresultCommand(serviceOutput,\r
- hresultXml));\r
- commands.Add(new ErrorCommand(serviceOutput,\r
- ntstatusXml,\r
- winerrorXml,\r
- hresultXml));\r
- commands.Add(new WmCommand(serviceOutput,\r
- wmXml));\r
- commands.Add(new SvnCommand(serviceOutput,\r
- svnCommand));\r
- commands.Add(new BugCommand(serviceOutput,\r
- bugUrl,\r
- WineBugUrl,\r
- SambaBugUrl));\r
- }\r
+\r
+ public void Run()\r
+ {\r
+ commands.Add(new HelpCommand(this));\r
+ /*commands.Add(new ApiCommand(serviceOutput,\r
+ chmPath,\r
+ mainChm));*/\r
+ commands.Add(new NtStatusCommand(this));\r
+ commands.Add(new WinerrorCommand(this));\r
+ commands.Add(new HResultCommand(this));\r
+ commands.Add(new ErrorCommand(this));\r
+ commands.Add(new WMCommand(this));\r
+ commands.Add(new SvnCommand(this));\r
+ commands.Add(new ReactOSBugUrl(this));\r
+ commands.Add(new SambaBugUrl(this));\r
+ commands.Add(new WineBugUrl(this));\r
+ }\r
+\r
+ public IServiceOutput ServiceOutput\r
+ {\r
+ get { return serviceOutput; }\r
+ }\r
+\r
+ public IList<Command> Commands\r
+ {\r
+ get { return commands; }\r
+ }\r
\r
public void InjectMessage(MessageContext context,\r
string message)\r
message = message.Substring(1).Trim();\r
int index = message.IndexOf(' ');\r
string commandName;\r
- string parameters = "";\r
+ string commandParams = "";\r
if (index != -1)\r
{\r
commandName = message.Substring(0, index).Trim();\r
- parameters = message.Substring(index).Trim();\r
+ commandParams = message.Substring(index).Trim();\r
}\r
else\r
commandName = message.Trim();\r
\r
- foreach (ICommand command in commands)\r
+ foreach (Command command in commands)\r
{\r
- if (command.CanHandle(commandName))\r
- {\r
- command.Handle(context,\r
- commandName, parameters);\r
- return;\r
- }\r
+ foreach (string cmd in command.AvailableCommands)\r
+ {\r
+ if (cmd == commandName)\r
+ {\r
+ command.Handle(context,\r
+ commandName, \r
+ commandParams);\r
+ return;\r
+ }\r
+ }\r
}\r
}\r
}\r
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TechBot.Library
+{
+ class WineBugUrl : BugCommand
+ {
+ public WineBugUrl(TechBotService techBot)
+ : base(techBot)
+ {
+ }
+
+ public override string[] AvailableCommands
+ {
+ get { return new string[] { "winebug" }; }
+ }
+
+ protected override string BugUrl
+ {
+ get { return "http://bugs.winehq.org/show_bug.cgi?id={0}"; }
+ }
+
+ public override string Help()
+ {
+ return "!winebug <number>";
+ }
+ }
+}
\r
namespace TechBot.Library\r
{\r
- public class WinerrorCommand : BaseCommand, ICommand\r
+ public class WinerrorCommand : XmlCommand\r
{\r
- private IServiceOutput serviceOutput;\r
- private string winerrorXml;\r
- private XmlDocument winerrorXmlDocument;\r
-\r
- public WinerrorCommand(IServiceOutput serviceOutput,\r
- string winerrorXml)\r
- {\r
- this.serviceOutput = serviceOutput;\r
- this.winerrorXml = winerrorXml;\r
- winerrorXmlDocument = new XmlDocument();\r
- winerrorXmlDocument.Load(winerrorXml);\r
- }\r
- \r
- public bool CanHandle(string commandName)\r
+ public WinerrorCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- return CanHandle(commandName,\r
- new string[] { "winerror" });\r
}\r
\r
- public void Handle(MessageContext context,\r
+ public override string XmlFile\r
+ {\r
+ get { return Settings.Default.WinErrorXml; }\r
+ }\r
+\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "winerror" }; }\r
+ }\r
+\r
+ public override void Handle(MessageContext context,\r
string commandName,\r
string parameters)\r
{\r
string winerrorText = parameters;\r
if (winerrorText.Equals(String.Empty))\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
"Please provide a valid System Error Code value.");\r
return;\r
}\r
long winerror = np.Parse(winerrorText);\r
if (np.Error)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is not a valid System Error Code value.",\r
winerrorText));\r
return;\r
string description = GetWinerrorDescription(winerror);\r
if (description != null)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is {1}.",\r
winerrorText,\r
description));\r
}\r
else\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("I don't know about System Error Code {0}.",\r
winerrorText));\r
}\r
}\r
- \r
- public string Help()\r
+\r
+ public override string Help()\r
{\r
return "!winerror <value>";\r
}\r
\r
public string GetWinerrorDescription(long winerror)\r
{\r
- XmlElement root = winerrorXmlDocument.DocumentElement;\r
+ XmlElement root = base.m_XmlDocument.DocumentElement;\r
XmlNode node = root.SelectSingleNode(String.Format("Winerror[@value='{0}']",\r
winerror));\r
if (node != null)\r
\r
namespace TechBot.Library\r
{\r
- public class WmCommand : BaseCommand, ICommand\r
+ public class WMCommand : XmlCommand\r
{\r
- private IServiceOutput serviceOutput;\r
- private string wmXml;\r
- private XmlDocument wmXmlDocument;\r
-\r
- public WmCommand(IServiceOutput serviceOutput,\r
- string wmXml)\r
+ public WMCommand(TechBotService techBot)\r
+ : base(techBot)\r
{\r
- this.serviceOutput = serviceOutput;\r
- this.wmXml = wmXml;\r
- wmXmlDocument = new XmlDocument();\r
- wmXmlDocument.Load(wmXml);\r
}\r
+\r
+ public override string XmlFile\r
+ {\r
+ get { return Settings.Default.WMXml; }\r
+ }\r
\r
- public bool CanHandle(string commandName)\r
- {\r
- return CanHandle(commandName,\r
- new string[] { "wm" });\r
- }\r
+ public override string[] AvailableCommands\r
+ {\r
+ get { return new string[] { "wm" }; }\r
+ }\r
\r
- public void Handle(MessageContext context,\r
+ public override void Handle(MessageContext context,\r
string commandName,\r
string parameters)\r
{\r
string wmText = parameters;\r
if (wmText.Equals(String.Empty))\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
"Please provide a valid window message value or name.");\r
return;\r
}\r
\r
if (output != null)\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("{0} is {1}.",\r
wmText,\r
output));\r
}\r
else\r
{\r
- serviceOutput.WriteLine(context,\r
+ TechBot.ServiceOutput.WriteLine(context,\r
String.Format("I don't know about window message {0}.",\r
wmText));\r
}\r
}\r
- \r
- public string Help()\r
+\r
+ public override string Help()\r
{\r
return "!wm <value> or !wm <name>";\r
}\r
\r
private string GetWmDescription(long wm)\r
{\r
- XmlElement root = wmXmlDocument.DocumentElement;\r
+ XmlElement root = base.m_XmlDocument.DocumentElement;\r
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@value='{0}']",\r
wm));\r
if (node != null)\r
\r
private string GetWmNumber(string wmName)\r
{\r
- XmlElement root = wmXmlDocument.DocumentElement;\r
+ XmlElement root = base.m_XmlDocument.DocumentElement;\r
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@text='{0}']",\r
wmName));\r
if (node != null)\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+ <section name="TechBot.Library.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </sectionGroup>
+ </configSections>
+ <applicationSettings>
+ <TechBot.Library.Settings>
+ <setting name="NtStatusXml" serializeAs="String">
+ <value>C:\Ros\current\irc\TechBot\Resources\ntstatus.xml</value>
+ </setting>
+ <setting name="WinErrorXml" serializeAs="String">
+ <value>C:\Ros\current\irc\TechBot\Resources\winerror.xml</value>
+ </setting>
+ <setting name="HResultXml" serializeAs="String">
+ <value>C:\Ros\current\irc\TechBot\Resources\hresult.xml</value>
+ </setting>
+ <setting name="WMXml" serializeAs="String">
+ <value>C:\Ros\current\irc\TechBot\Resources\wm.xml</value>
+ </setting>
+ <setting name="SVNRoot" serializeAs="String">
+ <value>svn://svn.reactos.org/trunk/reactos</value>
+ </setting>
+ </TechBot.Library.Settings>
+ </applicationSettings>
+</configuration>
\ No newline at end of file
IRCBotPassword,\r
ChmPath,\r
MainChm,\r
- NtstatusXml,\r
- WinerrorXml,\r
- HresultXml,\r
- WmXml,\r
- SvnCommand,\r
+ //NtstatusXml,\r
+ //WinerrorXml,\r
+ //HresultXml,\r
+ //WmXml,\r
+ //SvnCommand,\r
BugUrl,\r
WineBugUrl,\r
SambaBugUrl);\r
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TechBot</RootNamespace>
<AssemblyName>TechBot</AssemblyName>
+ <StartupObject>TechBot.TechBotService</StartupObject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>