Exemple #1
0
        /// <summary>
        /// Primary constructor.
        /// </summary>
        /// <param name="lineInput">Line input engine.</param>
        /// <param name="consoleInput">Interface for interacting with the input
        /// console; a default implementation is used if this parameter is null.
        /// </param>
        /// <param name="consoleOutput">Interface for interacting with the output
        /// console; a default implementation is used if this parameter is null.
        /// </param>
        /// <param name="keyBindingSet">The key bindings to use in the reader.
        /// Default bindings are used if this parameter is null.</param>
        public ConsoleReader(IConsoleLineInput lineInput = null, IConsoleInput consoleInput = null, IConsoleOutput consoleOutput = null, IReadOnlyConsoleKeyBindingSet keyBindingSet = null)
        {
            ConsoleInput  = consoleInput ?? BasicConsoleInputAndOutput.Default;
            ConsoleOutput = consoleOutput ?? BasicConsoleInputAndOutput.Default;
            KeyBindingSet = keyBindingSet ?? ConsoleKeyBindingSet.Default;
            LineInput     = lineInput ?? new ConsoleLineInput(ConsoleOutput, new ConsoleInputBuffer(), new ConsoleHistory(), null);

            _defaultCursorSize = ConsoleOutput.CursorSize;
        }
Exemple #2
0
        /// <summary>
        /// Primary constructor.
        /// </summary>
        /// <param name="lineInput">Line input engine.</param>
        /// <param name="consoleInput">Interface for interacting with the input
        /// console; a default implementation is used if this parameter is null.
        /// </param>
        /// <param name="consoleOutput">Interface for interacting with the output
        /// console; a default implementation is used if this parameter is null.
        /// </param>
        /// <param name="keyBindingSet">The key bindings to use in the reader.
        /// Default bindings are used if this parameter is null.</param>
        public ConsoleReader(IConsoleLineInput lineInput, IConsoleInput consoleInput = null, IConsoleOutput consoleOutput = null, IReadOnlyConsoleKeyBindingSet keyBindingSet = null)
        {
            if (lineInput == null)
            {
                throw new ArgumentNullException(nameof(lineInput));
            }

            LineInput = lineInput;
            ConsoleInput = consoleInput ?? BasicConsoleInputAndOutput.Default;
            ConsoleOutput = consoleOutput ?? BasicConsoleInputAndOutput.Default;
            KeyBindingSet = keyBindingSet ?? ConsoleKeyBindingSet.Default;

            _defaultCursorSize = ConsoleOutput.CursorSize;
        }