public void Check() { int first = reader.ReadNumber("From: ", 1, pathController.blockStates.Length), last = reader.ReadNumber("To: ", first, pathController.blockStates.Length); int blockNumber = pathController.Check(first, last); if (blockNumber == 0) { writer.WriteLine("Path is opened."); } else { writer.WriteLine("Result: {0} block closed.", blockNumber); } }
public string Check(int first, int last) { Console.WriteLine("Check from {0} to {1}", first, last); Exception exception = checker.CheckNumberFormat(first.ToString(), 1, pathController.blockStates.Length); if (exception != null) { return(exception.Message); } exception = checker.CheckNumberFormat(last.ToString(), first, pathController.blockStates.Length); if (exception != null) { return(exception.Message); } int result = pathController.Check(first, last); if (result == 0) { return("Path is opened."); } return(String.Format("Block {0} is closed", result)); }