public void AddReportBlock(ReportBlock reportBlock) { if (reportBlocks == null) { reportBlocks = new List <ReportBlock>(); } reportBlock.WriteToBuffer(Buffer, Offset + ReportBlocksStartPosition + reportBlocks.Count * ReportBlock.SIZE); reportBlocks.Add(reportBlock); }
protected override void LoadFromBuffer(byte[] buffer, int offset) { Buffer = buffer; Offset = offset; int position = ReportBlocksStartPosition; if (PacketLength > position) { reportBlocks = new List <ReportBlock>(); while (PacketLength >= position + ReportBlock.SIZE) { var reportBlock = new ReportBlock(); reportBlock.ReadFromBuffer(buffer, position); reportBlocks.Add(reportBlock); position += ReportBlock.SIZE; } } }