public string ProcessCommand(Command command)
{
switch (command.Name)
{
case AddEventCommandName:
if (command.Arguments.Length < 2 || command.Arguments.Length > 3)
{
throw new ArgumentException(
"'AddEvent' command has invalid number of arguments! " +
"Only two or three arguments can be passed!");
}
return this.ProcessAddCommand(command);
case DeleteEventsCommandName:
if (command.Arguments.Length != 1)
{
throw new ArgumentException(
"'DeleteEvents' command has invalid number of arguments! " +
"Only one argument can be passed!");
}
return this.ProcessDeleteCommand(command);
case ListEventsCommandName:
if (command.Arguments.Length != 2)
{
throw new ArgumentException(
"'ListEvents' command has invalid number of arguments! " +
"Only two arguments can be passed!");
}
return this.ProcessListEventsCommand(command);
default:
throw new ArgumentException(
string.Format("Invalid input command: {0}!", command.Name),
"inputCommand");
}
}