Exemplo n.º 1
0
        private StandardIOKernelServer(
            IKernel kernel,
            InputTextStream input,
            OutputTextStream output)
        {
            _kernel = kernel ?? throw new ArgumentNullException(nameof(kernel));
            _input  = input ?? throw new ArgumentNullException(nameof(input));
            _output = output ?? throw new ArgumentNullException(nameof(output));

            _disposables = new CompositeDisposable
            {
                _input.Subscribe(async line =>
                {
                    await DeserializeAndSendCommand(line);
                }),

                _kernel.KernelEvents.Subscribe(e =>
                {
                    switch (e)
                    {
                    case KernelBusy _:
                    case KernelIdle _:
                        break;

                    default:
                        {
                            WriteEventToOutput(e);
                        }
                        break;
                    }
                })
            };
        }
Exemplo n.º 2
0
        private StandardIOKernelServer(
            IKernel kernel,
            InputTextStream input,
            OutputTextStream output)
        {
            _kernel = kernel ?? throw new ArgumentNullException(nameof(kernel));
            _input  = input ?? throw new ArgumentNullException(nameof(input));
            _output = output ?? throw new ArgumentNullException(nameof(output));

            _disposables = new CompositeDisposable
            {
                _kernel.KernelEvents.Subscribe(WriteEventToOutput)
            };
        }
Exemplo n.º 3
0
        private StandardIOKernelServer(
            Kernel kernel,
            InputTextStream input,
            OutputTextStream output)
        {
            _kernel = kernel ?? throw new ArgumentNullException(nameof(kernel));
            _input  = input ?? throw new ArgumentNullException(nameof(input));
            _output = output ?? throw new ArgumentNullException(nameof(output));

            _disposables = new CompositeDisposable
            {
                _input.Subscribe(async line =>
                {
                    await DeserializeAndSendCommand(line);
                }),
                _kernel.KernelEvents.Subscribe(WriteEventToOutput),
                _input
            };
        }