reactos/irc/TechBot/TechBot.Library/BugCommand.cs
Marc Piulachs 82b5e2eb8b * refactor the code to make it more OOP and extensible
* remove old outdated SD project files
* make it use some .NET 2.0 features as generic collections and settings 

svn path=/trunk/; revision=31130
2007-12-10 19:08:13 +00:00

51 lines
1.6 KiB
C#

using System;
namespace TechBot.Library
{
public abstract class BugCommand : Command//, ICommand
{
public BugCommand(TechBotService techBot) : base (techBot)
{
}
public override void Handle(MessageContext context,
string commandName,
string parameters)
{
string bugText = parameters;
if (bugText.Equals(String.Empty))
{
TechBot.ServiceOutput.WriteLine(context,
"Please provide a valid bug number.");
return;
}
NumberParser np = new NumberParser();
long bug = np.Parse(bugText);
if (np.Error)
{
TechBot.ServiceOutput.WriteLine(context,
String.Format("{0} is not a valid bug number.",
bugText));
return;
}
/*
string bugUrl = this.RosBugUrl;
if (context is ChannelMessageContext)
{
ChannelMessageContext channelContext = context as ChannelMessageContext;
if (channelContext.Channel.Name == "winehackers")
bugUrl = this.WineBugUrl;
else if (channelContext.Channel.Name == "samba-technical")
bugUrl = this.SambaBugUrl;
}*/
TechBot.ServiceOutput.WriteLine(context, String.Format(BugUrl, bug));
}
protected abstract string BugUrl { get; }
}
}