Ejemplo n.º 1
0
        internal static ExtendedTagHeaderV3 Create(int paddingSize, bool crcDataPresent, byte[] crc)
        {
            var extendedHeader = new ExtendedTagHeaderV3
                                     {
                                         PaddingSize = paddingSize,
                                         CrcDataPresent = crcDataPresent,
                                         Crc32 = crc
                                     };

            return extendedHeader;
        }
Ejemplo n.º 2
0
        internal static ExtendedTagHeaderV3 Create(byte[] content)
        {
            var flags = new byte[2];
            var paddingBytes = new byte[4];

            Array.Copy(content, 0, flags, 0, 2);
            Array.Copy(content, 2, paddingBytes, 0, 4);

            var extendedHeader = new ExtendedTagHeaderV3();
            extendedHeader.CrcDataPresent = (flags[0] & 0x80) == 0x80;
            extendedHeader.PaddingSize = Utils.CalculateExtendedHeaderPaddingSize(paddingBytes);

            if (extendedHeader.CrcDataPresent)
            {
                var crcBytes = new byte[4];
                Array.Copy(content, 6, crcBytes, 0, 4);
                extendedHeader.Crc32 = crcBytes;
            }

            return extendedHeader;
        }