public void Dispose()
        {
            CommandExchanger.SendData(_streamCmd, CommandExchanger.Commands.STOP);

            _streamIn.Dispose();
            _streamOut.Dispose();
            _streamCmd.Dispose();
            _pipeIn.Dispose();
            _pipeOut.Dispose();
            _pipeCmd.Dispose();

            _coreProcess.WaitForExit(EXIT_MAXWAIT);
        }
Esempio n. 2
0
        private static void CmdLoop()
        {
            Dictionary <string, Func <bool> > cmdActions = new Dictionary <string, Func <bool> >();

            cmdActions[CommandExchanger.Commands.STOP] = Stop;
            using (PipeStream receivePipe = new AnonymousPipeClientStream(PipeDirection.In, _pipeCmdStringHandler))
                using (StreamReader receiveStream = new StreamReader(receivePipe))
                {
                    while (!_shouldStop)
                    {
                        var cmd = CommandExchanger.ReadACommand(receiveStream);
                        cmdActions[cmd]();
                    }
                }
        }