public static string PrettifyAACSMediaIdentifier(AACSMediaIdentifier?AACSMIResponse) { if (AACSMIResponse == null) { return(null); } AACSMediaIdentifier response = AACSMIResponse.Value; StringBuilder sb = new StringBuilder(); #if DEBUG if (response.Reserved1 != 0) { sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); } if (response.Reserved2 != 0) { sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); } #endif sb.AppendFormat("AACS Media Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaIdentifier, 80)); return(sb.ToString()); }
public static AACSMediaIdentifier? DecodeAACSMediaIdentifier(byte[] AACSMIResponse) { if(AACSMIResponse == null) return null; var decoded = new AACSMediaIdentifier(); decoded.MediaIdentifier = new byte[AACSMIResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMIResponse, 0); decoded.Reserved1 = AACSMIResponse[2]; decoded.Reserved2 = AACSMIResponse[3]; Array.Copy(AACSMIResponse, 4, decoded.MediaIdentifier, 0, AACSMIResponse.Length - 4); return decoded; }