public static string PrettifyAACSVolumeIdentifier(AACSVolumeIdentifier?AACSVIResponse) { if (AACSVIResponse == null) { return(null); } AACSVolumeIdentifier response = AACSVIResponse.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 Volume Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VolumeIdentifier, 80)); return(sb.ToString()); }
public static AACSVolumeIdentifier? DecodeAACSVolumeIdentifier(byte[] AACSVIResponse) { if(AACSVIResponse == null) return null; var decoded = new AACSVolumeIdentifier(); decoded.VolumeIdentifier = new byte[AACSVIResponse.Length - 4]; decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSVIResponse, 0); decoded.Reserved1 = AACSVIResponse[2]; decoded.Reserved2 = AACSVIResponse[3]; Array.Copy(AACSVIResponse, 4, decoded.VolumeIdentifier, 0, AACSVIResponse.Length - 4); return decoded; }