mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 20:56:04 +00:00
- 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
This commit is contained in:
parent
6d51a10a1b
commit
ac77d9d3a6
47 changed files with 1783 additions and 489 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue