- Moved commands outside TechBot.Library to TechBot.Commands.Common and TechBot.Comma...
authorMarc Piulachs <marc.piulachs@live.com>
Sun, 18 May 2008 15:54:43 +0000 (15:54 +0000)
committerMarc Piulachs <marc.piulachs@live.com>
Sun, 18 May 2008 15:54:43 +0000 (15:54 +0000)
- Made TechBot more configurable through .config files
- Code refactoring
- Removed automatic parameter parsing support to make everyone happy

svn path=/trunk/; revision=33586

47 files changed:
irc/TechBot/TechBot.Commands.Common/Base/BugCommand.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/HResultCommand.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/NtStatusCommand.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/Properties/AssemblyInfo.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/ReactOSBugUrl.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/SambaBugUrl.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/Settings.Designer.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/Settings.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/Settings.settings [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/SvnCommand.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/TechBot.Commands.Common.csproj [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/WMCommand.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/WineBugUrl.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/WinerrorCommand.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.Common/app.config [new file with mode: 0644]
irc/TechBot/TechBot.Commands.MSDN/ApiCommand.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.MSDN/Properties/AssemblyInfo.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.MSDN/Settings.Designer.cs [new file with mode: 0644]
irc/TechBot/TechBot.Commands.MSDN/Settings.settings [new file with mode: 0644]
irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj [new file with mode: 0644]
irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj.user [new file with mode: 0644]
irc/TechBot/TechBot.Commands.MSDN/app.config [new file with mode: 0644]
irc/TechBot/TechBot.Console/App.config
irc/TechBot/TechBot.Console/ConsoleTechBotService.cs
irc/TechBot/TechBot.Console/Main.cs
irc/TechBot/TechBot.Console/Settings.Designer.cs [new file with mode: 0644]
irc/TechBot/TechBot.Console/Settings.settings [new file with mode: 0644]
irc/TechBot/TechBot.Console/TechBot.Console.csproj
irc/TechBot/TechBot.IRCLibrary/TechBot.IRCLibrary.csproj
irc/TechBot/TechBot.IRCLibrary/app.config [new file with mode: 0644]
irc/TechBot/TechBot.Library/Attributes/CommandParameterAttribute.cs
irc/TechBot/TechBot.Library/Commands/Base/Command.cs
irc/TechBot/TechBot.Library/Commands/Base/XmlLookupCommand.cs
irc/TechBot/TechBot.Library/Commands/HelpCommand.cs
irc/TechBot/TechBot.Library/Factory/CommandFactory.cs
irc/TechBot/TechBot.Library/Settings.Designer.cs
irc/TechBot/TechBot.Library/Settings.settings
irc/TechBot/TechBot.Library/TechBot.Library.csproj
irc/TechBot/TechBot.Library/TechBotIrcService.cs
irc/TechBot/TechBot.Library/TechBotService.cs
irc/TechBot/TechBot.Library/app.config
irc/TechBot/TechBot.sln
irc/TechBot/TechBot/App.config
irc/TechBot/TechBot/ServiceThread.cs
irc/TechBot/TechBot/Settings.Designer.cs [new file with mode: 0644]
irc/TechBot/TechBot/Settings.settings [new file with mode: 0644]
irc/TechBot/TechBot/TechBot.csproj

diff --git a/irc/TechBot/TechBot.Commands.Common/Base/BugCommand.cs b/irc/TechBot/TechBot.Commands.Common/Base/BugCommand.cs
new file mode 100644 (file)
index 0000000..32f419e
--- /dev/null
@@ -0,0 +1,42 @@
+using System;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+       public abstract class BugCommand : Command
+       {
+        private string m_BugID = null;
+
+               public BugCommand()
+               {
+               }
+
+        public string BugID
+        {
+            get { return Parameters; }
+            set { Parameters = value; }
+        }
+
+        public override void ExecuteCommand()
+        {
+            if (Parameters == null)
+            {
+                Say("Please provide a valid bug number.");
+            }
+            else
+            {
+                try
+                {
+                    Say(BugUrl, Int32.Parse(BugID));
+                }
+                catch (Exception)
+                {
+                    Say("{0} is not a valid bug number.", BugID);
+                }
+            }
+        }
+
+        protected abstract string BugUrl { get; }
+       }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/HResultCommand.cs b/irc/TechBot/TechBot.Commands.Common/HResultCommand.cs
new file mode 100644 (file)
index 0000000..5d9f30d
--- /dev/null
@@ -0,0 +1,66 @@
+using System;
+using System.Xml;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("hresult", Help = "!hresult <value>")]
+    public class HResultCommand : XmlLookupCommand
+       {
+        public HResultCommand()
+               {
+               }
+
+        public override string XmlFile
+        {
+            get { return Settings.Default.HResultXml; }
+        }
+
+               public override void ExecuteCommand()
+               {
+            if (Text == null)
+            {
+                Say("Please provide a valid HRESULT value.");
+            }
+            else
+            {
+                NumberParser np = new NumberParser();
+                long hresult = np.Parse(Text);
+                if (np.Error)
+                {
+                    Say("{0} is not a valid HRESULT value.", Text);
+                    return;
+                }
+
+                string description = GetHresultDescription(hresult);
+                if (description != null)
+                {
+                    Say("{0} is {1}.",
+                        Text,
+                        description);
+                }
+                else
+                {
+                    Say("I don't know about HRESULT {0}.", Text);
+                }
+            }
+               }
+               
+               public string GetHresultDescription(long hresult)
+               {
+                       XmlElement root = base.m_XmlDocument.DocumentElement;
+                       XmlNode node = root.SelectSingleNode(String.Format("Hresult[@value='{0}']",
+                                                                          hresult.ToString("X8")));
+                       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;
+               }
+       }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/NtStatusCommand.cs b/irc/TechBot/TechBot.Commands.Common/NtStatusCommand.cs
new file mode 100644 (file)
index 0000000..1c3b668
--- /dev/null
@@ -0,0 +1,66 @@
+using System;
+using System.Xml;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("ntstatus", Help = "!ntstatus <value>")]
+       public class NtStatusCommand : XmlLookupCommand
+       {
+        public NtStatusCommand()
+               {
+               }
+
+        public override string XmlFile
+        {
+            get { return Settings.Default.NtStatusXml; }
+        }
+
+               public override void ExecuteCommand()
+               {
+            if (Text == null)
+            {
+                Say("Please provide a valid NTSTATUS value.");
+            }
+            else
+            {
+                NumberParser np = new NumberParser();
+                long ntstatus = np.Parse(Text);
+                if (np.Error)
+                {
+                    Say("{0} is not a valid NTSTATUS value.", Text);
+                    return;
+                }
+
+                string description = GetNtstatusDescription(ntstatus);
+                if (description != null)
+                {
+                    Say("{0} is {1}.",
+                        Text,
+                        description);
+                }
+                else
+                {
+                    Say("I don't know about NTSTATUS {0}.", Text);
+                }
+            }
+               }
+               
+               public string GetNtstatusDescription(long ntstatus)
+               {
+                       XmlElement root = base.m_XmlDocument.DocumentElement;
+                       XmlNode node = root.SelectSingleNode(String.Format("Ntstatus[@value='{0}']",
+                                                                          ntstatus.ToString("X8")));
+                       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;
+               }
+       }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/Properties/AssemblyInfo.cs b/irc/TechBot/TechBot.Commands.Common/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..72c565a
--- /dev/null
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TechBot.Commands.Common")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Sand")]
+[assembly: AssemblyProduct("TechBot.Commands.Common")]
+[assembly: AssemblyCopyright("Copyright © Sand 2008")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5d39d6f8-37fb-423b-ba88-1d5d8e5a1317")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/irc/TechBot/TechBot.Commands.Common/ReactOSBugUrl.cs b/irc/TechBot/TechBot.Commands.Common/ReactOSBugUrl.cs
new file mode 100644 (file)
index 0000000..3d94d6b
--- /dev/null
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("rosbug", Help = "!rosbug <number>", Description = "Will give you a link to the reqested ReactOS bug")]
+    class ReactOSBugUrl : BugCommand
+    {
+        public ReactOSBugUrl()
+        {
+        }
+
+        protected override string BugUrl
+        {
+            get { return "http://www.reactos.org/bugzilla/show_bug.cgi?id={0}"; }
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/SambaBugUrl.cs b/irc/TechBot/TechBot.Commands.Common/SambaBugUrl.cs
new file mode 100644 (file)
index 0000000..6c37677
--- /dev/null
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("sambabug", Help = "!sambabug <number>", Description = "Will give you a link to the reqested Samba bug")]
+    class SambaBugUrl : BugCommand
+    {
+        public SambaBugUrl()
+        {
+        }
+
+        protected override string BugUrl
+        {
+            get { return "https://bugzilla.samba.org/show_bug.cgi?id={0}"; }
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/Settings.Designer.cs b/irc/TechBot/TechBot.Commands.Common/Settings.Designer.cs
new file mode 100644 (file)
index 0000000..bb247b4
--- /dev/null
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.1433
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace TechBot.Commands.Common {
+    
+    
+    [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"]));
+            }
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/Settings.cs b/irc/TechBot/TechBot.Commands.Common/Settings.cs
new file mode 100644 (file)
index 0000000..45a94a8
--- /dev/null
@@ -0,0 +1,28 @@
+namespace TechBot.Commands.Common {
+    
+    
+    // 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.
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/Settings.settings b/irc/TechBot/TechBot.Commands.Common/Settings.settings
new file mode 100644 (file)
index 0000000..1971c3a
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TechBot.Commands.Common" 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
diff --git a/irc/TechBot/TechBot.Commands.Common/SvnCommand.cs b/irc/TechBot/TechBot.Commands.Common/SvnCommand.cs
new file mode 100644 (file)
index 0000000..9604761
--- /dev/null
@@ -0,0 +1,22 @@
+using System;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("svn", Help = "!svn" , Description="Where the ROS SVN repository is located")]
+       public class SvnCommand : Command
+       {
+               private string m_SvnRoot;
+
+        public SvnCommand()
+               {
+                       m_SvnRoot = Settings.Default.SVNRoot;
+               }
+               
+               public override void ExecuteCommand()
+               {
+            Say("svn co {0}", m_SvnRoot);
+               }
+       }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/TechBot.Commands.Common.csproj b/irc/TechBot/TechBot.Commands.Common/TechBot.Commands.Common.csproj
new file mode 100644 (file)
index 0000000..005c981
--- /dev/null
@@ -0,0 +1,74 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{041B5F06-BF97-4981-B024-3A7B6DD9F6AE}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>TechBot.Commands.Common</RootNamespace>
+    <AssemblyName>TechBot.Commands.Common</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Base\BugCommand.cs" />
+    <Compile Include="HResultCommand.cs" />
+    <Compile Include="NtStatusCommand.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ReactOSBugUrl.cs" />
+    <Compile Include="SambaBugUrl.cs" />
+    <Compile Include="Settings.cs" />
+    <Compile Include="Settings.Designer.cs">
+      <DependentUpon>Settings.settings</DependentUpon>
+      <AutoGen>True</AutoGen>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <Compile Include="SvnCommand.cs" />
+    <Compile Include="WineBugUrl.cs" />
+    <Compile Include="WinerrorCommand.cs" />
+    <Compile Include="WMCommand.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\TechBot.Library\TechBot.Library.csproj">
+      <Project>{1114F34D-F388-4F38-AE27-C0EE1B10B777}</Project>
+      <Name>TechBot.Library</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+    <None Include="Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/irc/TechBot/TechBot.Commands.Common/WMCommand.cs b/irc/TechBot/TechBot.Commands.Common/WMCommand.cs
new file mode 100644 (file)
index 0000000..4f2ec61
--- /dev/null
@@ -0,0 +1,94 @@
+using System;
+using System.Xml;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("wm" , Help = "!wm <value> or !wm <name>")]
+       public class WMCommand : XmlCommand
+       {
+        public WMCommand()
+               {
+               }
+
+        public override string XmlFile
+        {
+            get { return Settings.Default.WMXml; }
+        }
+               
+        [CommandParameter("wm", "The windows message to check" , DefaultParameter = true)]
+        public string WMText
+        {
+            get { return Parameters; }
+            set { Parameters = value; }
+        }
+
+               public override void ExecuteCommand()
+               {
+            if (WMText == null)
+            {
+                Say("Please provide a valid window message value or name.");
+
+            }
+            else
+            {
+                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)
+                {
+                    Say("{0} is {1}.",
+                         WMText,
+                         output);
+                }
+                else
+                {
+                    Say("I don't know about window message {0}.", WMText);
+                }
+            }
+               }
+
+               private string GetWmDescription(long wm)
+               {
+                       XmlElement root = base.m_XmlDocument.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 = base.m_XmlDocument.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;
+               }
+       }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/WineBugUrl.cs b/irc/TechBot/TechBot.Commands.Common/WineBugUrl.cs
new file mode 100644 (file)
index 0000000..e87a0c3
--- /dev/null
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("winebug", Help = "!winebug <number>" , Description="Will give you a link to the reqested Wine bug")]
+    class WineBugUrl : BugCommand
+    {
+        public WineBugUrl()
+        {
+        }
+
+        protected override string BugUrl
+        {
+            get { return "http://bugs.winehq.org/show_bug.cgi?id={0}"; }
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/WinerrorCommand.cs b/irc/TechBot/TechBot.Commands.Common/WinerrorCommand.cs
new file mode 100644 (file)
index 0000000..d6736a3
--- /dev/null
@@ -0,0 +1,66 @@
+using System;
+using System.Xml;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.Common
+{
+    [Command("winerror", Help = "!winerror <value>")]
+    public class WinErrorCommand : XmlLookupCommand
+       {
+        public WinErrorCommand()
+               {
+               }
+
+        public override string XmlFile
+        {
+            get { return Settings.Default.WinErrorXml; }
+        }
+
+               public override void ExecuteCommand()
+               {
+            if (Text == null)
+            {
+                Say("Please provide a valid System Error Code value.");
+            }
+            else
+            {
+                NumberParser np = new NumberParser();
+                long winerror = np.Parse(Text);
+                if (np.Error)
+                {
+                    Say("{0} is not a valid System Error Code value.", Text);
+                    return;
+                }
+
+                string description = GetWinerrorDescription(winerror);
+                if (description != null)
+                {
+                    Say("{0} is {1}.",
+                        Text,
+                        description);
+                }
+                else
+                {
+                    Say("I don't know about System Error Code {0}.", Text);
+                }
+            }
+               }
+
+               public string GetWinerrorDescription(long winerror)
+               {
+                       XmlElement root = base.m_XmlDocument.DocumentElement;
+                       XmlNode node = root.SelectSingleNode(String.Format("Winerror[@value='{0}']",
+                                                               Text));
+                       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;
+               }
+       }
+}
diff --git a/irc/TechBot/TechBot.Commands.Common/app.config b/irc/TechBot/TechBot.Commands.Common/app.config
new file mode 100644 (file)
index 0000000..b2c11ae
--- /dev/null
@@ -0,0 +1,27 @@
+<?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.Commands.Common.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+        </sectionGroup>
+    </configSections>
+    <applicationSettings>
+        <TechBot.Commands.Common.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.Commands.Common.Settings>
+    </applicationSettings>
+</configuration>
\ No newline at end of file
diff --git a/irc/TechBot/TechBot.Commands.MSDN/ApiCommand.cs b/irc/TechBot/TechBot.Commands.MSDN/ApiCommand.cs
new file mode 100644 (file)
index 0000000..3a8e88a
--- /dev/null
@@ -0,0 +1,310 @@
+using System;
+using System.IO;
+using System.Data;
+using System.Text.RegularExpressions;
+
+using HtmlHelp;
+using HtmlHelp.ChmDecoding;
+
+using TechBot.Library;
+
+namespace TechBot.Commands.MSDN
+{
+    [Command("api", Help = "!api <apiname>")]
+       public class ApiCommand : Command
+       {
+               private bool IsVerbose = false;
+
+               private HtmlHelpSystem chm;
+        private string name;
+
+        public ApiCommand()
+               {
+                       Run();
+               }
+
+        [CommandParameter("api", "The API name")]
+        public string API
+        {
+            get { return Parameters; }
+            set { Parameters = value; }
+        }
+               
+               private void WriteIfVerbose(string message)
+               {
+                       if (IsVerbose)
+                Say(message);
+               }
+
+               private void Run()
+               {
+                       string CHMFilename = Path.Combine(Settings.Default.ChmPath, Settings.Default.MainChm);
+                       chm = new HtmlHelpSystem();
+                       chm.OpenFile(CHMFilename, null);
+                       
+                       Console.WriteLine(String.Format("Loaded main CHM: {0}",
+                                                       Path.GetFileName(CHMFilename)));
+            foreach (string filename in Directory.GetFiles(Settings.Default.ChmPath))
+                       {
+                               if (!Path.GetExtension(filename).ToLower().Equals(".chm"))
+                                       continue;
+                if (Path.GetFileName(filename).ToLower().Equals(Settings.Default.MainChm))
+                                       continue;
+
+                               Console.WriteLine(String.Format("Loading CHM: {0}",
+                                                               Path.GetFileName(filename)));
+                               try
+                               {
+                                       chm.MergeFile(filename);
+                               }
+                               catch (Exception ex)
+                               {
+                                       Console.WriteLine(String.Format("Could not load CHM: {0}. Exception {1}",
+                                                                       Path.GetFileName(filename),
+                                                                       ex));
+                               }
+                       }
+                       Console.WriteLine(String.Format("Loaded {0} CHMs",
+                                                       chm.FileList.Length));
+               }
+
+        public override void ExecuteCommand()
+        {
+            if (Name.Trim().Equals(String.Empty))
+            {
+                Say("Please give me a keyword.");
+            }
+            else
+            {
+                Search(Name);
+            }
+        }
+
+        private bool SearchIndex(
+                                 string keyword)
+        {
+            if (chm.HasIndex)
+            {
+                IndexItem item = chm.Index.SearchIndex(keyword,
+                                                       IndexType.KeywordLinks);
+                if (item != null && item.Topics.Count > 0)
+                {
+                    WriteIfVerbose(String.Format("Keyword {0} found in index",
+                                                 item.KeyWord));
+                    IndexTopic indexTopic = item.Topics[0] as IndexTopic;
+                    return DisplayResult(                                         keyword,
+                                         indexTopic);
+                }
+                else
+                {
+                    WriteIfVerbose(String.Format("Keyword {0} not found in index",
+                                                 keyword));
+                    return false;
+                }
+            }
+            else
+                return false;
+        }
+
+               private void SearchFullText(string keyword)
+               {
+                       string sort = "Rating ASC";
+                       WriteIfVerbose(String.Format("Searching fulltext database for {0}",
+                                         keyword));
+
+                       bool partialMatches = false;
+                       bool titlesOnly = true;
+                       int maxResults = 100;
+                       DataTable results = chm.PerformSearch(keyword,
+                                                             maxResults,
+                                                             partialMatches,
+                                                             titlesOnly);
+                       WriteIfVerbose(String.Format("results.Rows.Count = {0}",
+                                                    results != null ?
+                                                    results.Rows.Count.ToString() : "(none)"));
+                       if (results != null && results.Rows.Count > 0)
+                       {
+                               results.DefaultView.Sort = sort;
+                               if (!DisplayResult(keyword,
+                                                  results))
+                               {
+                    Say("No result");
+                               }
+                       }
+                       else
+                       {
+                Say("No result");
+                       }
+               }
+
+               private void Search(string keyword)
+               {
+                       if (!SearchIndex(keyword))
+                               SearchFullText(keyword);
+               }
+               
+               private bool DisplayResult(string keyword,
+                                          IndexTopic indexTopic)
+               {
+                       keyword = keyword.Trim().ToLower();
+                       string url = indexTopic.URL;
+                       WriteIfVerbose(String.Format("URL from index search {0}",
+                                         url));
+                       string prototype = ExtractPrototype(url);
+                       if (prototype == null || prototype.Trim().Equals(String.Empty))
+                               return false;
+                       string formattedPrototype = FormatPrototype(prototype);
+            Say(formattedPrototype);
+                       return true;
+               }
+               
+               private bool DisplayResult(string keyword,
+                                          DataTable results)
+               {
+                       keyword = keyword.Trim().ToLower();
+                       for (int i = 0; i < results.DefaultView.Count; i++)
+                       {
+                               DataRowView row = results.DefaultView[i];
+                               string title = row["Title"].ToString();
+                               WriteIfVerbose(String.Format("Examining {0}", title));
+                               if (title.Trim().ToLower().Equals(keyword))
+                               {
+                                       string location = row["Location"].ToString();
+                                       string rating = row["Rating"].ToString();
+                                       string url = row["Url"].ToString();
+                                       string prototype = ExtractPrototype(url);
+                                       if (prototype == null || prototype.Trim().Equals(String.Empty))
+                                               continue;
+                                       string formattedPrototype = FormatPrototype(prototype);
+                    Say(formattedPrototype);
+                                       return true;
+                               }
+                       }
+                       return false;
+               }
+
+               private void DisplayNoResult(MessageContext context,
+                                            string keyword)
+               {
+            TechBot.ServiceOutput.WriteLine(context,
+                                               String.Format("I don't know about keyword {0}",
+                                                             keyword));
+               }
+
+               private string ReplaceComments(string s)
+               {
+                       return Regex.Replace(s, "//(.+)\r\n", "");
+               }
+
+               private string ReplaceLineEndings(string s)
+               {
+                       return Regex.Replace(s, "(\r\n)+", " ");
+               }
+
+               private string ReplaceSpaces(string s)
+               {
+                       return Regex.Replace(s, @" +", " ");
+               }
+               
+               private string ReplaceSpacesBeforeLeftParenthesis(string s)
+               {
+                       return Regex.Replace(s, @"\( ", @"(");
+               }
+
+               private string ReplaceSpacesBeforeRightParenthesis(string s)
+               {
+                       return Regex.Replace(s, @" \)", @")");
+               }
+
+               private string ReplaceSemicolon(string s)
+               {
+                       return Regex.Replace(s, @";", @"");
+               }
+
+               private string FormatPrototype(string prototype)
+               {
+                       string s = ReplaceComments(prototype);
+                       s = ReplaceLineEndings(s);
+                       s = ReplaceSpaces(s);
+                       s = ReplaceSpacesBeforeLeftParenthesis(s);
+                       s = ReplaceSpacesBeforeRightParenthesis(s);
+                       s = ReplaceSemicolon(s);
+                       return s;
+               }
+               
+               private string ExtractPrototype(string url)
+               {
+                       string page = GetPage(url);
+                       Match match = Regex.Match(page,
+                                                 "<PRE class=\"?syntax\"?>(.+)</PRE>",
+                                                 RegexOptions.Multiline |
+                                                 RegexOptions.Singleline);
+                       if (match.Groups.Count > 1)
+                       {
+                               string prototype = match.Groups[1].ToString();
+                               return StripHtml(StripAfterSlashPre(prototype));
+                       }
+                       
+                       return "";
+               }
+               
+               private string StripAfterSlashPre(string html)
+               {
+                       int index = html.IndexOf("</PRE>");
+                       if (index != -1)
+                       {
+                               return html.Substring(0, index);
+                       }
+                       else
+                               return html;
+               }
+               
+               private string StripHtml(string html)
+               {
+                       return Regex.Replace(html, @"<(.|\n)*?>", String.Empty);
+               }
+
+               private string GetPage(string url)
+               {
+                       string CHMFileName = "";
+                       string topicName = "";
+                       string anchor = "";
+                       CHMStream.CHMStream baseStream;
+                       if (!chm.BaseStream.GetCHMParts(url, ref CHMFileName, ref topicName, ref anchor))
+                       {
+                               baseStream = chm.BaseStream;
+                               CHMFileName = baseStream.CHMFileName;
+                               topicName = url;
+                               anchor = "";
+                       }
+                       else
+                       {
+                               baseStream = GetBaseStreamFromCHMFileName(CHMFileName);
+                       }
+
+                       if ((topicName == "") || (CHMFileName == "") || (baseStream == null))
+                       {
+                               return "";
+                       }
+
+                       return baseStream.ExtractTextFile(topicName);
+               }
+
+        private CHMStream.CHMStream GetBaseStreamFromCHMFileName(string CHMFileName)
+               {
+                       foreach (CHMFile file in chm.FileList)
+                       {
+                               WriteIfVerbose(String.Format("Compare: {0} <> {1}",
+                                                            file.ChmFilePath,
+                                                            CHMFileName));
+                               if (file.ChmFilePath.ToLower().Equals(CHMFileName.ToLower()))
+                               {
+                                       return file.BaseStream;
+                               }
+                       }
+                       WriteIfVerbose(String.Format("Could not find loaded CHM file in list: {0}",
+                                                    CHMFileName));
+                       return null;
+               }
+       }
+}
diff --git a/irc/TechBot/TechBot.Commands.MSDN/Properties/AssemblyInfo.cs b/irc/TechBot/TechBot.Commands.MSDN/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..44bdf80
--- /dev/null
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TechBot.Commands.MSDN")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Sand")]
+[assembly: AssemblyProduct("TechBot.Commands.MSDN")]
+[assembly: AssemblyCopyright("Copyright © Sand 2008")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("8a6332ce-82e3-4fbd-a799-8f4b8d025955")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/irc/TechBot/TechBot.Commands.MSDN/Settings.Designer.cs b/irc/TechBot/TechBot.Commands.MSDN/Settings.Designer.cs
new file mode 100644 (file)
index 0000000..634aeef
--- /dev/null
@@ -0,0 +1,50 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.1433
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace TechBot.Commands.MSDN {
+    
+    
+    [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.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("C:\\IRC\\TechBot\\CHM")]
+        public string ChmPath {
+            get {
+                return ((string)(this["ChmPath"]));
+            }
+            set {
+                this["ChmPath"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("kmarch.chm")]
+        public string MainChm {
+            get {
+                return ((string)(this["MainChm"]));
+            }
+            set {
+                this["MainChm"] = value;
+            }
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot.Commands.MSDN/Settings.settings b/irc/TechBot/TechBot.Commands.MSDN/Settings.settings
new file mode 100644 (file)
index 0000000..d13c49f
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TechBot.Commands.MSDN" GeneratedClassName="Settings">
+  <Profiles />
+  <Settings>
+    <Setting Name="ChmPath" Type="System.String" Scope="User">
+      <Value Profile="(Default)">C:\IRC\TechBot\CHM</Value>
+    </Setting>
+    <Setting Name="MainChm" Type="System.String" Scope="User">
+      <Value Profile="(Default)">kmarch.chm</Value>
+    </Setting>
+  </Settings>
+</SettingsFile>
\ No newline at end of file
diff --git a/irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj b/irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj
new file mode 100644 (file)
index 0000000..636ac87
--- /dev/null
@@ -0,0 +1,69 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{ADBF1ED6-A586-4707-BD59-4CD53448D0FE}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>TechBot.Commands.MSDN</RootNamespace>
+    <AssemblyName>TechBot.Commands.MSDN</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ApiCommand.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+      <DependentUpon>Settings.settings</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\CHMLibrary\CHMLibrary.csproj">
+      <Project>{72E5CCA1-6318-4D62-964D-CB23A5C743B5}</Project>
+      <Name>CHMLibrary</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\TechBot.Library\TechBot.Library.csproj">
+      <Project>{1114F34D-F388-4F38-AE27-C0EE1B10B777}</Project>
+      <Name>TechBot.Library</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+    <None Include="Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj.user b/irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj.user
new file mode 100644 (file)
index 0000000..a1d742b
--- /dev/null
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectView>ProjectFiles</ProjectView>
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/irc/TechBot/TechBot.Commands.MSDN/app.config b/irc/TechBot/TechBot.Commands.MSDN/app.config
new file mode 100644 (file)
index 0000000..83f087c
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <configSections>
+        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+            <section name="TechBot.Commands.MSDN.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+        </sectionGroup>
+    </configSections>
+    <userSettings>
+        <TechBot.Commands.MSDN.Settings>
+            <setting name="ChmPath" serializeAs="String">
+                <value>C:\IRC\TechBot\CHM</value>
+            </setting>
+            <setting name="MainChm" serializeAs="String">
+                <value>kmarch.chm</value>
+            </setting>
+        </TechBot.Commands.MSDN.Settings>
+    </userSettings>
+</configuration>
\ No newline at end of file
index f6678d8..dfa480f 100644 (file)
@@ -1,15 +1,27 @@
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
-       <appSettings>\r
-               <add key="IRCServerHostName" value="irc.eu.freenode.net" />\r
-               <add key="IRCServerHostPort" value="6667" />\r
-               <add key="IRCChannelNames" value="channel1;channel2" />\r
-               <add key="IRCBotName" value="MyBot" />\r
-               <add key="IRCBotPassword" value="MyPassword" />\r
-               <add key="ChmPath" value="C:\IRC\TechBot\CHM" />\r
-               <add key="MainChm" value="kmarch.chm" />\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
-       </appSettings>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <configSections>
+        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+            <section name="TechBot.Console.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+        </sectionGroup>
+    </configSections>
+    <userSettings>
+        <TechBot.Console.Settings>
+            <setting name="IRCServerHostName" serializeAs="String">
+                <value>irc.eu.freenode.net</value>
+            </setting>
+            <setting name="IRCChannelNames" serializeAs="String">
+                <value>rbuildbottest2</value>
+            </setting>
+            <setting name="IRCBotName" serializeAs="String">
+                <value>RBuildBot2</value>
+            </setting>
+            <setting name="IRCBotPassword" serializeAs="String">
+                <value>qwerty</value>
+            </setting>
+            <setting name="IRCServerHostPort" serializeAs="String">
+                <value>6667</value>
+            </setting>
+        </TechBot.Console.Settings>
+    </userSettings>
+</configuration>
\ No newline at end of file
index 14c3c84..d354313 100644 (file)
@@ -17,11 +17,10 @@ namespace TechBot.Console
 
     public class ConsoleTechBotService : TechBotService
     {
 
     public class ConsoleTechBotService : TechBotService
     {
-        public ConsoleTechBotService(
-                          string chmPath,
-                          string mainChm)
-            : base(new ConsoleServiceOutput(), chmPath, mainChm)
+        public ConsoleTechBotService()
+            : base(new ConsoleServiceOutput())
         {
         {
+            System.Console.WriteLine("TechBot running console service...");
         }
 
         public override void Run()
         }
 
         public override void Run()
@@ -31,8 +30,7 @@ namespace TechBot.Console
 
             while (true)
             {
 
             while (true)
             {
-                string s = System.Console.ReadLine();
-                InjectMessage(null, s);
+                InjectMessage(System.Console.ReadLine());
             }
         }
     }
             }
         }
     }
index 88760ac..eec2855 100644 (file)
-using System;\r
-using System.Configuration;\r
-using TechBot.Library;\r
-\r
-namespace TechBot.Console\r
-{\r
-       class MainClass\r
-       {\r
-               private static void VerifyRequiredOption(string optionName,\r
-                                                        string optionValue)\r
-               {\r
-                       if (optionValue == null)\r
-                       {\r
-                               throw new Exception(String.Format("Option '{0}' not set.",\r
-                                                                 optionName));\r
-                       }\r
-               }\r
-               \r
-               private static string IRCServerHostName\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "IRCServerHostName";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static int IRCServerHostPort\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "IRCServerHostPort";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return Int32.Parse(s);\r
-                       }\r
-               }\r
-\r
-               private static string IRCChannelNames\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "IRCChannelNames";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string IRCBotName\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "IRCBotName";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string IRCBotPassword\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "IRCBotPassword";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string ChmPath\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "ChmPath";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-               \r
-               private static string MainChm\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "MainChm";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string NtstatusXml\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "NtstatusXml";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string WinerrorXml\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "WinerrorXml";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string HresultXml\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "HresultXml";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string WmXml\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "WmXml";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string SvnCommand\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "SvnCommand";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string BugUrl\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "BugUrl";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-               private static string WineBugUrl\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "WineBugUrl";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-\r
-               private static string SambaBugUrl\r
-               {\r
-                       get\r
-                       {\r
-                               string optionName = "SambaBugUrl";\r
-                               string s = ConfigurationSettings.AppSettings[optionName];\r
-                               VerifyRequiredOption(optionName,\r
-                                                    s);\r
-                               return s;\r
-                       }\r
-               }\r
-\r
-\r
-        //private static void RunIrcService()\r
-        //{\r
-        //    IrcTechBotService ircService = new IrcTechBotService(IRCServerHostName,\r
-        //                                           IRCServerHostPort,\r
-        //                                           IRCChannelNames,\r
-        //                                           IRCBotName,\r
-        //                                           IRCBotPassword,\r
-        //                                           ChmPath,\r
-        //                                           MainChm);\r
-        //    ircService.Run();\r
-        //}\r
-\r
-        public static void Main(string[] args)\r
-        {\r
-            TechBotService m_TechBot = null;\r
-\r
-            if (args.Length > 0 && args[0].ToLower().Equals("irc"))\r
-            {\r
-                m_TechBot = new IrcTechBotService(IRCServerHostName,\r
-                                                                   IRCServerHostPort,\r
-                                                                   IRCChannelNames,\r
-                                                                   IRCBotName,\r
-                                                                   IRCBotPassword,\r
-                                                                   ChmPath,\r
-                                                                   MainChm);\r
-            }\r
-            else\r
-            {\r
-                System.Console.WriteLine("TechBot running console service...");\r
-                m_TechBot = new ConsoleTechBotService(\r
-                                                            ChmPath,\r
-                                                            MainChm);\r
-\r
-\r
-            }\r
-\r
-            m_TechBot.Run();\r
-        }\r
-       }\r
+using System;
+using System.Configuration;
+using TechBot.Library;
+
+namespace TechBot.Console
+{
+       class MainClass
+       {
+        public static void Main(string[] args)
+        {
+            TechBotService m_TechBot = null;
+
+            if (args.Length > 0 && args[0].ToLower().Equals("irc"))
+            {
+                m_TechBot = new IrcTechBotService(Settings.Default.IRCServerHostName,
+                                                  Settings.Default.IRCServerHostPort,
+                                                  Settings.Default.IRCChannelNames,
+                                                  Settings.Default.IRCBotName,
+                                                  Settings.Default.IRCBotPassword);
+            }
+            else
+            {
+                m_TechBot = new ConsoleTechBotService();
+            }
+
+            m_TechBot.Run();
+        }
+       }
 }
\ No newline at end of file
 }
\ No newline at end of file
diff --git a/irc/TechBot/TechBot.Console/Settings.Designer.cs b/irc/TechBot/TechBot.Console/Settings.Designer.cs
new file mode 100644 (file)
index 0000000..4f05450
--- /dev/null
@@ -0,0 +1,86 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.1433
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace TechBot.Console {
+    
+    
+    [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.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("irc.eu.freenode.net")]
+        public string IRCServerHostName {
+            get {
+                return ((string)(this["IRCServerHostName"]));
+            }
+            set {
+                this["IRCServerHostName"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("rbuildbottest2")]
+        public string IRCChannelNames {
+            get {
+                return ((string)(this["IRCChannelNames"]));
+            }
+            set {
+                this["IRCChannelNames"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("RBuildBot2")]
+        public string IRCBotName {
+            get {
+                return ((string)(this["IRCBotName"]));
+            }
+            set {
+                this["IRCBotName"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("qwerty")]
+        public string IRCBotPassword {
+            get {
+                return ((string)(this["IRCBotPassword"]));
+            }
+            set {
+                this["IRCBotPassword"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("6667")]
+        public int IRCServerHostPort {
+            get {
+                return ((int)(this["IRCServerHostPort"]));
+            }
+            set {
+                this["IRCServerHostPort"] = value;
+            }
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot.Console/Settings.settings b/irc/TechBot/TechBot.Console/Settings.settings
new file mode 100644 (file)
index 0000000..ba83409
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TechBot.Console" GeneratedClassName="Settings">
+  <Profiles />
+  <Settings>
+    <Setting Name="IRCServerHostName" Type="System.String" Scope="User">
+      <Value Profile="(Default)">irc.eu.freenode.net</Value>
+    </Setting>
+    <Setting Name="IRCChannelNames" Type="System.String" Scope="User">
+      <Value Profile="(Default)">rbuildbottest2</Value>
+    </Setting>
+    <Setting Name="IRCBotName" Type="System.String" Scope="User">
+      <Value Profile="(Default)">RBuildBot2</Value>
+    </Setting>
+    <Setting Name="IRCBotPassword" Type="System.String" Scope="User">
+      <Value Profile="(Default)">qwerty</Value>
+    </Setting>
+    <Setting Name="IRCServerHostPort" Type="System.Int32" Scope="User">
+      <Value Profile="(Default)">6667</Value>
+    </Setting>
+  </Settings>
+</SettingsFile>
\ No newline at end of file
index 4c0b6f7..a7be832 100644 (file)
     <Compile Include="AssemblyInfo.cs" />
     <Compile Include="ConsoleTechBotService.cs" />
     <Compile Include="Main.cs" />
     <Compile Include="AssemblyInfo.cs" />
     <Compile Include="ConsoleTechBotService.cs" />
     <Compile Include="Main.cs" />
+    <Compile Include="Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+      <DependentUpon>Settings.settings</DependentUpon>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
   </ItemGroup>
   <ItemGroup>
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\TechBot.Commands.Common\TechBot.Commands.Common.csproj">
+      <Project>{041B5F06-BF97-4981-B024-3A7B6DD9F6AE}</Project>
+      <Name>TechBot.Commands.Common</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\TechBot.Commands.RBuild\TechBot.Commands.RBuild.csproj">
+      <Project>{D676FEDE-62DD-4B4D-94C6-308598E827F9}</Project>
+      <Name>TechBot.Commands.RBuild</Name>
+    </ProjectReference>
     <ProjectReference Include="..\TechBot.IRCLibrary\TechBot.IRCLibrary.csproj">
       <Project>{D2A57931-DF04-4BC3-BD11-75DF4F3B0A88}</Project>
       <Name>TechBot.IRCLibrary</Name>
     <ProjectReference Include="..\TechBot.IRCLibrary\TechBot.IRCLibrary.csproj">
       <Project>{D2A57931-DF04-4BC3-BD11-75DF4F3B0A88}</Project>
       <Name>TechBot.IRCLibrary</Name>
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
-    <None Include="App.config" />
+    <None Include="app.config" />
+    <None Include="Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Properties\" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Properties\" />
index 04f4676..02647ee 100644 (file)
@@ -50,6 +50,9 @@
   <ItemGroup>
     <Reference Include="System" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
   <ItemGroup>
     <Folder Include="Properties\" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Properties\" />
   </ItemGroup>
diff --git a/irc/TechBot/TechBot.IRCLibrary/app.config b/irc/TechBot/TechBot.IRCLibrary/app.config
new file mode 100644 (file)
index 0000000..5a7d239
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <configSections>
+        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+            <section name="TechBot.IRCLibrary.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+        </sectionGroup>
+    </configSections>
+    <userSettings>
+        <TechBot.IRCLibrary.Settings>
+            <setting name="CommandPrefix" serializeAs="String">
+                <value>@</value>
+            </setting>
+        </TechBot.IRCLibrary.Settings>
+    </userSettings>
+</configuration>
\ No newline at end of file
index bdb3a80..f996c73 100644 (file)
@@ -13,6 +13,7 @@ namespace TechBot.Library
                private string m_name = "";
                private string m_description = "";
         private bool m_Required = true;
                private string m_name = "";
                private string m_description = "";
         private bool m_Required = true;
+        private bool m_Default = false;
                #endregion
 
                #region Public Properties
                #endregion
 
                #region Public Properties
@@ -26,6 +27,12 @@ namespace TechBot.Library
 
         public bool Required { get { return m_Required; } }
 
 
         public bool Required { get { return m_Required; } }
 
+        public bool DefaultParameter 
+        {
+            get { return m_Default; }
+            set { m_Default = value; }
+        }
+
                #endregion
 
                #region Constructors
                #endregion
 
                #region Constructors
index 839475b..25c5119 100644 (file)
@@ -1,4 +1,5 @@
 using System;
 using System;
+using System.Text.RegularExpressions;
 
 namespace TechBot.Library
 {
 
 namespace TechBot.Library
 {
@@ -6,6 +7,7 @@ namespace TechBot.Library
     {
         protected TechBotService m_TechBotService = null;
         protected MessageContext m_Context = null;
     {
         protected TechBotService m_TechBotService = null;
         protected MessageContext m_Context = null;
+        protected string m_Params = null;
 
         public TechBotService TechBot
         {
 
         public TechBotService TechBot
         {
@@ -30,10 +32,15 @@ namespace TechBot.Library
             }
         }
 
             }
         }
 
-        public void ParseParameters(string paramaters)
+        public string Parameters
         {
         {
-            ParametersParser parser = new ParametersParser(paramaters, this);
-            parser.Parse();
+            get { return m_Params; }
+            set { m_Params = value; }
+        }
+
+        protected virtual void Say()
+        {
+            TechBot.ServiceOutput.WriteLine(Context, string.Empty);
         }
 
         protected virtual void Say(string message)
         }
 
         protected virtual void Say(string message)
@@ -47,5 +54,13 @@ namespace TechBot.Library
         }
 
         public abstract void ExecuteCommand();
         }
 
         public abstract void ExecuteCommand();
+
+        public virtual void Initialize()
+        {
+        }
+
+        public virtual void DeInitialize()
+        {
+        }
     }
 }
     }
 }
index 547badb..e3a6aa0 100644 (file)
@@ -6,13 +6,12 @@ namespace TechBot.Library
 {
     public abstract class XmlLookupCommand : XmlCommand
     {
 {
     public abstract class XmlLookupCommand : XmlCommand
     {
-        private string m_Text = null;
+        protected string m_Text = null;
 
 
-        [CommandParameter("text", "The value to check")]
-        public string Text
+        public virtual string Text
         {
         {
-            get { return m_Text; }
-            set { m_Text = value; }
+            get { return Parameters; }
+            set { Parameters = value; }
         }
     }
 }
         }
     }
 }
index f47ae18..ff68f81 100644 (file)
@@ -1,9 +1,10 @@
 using System;
 using System;
+using System.Reflection;
 using System.Collections;
 
 namespace TechBot.Library
 {
 using System.Collections;
 
 namespace TechBot.Library
 {
-    [Command("help", Help = "!help")]
+    [Command("help", Help = "!help or !help -name:[CommandName]", Description = "Shows this help , type 'help -name:[CommandName]'")]
        public class HelpCommand : Command
        {
         private string m_CommandName = null;
        public class HelpCommand : Command
        {
         private string m_CommandName = null;
@@ -15,8 +16,8 @@ namespace TechBot.Library
         [CommandParameter("Name", "The command name to show help")]
         public string CommandName
         {
         [CommandParameter("Name", "The command name to show help")]
         public string CommandName
         {
-            get { return m_CommandName; }
-            set { m_CommandName = value; }
+            get { return Parameters; }
+            set { Parameters = value; }
         }
 
         public override void ExecuteCommand()
         }
 
         public override void ExecuteCommand()
@@ -27,7 +28,8 @@ namespace TechBot.Library
 
                 foreach (CommandBuilder command in TechBot.Commands)
                 {
 
                 foreach (CommandBuilder command in TechBot.Commands)
                 {
-                    Say("!{0} - {1}",
+                    Say("{0}{1} - {2}",
+                        Settings.Default.CommandPrefix,
                         command.Name,
                         command.Description);
                 }
                         command.Name,
                         command.Description);
                 }
@@ -43,7 +45,29 @@ namespace TechBot.Library
                 else
                 {
                     Say("Command '{0}' help:", CommandName);
                 else
                 {
                     Say("Command '{0}' help:", CommandName);
-                    Say("");
+                    Say();
+                    Say(cmdBuilder.Description);
+                    Say();
+                    Say(cmdBuilder.Help);
+                    Say();
+                    Say("Parameters :");
+                    Say();
+
+                    PropertyInfo[] propertyInfoArray = cmdBuilder.Type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
+                    foreach (PropertyInfo propertyInfo in propertyInfoArray)
+                    {
+                        CommandParameterAttribute[] commandAttributes = (CommandParameterAttribute[])
+                            Attribute.GetCustomAttributes(propertyInfo, typeof(CommandParameterAttribute));
+
+                        foreach (CommandParameterAttribute parameter in commandAttributes)
+                        {
+                            Say("\t-{0}: [{1}]", 
+                                parameter.Name, 
+                                parameter.Description);
+                        }
+                    }
+
+                    Say();
                 }
             }
         }
                 }
             }
         }
index b140c18..100bd2b 100644 (file)
@@ -28,6 +28,8 @@ namespace TechBot.Library
         {
             Assembly assPlugin = Assembly.LoadFile(sFile);
 
         {
             Assembly assPlugin = Assembly.LoadFile(sFile);
 
+            Console.WriteLine("Loading plugins from : {0}", assPlugin.Location);
+
             if (assPlugin != null)
             {
                 foreach (Type pluginType in assPlugin.GetTypes())
             if (assPlugin != null)
             {
                 foreach (Type pluginType in assPlugin.GetTypes())
@@ -36,6 +38,12 @@ namespace TechBot.Library
                     {
                         if (pluginType.IsAbstract == false)
                         {
                     {
                         if (pluginType.IsAbstract == false)
                         {
+                            CommandBuilder cmdBuilder = new CommandBuilder(pluginType);
+
+                            Console.WriteLine("{0}:{1}", 
+                                cmdBuilder.Name,
+                                cmdBuilder.Description);
+
                             //Add it to the list.
                             Commands.Add(new CommandBuilder(pluginType));
                         }
                             //Add it to the list.
                             Commands.Add(new CommandBuilder(pluginType));
                         }
index 4a88a84..8387bfc 100644 (file)
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.832
+//     Runtime Version:2.0.50727.1433
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -67,5 +67,14 @@ namespace TechBot.Library {
                 return ((string)(this["SVNRoot"]));
             }
         }
                 return ((string)(this["SVNRoot"]));
             }
         }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("@")]
+        public string CommandPrefix {
+            get {
+                return ((string)(this["CommandPrefix"]));
+            }
+        }
     }
 }
     }
 }
index 65c52e1..25503d7 100644 (file)
@@ -17,5 +17,8 @@
     <Setting Name="SVNRoot" Type="System.String" Scope="Application">
       <Value Profile="(Default)">svn://svn.reactos.org/trunk/reactos</Value>
     </Setting>
     <Setting Name="SVNRoot" Type="System.String" Scope="Application">
       <Value Profile="(Default)">svn://svn.reactos.org/trunk/reactos</Value>
     </Setting>
+    <Setting Name="CommandPrefix" Type="System.String" Scope="Application">
+      <Value Profile="(Default)">@</Value>
+    </Setting>
   </Settings>
 </SettingsFile>
\ No newline at end of file
   </Settings>
 </SettingsFile>
\ No newline at end of file
index 9cd39a4..5950574 100644 (file)
     <Compile Include="Factory\CommandFactory.cs" />
     <Compile Include="Commands\Base\Command.cs" />
     <Compile Include="Commands\Base\XmlCommand.cs" />
     <Compile Include="Factory\CommandFactory.cs" />
     <Compile Include="Commands\Base\Command.cs" />
     <Compile Include="Commands\Base\XmlCommand.cs" />
-    <Compile Include="Commands\BugCommand.cs" />
     <Compile Include="Commands\HelpCommand.cs" />
     <Compile Include="Commands\HelpCommand.cs" />
-    <Compile Include="Commands\HResultCommand.cs" />
-    <Compile Include="Commands\NtStatusCommand.cs" />
-    <Compile Include="Commands\ReactOSBugUrl.cs" />
-    <Compile Include="Commands\SambaBugUrl.cs" />
-    <Compile Include="Commands\SvnCommand.cs" />
-    <Compile Include="Commands\WineBugUrl.cs" />
-    <Compile Include="Commands\WinerrorCommand.cs" />
-    <Compile Include="Commands\WMCommand.cs" />
     <Compile Include="MessageContext.cs" />
     <Compile Include="NumberParser.cs" />
     <Compile Include="MessageContext.cs" />
     <Compile Include="NumberParser.cs" />
-    <Compile Include="ParametersParser.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ServiceOutput.cs" />
     <Compile Include="Settings.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ServiceOutput.cs" />
     <Compile Include="Settings.cs" />
     <Reference Include="System.XML" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System.XML" />
   </ItemGroup>
   <ItemGroup>
-    <ProjectReference Include="..\CHMLibrary\CHMLibrary.csproj">
-      <Project>{72E5CCA1-6318-4D62-964D-CB23A5C743B5}</Project>
-      <Name>CHMLibrary</Name>
-    </ProjectReference>
     <ProjectReference Include="..\TechBot.IRCLibrary\TechBot.IRCLibrary.csproj">
       <Project>{D2A57931-DF04-4BC3-BD11-75DF4F3B0A88}</Project>
       <Name>TechBot.IRCLibrary</Name>
     <ProjectReference Include="..\TechBot.IRCLibrary\TechBot.IRCLibrary.csproj">
       <Project>{D2A57931-DF04-4BC3-BD11-75DF4F3B0A88}</Project>
       <Name>TechBot.IRCLibrary</Name>
index 489a742..238261c 100644 (file)
@@ -14,6 +14,7 @@ namespace TechBot.Library
         {
             if (context is ChannelMessageContext)
             {
         {
             if (context is ChannelMessageContext)
             {
+                Thread.Sleep (500);
                 ChannelMessageContext channelContext = context as ChannelMessageContext;
                 channelContext.Channel.Talk(message);
             }
                 ChannelMessageContext channelContext = context as ChannelMessageContext;
                 channelContext.Channel.Talk(message);
             }
@@ -37,8 +38,6 @@ namespace TechBot.Library
                private string channelnames;
                private string botname;
                private string password;
                private string channelnames;
                private string botname;
                private string password;
-        private string chmPath;
-        private string mainChm;
                private IrcClient m_IrcClient;
                private ArrayList channels = new ArrayList();
                private bool isStopped = false;
                private IrcClient m_IrcClient;
                private ArrayList channels = new ArrayList();
                private bool isStopped = false;
@@ -47,10 +46,8 @@ namespace TechBot.Library
                                  int port,
                                  string channelnames,
                                  string botname,
                                  int port,
                                  string channelnames,
                                  string botname,
-                                 string password,
-                                 string chmPath,
-                                 string mainChm)
-            : base (new IrcServiceOutput() , chmPath , mainChm)
+                                 string password)
+            : base (new IrcServiceOutput())
                {
                        this.hostname = hostname;
                        this.port = port;
                {
                        this.hostname = hostname;
                        this.port = port;
@@ -60,8 +57,6 @@ namespace TechBot.Library
                                this.password = null;
                        else
                                this.password = password;
                                this.password = null;
                        else
                                this.password = password;
-                       this.chmPath = chmPath;
-                       this.mainChm = mainChm;
                }
 
         public override void Run()
                }
 
         public override void Run()
index bb0bb55..ad20173 100644 (file)
-using System;\r
-using System.Collections;\r
-using System.Collections.Generic;\r
-using System.IO;\r
-using System.Data;\r
-using System.Threading;\r
-\r
-using TechBot.IRCLibrary;\r
-\r
-namespace TechBot.Library\r
-{\r
-       public abstract class TechBotService\r
-       {\r
-               protected IServiceOutput serviceOutput;\r
-               private string chmPath;\r
-               private string mainChm;\r
-               \r
-               public TechBotService(IServiceOutput serviceOutput,\r
-                                     string chmPath,\r
-                                     string mainChm)\r
-               {\r
-                       this.serviceOutput = serviceOutput;\r
-                       this.chmPath = chmPath;\r
-                       this.mainChm = mainChm;\r
-               }\r
-\r
-        public virtual void Run()\r
-        {\r
-            CommandFactory.LoadPlugins();\r
-        }\r
-\r
-        public IServiceOutput ServiceOutput\r
-        {\r
-            get { return serviceOutput; }\r
-        }\r
-\r
-        public CommandBuilderCollection Commands\r
-        {\r
-            get { return CommandFactory.Commands; }\r
-        }\r
-\r
-        public void InjectMessage(MessageContext context, string message)\r
-        {\r
-            ParseCommandMessage(context,\r
-                                message);\r
-        }\r
-               \r
-               private bool IsCommandMessage(string message)\r
-               {\r
-                       return message.StartsWith("!");\r
-               }\r
-\r
-               public void ParseCommandMessage(MessageContext context,\r
-                                               string message)\r
-               {\r
-                       if (!IsCommandMessage(message))\r
-                               return;\r
-\r
-                       message = message.Substring(1).Trim();\r
-                       int index = message.IndexOf(' ');\r
-                       string commandName;\r
-                       string commandParams = "";\r
-                       if (index != -1)\r
-                       {\r
-                               commandName = message.Substring(0, index).Trim();\r
-                               commandParams = message.Substring(index).Trim();\r
-                       }\r
-                       else\r
-                               commandName = message.Trim();\r
-\r
-            foreach (CommandBuilder command in Commands)\r
-            {\r
-                if (command.Name == commandName)\r
-                {\r
-                    //Create a new instance of the required command type\r
-                    Command cmd = command.CreateCommand();\r
-\r
-                    cmd.TechBot = this;\r
-                    cmd.Context = context;\r
-                    cmd.ParseParameters(message);\r
-                    cmd.ExecuteCommand();\r
-\r
-                    return;\r
-                }\r
-            }\r
-               }\r
-       }\r
-}\r
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Data;
+using System.Threading;
+
+using TechBot.IRCLibrary;
+
+namespace TechBot.Library
+{
+       public abstract class TechBotService
+       {
+               protected IServiceOutput m_ServiceOutput;
+               
+               public TechBotService(IServiceOutput serviceOutput)
+               {
+                       m_ServiceOutput = serviceOutput;
+               }
+
+        public virtual void Run()
+        {
+            CommandFactory.LoadPlugins();
+        }
+
+        public IServiceOutput ServiceOutput
+        {
+            get { return m_ServiceOutput; }
+        }
+
+        public CommandBuilderCollection Commands
+        {
+            get { return CommandFactory.Commands; }
+        }
+
+        public void InjectMessage(MessageContext context, string message)
+        {
+            ParseCommandMessage(context,
+                                message);
+        }
+               
+               private bool IsCommandMessage(string message)
+               {
+            return message.StartsWith(Settings.Default.CommandPrefix);
+               }
+
+        public void InjectMessage(string message)
+        {
+            ParseCommandMessage(null, message);
+        }
+
+               public void ParseCommandMessage(MessageContext context,
+                                               string message)
+               {
+                       if (!IsCommandMessage(message))
+                               return;
+
+                       message = message.Substring(1).Trim();
+                       int index = message.IndexOf(' ');
+                       string commandName;
+                       string commandParams = "";
+                       if (index != -1)
+                       {
+                               commandName = message.Substring(0, index).Trim();
+                               commandParams = message.Substring(index).Trim();
+                       }
+                       else
+                               commandName = message.Trim();
+
+            foreach (CommandBuilder command in Commands)
+            {
+                if (command.Name == commandName)
+                {
+                    //Create a new instance of the required command type
+                    Command cmd = command.CreateCommand();
+
+                    cmd.TechBot = this;
+                    cmd.Context = context;
+                    cmd.Parameters = commandParams;
+
+                    try
+                    {
+                        cmd.Initialize();
+                        cmd.ExecuteCommand();
+                        cmd.DeInitialize();
+                    }
+                    catch (Exception e)
+                    {
+                        ServiceOutput.WriteLine(context, string.Format("Uops! Just crashed with exception '{0}' at {1}",
+                            e.Message,
+                            e.Source));
+
+                        ServiceOutput.WriteLine(context, e.StackTrace);
+                    }
+
+                    return;
+                }
+            }
+               }
+       }
+}
index c2ac070..aaaf277 100644 (file)
@@ -22,6 +22,9 @@
             <setting name="SVNRoot" serializeAs="String">
                 <value>svn://svn.reactos.org/trunk/reactos</value>
             </setting>
             <setting name="SVNRoot" serializeAs="String">
                 <value>svn://svn.reactos.org/trunk/reactos</value>
             </setting>
+            <setting name="CommandPrefix" serializeAs="String">
+                <value>@</value>
+            </setting>
         </TechBot.Library.Settings>
     </applicationSettings>
 </configuration>
\ No newline at end of file
         </TechBot.Library.Settings>
     </applicationSettings>
 </configuration>
\ No newline at end of file
index 0b3a83f..77c5baa 100644 (file)
@@ -13,6 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TechBot.IRCLibrary", "TechB
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TechBot.Library", "TechBot.Library\TechBot.Library.csproj", "{1114F34D-F388-4F38-AE27-C0EE1B10B777}"
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TechBot.Library", "TechBot.Library\TechBot.Library.csproj", "{1114F34D-F388-4F38-AE27-C0EE1B10B777}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TechBot.Commands.Common", "TechBot.Commands.Common\TechBot.Commands.Common.csproj", "{041B5F06-BF97-4981-B024-3A7B6DD9F6AE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TechBot.Commands.MSDN", "TechBot.Commands.MSDN\TechBot.Commands.MSDN.csproj", "{ADBF1ED6-A586-4707-BD59-4CD53448D0FE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TechBot.Commands.RBuild", "TechBot.Commands.RBuild\TechBot.Commands.RBuild.csproj", "{D676FEDE-62DD-4B4D-94C6-308598E827F9}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -43,6 +49,18 @@ Global
                {1114F34D-F388-4F38-AE27-C0EE1B10B777}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {1114F34D-F388-4F38-AE27-C0EE1B10B777}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {1114F34D-F388-4F38-AE27-C0EE1B10B777}.Release|Any CPU.Build.0 = Release|Any CPU
                {1114F34D-F388-4F38-AE27-C0EE1B10B777}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {1114F34D-F388-4F38-AE27-C0EE1B10B777}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {1114F34D-F388-4F38-AE27-C0EE1B10B777}.Release|Any CPU.Build.0 = Release|Any CPU
+               {041B5F06-BF97-4981-B024-3A7B6DD9F6AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {041B5F06-BF97-4981-B024-3A7B6DD9F6AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {041B5F06-BF97-4981-B024-3A7B6DD9F6AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {041B5F06-BF97-4981-B024-3A7B6DD9F6AE}.Release|Any CPU.Build.0 = Release|Any CPU
+               {ADBF1ED6-A586-4707-BD59-4CD53448D0FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {ADBF1ED6-A586-4707-BD59-4CD53448D0FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {ADBF1ED6-A586-4707-BD59-4CD53448D0FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {ADBF1ED6-A586-4707-BD59-4CD53448D0FE}.Release|Any CPU.Build.0 = Release|Any CPU
+               {D676FEDE-62DD-4B4D-94C6-308598E827F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {D676FEDE-62DD-4B4D-94C6-308598E827F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {D676FEDE-62DD-4B4D-94C6-308598E827F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {D676FEDE-62DD-4B4D-94C6-308598E827F9}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 397d4b0..77d88dd 100644 (file)
@@ -1,20 +1,44 @@
-<?xml version="1.0" encoding="utf-8" ?>\r
-<configuration>\r
-       <appSettings>\r
-               <add key="IRCServerHostName" value="irc.eu.freenode.net" />\r
-               <add key="IRCServerHostPort" value="6667" />\r
-               <add key="IRCChannelNames" value="channel1;channel2" />\r
-               <add key="IRCBotName" value="MyBot" />\r
-               <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="C:\IRC\TechBot\ntstatus.xml" />\r
-               <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.xml" />\r
-               <add key="HresultXml" value="C:\IRC\TechBot\hresult.xml" />\r
-               <add key="WmXml" value="C:\IRC\TechBot\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
-       </appSettings>\r
-</configuration>\r
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+       <configSections>
+  <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+   <section name="TechBot.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+  </sectionGroup>
+ </configSections>
+ <appSettings>
+               <add key="IRCServerHostName" value="irc.eu.freenode.net" />
+               <add key="IRCServerHostPort" value="6667" />
+               <add key="IRCChannelNames" value="channel1;channel2" />
+               <add key="IRCBotName" value="MyBot" />
+               <add key="IRCBotPassword" value="MyPassword" />
+               <add key="ChmPath" value="C:\IRC\TechBot\CHM" />
+               <add key="MainChm" value="kmarch.chm" />
+               <add key="NtstatusXml" value="C:\IRC\TechBot\ntstatus.xml" />
+               <add key="WinerrorXml" value="C:\IRC\TechBot\winerror.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.org/trunk/reactos" />
+               <add key="BugUrl" value="http://www.reactos.org/bugzilla/show_bug.cgi?id={0}" />
+               <add key="WineBugUrl" value="http://bugs.winehq.org/show_bug.cgi?id={0}" />
+               <add key="SambaBugUrl" value="https://bugzilla.samba.org/show_bug.cgi?id={0}" />
+       </appSettings>
+ <userSettings>
+  <TechBot.Settings>
+   <setting name="IRCServerHostName" serializeAs="String">
+    <value>irc.eu.freenode.net</value>
+   </setting>
+   <setting name="IRCChannelNames" serializeAs="String">
+    <value>rbuildbottest</value>
+   </setting>
+   <setting name="IRCBotName" serializeAs="String">
+    <value>RBuildBot</value>
+   </setting>
+   <setting name="IRCBotPassword" serializeAs="String">
+    <value>qwerty</value>
+   </setting>
+   <setting name="IRCServerHostPort" serializeAs="String">
+    <value>6667</value>
+   </setting>
+  </TechBot.Settings>
+ </userSettings>
+</configuration>
index 0675bca..411d0f9 100644 (file)
@@ -1,84 +1,43 @@
-using System;\r
-using System.Configuration;\r
-using System.Diagnostics;\r
-using TechBot.Library;\r
-\r
-namespace TechBot\r
-{\r
-       public class ServiceThread\r
-       {\r
-               private string IRCServerHostName;\r
-               private int IRCServerHostPort;\r
-               private string IRCChannelNames;\r
-               private string IRCBotName;\r
-               private string IRCBotPassword;\r
-               private string ChmPath;\r
-               private string MainChm;\r
-               private string NtstatusXml;\r
-               private string HresultXml;\r
-               private string WmXml;\r
-               private string WinerrorXml;\r
-               private string SvnCommand;\r
-               private string BugUrl, WineBugUrl, SambaBugUrl;\r
-               private EventLog eventLog;\r
-               \r
-               public ServiceThread(EventLog eventLog)\r
-               {\r
-                       this.eventLog = eventLog;\r
-               }\r
-               \r
-               private void SetupConfiguration()\r
-               {\r
-                       IRCServerHostName = ConfigurationSettings.AppSettings["IRCServerHostName"];\r
-                       IRCServerHostPort = Int32.Parse(ConfigurationSettings.AppSettings["IRCServerHostPort"]);\r
-                       IRCChannelNames = ConfigurationSettings.AppSettings["IRCChannelNames"];\r
-                       IRCBotName = ConfigurationSettings.AppSettings["IRCBotName"];\r
-                       IRCBotPassword = ConfigurationSettings.AppSettings["IRCBotPassword"];\r
-                       ChmPath = ConfigurationSettings.AppSettings["ChmPath"];\r
-                       MainChm = ConfigurationSettings.AppSettings["MainChm"];\r
-                       NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"];\r
-                       HresultXml = ConfigurationSettings.AppSettings["HresultXml"];\r
-                       WmXml = ConfigurationSettings.AppSettings["WmXml"];\r
-                       WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"];\r
-                       SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"];\r
-                       BugUrl = ConfigurationSettings.AppSettings["BugUrl"];\r
-                       WineBugUrl = ConfigurationSettings.AppSettings["WineBugUrl"];\r
-                       SambaBugUrl = ConfigurationSettings.AppSettings["SambaBugUrl"];\r
-               }\r
-               \r
-               public void Run()\r
-               {\r
-                       SetupConfiguration();\r
-                       System.Console.WriteLine("TechBot irc service...");\r
-                       \r
-                       IrcTechBotService ircService = new IrcTechBotService(IRCServerHostName,\r
-                                                              IRCServerHostPort,\r
-                                                              IRCChannelNames,\r
-                                                              IRCBotName,\r
-                                                              IRCBotPassword,\r
-                                                              ChmPath,\r
-                                                              MainChm);\r
-                                                   //NtstatusXml,\r
-                                                   //WinerrorXml,\r
-                                                   //HresultXml,\r
-                                                   //WmXml,\r
-                                                              //SvnCommand,\r
-                                                   //BugUrl,\r
-                                                   //WineBugUrl,\r
-                                                   //SambaBugUrl);\r
-                       ircService.Run();\r
-               }\r
-               \r
-               public void Start()\r
-               {\r
-                       try\r
-                       {\r
-                               Run();\r
-                       }\r
-                       catch (Exception ex)\r
-                       {\r
-                               eventLog.WriteEntry(String.Format("Ex. {0}", ex));\r
-                       }\r
-               }\r
-       }\r
-}\r
+using System;
+using System.Configuration;
+using System.Diagnostics;
+using TechBot.Library;
+
+namespace TechBot
+{
+       public class ServiceThread
+       {
+               private EventLog m_EventLog;
+               
+               public ServiceThread(EventLog eventLog)
+               {
+                       m_EventLog = eventLog;
+               }
+
+        public void Run()
+        {
+            System.Console.WriteLine("TechBot irc service...");
+
+            IrcTechBotService ircService = new IrcTechBotService(
+                Settings.Default.IRCServerHostName,
+                Settings.Default.IRCServerHostPort,
+                Settings.Default.IRCChannelNames,
+                Settings.Default.IRCBotName,
+                Settings.Default.IRCBotPassword);
+
+            ircService.Run();
+        }
+               
+               public void Start()
+               {
+                       try
+                       {
+                               Run();
+                       }
+                       catch (Exception ex)
+                       {
+                               m_EventLog.WriteEntry(String.Format("Ex. {0}", ex));
+                       }
+               }
+       }
+}
diff --git a/irc/TechBot/TechBot/Settings.Designer.cs b/irc/TechBot/TechBot/Settings.Designer.cs
new file mode 100644 (file)
index 0000000..87ae598
--- /dev/null
@@ -0,0 +1,86 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.1433
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace TechBot {
+    
+    
+    [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.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("irc.eu.freenode.net")]
+        public string IRCServerHostName {
+            get {
+                return ((string)(this["IRCServerHostName"]));
+            }
+            set {
+                this["IRCServerHostName"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("rbuildbottest")]
+        public string IRCChannelNames {
+            get {
+                return ((string)(this["IRCChannelNames"]));
+            }
+            set {
+                this["IRCChannelNames"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("RBuildBot")]
+        public string IRCBotName {
+            get {
+                return ((string)(this["IRCBotName"]));
+            }
+            set {
+                this["IRCBotName"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("qwerty")]
+        public string IRCBotPassword {
+            get {
+                return ((string)(this["IRCBotPassword"]));
+            }
+            set {
+                this["IRCBotPassword"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("6667")]
+        public int IRCServerHostPort {
+            get {
+                return ((int)(this["IRCServerHostPort"]));
+            }
+            set {
+                this["IRCServerHostPort"] = value;
+            }
+        }
+    }
+}
diff --git a/irc/TechBot/TechBot/Settings.settings b/irc/TechBot/TechBot/Settings.settings
new file mode 100644 (file)
index 0000000..cd1160b
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TechBot" GeneratedClassName="Settings">
+  <Profiles />
+  <Settings>
+    <Setting Name="IRCServerHostName" Type="System.String" Scope="User">
+      <Value Profile="(Default)">irc.eu.freenode.net</Value>
+    </Setting>
+    <Setting Name="IRCChannelNames" Type="System.String" Scope="User">
+      <Value Profile="(Default)">rbuildbottest</Value>
+    </Setting>
+    <Setting Name="IRCBotName" Type="System.String" Scope="User">
+      <Value Profile="(Default)">RBuildBot</Value>
+    </Setting>
+    <Setting Name="IRCBotPassword" Type="System.String" Scope="User">
+      <Value Profile="(Default)">qwerty</Value>
+    </Setting>
+    <Setting Name="IRCServerHostPort" Type="System.Int32" Scope="User">
+      <Value Profile="(Default)">6667</Value>
+    </Setting>
+  </Settings>
+</SettingsFile>
\ No newline at end of file
index 85fc479..b5b4291 100644 (file)
   -->
   <ItemGroup>
     <None Include="App.config" />
   -->
   <ItemGroup>
     <None Include="App.config" />
+    <None Include="Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="AssemblyInfo.cs" />
       <SubType>Component</SubType>
     </Compile>
     <Compile Include="ServiceThread.cs" />
       <SubType>Component</SubType>
     </Compile>
     <Compile Include="ServiceThread.cs" />
+    <Compile Include="Settings.Designer.cs">
+      <DependentUpon>Settings.settings</DependentUpon>
+      <AutoGen>True</AutoGen>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
     <Compile Include="TechBotService.cs">
       <SubType>Component</SubType>
     </Compile>
     <Compile Include="TechBotService.cs">
       <SubType>Component</SubType>
     </Compile>