Esempio n. 1
0
        private void MessageLoop()
        {
            var bytes = new byte[1024 * 64];

            while (true)
            {
                var len = _process.StandardOutput.BaseStream.Read(bytes, 0, bytes.Length);
                if (len <= 0)
                {
                    break;
                }

                var data = bytes.Length != len
                    ? bytes.Take(len).ToArray()
                    : bytes;

                DataReceived?.Invoke(this, data);
            }
            EofReceived?.Invoke(this, EventArgs.Empty);
            CloseReceived?.Invoke(this, (uint)_process.ExitCode);
        }
        internal void OnEof()
        {
            ClientMarkedEof = true;

            EofReceived?.Invoke(this, EventArgs.Empty);
        }