/// <summary> /// Parses the binary body image. /// </summary> /// <param name="buffer">Binary image to parse.</param> /// <param name="startIndex">Start index into <paramref name="buffer"/> to begin parsing.</param> /// <param name="length">Length of valid data within <paramref name="buffer"/>.</param> /// <returns>The length of the data that was parsed.</returns> /// <remarks> /// The body image of the <see cref="ChannelFrameBase{T}"/> is parsed to create a collection of <see cref="Cells"/>. /// </remarks> protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) { IChannelFrameParsingState <T> state = State; T cell; int parsedLength, index = startIndex; // Parse all frame cells for (int x = 0; x < state.CellCount; x++) { cell = state.CreateNewCell(this, state, x, buffer, index, out parsedLength); m_cells.Add(cell); index += parsedLength; } return(index - startIndex); }