public static string ReadLine() { if ((stdin is CStreamReader) && ConsoleDriver.IsConsole) { return(ConsoleDriver.ReadLine()); } else { return(stdin.ReadLine()); } }
protected override bool TryGetResult(out bool result) { var input = ConsoleDriver.ReadLine(); if (string.IsNullOrEmpty(input)) { if (_defaultValue != null) { result = _defaultValue.Value; return(true); } Renderer.SetValidationResult(new ValidationResult("Value is required")); } else { var lowerInput = input.ToLower(); if (lowerInput == "y" || lowerInput == "yes") { result = true; return(true); } if (lowerInput == "n" || lowerInput == "no") { result = false; return(true); } Renderer.SetValidationResult(new ValidationResult("Value is invalid")); } result = default; return(false); }