Exemplo n.º 1
0
        void InputReader_DoWork(object sender, DoWorkEventArgs e)
        {
            var builder = new StringBuilder();

            while (!_processExitCode.HasValue)
            {
                string value = char.ConvertFromUtf32(System.Console.Read());
                builder.Append(value);


                if (builder.ToString().EndsWith("\r\n"))
                {
                    // Clear the builder if an line is finished and safe the last line
                    _lastLineWrittenToConsole = builder.ToString();
                    builder.Clear();
                }

                _client.WriteToProcess(value); // WriteToStdInputOfProcess
            }
        }