internal void LoadData(byte[] scsiInquiryData, CommonTypes.Structs.Devices.SCSI.Inquiry?scsiInquiry, Dictionary <byte, byte[]> scsiEvpdPages, Modes.DecodedMode?scsiMode, PeripheralDeviceTypes scsiType, byte[] scsiModeSense6, byte[] scsiModeSense10, byte[] mmcConfiguration) { inquiryData = scsiInquiryData; inquiry = scsiInquiry; evpdPages = scsiEvpdPages; mode = scsiMode; type = scsiType; modeSense6 = scsiModeSense6; modeSense10 = scsiModeSense10; configuration = mmcConfiguration; if (inquiryData == null || !inquiry.HasValue) { return; } Visible = true; txtScsiInquiry.Text = Inquiry.Prettify(inquiry); if (mode.HasValue) { tabScsiModeSense.Visible = true; var modePagesList = new TreeGridItemCollection(); treeModeSensePages.Columns.Add(new GridColumn { HeaderText = "Page", DataCell = new TextBoxCell(0) }); treeModeSensePages.AllowMultipleSelection = false; treeModeSensePages.ShowHeader = false; treeModeSensePages.DataStore = modePagesList; modePagesList.Add(new TreeGridItem { Values = new object[] { "Header", Modes.PrettifyModeHeader(mode.Value.Header, type) } }); if (mode.Value.Pages != null) { foreach (var page in mode.Value.Pages.OrderBy(t => t.Page).ThenBy(t => t.Subpage)) { var pageNumberText = page.Subpage == 0 ? $"MODE {page.Page:X2}h" : $"MODE {page.Page:X2} Subpage {page.Subpage:X2}"; string decodedText; switch (page.Page) { case 0x00: { if (type == PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0) { decodedText = Modes.PrettifyModePage_00_SFF(page.PageResponse); } else { decodedText = "Undecoded"; } break; } case 0x01: { if (page.Subpage == 0) { decodedText = type == PeripheralDeviceTypes.MultiMediaDevice ? Modes.PrettifyModePage_01_MMC(page.PageResponse) : Modes.PrettifyModePage_01(page.PageResponse); } else { goto default; } break; } case 0x02: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_02(page.PageResponse); } else { goto default; } break; } case 0x03: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_03(page.PageResponse); } else { goto default; } break; } case 0x04: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_04(page.PageResponse); } else { goto default; } break; } case 0x05: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_05(page.PageResponse); } else { goto default; } break; } case 0x06: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_06(page.PageResponse); } else { goto default; } break; } case 0x07: { if (page.Subpage == 0) { decodedText = type == PeripheralDeviceTypes.MultiMediaDevice ? Modes.PrettifyModePage_07_MMC(page.PageResponse) : Modes.PrettifyModePage_07(page.PageResponse); } else { goto default; } break; } case 0x08: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_08(page.PageResponse); } else { goto default; } break; } case 0x0A: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_0A(page.PageResponse); } else if (page.Subpage == 1) { decodedText = Modes.PrettifyModePage_0A_S01(page.PageResponse); } else { goto default; } break; } case 0x0B: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_0B(page.PageResponse); } else { goto default; } break; } case 0x0D: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_0D(page.PageResponse); } else { goto default; } break; } case 0x0E: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_0E(page.PageResponse); } else { goto default; } break; } case 0x0F: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_0F(page.PageResponse); } else { goto default; } break; } case 0x10: { if (page.Subpage == 0) { decodedText = type == PeripheralDeviceTypes.SequentialAccess ? Modes.PrettifyModePage_10_SSC(page.PageResponse) : Modes.PrettifyModePage_10(page.PageResponse); } else { goto default; } break; } case 0x11: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_11(page.PageResponse); } else { goto default; } break; } case 0x12: case 0x13: case 0x14: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_12_13_14(page.PageResponse); } else { goto default; } break; } case 0x1A: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_1A(page.PageResponse); } else if (page.Subpage == 1) { decodedText = Modes.PrettifyModePage_1A_S01(page.PageResponse); } else { goto default; } break; } case 0x1B: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_1B(page.PageResponse); } else { goto default; } break; } case 0x1C: { if (page.Subpage == 0) { decodedText = type == PeripheralDeviceTypes.MultiMediaDevice ? Modes.PrettifyModePage_1C_SFF(page.PageResponse) : Modes.PrettifyModePage_1C(page.PageResponse); } else if (page.Subpage == 1) { decodedText = Modes.PrettifyModePage_1C_S01(page.PageResponse); } else { goto default; } break; } case 0x1D: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_1D(page.PageResponse); } else { goto default; } break; } case 0x21: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "CERTANCE") { decodedText = Modes.PrettifyCertanceModePage_21(page.PageResponse); } else { goto default; } break; } case 0x22: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "CERTANCE") { decodedText = Modes.PrettifyCertanceModePage_22(page.PageResponse); } else { goto default; } break; } case 0x24: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "IBM") { decodedText = Modes.PrettifyIBMModePage_24(page.PageResponse); } else { goto default; } break; } case 0x2A: { if (page.Subpage == 0) { decodedText = Modes.PrettifyModePage_2A(page.PageResponse); } else { goto default; } break; } case 0x2F: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "IBM") { decodedText = Modes.PrettifyIBMModePage_2F(page.PageResponse); } else { goto default; } break; } case 0x30: { if (Modes.IsAppleModePage_30(page.PageResponse)) { decodedText = "Drive identifies as Apple OEM drive"; } else { goto default; } break; } case 0x3B: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP") { decodedText = Modes.PrettifyHPModePage_3B(page.PageResponse); } else { goto default; } break; } case 0x3C: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP") { decodedText = Modes.PrettifyHPModePage_3C(page.PageResponse); } else { goto default; } break; } case 0x3D: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "IBM") { decodedText = Modes.PrettifyIBMModePage_3D(page.PageResponse); } else if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP") { decodedText = Modes.PrettifyHPModePage_3D(page.PageResponse); } else { goto default; } break; } case 0x3E: { if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "FUJITSU") { decodedText = Modes.PrettifyFujitsuModePage_3E(page.PageResponse); } else if (StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP") { decodedText = Modes.PrettifyHPModePage_3E(page.PageResponse); } else { goto default; } break; } default: { decodedText = "Undecoded"; break; } } // TODO: Automatic error reporting if (decodedText == null) { decodedText = "Error decoding page, please open an issue."; } modePagesList.Add(new TreeGridItem { Values = new object[] { pageNumberText, decodedText } }); } } } if (evpdPages != null) { tabScsiEvpd.Visible = true; treeEvpdPages.ShowHeader = false; var evpdPagesList = new TreeGridItemCollection(); treeEvpdPages.Columns.Add(new GridColumn { HeaderText = "Page", DataCell = new TextBoxCell(0) }); treeEvpdPages.AllowMultipleSelection = false; treeEvpdPages.ShowHeader = false; treeEvpdPages.DataStore = evpdPagesList; foreach (var page in evpdPages.OrderBy(t => t.Key)) { var evpdPageTitle = ""; var evpdDecodedPage = ""; if (page.Key >= 0x01 && page.Key <= 0x7F) { evpdPageTitle = $"ASCII Page {page.Key:X2}h"; evpdDecodedPage = EVPD.DecodeASCIIPage(page.Value); } else if (page.Key == 0x80) { evpdPageTitle = "Unit Serial Number"; evpdDecodedPage = EVPD.DecodePage80(page.Value); } else if (page.Key == 0x81) { evpdPageTitle = "SCSI Implemented operating definitions"; evpdDecodedPage = EVPD.PrettifyPage_81(page.Value); } else if (page.Key == 0x82) { evpdPageTitle = "ASCII implemented operating definitions"; evpdDecodedPage = EVPD.DecodePage82(page.Value); } else if (page.Key == 0x83) { evpdPageTitle = "SCSI Device identification"; evpdDecodedPage = EVPD.PrettifyPage_83(page.Value); } else if (page.Key == 0x84) { evpdPageTitle = "SCSI Software Interface Identifiers"; evpdDecodedPage = EVPD.PrettifyPage_84(page.Value); } else if (page.Key == 0x85) { evpdPageTitle = "SCSI Management Network Addresses"; evpdDecodedPage = EVPD.PrettifyPage_85(page.Value); } else if (page.Key == 0x86) { evpdPageTitle = "SCSI Extended INQUIRY Data"; evpdDecodedPage = EVPD.PrettifyPage_86(page.Value); } else if (page.Key == 0x89) { evpdPageTitle = "SCSI to ATA Translation Layer Data"; evpdDecodedPage = EVPD.PrettifyPage_89(page.Value); } else if (page.Key == 0xB0) { evpdPageTitle = "SCSI Sequential-access Device Capabilities"; evpdDecodedPage = EVPD.PrettifyPage_B0(page.Value); } else if (page.Key == 0xB1) { evpdPageTitle = "Manufacturer-assigned Serial Number"; evpdDecodedPage = EVPD.DecodePageB1(page.Value); } else if (page.Key == 0xB2) { evpdPageTitle = "TapeAlert Supported Flags Bitmap"; evpdDecodedPage = $"0x{EVPD.DecodePageB2(page.Value):X16}"; } else if (page.Key == 0xB3) { evpdPageTitle = "Automation Device Serial Number"; evpdDecodedPage = EVPD.DecodePageB3(page.Value); } else if (page.Key == 0xB4) { evpdPageTitle = "Data Transfer Device Element Address"; evpdDecodedPage = EVPD.DecodePageB4(page.Value); } else if (page.Key == 0xC0 && StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() == "quantum") { evpdPageTitle = "Quantum Firmware Build Information page"; evpdDecodedPage = EVPD.PrettifyPage_C0_Quantum(page.Value); } else if (page.Key == 0xC0 && StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() == "seagate") { evpdPageTitle = "Seagate Firmware Numbers page"; evpdDecodedPage = EVPD.PrettifyPage_C0_Seagate(page.Value); } else if (page.Key == 0xC0 && StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() == "ibm") { evpdPageTitle = "IBM Drive Component Revision Levels page"; evpdDecodedPage = EVPD.PrettifyPage_C0_IBM(page.Value); } else if (page.Key == 0xC1 && StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() == "ibm") { evpdPageTitle = "IBM Drive Serial Numbers page"; evpdDecodedPage = EVPD.PrettifyPage_C1_IBM(page.Value); } else if ((page.Key == 0xC0 || page.Key == 0xC1) && StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() == "certance") { evpdPageTitle = "Certance Drive Component Revision Levels page"; evpdDecodedPage = EVPD.PrettifyPage_C0_C1_Certance(page.Value); } else if ((page.Key == 0xC2 || page.Key == 0xC3 || page.Key == 0xC4 || page.Key == 0xC5 || page.Key == 0xC6) && StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() == "certance") { switch (page.Key) { case 0xC2: evpdPageTitle = "Head Assembly Serial Number"; break; case 0xC3: evpdPageTitle = "Reel Motor 1 Serial Number"; break; case 0xC4: evpdPageTitle = "Reel Motor 2 Serial Number"; break; case 0xC5: evpdPageTitle = "Board Serial Number"; break; case 0xC6: evpdPageTitle = "Base Mechanical Serial Number"; break; } evpdDecodedPage = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(page.Value); } else if ((page.Key == 0xC0 || page.Key == 0xC1 || page.Key == 0xC2 || page.Key == 0xC3 || page.Key == 0xC4 || page.Key == 0xC5) && StringHandlers .CToString(inquiry.Value.VendorIdentification) .ToLowerInvariant().Trim() == "hp") { switch (page.Key) { case 0xC0: evpdPageTitle = "HP Drive Firmware Revision Levels page:"; break; case 0xC1: evpdPageTitle = "HP Drive Hardware Revision Levels page:"; break; case 0xC2: evpdPageTitle = "HP Drive PCA Revision Levels page:"; break; case 0xC3: evpdPageTitle = "HP Drive Mechanism Revision Levels page:"; break; case 0xC4: evpdPageTitle = "HP Drive Head Assembly Revision Levels page:"; break; case 0xC5: evpdPageTitle = "HP Drive ACI Revision Levels page:"; break; } evpdDecodedPage = EVPD.PrettifyPage_C0_to_C5_HP(page.Value); } else if (page.Key == 0xDF && StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() == "certance") { evpdPageTitle = "Certance drive status page"; evpdDecodedPage = EVPD.PrettifyPage_DF_Certance(page.Value); } else { if (page.Key == 0x00) { continue; } evpdPageTitle = $"Page {page.Key:X2}h"; evpdDecodedPage = "Undecoded"; DicConsole.DebugWriteLine("Device-Info command", "Found undecoded SCSI VPD page 0x{0:X2}", page.Key); } evpdPagesList.Add(new TreeGridItem { Values = new object[] { evpdPageTitle, evpdDecodedPage, page.Value } }); } } if (configuration != null) { tabMmcFeatures.Visible = true; var featuresList = new TreeGridItemCollection(); treeMmcFeatures.Columns.Add(new GridColumn { HeaderText = "Feature", DataCell = new TextBoxCell(0) }); treeMmcFeatures.AllowMultipleSelection = false; treeMmcFeatures.ShowHeader = false; treeMmcFeatures.DataStore = featuresList; var ftr = Features.Separate(configuration); DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes", ftr.DataLength); DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile); if (ftr.Descriptors != null) { foreach (var desc in ftr.Descriptors) { var featureNumber = $"Feature {desc.Code:X4}h"; string featureDescription; DicConsole.DebugWriteLine("Device-Info command", "Feature {0:X4}h", desc.Code); switch (desc.Code) { case 0x0000: featureDescription = Features.Prettify_0000(desc.Data); break; case 0x0001: featureDescription = Features.Prettify_0001(desc.Data); break; case 0x0002: featureDescription = Features.Prettify_0002(desc.Data); break; case 0x0003: featureDescription = Features.Prettify_0003(desc.Data); break; case 0x0004: featureDescription = Features.Prettify_0004(desc.Data); break; case 0x0010: featureDescription = Features.Prettify_0010(desc.Data); break; case 0x001D: featureDescription = Features.Prettify_001D(desc.Data); break; case 0x001E: featureDescription = Features.Prettify_001E(desc.Data); break; case 0x001F: featureDescription = Features.Prettify_001F(desc.Data); break; case 0x0020: featureDescription = Features.Prettify_0020(desc.Data); break; case 0x0021: featureDescription = Features.Prettify_0021(desc.Data); break; case 0x0022: featureDescription = Features.Prettify_0022(desc.Data); break; case 0x0023: featureDescription = Features.Prettify_0023(desc.Data); break; case 0x0024: featureDescription = Features.Prettify_0024(desc.Data); break; case 0x0025: featureDescription = Features.Prettify_0025(desc.Data); break; case 0x0026: featureDescription = Features.Prettify_0026(desc.Data); break; case 0x0027: featureDescription = Features.Prettify_0027(desc.Data); break; case 0x0028: featureDescription = Features.Prettify_0028(desc.Data); break; case 0x0029: featureDescription = Features.Prettify_0029(desc.Data); break; case 0x002A: featureDescription = Features.Prettify_002A(desc.Data); break; case 0x002B: featureDescription = Features.Prettify_002B(desc.Data); break; case 0x002C: featureDescription = Features.Prettify_002C(desc.Data); break; case 0x002D: featureDescription = Features.Prettify_002D(desc.Data); break; case 0x002E: featureDescription = Features.Prettify_002E(desc.Data); break; case 0x002F: featureDescription = Features.Prettify_002F(desc.Data); break; case 0x0030: featureDescription = Features.Prettify_0030(desc.Data); break; case 0x0031: featureDescription = Features.Prettify_0031(desc.Data); break; case 0x0032: featureDescription = Features.Prettify_0032(desc.Data); break; case 0x0033: featureDescription = Features.Prettify_0033(desc.Data); break; case 0x0035: featureDescription = Features.Prettify_0035(desc.Data); break; case 0x0037: featureDescription = Features.Prettify_0037(desc.Data); break; case 0x0038: featureDescription = Features.Prettify_0038(desc.Data); break; case 0x003A: featureDescription = Features.Prettify_003A(desc.Data); break; case 0x003B: featureDescription = Features.Prettify_003B(desc.Data); break; case 0x0040: featureDescription = Features.Prettify_0040(desc.Data); break; case 0x0041: featureDescription = Features.Prettify_0041(desc.Data); break; case 0x0042: featureDescription = Features.Prettify_0042(desc.Data); break; case 0x0050: featureDescription = Features.Prettify_0050(desc.Data); break; case 0x0051: featureDescription = Features.Prettify_0051(desc.Data); break; case 0x0080: featureDescription = Features.Prettify_0080(desc.Data); break; case 0x0100: featureDescription = Features.Prettify_0100(desc.Data); break; case 0x0101: featureDescription = Features.Prettify_0101(desc.Data); break; case 0x0102: featureDescription = Features.Prettify_0102(desc.Data); break; case 0x0103: featureDescription = Features.Prettify_0103(desc.Data); break; case 0x0104: featureDescription = Features.Prettify_0104(desc.Data); break; case 0x0105: featureDescription = Features.Prettify_0105(desc.Data); break; case 0x0106: featureDescription = Features.Prettify_0106(desc.Data); break; case 0x0107: featureDescription = Features.Prettify_0107(desc.Data); break; case 0x0108: featureDescription = Features.Prettify_0108(desc.Data); break; case 0x0109: featureDescription = Features.Prettify_0109(desc.Data); break; case 0x010A: featureDescription = Features.Prettify_010A(desc.Data); break; case 0x010B: featureDescription = Features.Prettify_010B(desc.Data); break; case 0x010C: featureDescription = Features.Prettify_010C(desc.Data); break; case 0x010D: featureDescription = Features.Prettify_010D(desc.Data); break; case 0x010E: featureDescription = Features.Prettify_010E(desc.Data); break; case 0x0110: featureDescription = Features.Prettify_0110(desc.Data); break; case 0x0113: featureDescription = Features.Prettify_0113(desc.Data); break; case 0x0142: featureDescription = Features.Prettify_0142(desc.Data); break; default: featureDescription = "Unknown feature"; break; } featuresList.Add(new TreeGridItem { Values = new object[] { featureNumber, featureDescription } }); } } else { DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION returned no feature descriptors"); } } Invalidate(); }
public static void PrintImageInfo(IMediaImage imageFormat) { DicConsole.WriteLine("Image information:"); if (!string.IsNullOrWhiteSpace(imageFormat.Info.Version)) { DicConsole.WriteLine("Format: {0} version {1}", imageFormat.Format, imageFormat.Info.Version); } else { DicConsole.WriteLine("Format: {0}", imageFormat.Format); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.Application) && !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion)) { DicConsole.WriteLine("Was created with {0} version {1}", imageFormat.Info.Application, imageFormat.Info.ApplicationVersion); } else if (!string.IsNullOrWhiteSpace(imageFormat.Info.Application)) { DicConsole.WriteLine("Was created with {0}", imageFormat.Info.Application); } DicConsole.WriteLine("Image without headers is {0} bytes long", imageFormat.Info.ImageSize); DicConsole.WriteLine("Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes)", imageFormat.Info.Sectors, imageFormat.Info.SectorSize, imageFormat.Info.Sectors * imageFormat.Info.SectorSize); if (!string.IsNullOrWhiteSpace(imageFormat.Info.Creator)) { DicConsole.WriteLine("Created by: {0}", imageFormat.Info.Creator); } if (imageFormat.Info.CreationTime != DateTime.MinValue) { DicConsole.WriteLine("Created on {0}", imageFormat.Info.CreationTime); } if (imageFormat.Info.LastModificationTime != DateTime.MinValue) { DicConsole.WriteLine("Last modified on {0}", imageFormat.Info.LastModificationTime); } DicConsole.WriteLine("Contains a media of type {0} and XML type {1}", imageFormat.Info.MediaType, imageFormat.Info.XmlMediaType); DicConsole.WriteLine("{0} partitions", imageFormat.Info.HasPartitions ? "Has" : "Doesn't have"); DicConsole.WriteLine("{0} sessions", imageFormat.Info.HasSessions ? "Has" : "Doesn't have"); if (!string.IsNullOrWhiteSpace(imageFormat.Info.Comments)) { DicConsole.WriteLine("Comments: {0}", imageFormat.Info.Comments); } if (imageFormat.Info.MediaSequence != 0 && imageFormat.Info.LastMediaSequence != 0) { DicConsole.WriteLine("Media is number {0} on a set of {1} medias", imageFormat.Info.MediaSequence, imageFormat.Info.LastMediaSequence); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle)) { DicConsole.WriteLine("Media title: {0}", imageFormat.Info.MediaTitle); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer)) { DicConsole.WriteLine("Media manufacturer: {0}", imageFormat.Info.MediaManufacturer); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel)) { DicConsole.WriteLine("Media model: {0}", imageFormat.Info.MediaModel); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber)) { DicConsole.WriteLine("Media serial number: {0}", imageFormat.Info.MediaSerialNumber); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode)) { DicConsole.WriteLine("Media barcode: {0}", imageFormat.Info.MediaBarcode); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber)) { DicConsole.WriteLine("Media part number: {0}", imageFormat.Info.MediaPartNumber); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer)) { DicConsole.WriteLine("Drive manufacturer: {0}", imageFormat.Info.DriveManufacturer); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel)) { DicConsole.WriteLine("Drive model: {0}", imageFormat.Info.DriveModel); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber)) { DicConsole.WriteLine("Drive serial number: {0}", imageFormat.Info.DriveSerialNumber); } if (!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision)) { DicConsole.WriteLine("Drive firmware info: {0}", imageFormat.Info.DriveFirmwareRevision); } if (imageFormat.Info.Cylinders > 0 && imageFormat.Info.Heads > 0 && imageFormat.Info.SectorsPerTrack > 0 && imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc && (!(imageFormat is ITapeImage tapeImage) || !tapeImage.IsTape)) { DicConsole.WriteLine("Media geometry: {0} cylinders, {1} heads, {2} sectors per track", imageFormat.Info.Cylinders, imageFormat.Info.Heads, imageFormat.Info.SectorsPerTrack); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Count > 0) { DicConsole.WriteLine("Contains {0} readable media tags:", imageFormat.Info.ReadableMediaTags.Count); foreach (MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t)) { DicConsole.Write("{0} ", tag); } DicConsole.WriteLine(); } if (imageFormat.Info.ReadableSectorTags != null && imageFormat.Info.ReadableSectorTags.Count > 0) { DicConsole.WriteLine("Contains {0} readable sector tags:", imageFormat.Info.ReadableSectorTags.Count); foreach (SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t)) { DicConsole.Write("{0} ", tag); } DicConsole.WriteLine(); } DicConsole.WriteLine(); PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess; byte[] scsiVendorId = null; if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_INQUIRY)) { byte[] inquiry = imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); scsiDeviceType = (PeripheralDeviceTypes)(inquiry[0] & 0x1F); if (inquiry.Length >= 16) { scsiVendorId = new byte[8]; Array.Copy(inquiry, 8, scsiVendorId, 0, 8); } DicConsole.WriteLine("SCSI INQUIRY contained in image:"); DicConsole.Write("{0}", Inquiry.Prettify(inquiry)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) { byte[] identify = imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); DicConsole.WriteLine("ATA IDENTIFY contained in image:"); DicConsole.Write("{0}", Identify.Prettify(identify)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY)) { byte[] identify = imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); DicConsole.WriteLine("ATAPI IDENTIFY contained in image:"); DicConsole.Write("{0}", Identify.Prettify(identify)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10)) { byte[] modeSense10 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10); Modes.DecodedMode?decMode = Modes.DecodeMode10(modeSense10, scsiDeviceType); if (decMode.HasValue) { DicConsole.WriteLine("SCSI MODE SENSE (10) contained in image:"); PrintScsiModePages.Print(decMode.Value, scsiDeviceType, scsiVendorId); DicConsole.WriteLine(); } } else if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6)) { byte[] modeSense6 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6); Modes.DecodedMode?decMode = Modes.DecodeMode6(modeSense6, scsiDeviceType); if (decMode.HasValue) { DicConsole.WriteLine("SCSI MODE SENSE (6) contained in image:"); PrintScsiModePages.Print(decMode.Value, scsiDeviceType, scsiVendorId); DicConsole.WriteLine(); } } else if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODEPAGE_2A)) { byte[] mode2A = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODEPAGE_2A); DicConsole.Write("{0}", Modes.PrettifyModePage_2A(mode2A)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC)) { byte[] toc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC); if (toc.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(toc, 0)); if (dataLen + 2 != toc.Length) { byte[] tmp = new byte[toc.Length + 2]; Array.Copy(toc, 0, tmp, 2, toc.Length); tmp[0] = (byte)((toc.Length & 0xFF00) >> 8); tmp[1] = (byte)(toc.Length & 0xFF); toc = tmp; } DicConsole.WriteLine("CompactDisc Table of Contents contained in image:"); DicConsole.Write("{0}", FullTOC.Prettify(toc)); DicConsole.WriteLine(); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA)) { byte[] pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA); if (pma.Length > 0) { ushort dataLen = Swapping.Swap(BitConverter.ToUInt16(pma, 0)); if (dataLen + 2 != pma.Length) { byte[] tmp = new byte[pma.Length + 2]; Array.Copy(pma, 0, tmp, 2, pma.Length); tmp[0] = (byte)((pma.Length & 0xFF00) >> 8); tmp[1] = (byte)(pma.Length & 0xFF); pma = tmp; } DicConsole.WriteLine("CompactDisc Power Management Area contained in image:"); DicConsole.Write("{0}", PMA.Prettify(pma)); DicConsole.WriteLine(); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP)) { byte[] atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(atip, 0)); if (dataLen + 4 != atip.Length) { byte[] tmp = new byte[atip.Length + 4]; Array.Copy(atip, 0, tmp, 4, atip.Length); tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24); tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16); tmp[2] = (byte)((atip.Length & 0xFF00) >> 8); tmp[3] = (byte)(atip.Length & 0xFF); atip = tmp; } DicConsole.WriteLine("CompactDisc Absolute Time In Pregroove (ATIP) contained in image:"); DicConsole.Write("{0}", ATIP.Prettify(atip)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT)) { byte[] cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT); uint dataLen = Swapping.Swap(BitConverter.ToUInt32(cdtext, 0)); if (dataLen + 4 != cdtext.Length) { byte[] tmp = new byte[cdtext.Length + 4]; Array.Copy(cdtext, 0, tmp, 4, cdtext.Length); tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24); tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16); tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8); tmp[3] = (byte)(cdtext.Length & 0xFF); cdtext = tmp; } DicConsole.WriteLine("CompactDisc Lead-in's CD-Text contained in image:"); DicConsole.Write("{0}", CDTextOnLeadIn.Prettify(cdtext)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN)) { byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN); DicConsole.WriteLine("CompactDisc Media Catalogue Number contained in image: {0}", Encoding.UTF8.GetString(mcn)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_PFI)) { byte[] pfi = imageFormat.ReadDiskTag(MediaTagType.DVD_PFI); DicConsole.WriteLine("DVD Physical Format Information contained in image:"); DicConsole.Write("{0}", PFI.Prettify(pfi)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_DDS)) { byte[] dds = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_DDS); DicConsole.WriteLine("DVD-RAM Disc Definition Structure contained in image:"); DicConsole.Write("{0}", DDS.Prettify(dds)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PFI)) { byte[] pfi = imageFormat.ReadDiskTag(MediaTagType.DVDR_PFI); DicConsole.WriteLine("DVD-R Physical Format Information contained in image:"); DicConsole.Write("{0}", PFI.Prettify(pfi)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DI)) { byte[] di = imageFormat.ReadDiskTag(MediaTagType.BD_DI); DicConsole.WriteLine("Bluray Disc Information contained in image:"); DicConsole.Write("{0}", DI.Prettify(di)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DDS)) { byte[] dds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS); DicConsole.WriteLine("Bluray Disc Definition Structure contained in image:"); DicConsole.Write("{0}", Decoders.Bluray.DDS.Prettify(dds)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) { byte[] cis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS); DicConsole.WriteLine("PCMCIA CIS:"); Tuple[] tuples = CIS.GetTuples(cis); if (tuples != null) { foreach (Tuple tuple in tuples) { switch (tuple.Code) { case TupleCodes.CISTPL_NULL: case TupleCodes.CISTPL_END: break; case TupleCodes.CISTPL_DEVICEGEO: case TupleCodes.CISTPL_DEVICEGEO_A: DicConsole.WriteLine("{0}", CIS.PrettifyDeviceGeometryTuple(tuple)); break; case TupleCodes.CISTPL_MANFID: DicConsole.WriteLine("{0}", CIS.PrettifyManufacturerIdentificationTuple(tuple)); break; case TupleCodes.CISTPL_VERS_1: DicConsole.WriteLine("{0}", CIS.PrettifyLevel1VersionTuple(tuple)); break; case TupleCodes.CISTPL_ALTSTR: case TupleCodes.CISTPL_BAR: case TupleCodes.CISTPL_BATTERY: case TupleCodes.CISTPL_BYTEORDER: case TupleCodes.CISTPL_CFTABLE_ENTRY: case TupleCodes.CISTPL_CFTABLE_ENTRY_CB: case TupleCodes.CISTPL_CHECKSUM: case TupleCodes.CISTPL_CONFIG: case TupleCodes.CISTPL_CONFIG_CB: case TupleCodes.CISTPL_DATE: case TupleCodes.CISTPL_DEVICE: case TupleCodes.CISTPL_DEVICE_A: case TupleCodes.CISTPL_DEVICE_OA: case TupleCodes.CISTPL_DEVICE_OC: case TupleCodes.CISTPL_EXTDEVIC: case TupleCodes.CISTPL_FORMAT: case TupleCodes.CISTPL_FORMAT_A: case TupleCodes.CISTPL_FUNCE: case TupleCodes.CISTPL_FUNCID: case TupleCodes.CISTPL_GEOMETRY: case TupleCodes.CISTPL_INDIRECT: case TupleCodes.CISTPL_JEDEC_A: case TupleCodes.CISTPL_JEDEC_C: case TupleCodes.CISTPL_LINKTARGET: case TupleCodes.CISTPL_LONGLINK_A: case TupleCodes.CISTPL_LONGLINK_C: case TupleCodes.CISTPL_LONGLINK_CB: case TupleCodes.CISTPL_LONGLINK_MFC: case TupleCodes.CISTPL_NO_LINK: case TupleCodes.CISTPL_ORG: case TupleCodes.CISTPL_PWR_MGMNT: case TupleCodes.CISTPL_SPCL: case TupleCodes.CISTPL_SWIL: case TupleCodes.CISTPL_VERS_2: DicConsole.DebugWriteLine("Device-Info command", "Found undecoded tuple ID {0}", tuple.Code); break; default: DicConsole.DebugWriteLine("Device-Info command", "Found unknown tuple ID 0x{0:X2}", (byte)tuple.Code); break; } } } else { DicConsole.DebugWriteLine("Device-Info command", "Could not get tuples"); } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CID)) { byte[] cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID); DicConsole.WriteLine("SecureDigital CID contained in image:"); DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(cid)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CSD)) { byte[] csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD); DicConsole.WriteLine("SecureDigital CSD contained in image:"); DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(csd)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_SCR)) { byte[] scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR); DicConsole.WriteLine("SecureDigital SCR contained in image:"); DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(scr)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_OCR)) { byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR); DicConsole.WriteLine("SecureDigital OCR contained in image:"); DicConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(ocr)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CID)) { byte[] cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID); DicConsole.WriteLine("MultiMediaCard CID contained in image:"); DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyCID(cid)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CSD)) { byte[] csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD); DicConsole.WriteLine("MultiMediaCard CSD contained in image:"); DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyCSD(csd)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_ExtendedCSD)) { byte[] ecsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD); DicConsole.WriteLine("MultiMediaCard ExtendedCSD contained in image:"); DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(ecsd)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_OCR)) { byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR); DicConsole.WriteLine("MultiMediaCard OCR contained in image:"); DicConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyOCR(ocr)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_PFI)) { byte[] xpfi = imageFormat.ReadDiskTag(MediaTagType.Xbox_PFI); DicConsole.WriteLine("Xbox Physical Format Information contained in image:"); DicConsole.Write("{0}", PFI.Prettify(xpfi)); DicConsole.WriteLine(); } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_DMI)) { byte[] xdmi = imageFormat.ReadDiskTag(MediaTagType.Xbox_DMI); if (DMI.IsXbox(xdmi)) { DMI.XboxDMI?xmi = DMI.DecodeXbox(xdmi); if (xmi.HasValue) { DicConsole.WriteLine("Xbox DMI contained in image:"); DicConsole.Write("{0}", DMI.PrettifyXbox(xmi)); DicConsole.WriteLine(); } } if (DMI.IsXbox360(xdmi)) { DMI.Xbox360DMI?xmi = DMI.DecodeXbox360(xdmi); if (xmi.HasValue) { DicConsole.WriteLine("Xbox 360 DMI contained in image:"); DicConsole.Write("{0}", DMI.PrettifyXbox360(xmi)); DicConsole.WriteLine(); } } } if (imageFormat.Info.ReadableMediaTags != null && imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_SecuritySector)) { byte[] toc = imageFormat.ReadDiskTag(MediaTagType.Xbox_SecuritySector); DicConsole.WriteLine("Xbox Security Sectors contained in image:"); DicConsole.Write("{0}", SS.Prettify(toc)); DicConsole.WriteLine(); } if (imageFormat is IOpticalMediaImage opticalImage) { try { if (opticalImage.Sessions != null && opticalImage.Sessions.Count > 0) { DicConsole.WriteLine("Image sessions:"); DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", "Session", "First track", "Last track", "Start", "End"); DicConsole.WriteLine("========================================================="); foreach (Session session in opticalImage.Sessions) { DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", session.SessionSequence, session.StartTrack, session.EndTrack, session.StartSector, session.EndSector); } DicConsole.WriteLine(); } } catch { // ignored } try { if (opticalImage.Tracks != null && opticalImage.Tracks.Count > 0) { DicConsole.WriteLine("Image tracks:"); DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", "Track", "Type", "Bps", "Raw bps", "Subchannel", "Pregap", "Start", "End"); DicConsole. WriteLine("================================================================================="); foreach (Track track in opticalImage.Tracks) { DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", track.TrackSequence, track.TrackType, track.TrackBytesPerSector, track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap, track.TrackStartSector, track.TrackEndSector); } DicConsole.WriteLine(); } } catch { // ignored } } if (imageFormat.DumpHardware == null) { return; } const string MANUFACTURER_STRING = "Manufacturer"; const string MODEL_STRING = "Model"; const string SERIAL_STRING = "Serial"; const string SOFTWARE_STRING = "Software"; const string VERSION_STRING = "Version"; const string OS_STRING = "Operating system"; const string START_STRING = "Start"; const string END_STRING = "End"; int manufacturerLen = MANUFACTURER_STRING.Length; int modelLen = MODEL_STRING.Length; int serialLen = SERIAL_STRING.Length; int softwareLen = SOFTWARE_STRING.Length; int versionLen = VERSION_STRING.Length; int osLen = OS_STRING.Length; int sectorLen = START_STRING.Length; foreach (DumpHardwareType dump in imageFormat.DumpHardware) { if (dump.Manufacturer?.Length > manufacturerLen) { manufacturerLen = dump.Manufacturer.Length; } if (dump.Model?.Length > modelLen) { modelLen = dump.Model.Length; } if (dump.Serial?.Length > serialLen) { serialLen = dump.Serial.Length; } if (dump.Software?.Name?.Length > softwareLen) { softwareLen = dump.Software.Name.Length; } if (dump.Software?.Version?.Length > versionLen) { versionLen = dump.Software.Version.Length; } if (dump.Software?.OperatingSystem?.Length > osLen) { osLen = dump.Software.OperatingSystem.Length; } foreach (ExtentType extent in dump.Extents) { if ($"{extent.Start}".Length > sectorLen) { sectorLen = $"{extent.Start}".Length; } if ($"{extent.End}".Length > sectorLen) { sectorLen = $"{extent.End}".Length; } } } manufacturerLen += 2; modelLen += 2; serialLen += 2; softwareLen += 2; versionLen += 2; osLen += 2; sectorLen += 2; sectorLen += 2; char[] separator = new char[manufacturerLen + modelLen + serialLen + softwareLen + versionLen + osLen + sectorLen + sectorLen]; for (int i = 0; i < separator.Length; i++) { separator[i] = '='; } string format = $"{{0,-{manufacturerLen}}}{{1,-{modelLen}}}{{2,-{serialLen}}}{{3,-{softwareLen}}}{{4,-{versionLen}}}{{5,-{osLen}}}{{6,-{sectorLen}}}{{7,-{sectorLen}}}"; DicConsole.WriteLine("Dump hardware information:"); DicConsole.WriteLine(format, MANUFACTURER_STRING, MODEL_STRING, SERIAL_STRING, SOFTWARE_STRING, VERSION_STRING, OS_STRING, START_STRING, END_STRING); DicConsole.WriteLine(new string(separator)); foreach (DumpHardwareType dump in imageFormat.DumpHardware) { foreach (ExtentType extent in dump.Extents) { DicConsole.WriteLine(format, dump.Manufacturer, dump.Model, dump.Serial, dump.Software.Name, dump.Software.Version, dump.Software.OperatingSystem, extent.Start, extent.End); } } DicConsole.WriteLine(); }
// TODO: More graphically aware decoders void OnCmbTagSelectedIndexChanged(object sender, EventArgs e) { if (!(cmbTag.SelectedValue is MediaTagWithData tagWithData)) { return; } // TODO: Decoders should be able to handle tags with/without length header txtPrintHex.Text = PrintHex.ByteArrayToHexArrayString(tagWithData.Data, HEX_COLUMNS); tabDecoded.Visible = true; switch (tagWithData.Tag) { case MediaTagType.CD_TOC: txtDecoded.Text = TOC.Prettify(tagWithData.Data); break; case MediaTagType.CD_SessionInfo: txtDecoded.Text = Session.Prettify(tagWithData.Data); break; case MediaTagType.CD_FullTOC: txtDecoded.Text = FullTOC.Prettify(tagWithData.Data); break; case MediaTagType.CD_PMA: txtDecoded.Text = PMA.Prettify(tagWithData.Data); break; case MediaTagType.CD_ATIP: txtDecoded.Text = ATIP.Prettify(tagWithData.Data); break; case MediaTagType.CD_TEXT: txtDecoded.Text = CDTextOnLeadIn.Prettify(tagWithData.Data); break; case MediaTagType.CD_MCN: txtDecoded.Text = Encoding.ASCII.GetString(tagWithData.Data); break; case MediaTagType.DVD_PFI: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.DVD_CMI: txtDecoded.Text = CSS_CPRM.PrettifyLeadInCopyright(tagWithData.Data); break; case MediaTagType.DVDRAM_DDS: txtDecoded.Text = DDS.Prettify(tagWithData.Data); break; case MediaTagType.DVDRAM_SpareArea: txtDecoded.Text = Spare.Prettify(tagWithData.Data); break; case MediaTagType.DVDR_PFI: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.HDDVD_MediumStatus: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.BD_DI: txtDecoded.Text = DI.Prettify(tagWithData.Data); break; case MediaTagType.BD_BCA: txtDecoded.Text = BCA.Prettify(tagWithData.Data); break; case MediaTagType.BD_DDS: txtDecoded.Text = Decoders.Bluray.DDS.Prettify(tagWithData.Data); break; case MediaTagType.BD_CartridgeStatus: txtDecoded.Text = Cartridge.Prettify(tagWithData.Data); break; case MediaTagType.BD_SpareArea: txtDecoded.Text = Decoders.Bluray.Spare.Prettify(tagWithData.Data); break; case MediaTagType.MMC_WriteProtection: txtDecoded.Text = WriteProtect.PrettifyWriteProtectionStatus(tagWithData.Data); break; case MediaTagType.MMC_DiscInformation: txtDecoded.Text = DiscInformation.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_INQUIRY: txtDecoded.Text = Inquiry.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_MODEPAGE_2A: txtDecoded.Text = Modes.PrettifyModePage_2A(tagWithData.Data); break; case MediaTagType.ATA_IDENTIFY: case MediaTagType.ATAPI_IDENTIFY: txtDecoded.Text = Identify.Prettify(tagWithData.Data); break; case MediaTagType.Xbox_SecuritySector: txtDecoded.Text = SS.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_MODESENSE_6: txtDecoded.Text = Modes.PrettifyModeHeader6(tagWithData.Data, PeripheralDeviceTypes.DirectAccess); break; case MediaTagType.SCSI_MODESENSE_10: txtDecoded.Text = Modes.PrettifyModeHeader10(tagWithData.Data, PeripheralDeviceTypes.DirectAccess); break; case MediaTagType.Xbox_DMI: txtDecoded.Text = DMI.IsXbox360(tagWithData.Data) ? DMI.PrettifyXbox360(tagWithData.Data) : DMI.PrettifyXbox(tagWithData.Data); break; default: tabDecoded.Visible = false; break; } }