public static ModePage_0B?DecodeModePage_0B(byte[] pageResponse) { if ((pageResponse?[0] &0x40) == 0x40) { return(null); } if ((pageResponse?[0] &0x3F) != 0x0B) { return(null); } if (pageResponse[1] + 2 != pageResponse.Length) { return(null); } if (pageResponse.Length < 8) { return(null); } ModePage_0B decoded = new ModePage_0B(); decoded.PS |= (pageResponse[0] & 0x80) == 0x80; decoded.MediumType1 = (MediumTypes)pageResponse[4]; decoded.MediumType2 = (MediumTypes)pageResponse[5]; decoded.MediumType3 = (MediumTypes)pageResponse[6]; decoded.MediumType4 = (MediumTypes)pageResponse[7]; return(decoded); }
public static string PrettifyModePage_0B(ModePage_0B?modePage) { if (!modePage.HasValue) { return(null); } ModePage_0B page = modePage.Value; var sb = new StringBuilder(); sb.AppendLine("SCSI Medium types supported page:"); if (page.PS) { sb.AppendLine("\tParameters can be saved"); } if (page.MediumType1 != MediumTypes.Default) { sb.AppendFormat("Supported medium type one: {0}", GetMediumTypeDescription(page.MediumType1)). AppendLine(); } if (page.MediumType2 != MediumTypes.Default) { sb.AppendFormat("Supported medium type two: {0}", GetMediumTypeDescription(page.MediumType2)). AppendLine(); } if (page.MediumType3 != MediumTypes.Default) { sb.AppendFormat("Supported medium type three: {0}", GetMediumTypeDescription(page.MediumType3)). AppendLine(); } if (page.MediumType4 != MediumTypes.Default) { sb.AppendFormat("Supported medium type four: {0}", GetMediumTypeDescription(page.MediumType4)). AppendLine(); } return(sb.ToString()); }