All pastes #765190 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-07 21:32 UTC
rendered paste body
// SubCommand.cs created with MonoDevelop
// User: rik at 20:08 06/10/2007
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//

using System;
using Roboter.Common;

namespace Roboter.Plugins.Fun
{
	public class SubCommand : ICommand
	{
		public string Command
		{
			get { return "sub"; }
		}
		
		public string Name
		{
			get { return "Sub"; }
		}
		
		public bool Watcher
		{
			get { return true; }
		}
		
		public void Process(string line)
		{
			string dayString = Helper.GetParameters(line);
			DayOfWeek day;
			if (dayString.Trim().Length > 0)
				day = StringToDayOfWeek(dayString);
			else
				day = DateTime.Now.DayOfWeek;

			IrcClient.PrivateMessage(SubOfTheDay(day));
		}
		
		public DayOfWeek StringToDayOfWeek(string day)
		{
			day = day.Trim().ToLower();

			switch(day)
			{
				case "monday":
					return DayOfWeek.Monday;
				case "tuesday":
					return DayOfWeek.Tuesday;
				case "wednesday":
					return DayOfWeek.Wednesday;
				case "thursday":
					return DayOfWeek.Thursday;
				case "friday":
					return DayOfWeek.Friday;
				case "saturday":
					return DayOfWeek.Saturday;
				case "sunday":
					return DayOfWeek.Sunday;
				default:
					return DateTime.Now.DayOfWeek;
			}			
		}
		
		public string SubOfTheDay(DayOfWeek day)
		{
			switch(day)
			{
				case DayOfWeek.Monday:
					return "The Sub of the day is: Ham and Stuff - Price: £1.99 (6\")";
					break;
				case DayOfWeek.Tuesday:
					return "The Sub of the day is: Meatball Marinara - Price: £1.99 (6\")";
				case DayOfWeek.Wednesday:
					return "The Sub of the day is: More Ham and Stuff - Price: £1.99 (6\")";
				case DayOfWeek.Thursday:
					return "The Sub of the day is: Some Steaky Thing - Price: £1.99 (6\")";
				case DayOfWeek.Friday:
					return "The Sub of the day is: Looks like Chicken (I think) - Price: £1.99 (6\")";
				case DayOfWeek.Saturday:
					return "The Sub of the day is: Not Sure - Price: £1.99 (6\")";
				case DayOfWeek.Sunday:
					return "The Sub of the day is: Could be Chicken and Bacon - Price: £1.99 (6\")";
			}
			return string.Empty;
		}
		
		public void ProcessWatch(string line)
		{
			
		}
		
		public string GetHelp()
		{
			return string.Empty;
		}
	}
}