Exemplo n.º 1
0
        public void ProcessIncomingMessage(BinaryReader inputReader)
        {
            byte messageType = inputReader.ReadByte();

            switch (messageType)
            {
            case MessageTypes.Start:
                _messageHandler.OnStart();
                break;

            case MessageTypes.Stop:
                _messageHandler.OnStop();
                break;

            case MessageTypes.Pause:
                _messageHandler.OnPause();
                break;

            case MessageTypes.Unpause:
                _messageHandler.OnUnpause();
                break;

            case MessageTypes.Suspend:
                _messageHandler.OnSuspend();
                break;

            case MessageTypes.Unsuspend:
                _messageHandler.OnUnsuspend();
                break;

            case MessageTypes.Configuration:
                _configurationHandler.OnConfig(_configurationReader.ReadConfiguration(inputReader));
                break;

            case MessageTypes.Error:
                _messageHandler.OnError(inputReader.ReadUtfBigEndian());
                break;

            default:
                _errorHandler.HandleError("Unrecognized control message in ProcessIncomingMessage.", null);
                break;
            }
        }