Пример #1
0
        private void OnDataReceived(byte[] data, int offset, int length)
        {
            while (true)
            {
                int left;

                var commandInfo = CommandReader.GetCommandInfo(data, offset, length, out left);

                if (CommandReader.NextCommandReader != null)
                {
                    CommandReader = CommandReader.NextCommandReader;
                }

                if (commandInfo != null)
                {
                    ExecuteCommand(commandInfo);
                }

                if (left <= 0)
                {
                    break;
                }

                offset = offset + length - left;
                length = left;
            }
        }