- Add support for "!wm <value>" and "!wm <name>" commands.

- Update the #develop project file.
- Add list of window message values. Thanks to Royce3.

svn path=/trunk/; revision=20164
This commit is contained in:
Filip Navara 2005-12-14 17:34:00 +00:00
parent fe84901940
commit bd0b0b3d09
9 changed files with 467 additions and 12 deletions

View file

@ -0,0 +1,321 @@
<?xml version="1.0" ?>
<WindowMessageList>
<WindowMessage text="WM_APP" value="32768" />
<WindowMessage text="WM_ACTIVATE" value="6" />
<WindowMessage text="WM_ACTIVATEAPP" value="28" />
<WindowMessage text="WM_AFXFIRST" value="864" />
<WindowMessage text="WM_AFXLAST" value="895" />
<WindowMessage text="WM_ASKCBFORMATNAME" value="780" />
<WindowMessage text="WM_CANCELJOURNAL" value="75" />
<WindowMessage text="WM_CANCELMODE" value="31" />
<WindowMessage text="WM_CAPTURECHANGED" value="533" />
<WindowMessage text="WM_CHANGECBCHAIN" value="781" />
<WindowMessage text="WM_CHANGEUISTATE" value="295" />
<WindowMessage text="WM_UPDATEUISTATE" value="296" />
<WindowMessage text="WM_QUERYUISTATE" value="297" />
<WindowMessage text="WM_CHAR" value="258" />
<WindowMessage text="WM_CHARTOITEM" value="47" />
<WindowMessage text="WM_CHILDACTIVATE" value="34" />
<WindowMessage text="WM_CLEAR" value="771" />
<WindowMessage text="WM_CLOSE" value="16" />
<WindowMessage text="WM_COMMAND" value="273" />
<WindowMessage text="WM_COMMNOTIFY" value="68" />
<WindowMessage text="WM_COMPACTING" value="65" />
<WindowMessage text="WM_COMPAREITEM" value="57" />
<WindowMessage text="WM_CONTEXTMENU" value="123" />
<WindowMessage text="WM_COPY" value="769" />
<WindowMessage text="WM_COPYDATA" value="74" />
<WindowMessage text="WM_CREATE" value="1" />
<WindowMessage text="WM_CTLCOLORBTN" value="309" />
<WindowMessage text="WM_CTLCOLORDLG" value="310" />
<WindowMessage text="WM_CTLCOLOREDIT" value="307" />
<WindowMessage text="WM_CTLCOLORLISTBOX" value="308" />
<WindowMessage text="WM_CTLCOLORMSGBOX" value="306" />
<WindowMessage text="WM_CTLCOLORSCROLLBAR" value="311" />
<WindowMessage text="WM_CTLCOLORSTATIC" value="312" />
<WindowMessage text="WM_CUT" value="768" />
<WindowMessage text="WM_DEADCHAR" value="259" />
<WindowMessage text="WM_DELETEITEM" value="45" />
<WindowMessage text="WM_DESTROY" value="2" />
<WindowMessage text="WM_DESTROYCLIPBOARD" value="775" />
<WindowMessage text="WM_DEVICECHANGE" value="537" />
<WindowMessage text="WM_DEVMODECHANGE" value="27" />
<WindowMessage text="WM_DISPLAYCHANGE" value="126" />
<WindowMessage text="WM_DRAWCLIPBOARD" value="776" />
<WindowMessage text="WM_DRAWITEM" value="43" />
<WindowMessage text="WM_DROPFILES" value="563" />
<WindowMessage text="WM_ENABLE" value="10" />
<WindowMessage text="WM_ENDSESSION" value="22" />
<WindowMessage text="WM_ENTERIDLE" value="289" />
<WindowMessage text="WM_ENTERMENULOOP" value="529" />
<WindowMessage text="WM_ENTERSIZEMOVE" value="561" />
<WindowMessage text="WM_ERASEBKGND" value="20" />
<WindowMessage text="WM_EXITMENULOOP" value="530" />
<WindowMessage text="WM_EXITSIZEMOVE" value="562" />
<WindowMessage text="WM_FONTCHANGE" value="29" />
<WindowMessage text="WM_GETDLGCODE" value="135" />
<WindowMessage text="WM_GETFONT" value="49" />
<WindowMessage text="WM_GETHOTKEY" value="51" />
<WindowMessage text="WM_GETICON" value="127" />
<WindowMessage text="WM_GETMINMAXINFO" value="36" />
<WindowMessage text="WM_GETTEXT" value="13" />
<WindowMessage text="WM_GETTEXTLENGTH" value="14" />
<WindowMessage text="WM_HANDHELDFIRST" value="856" />
<WindowMessage text="WM_HANDHELDLAST" value="863" />
<WindowMessage text="WM_HELP" value="83" />
<WindowMessage text="WM_HOTKEY" value="786" />
<WindowMessage text="WM_HSCROLL" value="276" />
<WindowMessage text="WM_HSCROLLCLIPBOARD" value="782" />
<WindowMessage text="WM_ICONERASEBKGND" value="39" />
<WindowMessage text="WM_INITDIALOG" value="272" />
<WindowMessage text="WM_INITMENU" value="278" />
<WindowMessage text="WM_INITMENUPOPUP" value="279" />
<WindowMessage text="WM_INPUTLANGCHANGE" value="81" />
<WindowMessage text="WM_INPUTLANGCHANGEREQUEST" value="80" />
<WindowMessage text="WM_KEYDOWN" value="256" />
<WindowMessage text="WM_KEYUP" value="257" />
<WindowMessage text="WM_KILLFOCUS" value="8" />
<WindowMessage text="WM_MDIACTIVATE" value="546" />
<WindowMessage text="WM_MDICASCADE" value="551" />
<WindowMessage text="WM_MDICREATE" value="544" />
<WindowMessage text="WM_MDIDESTROY" value="545" />
<WindowMessage text="WM_MDIGETACTIVE" value="553" />
<WindowMessage text="WM_MDIICONARRANGE" value="552" />
<WindowMessage text="WM_MDIMAXIMIZE" value="549" />
<WindowMessage text="WM_MDINEXT" value="548" />
<WindowMessage text="WM_MDIREFRESHMENU" value="564" />
<WindowMessage text="WM_MDIRESTORE" value="547" />
<WindowMessage text="WM_MDISETMENU" value="560" />
<WindowMessage text="WM_MDITILE" value="550" />
<WindowMessage text="WM_MEASUREITEM" value="44" />
<WindowMessage text="WM_MENURBUTTONUP" value="290" />
<WindowMessage text="WM_MENUCHAR" value="288" />
<WindowMessage text="WM_MENUSELECT" value="287" />
<WindowMessage text="WM_NEXTMENU" value="531" />
<WindowMessage text="WM_MOVE" value="3" />
<WindowMessage text="WM_MOVING" value="534" />
<WindowMessage text="WM_NCACTIVATE" value="134" />
<WindowMessage text="WM_NCCALCSIZE" value="131" />
<WindowMessage text="WM_NCCREATE" value="129" />
<WindowMessage text="WM_NCDESTROY" value="130" />
<WindowMessage text="WM_NCHITTEST" value="132" />
<WindowMessage text="WM_NCLBUTTONDBLCLK" value="163" />
<WindowMessage text="WM_NCLBUTTONDOWN" value="161" />
<WindowMessage text="WM_NCLBUTTONUP" value="162" />
<WindowMessage text="WM_NCMBUTTONDBLCLK" value="169" />
<WindowMessage text="WM_NCMBUTTONDOWN" value="167" />
<WindowMessage text="WM_NCMBUTTONUP" value="168" />
<WindowMessage text="WM_NCXBUTTONDOWN" value="171" />
<WindowMessage text="WM_NCXBUTTONUP" value="172" />
<WindowMessage text="WM_NCXBUTTONDBLCLK" value="173" />
<WindowMessage text="WM_NCMOUSEMOVE" value="160" />
<WindowMessage text="WM_NCMOUSEHOVER" value="0x02A0" />
<WindowMessage text="WM_NCMOUSELEAVE" value="0x02A2" />
<WindowMessage text="WM_NCPAINT" value="133" />
<WindowMessage text="WM_NCRBUTTONDBLCLK" value="166" />
<WindowMessage text="WM_NCRBUTTONDOWN" value="164" />
<WindowMessage text="WM_NCRBUTTONUP" value="165" />
<WindowMessage text="WM_NEXTDLGCTL" value="40" />
<WindowMessage text="WM_NEXTMENU" value="531" />
<WindowMessage text="WM_NOTIFY" value="78" />
<WindowMessage text="WM_NOTIFYFORMAT" value="85" />
<WindowMessage text="WM_NULL" value="0" />
<WindowMessage text="WM_PAINT" value="15" />
<WindowMessage text="WM_PAINTCLIPBOARD" value="777" />
<WindowMessage text="WM_PAINTICON" value="38" />
<WindowMessage text="WM_PALETTECHANGED" value="785" />
<WindowMessage text="WM_PALETTEISCHANGING" value="784" />
<WindowMessage text="WM_PARENTNOTIFY" value="528" />
<WindowMessage text="WM_PASTE" value="770" />
<WindowMessage text="WM_PENWINFIRST" value="896" />
<WindowMessage text="WM_PENWINLAST" value="911" />
<WindowMessage text="WM_POWER" value="72" />
<WindowMessage text="WM_POWERBROADCAST" value="536" />
<WindowMessage text="WM_PRINT" value="791" />
<WindowMessage text="WM_PRINTCLIENT" value="792" />
<WindowMessage text="WM_QUERYDRAGICON" value="55" />
<WindowMessage text="WM_QUERYENDSESSION" value="17" />
<WindowMessage text="WM_QUERYNEWPALETTE" value="783" />
<WindowMessage text="WM_QUERYOPEN" value="19" />
<WindowMessage text="WM_QUEUESYNC" value="35" />
<WindowMessage text="WM_QUIT" value="18" />
<WindowMessage text="WM_RENDERALLFORMATS" value="774" />
<WindowMessage text="WM_RENDERFORMAT" value="773" />
<WindowMessage text="WM_SETCURSOR" value="32" />
<WindowMessage text="WM_SETFOCUS" value="7" />
<WindowMessage text="WM_SETFONT" value="48" />
<WindowMessage text="WM_SETHOTKEY" value="50" />
<WindowMessage text="WM_SETICON" value="128" />
<WindowMessage text="WM_SETREDRAW" value="11" />
<WindowMessage text="WM_SETTEXT" value="12" />
<WindowMessage text="WM_SETTINGCHANGE" value="26" />
<WindowMessage text="WM_SHOWWINDOW" value="24" />
<WindowMessage text="WM_SIZE" value="5" />
<WindowMessage text="WM_SIZECLIPBOARD" value="779" />
<WindowMessage text="WM_SIZING" value="532" />
<WindowMessage text="WM_SPOOLERSTATUS" value="42" />
<WindowMessage text="WM_STYLECHANGED" value="125" />
<WindowMessage text="WM_STYLECHANGING" value="124" />
<WindowMessage text="WM_SYSCHAR" value="262" />
<WindowMessage text="WM_SYSCOLORCHANGE" value="21" />
<WindowMessage text="WM_SYSCOMMAND" value="274" />
<WindowMessage text="WM_SYSDEADCHAR" value="263" />
<WindowMessage text="WM_SYSKEYDOWN" value="260" />
<WindowMessage text="WM_SYSKEYUP" value="261" />
<WindowMessage text="WM_TCARD" value="82" />
<WindowMessage text="WM_TIMECHANGE" value="30" />
<WindowMessage text="WM_TIMER" value="275" />
<WindowMessage text="WM_SYSTIMER" value="280" />
<WindowMessage text="WM_UNDO" value="772" />
<WindowMessage text="WM_USER" value="1024" />
<WindowMessage text="WM_USERCHANGED" value="84" />
<WindowMessage text="WM_VKEYTOITEM" value="46" />
<WindowMessage text="WM_VSCROLL" value="277" />
<WindowMessage text="WM_VSCROLLCLIPBOARD" value="778" />
<WindowMessage text="WM_WINDOWPOSCHANGED" value="71" />
<WindowMessage text="WM_WINDOWPOSCHANGING" value="70" />
<WindowMessage text="WM_WININICHANGE" value="26" />
<WindowMessage text="WM_KEYFIRST" value="256" />
<WindowMessage text="WM_KEYLAST" value="264" />
<WindowMessage text="WM_SYNCPAINT" value="136" />
<WindowMessage text="WM_MOUSEACTIVATE" value="33" />
<WindowMessage text="WM_MOUSEMOVE" value="512" />
<WindowMessage text="WM_LBUTTONDOWN" value="513" />
<WindowMessage text="WM_LBUTTONUP" value="514" />
<WindowMessage text="WM_LBUTTONDBLCLK" value="515" />
<WindowMessage text="WM_RBUTTONDOWN" value="516" />
<WindowMessage text="WM_RBUTTONUP" value="517" />
<WindowMessage text="WM_RBUTTONDBLCLK" value="518" />
<WindowMessage text="WM_MBUTTONDOWN" value="519" />
<WindowMessage text="WM_MBUTTONUP" value="520" />
<WindowMessage text="WM_MBUTTONDBLCLK" value="521" />
<WindowMessage text="WM_MOUSEWHEEL" value="522" />
<WindowMessage text="WM_MOUSEFIRST" value="512" />
<WindowMessage text="WM_XBUTTONDOWN" value="523" />
<WindowMessage text="WM_XBUTTONUP" value="524" />
<WindowMessage text="WM_XBUTTONDBLCLK" value="525" />
<WindowMessage text="WM_MOUSELAST" value="525" />
<WindowMessage text="WM_MOUSEHOVER" value="0x2A1" />
<WindowMessage text="WM_MOUSELEAVE" value="0x2A3" />
<WindowMessage text="WM_THEMECHANGED" value="794" />
<WindowMessage text="BM_CLICK" value="245" />
<WindowMessage text="BM_GETCHECK" value="240" />
<WindowMessage text="BM_GETIMAGE" value="246" />
<WindowMessage text="BM_GETSTATE" value="242" />
<WindowMessage text="BM_SETCHECK" value="241" />
<WindowMessage text="BM_SETIMAGE" value="247" />
<WindowMessage text="BM_SETSTATE" value="243" />
<WindowMessage text="BM_SETSTYLE" value="244" />
<WindowMessage text="CB_ADDSTRING" value="323" />
<WindowMessage text="CB_DELETESTRING" value="324" />
<WindowMessage text="CB_DIR" value="325" />
<WindowMessage text="CB_FINDSTRING" value="332" />
<WindowMessage text="CB_FINDSTRINGEXACT" value="344" />
<WindowMessage text="CB_GETCOMBOBOXINFO" value="356" />
<WindowMessage text="CB_GETCOUNT" value="326" />
<WindowMessage text="CB_GETCURSEL" value="327" />
<WindowMessage text="CB_GETDROPPEDCONTROLRECT" value="338" />
<WindowMessage text="CB_GETDROPPEDSTATE" value="343" />
<WindowMessage text="CB_GETDROPPEDWIDTH" value="351" />
<WindowMessage text="CB_GETEDITSEL" value="320" />
<WindowMessage text="CB_GETEXTENDEDUI" value="342" />
<WindowMessage text="CB_GETHORIZONTALEXTENT" value="349" />
<WindowMessage text="CB_GETITEMDATA" value="336" />
<WindowMessage text="CB_GETITEMHEIGHT" value="340" />
<WindowMessage text="CB_GETLBTEXT" value="328" />
<WindowMessage text="CB_GETLBTEXTLEN" value="329" />
<WindowMessage text="CB_GETLOCALE" value="346" />
<WindowMessage text="CB_GETTOPINDEX" value="347" />
<WindowMessage text="CB_INITSTORAGE" value="353" />
<WindowMessage text="CB_INSERTSTRING" value="330" />
<WindowMessage text="CB_LIMITTEXT" value="321" />
<WindowMessage text="CB_RESETCONTENT" value="331" />
<WindowMessage text="CB_SELECTSTRING" value="333" />
<WindowMessage text="CB_SETCURSEL" value="334" />
<WindowMessage text="CB_SETDROPPEDWIDTH" value="352" />
<WindowMessage text="CB_SETEDITSEL" value="322" />
<WindowMessage text="CB_SETEXTENDEDUI" value="341" />
<WindowMessage text="CB_SETHORIZONTALEXTENT" value="350" />
<WindowMessage text="CB_SETITEMDATA" value="337" />
<WindowMessage text="CB_SETITEMHEIGHT" value="339" />
<WindowMessage text="CB_SETLOCALE" value="345" />
<WindowMessage text="CB_SETTOPINDEX" value="348" />
<WindowMessage text="CB_SHOWDROPDOWN" value="335" />
<WindowMessage text="EM_CANUNDO" value="198" />
<WindowMessage text="EM_CHARFROMPOS" value="215" />
<WindowMessage text="EM_EMPTYUNDOBUFFER" value="205" />
<WindowMessage text="EM_FMTLINES" value="200" />
<WindowMessage text="EM_GETFIRSTVISIBLELINE" value="206" />
<WindowMessage text="EM_GETHANDLE" value="189" />
<WindowMessage text="EM_GETLIMITTEXT" value="213" />
<WindowMessage text="EM_GETLINE" value="196" />
<WindowMessage text="EM_GETLINECOUNT" value="186" />
<WindowMessage text="EM_GETMARGINS" value="212" />
<WindowMessage text="EM_GETMODIFY" value="184" />
<WindowMessage text="EM_GETPASSWORDCHAR" value="210" />
<WindowMessage text="EM_GETRECT" value="178" />
<WindowMessage text="EM_GETSEL" value="176" />
<WindowMessage text="EM_GETTHUMB" value="190" />
<WindowMessage text="EM_GETWORDBREAKPROC" value="209" />
<WindowMessage text="EM_LIMITTEXT" value="197" />
<WindowMessage text="EM_LINEFROMCHAR" value="201" />
<WindowMessage text="EM_LINEINDEX" value="187" />
<WindowMessage text="EM_LINELENGTH" value="193" />
<WindowMessage text="EM_LINESCROLL" value="182" />
<WindowMessage text="EM_POSFROMCHAR" value="214" />
<WindowMessage text="EM_REPLACESEL" value="194" />
<WindowMessage text="EM_SCROLL" value="181" />
<WindowMessage text="EM_SCROLLCARET" value="183" />
<WindowMessage text="EM_SETHANDLE" value="188" />
<WindowMessage text="EM_SETLIMITTEXT" value="197" />
<WindowMessage text="EM_SETMARGINS" value="211" />
<WindowMessage text="EM_SETMODIFY" value="185" />
<WindowMessage text="EM_SETPASSWORDCHAR" value="204" />
<WindowMessage text="EM_SETREADONLY" value="207" />
<WindowMessage text="EM_SETRECT" value="179" />
<WindowMessage text="EM_SETRECTNP" value="180" />
<WindowMessage text="EM_SETSEL" value="177" />
<WindowMessage text="EM_SETTABSTOPS" value="203" />
<WindowMessage text="EM_SETWORDBREAKPROC" value="208" />
<WindowMessage text="EM_UNDO" value="199" />
<WindowMessage text="LB_ADDFILE" value="406" />
<WindowMessage text="LB_ADDSTRING" value="384" />
<WindowMessage text="LB_DELETESTRING" value="386" />
<WindowMessage text="LB_DIR" value="397" />
<WindowMessage text="LB_FINDSTRING" value="399" />
<WindowMessage text="LB_FINDSTRINGEXACT" value="418" />
<WindowMessage text="LB_GETANCHORINDEX" value="413" />
<WindowMessage text="LB_GETCARETINDEX" value="415" />
<WindowMessage text="LB_GETCOUNT" value="395" />
<WindowMessage text="LB_GETCURSEL" value="392" />
<WindowMessage text="LB_GETHORIZONTALEXTENT" value="403" />
<WindowMessage text="LB_GETITEMDATA" value="409" />
<WindowMessage text="LB_GETITEMHEIGHT" value="417" />
<WindowMessage text="LB_GETITEMRECT" value="408" />
<WindowMessage text="LB_GETLOCALE" value="422" />
<WindowMessage text="LB_GETSEL" value="391" />
<WindowMessage text="LB_GETSELCOUNT" value="400" />
<WindowMessage text="LB_GETSELITEMS" value="401" />
<WindowMessage text="LB_GETTEXT" value="393" />
<WindowMessage text="LB_GETTEXTLEN" value="394" />
<WindowMessage text="LB_GETTOPINDEX" value="398" />
<WindowMessage text="LB_INITSTORAGE" value="424" />
<WindowMessage text="LB_INSERTSTRING" value="385" />
<WindowMessage text="LB_ITEMFROMPOINT" value="425" />
<WindowMessage text="LB_RESETCONTENT" value="388" />
<WindowMessage text="LB_SELECTSTRING" value="396" />
<WindowMessage text="LB_SELITEMRANGE" value="411" />
<WindowMessage text="LB_SELITEMRANGEEX" value="387" />
<WindowMessage text="LB_SETANCHORINDEX" value="412" />
<WindowMessage text="LB_SETCARETINDEX" value="414" />
<WindowMessage text="LB_SETCOLUMNWIDTH" value="405" />
<WindowMessage text="LB_SETCOUNT" value="423" />
<WindowMessage text="LB_SETCURSEL" value="390" />
<WindowMessage text="LB_SETHORIZONTALEXTENT" value="404" />
<WindowMessage text="LB_SETITEMDATA" value="410" />
<WindowMessage text="LB_SETITEMHEIGHT" value="416" />
<WindowMessage text="LB_SETLOCALE" value="421" />
<WindowMessage text="LB_SETSEL" value="389" />
<WindowMessage text="LB_SETTABSTOPS" value="402" />
<WindowMessage text="LB_SETTOPINDEX" value="407" />
</WindowMessageList>

View file

@ -10,6 +10,7 @@
<add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" /> <add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
<add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" /> <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />
<add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" /> <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />
<add key="WmXml" value="C:\IRC\TechBot\wm.xml" />
<add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" /> <add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />
</appSettings> </appSettings>
</configuration> </configuration>

View file

@ -134,6 +134,18 @@ namespace TechBot.Console
} }
} }
private static string WmXml
{
get
{
string optionName = "WmXml";
string s = ConfigurationSettings.AppSettings[optionName];
VerifyRequiredOption(optionName,
s);
return s;
}
}
private static string SvnCommand private static string SvnCommand
{ {
get get
@ -157,6 +169,7 @@ namespace TechBot.Console
NtstatusXml, NtstatusXml,
WinerrorXml, WinerrorXml,
HresultXml, HresultXml,
WmXml,
SvnCommand); SvnCommand);
ircService.Run(); ircService.Run();
} }
@ -176,6 +189,7 @@ namespace TechBot.Console
NtstatusXml, NtstatusXml,
WinerrorXml, WinerrorXml,
HresultXml, HresultXml,
WmXml,
SvnCommand); SvnCommand);
service.Run(); service.Run();
while (true) while (true)

View file

@ -16,6 +16,7 @@ namespace TechBot.Library
private string ntstatusXml; private string ntstatusXml;
private string winerrorXml; private string winerrorXml;
private string hresultXml; private string hresultXml;
private string wmXml;
private string svnCommand; private string svnCommand;
private IrcClient client; private IrcClient client;
private ArrayList channels = new ArrayList(); /* IrcChannel */ private ArrayList channels = new ArrayList(); /* IrcChannel */
@ -31,18 +32,20 @@ namespace TechBot.Library
string ntstatusXml, string ntstatusXml,
string winerrorXml, string winerrorXml,
string hresultXml, string hresultXml,
string wmXml,
string svnCommand) string svnCommand)
{ {
this.hostname = hostname; this.hostname = hostname;
this.port = port; this.port = port;
this.channelnames = channelnames; this.channelnames = channelnames;
this.botname = botname; this.botname = botname;
this.chmPath = chmPath; this.chmPath = chmPath;
this.mainChm = mainChm; this.mainChm = mainChm;
this.ntstatusXml = ntstatusXml; this.ntstatusXml = ntstatusXml;
this.winerrorXml = winerrorXml; this.winerrorXml = winerrorXml;
this.hresultXml = hresultXml; this.hresultXml = hresultXml;
this.svnCommand = svnCommand; this.wmXml = wmXml;
this.svnCommand = svnCommand;
} }
public void Run() public void Run()
@ -53,6 +56,7 @@ namespace TechBot.Library
ntstatusXml, ntstatusXml,
winerrorXml, winerrorXml,
hresultXml, hresultXml,
wmXml,
svnCommand); svnCommand);
service.Run(); service.Run();

View file

@ -13,6 +13,8 @@
<File name=".\HresultCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\HresultCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\WinerrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\WinerrorCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\SvnCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\SvnCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\WmCommand.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
<File name=".\MessageContext.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
</Contents> </Contents>
<References> <References>
<Reference type="Project" refto="CHMLibrary" localcopy="True" /> <Reference type="Project" refto="CHMLibrary" localcopy="True" />

View file

@ -15,16 +15,18 @@ namespace TechBot.Library
private string ntstatusXml; private string ntstatusXml;
private string winerrorXml; private string winerrorXml;
private string hresultXml; private string hresultXml;
private string wmXml;
private string svnCommand; private string svnCommand;
private ArrayList commands = new ArrayList(); private ArrayList commands = new ArrayList();
public TechBotService(IServiceOutput serviceOutput, public TechBotService(IServiceOutput serviceOutput,
string chmPath, string chmPath,
string mainChm, string mainChm,
string ntstatusXml, string ntstatusXml,
string winerrorXml, string winerrorXml,
string hresultXml, string hresultXml,
string svnCommand) string wmXml,
string svnCommand)
{ {
this.serviceOutput = serviceOutput; this.serviceOutput = serviceOutput;
this.chmPath = chmPath; this.chmPath = chmPath;
@ -32,6 +34,7 @@ namespace TechBot.Library
this.ntstatusXml = ntstatusXml; this.ntstatusXml = ntstatusXml;
this.winerrorXml = winerrorXml; this.winerrorXml = winerrorXml;
this.hresultXml = hresultXml; this.hresultXml = hresultXml;
this.wmXml = wmXml;
this.svnCommand = svnCommand; this.svnCommand = svnCommand;
} }
@ -48,6 +51,8 @@ namespace TechBot.Library
winerrorXml)); winerrorXml));
commands.Add(new HresultCommand(serviceOutput, commands.Add(new HresultCommand(serviceOutput,
hresultXml)); hresultXml));
commands.Add(new WmCommand(serviceOutput,
wmXml));
commands.Add(new SvnCommand(serviceOutput, commands.Add(new SvnCommand(serviceOutput,
svnCommand)); svnCommand));
} }

View file

@ -0,0 +1,104 @@
using System;
using System.Xml;
namespace TechBot.Library
{
public class WmCommand : BaseCommand, ICommand
{
private IServiceOutput serviceOutput;
private string wmXml;
private XmlDocument wmXmlDocument;
public WmCommand(IServiceOutput serviceOutput,
string wmXml)
{
this.serviceOutput = serviceOutput;
this.wmXml = wmXml;
wmXmlDocument = new XmlDocument();
wmXmlDocument.Load(wmXml);
}
public bool CanHandle(string commandName)
{
return CanHandle(commandName,
new string[] { "wm" });
}
public void Handle(MessageContext context,
string commandName,
string parameters)
{
string wmText = parameters;
if (wmText.Equals(String.Empty))
{
serviceOutput.WriteLine(context,
"Please provide a valid window message value or name.");
return;
}
NumberParser np = new NumberParser();
long wm = np.Parse(wmText);
string output;
if (np.Error)
{
// Assume "!wm <name>" form.
output = GetWmNumber(wmText);
}
else
{
output = GetWmDescription(wm);
}
if (output != null)
{
serviceOutput.WriteLine(context,
String.Format("{0} is {1}.",
wmText,
output));
}
else
{
serviceOutput.WriteLine(context,
String.Format("I don't know about window message {0}.",
wmText));
}
}
public string Help()
{
return "!wm <value> or !wm <name>";
}
private string GetWmDescription(long wm)
{
XmlElement root = wmXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@value='{0}']",
wm));
if (node != null)
{
XmlAttribute text = node.Attributes["text"];
if (text == null)
throw new Exception("Node has no text attribute.");
return text.Value;
}
else
return null;
}
private string GetWmNumber(string wmName)
{
XmlElement root = wmXmlDocument.DocumentElement;
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@text='{0}']",
wmName));
if (node != null)
{
XmlAttribute value = node.Attributes["value"];
if (value == null)
throw new Exception("Node has no value attribute.");
return value.Value;
}
else
return null;
}
}
}

View file

@ -10,6 +10,7 @@
<add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" /> <add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
<add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" /> <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />
<add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" /> <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />
<add key="WmXml" value="C:\IRC\TechBot\wm.xml" />
<add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" /> <add key="SvnCommand" value="svn co svn://svn.reactos.com/trunk/reactos" />
</appSettings> </appSettings>
</configuration> </configuration>

View file

@ -15,6 +15,7 @@ namespace TechBot
private string MainChm; private string MainChm;
private string NtstatusXml; private string NtstatusXml;
private string HresultXml; private string HresultXml;
private string WmXml;
private string WinerrorXml; private string WinerrorXml;
private string SvnCommand; private string SvnCommand;
private EventLog eventLog; private EventLog eventLog;
@ -34,6 +35,7 @@ namespace TechBot
MainChm = ConfigurationSettings.AppSettings["MainChm"]; MainChm = ConfigurationSettings.AppSettings["MainChm"];
NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"]; NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"];
HresultXml = ConfigurationSettings.AppSettings["HresultXml"]; HresultXml = ConfigurationSettings.AppSettings["HresultXml"];
WmXml = ConfigurationSettings.AppSettings["WmXml"];
WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"]; WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"];
SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"]; SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"];
} }
@ -52,6 +54,7 @@ namespace TechBot
NtstatusXml, NtstatusXml,
WinerrorXml, WinerrorXml,
HresultXml, HresultXml,
WmXml,
SvnCommand); SvnCommand);
ircService.Run(); ircService.Run();
} }