internal static TocCdtextDataBlock GetTocCdtextDataBlock(byte[] buffer, int offset) { byte packType = buffer[offset]; byte trackNumberAndExtension = buffer[offset + 1]; // 7 + 1 byte sequenceNumber = buffer[offset + 2]; byte positionAndBlockAndIsUnicode = buffer[offset + 3]; // 4 + 3 + 1 ushort crc = BitConverter.ToUInt16(buffer, offset + 16); byte[] data = new byte[12]; Array.Copy(buffer, offset + 4, data, 0, data.Length); TocCdtextDataBlock result = new TocCdtextDataBlock(); result.PackType = (TocCdtextDataBlockPackType)packType; result.TrackNumber = trackNumberAndExtension & 0x7F; result.IsExtension = (trackNumberAndExtension & 0x80) != 0; result.SequenceNumber = sequenceNumber; result.CharacterPosition = positionAndBlockAndIsUnicode & 0x0F; result.BlockNumber = (positionAndBlockAndIsUnicode >> 4) & 0x07; result.IsUnicode = (positionAndBlockAndIsUnicode & 0x80) != 0; result.Data = data; result.Crc = crc; return(result); }
internal static TocCdtextDataBlock GetTocCdtextDataBlock(byte[] buffer, int offset) { byte packType = buffer[offset]; byte trackNumberAndExtension = buffer[offset + 1]; // 7 + 1 byte sequenceNumber = buffer[offset + 2]; byte positionAndBlockAndIsUnicode = buffer[offset + 3]; // 4 + 3 + 1 ushort crc = BitConverter.ToUInt16(buffer, offset + 16); byte[] data = new byte[12]; Array.Copy(buffer, offset + 4, data, 0, data.Length); TocCdtextDataBlock result = new TocCdtextDataBlock(); result.PackType = (TocCdtextDataBlockPackType)packType; result.TrackNumber = trackNumberAndExtension & 0x7F; result.IsExtension = (trackNumberAndExtension & 0x80) != 0; result.SequenceNumber = sequenceNumber; result.CharacterPosition = positionAndBlockAndIsUnicode & 0x0F; result.BlockNumber = (positionAndBlockAndIsUnicode >> 4) & 0x07; result.IsUnicode = (positionAndBlockAndIsUnicode & 0x80) != 0; result.Data = data; result.Crc = crc; return result; }