/// <summary> /// Initializes a new instance of the <see cref="UIManager"/> class. /// </summary> /// <param name="renderer">The renderer which is going to be used by the UIManager.</param> /// <param name="inputReader">The input reader which UIManager is going to use.</param> public UIManager(IRenderer renderer, IUserInputReader inputReader) { this.Renderer = renderer; this.InputReader = inputReader; this.fieldDrawer = new MinefieldDrawer(renderer); }
public Game(IUserInputReader userInputReader, IMessageWriter messageWriter, MessageProvider messageProvider, GuessValidator guessValidator, GuessEvaluator guessEvaluator) { _userInputReader = userInputReader; _messageWriter = messageWriter; _messageProvider = messageProvider; _guessValidator = guessValidator; _guessEvaluator = guessEvaluator; }
/// <summary> /// Initializes a new instance of the <see cref="UIManager"/> class. /// </summary> /// <param name="renderer">The renderer which is going to be used by the UIManager.</param> /// <param name="inputReader">The input reader which UIManager is going to use.</param> public UIManager(IRenderer renderer, IUserInputReader inputReader) { this.Renderer = renderer; this.InputReader = inputReader; this.cmdLineRow = CmdLineRowDefault; this.minefieldTopLeft = new CellPos(3, 0); this.boardGenerator = new BoardDrawer(renderer); }
/// <summary> /// Initializes a new instance of the <see cref="UIManager"/> class. /// </summary> /// <param name="renderer">The renderer which is going to be used by the UIManager.</param> /// <param name="inputReader">The input reader which UIManager is going to use.</param> public UIManager(IRenderer renderer, IUserInputReader inputReader) { this.Renderer = renderer; this.InputReader = inputReader; this.cmdLineRow = CmdLineRowDefault; this.minefieldTopLeft = new CellPos(3, 0); this.boardGenerator = new BoardDrawer(renderer); }
public static int GetFieldCount(IUserInputReader reader) { int fieldCount = 0; while (true) { Console.WriteLine("How many fields should each record contain?"); if (reader.ReadInput(ref fieldCount)) { break; } } return(fieldCount); }
public static string GetFilePath(IUserInputReader reader, Func <string, bool> fileValidator) { string filepath = null; while (true) { Console.WriteLine("Please enter the location of the file"); if (reader.ReadInput(ref filepath) && fileValidator(filepath)) { break; } Console.WriteLine("That file does not exist"); } return(filepath); }
public static string GetExtension(IUserInputReader reader) { string extension = null; while (true) { Console.WriteLine("Is the file format CSV (comma-separated values) or TSV (tab-separated values)?"); if (reader.ReadInput(ref extension)) { extension = extension.ToLower(); if (FileParser.IsValidExtension(extension)) { break; } Console.WriteLine("Invalid type specified. (Valid values are 'csv' and 'tsv')"); } } return(extension); }