private string TryFlippingLightswitch(string[] inputs) { string message = "Try including an object to interact with after the verb."; if (CommandProcessingService.ValidateNoun(inputs)) { string noun = inputs[1]; switch (noun) { case "light": case "lights": case "lightswitch": case "switch": message = ToggleLights(); break; default: message = "Try including the title of the object you wish \n" + "to interact with."; break; } } return(message); }
public static void BrowseLibrary() { IO.OutputNewLine(ShowBookTitles()); IO.OutputNewLine(); string[] actionsArray = IO.SplitAndSanitizeInput(IO.GetInput()); while (!actionsArray[0].Equals("leave")) { // Empty line buffer after getting input IO.OutputNewLine(); switch (actionsArray[0]) { case "read": if (CommandProcessingService.ValidateNoun(actionsArray)) { IO.OutputNewLine(ReadBook(actionsArray)); } else { IO.OutputNewLine("Try including a title after 'read'."); } break; default: IO.OutputNewLine("enter 'leave' to leave"); break; } // Empty line buffer before getting next input IO.OutputNewLine(); actionsArray = IO.SplitAndSanitizeInput(IO.GetInput()); } }