From ac77d9d3a6afb7faac0b2ea73a5483a06ef44794 Mon Sep 17 00:00:00 2001 From: Marc Piulachs Date: Sun, 18 May 2008 15:54:43 +0000 Subject: [PATCH] - Moved commands outside TechBot.Library to TechBot.Commands.Common and TechBot.Commands.MSDN except for Command base classes - Made TechBot more configurable through .config files - Code refactoring - Removed automatic parameter parsing support to make everyone happy svn path=/trunk/; revision=33586 --- .../Base/BugCommand.cs | 42 +++ .../TechBot.Commands.Common/HResultCommand.cs | 66 ++++ .../NtStatusCommand.cs | 66 ++++ .../Properties/AssemblyInfo.cs | 35 ++ .../TechBot.Commands.Common/ReactOSBugUrl.cs | 21 ++ .../TechBot.Commands.Common/SambaBugUrl.cs | 21 ++ .../Settings.Designer.cs | 71 ++++ .../TechBot.Commands.Common/Settings.cs | 28 ++ .../TechBot.Commands.Common/Settings.settings | 21 ++ .../TechBot.Commands.Common/SvnCommand.cs | 22 ++ .../TechBot.Commands.Common.csproj | 74 +++++ .../TechBot.Commands.Common/WMCommand.cs | 94 ++++++ .../TechBot.Commands.Common/WineBugUrl.cs | 21 ++ .../WinerrorCommand.cs | 66 ++++ .../TechBot.Commands.Common/app.config | 27 ++ .../TechBot.Commands.MSDN/ApiCommand.cs | 310 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 35 ++ .../Settings.Designer.cs | 50 +++ .../TechBot.Commands.MSDN/Settings.settings | 12 + .../TechBot.Commands.MSDN.csproj | 69 ++++ .../TechBot.Commands.MSDN.csproj.user | 5 + irc/TechBot/TechBot.Commands.MSDN/app.config | 18 + irc/TechBot/TechBot.Console/App.config | 42 ++- .../TechBot.Console/ConsoleTechBotService.cs | 10 +- irc/TechBot/TechBot.Console/Main.cs | 267 ++------------- .../TechBot.Console/Settings.Designer.cs | 86 +++++ irc/TechBot/TechBot.Console/Settings.settings | 21 ++ .../TechBot.Console/TechBot.Console.csproj | 19 +- .../TechBot.IRCLibrary.csproj | 3 + irc/TechBot/TechBot.IRCLibrary/app.config | 15 + .../Attributes/CommandParameterAttribute.cs | 7 + .../TechBot.Library/Commands/Base/Command.cs | 21 +- .../Commands/Base/XmlLookupCommand.cs | 9 +- .../TechBot.Library/Commands/HelpCommand.cs | 34 +- .../TechBot.Library/Factory/CommandFactory.cs | 8 + .../TechBot.Library/Settings.Designer.cs | 11 +- irc/TechBot/TechBot.Library/Settings.settings | 3 + .../TechBot.Library/TechBot.Library.csproj | 14 - .../TechBot.Library/TechBotIrcService.cs | 11 +- irc/TechBot/TechBot.Library/TechBotService.cs | 189 ++++++----- irc/TechBot/TechBot.Library/app.config | 3 + irc/TechBot/TechBot.sln | 18 + irc/TechBot/TechBot/App.config | 64 ++-- irc/TechBot/TechBot/ServiceThread.cs | 127 +++---- irc/TechBot/TechBot/Settings.Designer.cs | 86 +++++ irc/TechBot/TechBot/Settings.settings | 21 ++ irc/TechBot/TechBot/TechBot.csproj | 9 + 47 files changed, 1783 insertions(+), 489 deletions(-) create mode 100644 irc/TechBot/TechBot.Commands.Common/Base/BugCommand.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/HResultCommand.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/NtStatusCommand.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/Properties/AssemblyInfo.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/ReactOSBugUrl.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/SambaBugUrl.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/Settings.Designer.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/Settings.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/Settings.settings create mode 100644 irc/TechBot/TechBot.Commands.Common/SvnCommand.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/TechBot.Commands.Common.csproj create mode 100644 irc/TechBot/TechBot.Commands.Common/WMCommand.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/WineBugUrl.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/WinerrorCommand.cs create mode 100644 irc/TechBot/TechBot.Commands.Common/app.config create mode 100644 irc/TechBot/TechBot.Commands.MSDN/ApiCommand.cs create mode 100644 irc/TechBot/TechBot.Commands.MSDN/Properties/AssemblyInfo.cs create mode 100644 irc/TechBot/TechBot.Commands.MSDN/Settings.Designer.cs create mode 100644 irc/TechBot/TechBot.Commands.MSDN/Settings.settings create mode 100644 irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj create mode 100644 irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj.user create mode 100644 irc/TechBot/TechBot.Commands.MSDN/app.config create mode 100644 irc/TechBot/TechBot.Console/Settings.Designer.cs create mode 100644 irc/TechBot/TechBot.Console/Settings.settings create mode 100644 irc/TechBot/TechBot.IRCLibrary/app.config create mode 100644 irc/TechBot/TechBot/Settings.Designer.cs create mode 100644 irc/TechBot/TechBot/Settings.settings diff --git a/irc/TechBot/TechBot.Commands.Common/Base/BugCommand.cs b/irc/TechBot/TechBot.Commands.Common/Base/BugCommand.cs new file mode 100644 index 00000000000..32f419e6e6f --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/Base/BugCommand.cs @@ -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 index 00000000000..5d9f30d0adb --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/HResultCommand.cs @@ -0,0 +1,66 @@ +using System; +using System.Xml; + +using TechBot.Library; + +namespace TechBot.Commands.Common +{ + [Command("hresult", Help = "!hresult ")] + 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 index 00000000000..1c3b6686877 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/NtStatusCommand.cs @@ -0,0 +1,66 @@ +using System; +using System.Xml; + +using TechBot.Library; + +namespace TechBot.Commands.Common +{ + [Command("ntstatus", Help = "!ntstatus ")] + 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 index 00000000000..72c565a8582 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/Properties/AssemblyInfo.cs @@ -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 index 00000000000..3d94d6ba839 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/ReactOSBugUrl.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using TechBot.Library; + +namespace TechBot.Commands.Common +{ + [Command("rosbug", Help = "!rosbug ", 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 index 00000000000..6c3767720de --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/SambaBugUrl.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using TechBot.Library; + +namespace TechBot.Commands.Common +{ + [Command("sambabug", Help = "!sambabug ", 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 index 00000000000..bb247b4ccd5 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/Settings.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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 index 00000000000..45a94a87392 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/Settings.cs @@ -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 index 00000000000..1971c3a6757 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/Settings.settings @@ -0,0 +1,21 @@ + + + + + + C:\Ros\current\irc\TechBot\Resources\ntstatus.xml + + + C:\Ros\current\irc\TechBot\Resources\winerror.xml + + + C:\Ros\current\irc\TechBot\Resources\hresult.xml + + + C:\Ros\current\irc\TechBot\Resources\wm.xml + + + svn://svn.reactos.org/trunk/reactos + + + \ 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 index 00000000000..9604761132a --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/SvnCommand.cs @@ -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 index 00000000000..005c98114b7 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/TechBot.Commands.Common.csproj @@ -0,0 +1,74 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {041B5F06-BF97-4981-B024-3A7B6DD9F6AE} + Library + Properties + TechBot.Commands.Common + TechBot.Commands.Common + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Settings.settings + True + True + + + + + + + + + {1114F34D-F388-4F38-AE27-C0EE1B10B777} + TechBot.Library + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + \ 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 index 00000000000..4f2ec61e95a --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/WMCommand.cs @@ -0,0 +1,94 @@ +using System; +using System.Xml; + +using TechBot.Library; + +namespace TechBot.Commands.Common +{ + [Command("wm" , Help = "!wm or !wm ")] + 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 " 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 index 00000000000..e87a0c30b3e --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/WineBugUrl.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using TechBot.Library; + +namespace TechBot.Commands.Common +{ + [Command("winebug", Help = "!winebug " , 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 index 00000000000..d6736a3da26 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/WinerrorCommand.cs @@ -0,0 +1,66 @@ +using System; +using System.Xml; + +using TechBot.Library; + +namespace TechBot.Commands.Common +{ + [Command("winerror", Help = "!winerror ")] + 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 index 00000000000..b2c11aecdf3 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.Common/app.config @@ -0,0 +1,27 @@ + + + + +
+ + + + + + C:\Ros\current\irc\TechBot\Resources\ntstatus.xml + + + C:\Ros\current\irc\TechBot\Resources\winerror.xml + + + C:\Ros\current\irc\TechBot\Resources\hresult.xml + + + C:\Ros\current\irc\TechBot\Resources\wm.xml + + + svn://svn.reactos.org/trunk/reactos + + + + \ 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 index 00000000000..3a8e88ad06b --- /dev/null +++ b/irc/TechBot/TechBot.Commands.MSDN/ApiCommand.cs @@ -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 ")] + 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, + "
(.+)
", + 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(""); + 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 index 00000000000..44bdf804a8b --- /dev/null +++ b/irc/TechBot/TechBot.Commands.MSDN/Properties/AssemblyInfo.cs @@ -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 index 00000000000..634aeefe0c7 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.MSDN/Settings.Designer.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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 index 00000000000..d13c49f8e2a --- /dev/null +++ b/irc/TechBot/TechBot.Commands.MSDN/Settings.settings @@ -0,0 +1,12 @@ + + + + + + C:\IRC\TechBot\CHM + + + kmarch.chm + + + \ 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 index 00000000000..636ac87d58f --- /dev/null +++ b/irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj @@ -0,0 +1,69 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {ADBF1ED6-A586-4707-BD59-4CD53448D0FE} + Library + Properties + TechBot.Commands.MSDN + TechBot.Commands.MSDN + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + True + True + Settings.settings + + + + + {72E5CCA1-6318-4D62-964D-CB23A5C743B5} + CHMLibrary + + + {1114F34D-F388-4F38-AE27-C0EE1B10B777} + TechBot.Library + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + \ 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 index 00000000000..a1d742b1c46 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.MSDN/TechBot.Commands.MSDN.csproj.user @@ -0,0 +1,5 @@ + + + ProjectFiles + + \ 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 index 00000000000..83f087c3399 --- /dev/null +++ b/irc/TechBot/TechBot.Commands.MSDN/app.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + C:\IRC\TechBot\CHM + + + kmarch.chm + + + + \ No newline at end of file diff --git a/irc/TechBot/TechBot.Console/App.config b/irc/TechBot/TechBot.Console/App.config index f6678d802b3..dfa480f3d3c 100644 --- a/irc/TechBot/TechBot.Console/App.config +++ b/irc/TechBot/TechBot.Console/App.config @@ -1,15 +1,27 @@ - - - - - - - - - - - - - - - + + + + +
+ + + + + + irc.eu.freenode.net + + + rbuildbottest2 + + + RBuildBot2 + + + qwerty + + + 6667 + + + + \ No newline at end of file diff --git a/irc/TechBot/TechBot.Console/ConsoleTechBotService.cs b/irc/TechBot/TechBot.Console/ConsoleTechBotService.cs index 14c3c84533d..d3543131aa7 100644 --- a/irc/TechBot/TechBot.Console/ConsoleTechBotService.cs +++ b/irc/TechBot/TechBot.Console/ConsoleTechBotService.cs @@ -17,11 +17,10 @@ namespace TechBot.Console 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() @@ -31,8 +30,7 @@ namespace TechBot.Console while (true) { - string s = System.Console.ReadLine(); - InjectMessage(null, s); + InjectMessage(System.Console.ReadLine()); } } } diff --git a/irc/TechBot/TechBot.Console/Main.cs b/irc/TechBot/TechBot.Console/Main.cs index 88760ac51aa..eec2855e95b 100644 --- a/irc/TechBot/TechBot.Console/Main.cs +++ b/irc/TechBot/TechBot.Console/Main.cs @@ -1,240 +1,29 @@ -using System; -using System.Configuration; -using TechBot.Library; - -namespace TechBot.Console -{ - class MainClass - { - private static void VerifyRequiredOption(string optionName, - string optionValue) - { - if (optionValue == null) - { - throw new Exception(String.Format("Option '{0}' not set.", - optionName)); - } - } - - private static string IRCServerHostName - { - get - { - string optionName = "IRCServerHostName"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static int IRCServerHostPort - { - get - { - string optionName = "IRCServerHostPort"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return Int32.Parse(s); - } - } - - private static string IRCChannelNames - { - get - { - string optionName = "IRCChannelNames"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string IRCBotName - { - get - { - string optionName = "IRCBotName"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string IRCBotPassword - { - get - { - string optionName = "IRCBotPassword"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string ChmPath - { - get - { - string optionName = "ChmPath"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string MainChm - { - get - { - string optionName = "MainChm"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string NtstatusXml - { - get - { - string optionName = "NtstatusXml"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string WinerrorXml - { - get - { - string optionName = "WinerrorXml"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string HresultXml - { - get - { - string optionName = "HresultXml"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string WmXml - { - get - { - string optionName = "WmXml"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string SvnCommand - { - get - { - string optionName = "SvnCommand"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string BugUrl - { - get - { - string optionName = "BugUrl"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - private static string WineBugUrl - { - get - { - string optionName = "WineBugUrl"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - - private static string SambaBugUrl - { - get - { - string optionName = "SambaBugUrl"; - string s = ConfigurationSettings.AppSettings[optionName]; - VerifyRequiredOption(optionName, - s); - return s; - } - } - - - //private static void RunIrcService() - //{ - // IrcTechBotService ircService = new IrcTechBotService(IRCServerHostName, - // IRCServerHostPort, - // IRCChannelNames, - // IRCBotName, - // IRCBotPassword, - // ChmPath, - // MainChm); - // ircService.Run(); - //} - - public static void Main(string[] args) - { - TechBotService m_TechBot = null; - - if (args.Length > 0 && args[0].ToLower().Equals("irc")) - { - m_TechBot = new IrcTechBotService(IRCServerHostName, - IRCServerHostPort, - IRCChannelNames, - IRCBotName, - IRCBotPassword, - ChmPath, - MainChm); - } - else - { - System.Console.WriteLine("TechBot running console service..."); - m_TechBot = new ConsoleTechBotService( - ChmPath, - MainChm); - - - } - - m_TechBot.Run(); - } - } +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 diff --git a/irc/TechBot/TechBot.Console/Settings.Designer.cs b/irc/TechBot/TechBot.Console/Settings.Designer.cs new file mode 100644 index 00000000000..4f05450c12f --- /dev/null +++ b/irc/TechBot/TechBot.Console/Settings.Designer.cs @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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 index 00000000000..ba8340928b0 --- /dev/null +++ b/irc/TechBot/TechBot.Console/Settings.settings @@ -0,0 +1,21 @@ + + + + + + irc.eu.freenode.net + + + rbuildbottest2 + + + RBuildBot2 + + + qwerty + + + 6667 + + + \ No newline at end of file diff --git a/irc/TechBot/TechBot.Console/TechBot.Console.csproj b/irc/TechBot/TechBot.Console/TechBot.Console.csproj index 4c0b6f77141..a7be83244f4 100644 --- a/irc/TechBot/TechBot.Console/TechBot.Console.csproj +++ b/irc/TechBot/TechBot.Console/TechBot.Console.csproj @@ -40,11 +40,24 @@ + + True + True + Settings.settings + + + {041B5F06-BF97-4981-B024-3A7B6DD9F6AE} + TechBot.Commands.Common + + + {D676FEDE-62DD-4B4D-94C6-308598E827F9} + TechBot.Commands.RBuild + {D2A57931-DF04-4BC3-BD11-75DF4F3B0A88} TechBot.IRCLibrary @@ -55,7 +68,11 @@ - + + + SettingsSingleFileGenerator + Settings.Designer.cs + diff --git a/irc/TechBot/TechBot.IRCLibrary/TechBot.IRCLibrary.csproj b/irc/TechBot/TechBot.IRCLibrary/TechBot.IRCLibrary.csproj index 04f4676758a..02647ee5cde 100644 --- a/irc/TechBot/TechBot.IRCLibrary/TechBot.IRCLibrary.csproj +++ b/irc/TechBot/TechBot.IRCLibrary/TechBot.IRCLibrary.csproj @@ -50,6 +50,9 @@ + + + diff --git a/irc/TechBot/TechBot.IRCLibrary/app.config b/irc/TechBot/TechBot.IRCLibrary/app.config new file mode 100644 index 00000000000..5a7d239a864 --- /dev/null +++ b/irc/TechBot/TechBot.IRCLibrary/app.config @@ -0,0 +1,15 @@ + + + + +
+ + + + + + @ + + + + \ No newline at end of file diff --git a/irc/TechBot/TechBot.Library/Attributes/CommandParameterAttribute.cs b/irc/TechBot/TechBot.Library/Attributes/CommandParameterAttribute.cs index bdb3a8091b0..f996c73dc6c 100644 --- a/irc/TechBot/TechBot.Library/Attributes/CommandParameterAttribute.cs +++ b/irc/TechBot/TechBot.Library/Attributes/CommandParameterAttribute.cs @@ -13,6 +13,7 @@ namespace TechBot.Library private string m_name = ""; private string m_description = ""; private bool m_Required = true; + private bool m_Default = false; #endregion #region Public Properties @@ -26,6 +27,12 @@ namespace TechBot.Library public bool Required { get { return m_Required; } } + public bool DefaultParameter + { + get { return m_Default; } + set { m_Default = value; } + } + #endregion #region Constructors diff --git a/irc/TechBot/TechBot.Library/Commands/Base/Command.cs b/irc/TechBot/TechBot.Library/Commands/Base/Command.cs index 839475b73f7..25c5119b2c2 100644 --- a/irc/TechBot/TechBot.Library/Commands/Base/Command.cs +++ b/irc/TechBot/TechBot.Library/Commands/Base/Command.cs @@ -1,4 +1,5 @@ using System; +using System.Text.RegularExpressions; namespace TechBot.Library { @@ -6,6 +7,7 @@ namespace TechBot.Library { protected TechBotService m_TechBotService = null; protected MessageContext m_Context = null; + protected string m_Params = null; 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) @@ -47,5 +54,13 @@ namespace TechBot.Library } public abstract void ExecuteCommand(); + + public virtual void Initialize() + { + } + + public virtual void DeInitialize() + { + } } } diff --git a/irc/TechBot/TechBot.Library/Commands/Base/XmlLookupCommand.cs b/irc/TechBot/TechBot.Library/Commands/Base/XmlLookupCommand.cs index 547badb5adb..e3a6aa0843c 100644 --- a/irc/TechBot/TechBot.Library/Commands/Base/XmlLookupCommand.cs +++ b/irc/TechBot/TechBot.Library/Commands/Base/XmlLookupCommand.cs @@ -6,13 +6,12 @@ namespace TechBot.Library { 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; } } } } diff --git a/irc/TechBot/TechBot.Library/Commands/HelpCommand.cs b/irc/TechBot/TechBot.Library/Commands/HelpCommand.cs index f47ae18e912..ff68f81b35d 100644 --- a/irc/TechBot/TechBot.Library/Commands/HelpCommand.cs +++ b/irc/TechBot/TechBot.Library/Commands/HelpCommand.cs @@ -1,9 +1,10 @@ using System; +using System.Reflection; 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; @@ -15,8 +16,8 @@ namespace TechBot.Library [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() @@ -27,7 +28,8 @@ namespace TechBot.Library foreach (CommandBuilder command in TechBot.Commands) { - Say("!{0} - {1}", + Say("{0}{1} - {2}", + Settings.Default.CommandPrefix, command.Name, command.Description); } @@ -43,7 +45,29 @@ namespace TechBot.Library 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(); } } } diff --git a/irc/TechBot/TechBot.Library/Factory/CommandFactory.cs b/irc/TechBot/TechBot.Library/Factory/CommandFactory.cs index b140c182029..100bd2bdcf4 100644 --- a/irc/TechBot/TechBot.Library/Factory/CommandFactory.cs +++ b/irc/TechBot/TechBot.Library/Factory/CommandFactory.cs @@ -28,6 +28,8 @@ namespace TechBot.Library { Assembly assPlugin = Assembly.LoadFile(sFile); + Console.WriteLine("Loading plugins from : {0}", assPlugin.Location); + if (assPlugin != null) { foreach (Type pluginType in assPlugin.GetTypes()) @@ -36,6 +38,12 @@ namespace TechBot.Library { 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)); } diff --git a/irc/TechBot/TechBot.Library/Settings.Designer.cs b/irc/TechBot/TechBot.Library/Settings.Designer.cs index 4a88a841664..8387bfcfec5 100644 --- a/irc/TechBot/TechBot.Library/Settings.Designer.cs +++ b/irc/TechBot/TechBot.Library/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // 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. @@ -67,5 +67,14 @@ namespace TechBot.Library { return ((string)(this["SVNRoot"])); } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("@")] + public string CommandPrefix { + get { + return ((string)(this["CommandPrefix"])); + } + } } } diff --git a/irc/TechBot/TechBot.Library/Settings.settings b/irc/TechBot/TechBot.Library/Settings.settings index 65c52e18b81..25503d743cd 100644 --- a/irc/TechBot/TechBot.Library/Settings.settings +++ b/irc/TechBot/TechBot.Library/Settings.settings @@ -17,5 +17,8 @@ svn://svn.reactos.org/trunk/reactos + + @ + \ No newline at end of file diff --git a/irc/TechBot/TechBot.Library/TechBot.Library.csproj b/irc/TechBot/TechBot.Library/TechBot.Library.csproj index 9cd39a4a7ff..59505743bf2 100644 --- a/irc/TechBot/TechBot.Library/TechBot.Library.csproj +++ b/irc/TechBot/TechBot.Library/TechBot.Library.csproj @@ -48,19 +48,9 @@ - - - - - - - - - - @@ -78,10 +68,6 @@ - - {72E5CCA1-6318-4D62-964D-CB23A5C743B5} - CHMLibrary - {D2A57931-DF04-4BC3-BD11-75DF4F3B0A88} TechBot.IRCLibrary diff --git a/irc/TechBot/TechBot.Library/TechBotIrcService.cs b/irc/TechBot/TechBot.Library/TechBotIrcService.cs index 489a742dfda..238261cec5a 100644 --- a/irc/TechBot/TechBot.Library/TechBotIrcService.cs +++ b/irc/TechBot/TechBot.Library/TechBotIrcService.cs @@ -14,6 +14,7 @@ namespace TechBot.Library { if (context is ChannelMessageContext) { + Thread.Sleep (500); 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 chmPath; - private string mainChm; 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, - string password, - string chmPath, - string mainChm) - : base (new IrcServiceOutput() , chmPath , mainChm) + string password) + : base (new IrcServiceOutput()) { this.hostname = hostname; this.port = port; @@ -60,8 +57,6 @@ namespace TechBot.Library this.password = null; else this.password = password; - this.chmPath = chmPath; - this.mainChm = mainChm; } public override void Run() diff --git a/irc/TechBot/TechBot.Library/TechBotService.cs b/irc/TechBot/TechBot.Library/TechBotService.cs index bb0bb5563d8..ad201736ea4 100644 --- a/irc/TechBot/TechBot.Library/TechBotService.cs +++ b/irc/TechBot/TechBot.Library/TechBotService.cs @@ -1,88 +1,101 @@ -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 serviceOutput; - private string chmPath; - private string mainChm; - - public TechBotService(IServiceOutput serviceOutput, - string chmPath, - string mainChm) - { - this.serviceOutput = serviceOutput; - this.chmPath = chmPath; - this.mainChm = mainChm; - } - - public virtual void Run() - { - CommandFactory.LoadPlugins(); - } - - public IServiceOutput ServiceOutput - { - get { return 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("!"); - } - - 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.ParseParameters(message); - cmd.ExecuteCommand(); - - return; - } - } - } - } -} +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; + } + } + } + } +} diff --git a/irc/TechBot/TechBot.Library/app.config b/irc/TechBot/TechBot.Library/app.config index c2ac070e60e..aaaf277fac6 100644 --- a/irc/TechBot/TechBot.Library/app.config +++ b/irc/TechBot/TechBot.Library/app.config @@ -22,6 +22,9 @@ svn://svn.reactos.org/trunk/reactos + + @ + \ No newline at end of file diff --git a/irc/TechBot/TechBot.sln b/irc/TechBot/TechBot.sln index 0b3a83f21de..77c5baa4e47 100644 --- a/irc/TechBot/TechBot.sln +++ b/irc/TechBot/TechBot.sln @@ -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 +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 @@ -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 + {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 diff --git a/irc/TechBot/TechBot/App.config b/irc/TechBot/TechBot/App.config index 397d4b0773c..77d88dd389e 100644 --- a/irc/TechBot/TechBot/App.config +++ b/irc/TechBot/TechBot/App.config @@ -1,20 +1,44 @@ - - - - - - - - - - - - - - - - - - - - + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + irc.eu.freenode.net + + + rbuildbottest + + + RBuildBot + + + qwerty + + + 6667 + + + + diff --git a/irc/TechBot/TechBot/ServiceThread.cs b/irc/TechBot/TechBot/ServiceThread.cs index 0675bca22b6..411d0f94f98 100644 --- a/irc/TechBot/TechBot/ServiceThread.cs +++ b/irc/TechBot/TechBot/ServiceThread.cs @@ -1,84 +1,43 @@ -using System; -using System.Configuration; -using System.Diagnostics; -using TechBot.Library; - -namespace TechBot -{ - public class ServiceThread - { - private string IRCServerHostName; - private int IRCServerHostPort; - private string IRCChannelNames; - private string IRCBotName; - private string IRCBotPassword; - private string ChmPath; - private string MainChm; - private string NtstatusXml; - private string HresultXml; - private string WmXml; - private string WinerrorXml; - private string SvnCommand; - private string BugUrl, WineBugUrl, SambaBugUrl; - private EventLog eventLog; - - public ServiceThread(EventLog eventLog) - { - this.eventLog = eventLog; - } - - private void SetupConfiguration() - { - IRCServerHostName = ConfigurationSettings.AppSettings["IRCServerHostName"]; - IRCServerHostPort = Int32.Parse(ConfigurationSettings.AppSettings["IRCServerHostPort"]); - IRCChannelNames = ConfigurationSettings.AppSettings["IRCChannelNames"]; - IRCBotName = ConfigurationSettings.AppSettings["IRCBotName"]; - IRCBotPassword = ConfigurationSettings.AppSettings["IRCBotPassword"]; - ChmPath = ConfigurationSettings.AppSettings["ChmPath"]; - MainChm = ConfigurationSettings.AppSettings["MainChm"]; - NtstatusXml = ConfigurationSettings.AppSettings["NtstatusXml"]; - HresultXml = ConfigurationSettings.AppSettings["HresultXml"]; - WmXml = ConfigurationSettings.AppSettings["WmXml"]; - WinerrorXml = ConfigurationSettings.AppSettings["WinerrorXml"]; - SvnCommand = ConfigurationSettings.AppSettings["SvnCommand"]; - BugUrl = ConfigurationSettings.AppSettings["BugUrl"]; - WineBugUrl = ConfigurationSettings.AppSettings["WineBugUrl"]; - SambaBugUrl = ConfigurationSettings.AppSettings["SambaBugUrl"]; - } - - public void Run() - { - SetupConfiguration(); - System.Console.WriteLine("TechBot irc service..."); - - IrcTechBotService ircService = new IrcTechBotService(IRCServerHostName, - IRCServerHostPort, - IRCChannelNames, - IRCBotName, - IRCBotPassword, - ChmPath, - MainChm); - //NtstatusXml, - //WinerrorXml, - //HresultXml, - //WmXml, - //SvnCommand, - //BugUrl, - //WineBugUrl, - //SambaBugUrl); - ircService.Run(); - } - - public void Start() - { - try - { - Run(); - } - catch (Exception ex) - { - eventLog.WriteEntry(String.Format("Ex. {0}", ex)); - } - } - } -} +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 index 00000000000..87ae5985bc2 --- /dev/null +++ b/irc/TechBot/TechBot/Settings.Designer.cs @@ -0,0 +1,86 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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 index 00000000000..cd1160b7e7f --- /dev/null +++ b/irc/TechBot/TechBot/Settings.settings @@ -0,0 +1,21 @@ + + + + + + irc.eu.freenode.net + + + rbuildbottest + + + RBuildBot + + + qwerty + + + 6667 + + + \ No newline at end of file diff --git a/irc/TechBot/TechBot/TechBot.csproj b/irc/TechBot/TechBot/TechBot.csproj index 85fc4791e03..b5b42911efa 100644 --- a/irc/TechBot/TechBot/TechBot.csproj +++ b/irc/TechBot/TechBot/TechBot.csproj @@ -39,6 +39,10 @@ --> + + SettingsSingleFileGenerator + Settings.Designer.cs + @@ -46,6 +50,11 @@ Component + + Settings.settings + True + True + Component