private void ParsePacketBlock(Int64 offset, Boolean swapValue, List <PcapNgInterface> sectionIfaceList, UInt32 index)
        {
            var interfaceId = this.GetPacketBlockInterfaceId(offset, swapValue);

            if (sectionIfaceList.Count() <= interfaceId || sectionIfaceList[interfaceId].InterfaceId != interfaceId)
            {
                throw new PcapNgParsingErrorException("No such an interface !");
            }

            var iface     = sectionIfaceList[interfaceId];
            var dropCount = this.GetPacketBlockDropsCount(offset, swapValue);

            var timeStamp   = (UInt64)this.GetPacketBlockTimestampH(offset, swapValue) << 32 | this.GetPacketBlockTimestampL(offset, swapValue);
            var capturedLen = this.GetPacketBlockCapturedLen(offset, swapValue);
            var packetLen   = this.GetPacketBlockPacketLen(offset, swapValue);

            var blockLen = this.GetGeneralBlockTotalLength(offset, swapValue);

            var packetTimeStamp = this.ConvertUint64ToTimeStamp(timeStamp, iface);
            //DateTime packetTimeStamp = DateTime.Now;

            var newFrame = new PmFramePcapNg(this.PmCapture, index, offset, ConvertPcapNgLayer2ToCommonLayer2((PcapNgLinkType)iface.LinkType), packetTimeStamp, packetLen,
                                             capturedLen, PmFramePcapNg.FrameBLockType.PacketBlock, iface);


            this.PmCapture.Frames.Add(newFrame);
        }
        private async Task ParseEnhancedPacketBlock(Int64 offset, Boolean swapValue, List <PcapNgInterface> sectionIfaceList, UInt32 index)
        {
            //PmConsolePrinter.PrintDebug("Enhanced Packet Block " + offset);
            var ifaceId = this.GetEhcPacketBlockInterfaceId(offset, swapValue);

            if (sectionIfaceList.Count() <= ifaceId || sectionIfaceList[(Int32)ifaceId].InterfaceId != ifaceId)
            {
                throw new PcapNgParsingErrorException("No such an interface !");
            }

            var iface = sectionIfaceList[(Int32)ifaceId];

            var timeStamp   = (UInt64)this.GetEhcPacketBlockTimestampH(offset, swapValue) << 32 | this.GetEhcPacketBlockTimestampL(offset, swapValue);
            var capturedLen = this.GetEhcPacketBlockCapturedLen(offset, swapValue);
            var packetLen   = this.GetEhcPacketBlockPacketLen(offset, swapValue);

            var blockLen = this.GetGeneralBlockTotalLength(offset, swapValue);

            var packetTimeStamp = this.ConvertUint64ToTimeStamp(timeStamp, iface);

            var newFrame = new PmFramePcapNg(this.PmCapture, index, offset, ConvertPcapNgLayer2ToCommonLayer2((PcapNgLinkType)iface.LinkType), packetTimeStamp, packetLen,
                                             capturedLen, PmFramePcapNg.FrameBLockType.EnhancedPacket, iface);

            var currentOffset  = offset + 28 + this.AdjustLength(capturedLen);
            var eofBlockOffset = offset + blockLen - 4;

            //bool eofFound = false;
            while (currentOffset < eofBlockOffset)
            {
                var optionCode   = this.GetOptionCode(currentOffset, swapValue);
                var optionLength = this.GetOptionLength(currentOffset, swapValue);

                var dataOffset = currentOffset + 4;

                switch ((EnhancedPacketBlockOptions)optionCode)
                {
                case EnhancedPacketBlockOptions.EpbFlags:
                    newFrame.EpbFlags = this.GetOptionBytes(dataOffset, 4);
                    break;

                case EnhancedPacketBlockOptions.EpbHash:
                    newFrame.EpbHash = this.GetOptionBytes(dataOffset, optionLength);
                    break;

                case EnhancedPacketBlockOptions.EpbDropcount:
                    newFrame.Dropcount = this.GetOptionUint64(dataOffset, swapValue);
                    break;
                }

                currentOffset += this.AdjustLength(optionLength) + 4;
            }

            await this.PmMetaFramesBufferBlock.SendAsync(newFrame);
        }
        private async Task ParseSimplyPacketBlock(Int64 offset, Boolean swapValue, List <PcapNgInterface> sectionIfaceList, UInt32 index)
        {
            //PmConsolePrinter.PrintDebug("Simply Packet Block " + offset);

            if (!sectionIfaceList.Any())
            {
                throw new PcapNgParsingErrorException("No interface for this packet !");
            }

            var packetLen = this.GetSimplyPacketBlockPacketLen(offset, swapValue);

            var packetTimeStamp = new DateTime(0, 0, 0, 0, 0, 0);

            var newFrame = new PmFramePcapNg(this.PmCapture, index, offset, ConvertPcapNgLayer2ToCommonLayer2((PcapNgLinkType)sectionIfaceList.First().LinkType), packetTimeStamp,
                                             packetLen, packetLen, PmFramePcapNg.FrameBLockType.SimplePacket, sectionIfaceList.First());

            await this.PmMetaFramesBufferBlock.SendAsync(newFrame);
        }