Fix reformatting.

This commit is contained in:
2019-11-02 23:52:33 +00:00
parent f6df95b732
commit dcaf51faef
52 changed files with 6663 additions and 5874 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -39,52 +39,72 @@ namespace DiscImageChef.Server
public static class ScsiEvpd
{
/// <summary>
/// Takes the SCSI EVPD part of a device report and prints it as a list key=value pairs to be sequenced by ASP.NET in
/// the rendering
/// Takes the SCSI EVPD part of a device report and prints it as a list key=value pairs to be sequenced by ASP.NET
/// in the rendering
/// </summary>
/// <param name="pages">EVPD pages</param>
/// <param name="vendor">SCSI vendor string</param>
/// <param name="evpdPages">List to put the key=value pairs on</param>
public static void Report(IEnumerable<ScsiPage> pages, string vendor, ref Dictionary<string, string> evpdPages)
{
foreach (var evpd in pages)
foreach(ScsiPage evpd in pages)
{
string decoded;
if (evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = EVPD.DecodeASCIIPage(evpd.value);
else if (evpd.page == 0x81) decoded = EVPD.PrettifyPage_81(evpd.value);
else if (evpd.page == 0x82) decoded = EVPD.DecodePage82(evpd.value);
else if (evpd.page == 0x83) decoded = EVPD.PrettifyPage_83(evpd.value);
else if (evpd.page == 0x84) decoded = EVPD.PrettifyPage_84(evpd.value);
else if (evpd.page == 0x85) decoded = EVPD.PrettifyPage_85(evpd.value);
else if (evpd.page == 0x86) decoded = EVPD.PrettifyPage_86(evpd.value);
else if (evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value);
else if (evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value);
else if (evpd.page == 0xB2)
decoded =
$"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}<br/>";
else if (evpd.page == 0xB4) decoded = EVPD.DecodePageB4(evpd.value);
else if (evpd.page == 0xC0 && vendor.Trim() == "quantum")
decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value);
else if (evpd.page == 0xC0 && vendor.Trim() == "seagate")
decoded =
EVPD.PrettifyPage_C0_Seagate(evpd.value);
else if (evpd.page == 0xC0 && vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C0_IBM(evpd.value);
else if (evpd.page == 0xC1 && vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C1_IBM(evpd.value);
else if ((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value);
else if ((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 ||
evpd.page == 0xC6) &&
vendor.Trim() == "certance") decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value);
else if ((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 ||
evpd.page == 0xC4 || evpd.page == 0xC5) &&
vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value);
else if (evpd.page == 0xDF && vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_DF_Certance(evpd.value);
else decoded = "Undecoded";
if (!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "<br/>");
if(evpd.page >= 0x01 &&
evpd.page <= 0x7F)
decoded = EVPD.DecodeASCIIPage(evpd.value);
else if(evpd.page == 0x81)
decoded = EVPD.PrettifyPage_81(evpd.value);
else if(evpd.page == 0x82)
decoded = EVPD.DecodePage82(evpd.value);
else if(evpd.page == 0x83)
decoded = EVPD.PrettifyPage_83(evpd.value);
else if(evpd.page == 0x84)
decoded = EVPD.PrettifyPage_84(evpd.value);
else if(evpd.page == 0x85)
decoded = EVPD.PrettifyPage_85(evpd.value);
else if(evpd.page == 0x86)
decoded = EVPD.PrettifyPage_86(evpd.value);
else if(evpd.page == 0x89)
decoded = EVPD.PrettifyPage_89(evpd.value);
else if(evpd.page == 0xB0)
decoded = EVPD.PrettifyPage_B0(evpd.value);
else if(evpd.page == 0xB2)
decoded = $"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}<br/>";
else if(evpd.page == 0xB4)
decoded = EVPD.DecodePageB4(evpd.value);
else if(evpd.page == 0xC0 &&
vendor.Trim() == "quantum")
decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value);
else if(evpd.page == 0xC0 &&
vendor.Trim() == "seagate")
decoded = EVPD.PrettifyPage_C0_Seagate(evpd.value);
else if(evpd.page == 0xC0 &&
vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C0_IBM(evpd.value);
else if(evpd.page == 0xC1 &&
vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C1_IBM(evpd.value);
else if((evpd.page == 0xC0 || evpd.page == 0xC1) &&
vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value);
else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 ||
evpd.page == 0xC6) &&
vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value);
else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 ||
evpd.page == 0xC4 || evpd.page == 0xC5) &&
vendor.Trim() == "hp")
decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value);
else if(evpd.page == 0xDF &&
vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_DF_Certance(evpd.value);
else
decoded = "Undecoded";
if(!string.IsNullOrEmpty(decoded))
decoded = decoded.Replace("\n", "<br/>");
evpdPages.Add($"EVPD page {evpd.page:X2}h", decoded);
}

File diff suppressed because it is too large Load Diff

View File

@@ -39,251 +39,480 @@ namespace DiscImageChef.Server
public static class ScsiMmcFeatures
{
/// <summary>
/// Takes the MMC FEATURES part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
/// rendering
/// Takes the MMC FEATURES part of a device report and prints it as a list of values to be sequenced by ASP.NET in
/// the rendering
/// </summary>
/// <param name="ftr">FEATURES part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param>
public static void Report(MmcFeatures ftr, ref List<string> mmcOneValue)
{
if (ftr.SupportsAACS && ftr.AACSVersion.HasValue)
if(ftr.SupportsAACS &&
ftr.AACSVersion.HasValue)
mmcOneValue.Add($"Drive supports AACS version {ftr.AACSVersion}");
else if (ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS");
if (ftr.AGIDs.HasValue) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
if (ftr.CanGenerateBindingNonce)
else if(ftr.SupportsAACS)
mmcOneValue.Add("Drive supports AACS");
if(ftr.AGIDs.HasValue)
mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
if(ftr.CanGenerateBindingNonce)
{
mmcOneValue.Add("Drive supports generating the binding nonce");
if (ftr.BindingNonceBlocks.HasValue)
if(ftr.BindingNonceBlocks.HasValue)
mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce");
}
if (ftr.BlocksPerReadableUnit > 1)
if(ftr.BlocksPerReadableUnit > 1)
mmcOneValue.Add($"{ftr.BlocksPerReadableUnit} logical blocks per media writable unit");
if (ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs");
if (ftr.BufferUnderrunFreeInSAO)
mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode");
if (ftr.BufferUnderrunFreeInTAO) mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode");
if (ftr.CanAudioScan) mmcOneValue.Add("Drive supports the SCAN command");
if (ftr.CanEject) mmcOneValue.Add("Drive can eject media");
if (ftr.CanEraseSector) mmcOneValue.Add("Drive supports media that require erasing before writing");
if (ftr.CanExpandBDRESpareArea)
mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc");
if (ftr.CanFormat) mmcOneValue.Add("Drive can format media into logical blocks");
if (ftr.CanFormatBDREWithoutSpare) mmcOneValue.Add("Drive can format BD-RE with no spares allocated");
if (ftr.CanFormatQCert) mmcOneValue.Add("Drive can format BD-RE discs with quick certification");
if (ftr.CanFormatCert) mmcOneValue.Add("Drive can format BD-RE discs with full certification");
if (ftr.CanFormatFRF) mmcOneValue.Add("Drive can fast re-format BD-RE discs");
if (ftr.CanFormatRRM) mmcOneValue.Add("Drive can format BD-R discs with RRM format");
if (ftr.CanLoad) mmcOneValue.Add("Drive can load media");
if (ftr.CanMuteSeparateChannels) mmcOneValue.Add("Drive is able to mute channels separately");
if (ftr.CanOverwriteSAOTrack) mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs");
if (ftr.CanOverwriteTAOTrack) mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs");
if (ftr.CanPlayCDAudio) mmcOneValue.Add("Drive has an analogue audio output");
if (ftr.CanPseudoOverwriteBDR) mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode");
if (ftr.CanReadAllDualR) mmcOneValue.Add("Drive can read DVD-R DL from all recording modes");
if (ftr.CanReadAllDualRW) mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes");
if (ftr.CanReadBD) mmcOneValue.Add("Drive can read BD-ROM");
if (ftr.CanReadBDR) mmcOneValue.Add("Drive can read BD-R Ver.1");
if (ftr.CanReadBDRE1) mmcOneValue.Add("Drive can read BD-RE Ver.1");
if (ftr.CanReadBDRE2) mmcOneValue.Add("Drive can read BD-RE Ver.2");
if (ftr.CanReadBDROM) mmcOneValue.Add("Drive can read BD-ROM Ver.1");
if (ftr.CanReadBluBCA) mmcOneValue.Add("Drive can read BD's Burst Cutting Area");
if (ftr.CanReadCD) mmcOneValue.Add("Drive can read CD-ROM");
if (ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW");
else if (ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write DVD+MRW");
else if (ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW)
mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW");
else if (ftr.CanWriteCDMRW) mmcOneValue.Add("Drive can read and write CD-MRW");
else if (ftr.CanReadDVDPlusMRW) mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW");
else if (ftr.CanReadCDMRW) mmcOneValue.Add("Drive can read CD-MRW");
if (ftr.CanReadCPRM_MKB) mmcOneValue.Add("Drive supports reading Media Key Block of CPRM");
if (ftr.CanReadDDCD) mmcOneValue.Add("Drive can read DDCDs");
if (ftr.CanReadDVD) mmcOneValue.Add("Drive can read DVD");
if (ftr.CanWriteDVDPlusRW) mmcOneValue.Add("Drive can read and write DVD+RW");
else if (ftr.CanReadDVDPlusRW) mmcOneValue.Add("Drive can read DVD+RW");
if (ftr.CanWriteDVDPlusR) mmcOneValue.Add("Drive can read and write DVD+R");
else if (ftr.CanReadDVDPlusR) mmcOneValue.Add("Drive can read DVD+R");
if (ftr.CanWriteDVDPlusRDL) mmcOneValue.Add("Drive can read and write DVD+R DL");
else if (ftr.CanReadDVDPlusRDL) mmcOneValue.Add("Drive can read DVD+R DL");
if (ftr.CanReadDriveAACSCertificate) mmcOneValue.Add("Drive supports reading the Drive Certificate");
if (ftr.CanReadHDDVD && ftr.CanReadHDDVDR && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM");
else if (ftr.CanReadHDDVD && ftr.CanReadHDDVDR)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R");
else if (ftr.CanReadHDDVD && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM");
else if (ftr.CanReadHDDVD) mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW");
if (ftr.CanReadLeadInCDText) mmcOneValue.Add("Drive can return CD-Text from Lead-In");
if (ftr.CanReadOldBDR) mmcOneValue.Add("Drive can read BD-R pre-1.0");
if (ftr.CanReadOldBDRE) mmcOneValue.Add("Drive can read BD-RE pre-1.0");
if (ftr.CanReadOldBDROM) mmcOneValue.Add("Drive can read BD-ROM pre-1.0");
if (ftr.CanReadSpareAreaInformation) mmcOneValue.Add("Drive can return Spare Area Information");
if (ftr.CanReportDriveSerial) mmcOneValue.Add("Drive is to report drive serial number");
if (ftr.CanReportMediaSerial) mmcOneValue.Add("Drive is to read media serial number");
if (ftr.CanTestWriteDDCDR) mmcOneValue.Add("Drive can do a test writing with DDCD-R");
if (ftr.CanTestWriteDVD) mmcOneValue.Add("Drive can do a test writing with DVDs");
if (ftr.CanTestWriteInSAO) mmcOneValue.Add("Drive can do a test writing in Session at Once Mode");
if (ftr.CanTestWriteInTAO) mmcOneValue.Add("Drive can do a test writing in Track at Once Mode");
if (ftr.CanUpgradeFirmware) mmcOneValue.Add("Drive supports Microcode Upgrade");
if (ftr.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page");
if (ftr.Locked) mmcOneValue.Add("Drive can lock media");
if (ftr.LogicalBlockSize > 0) mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block");
if (ftr.MultiRead)
mmcOneValue.Add(
"Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
if (ftr.PhysicalInterfaceStandard.HasValue)
switch (ftr.PhysicalInterfaceStandard)
if(ftr.BufferUnderrunFreeInDVD)
mmcOneValue.Add("Drive supports zero loss linking writing DVDs");
if(ftr.BufferUnderrunFreeInSAO)
mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode");
if(ftr.BufferUnderrunFreeInTAO)
mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode");
if(ftr.CanAudioScan)
mmcOneValue.Add("Drive supports the SCAN command");
if(ftr.CanEject)
mmcOneValue.Add("Drive can eject media");
if(ftr.CanEraseSector)
mmcOneValue.Add("Drive supports media that require erasing before writing");
if(ftr.CanExpandBDRESpareArea)
mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc");
if(ftr.CanFormat)
mmcOneValue.Add("Drive can format media into logical blocks");
if(ftr.CanFormatBDREWithoutSpare)
mmcOneValue.Add("Drive can format BD-RE with no spares allocated");
if(ftr.CanFormatQCert)
mmcOneValue.Add("Drive can format BD-RE discs with quick certification");
if(ftr.CanFormatCert)
mmcOneValue.Add("Drive can format BD-RE discs with full certification");
if(ftr.CanFormatFRF)
mmcOneValue.Add("Drive can fast re-format BD-RE discs");
if(ftr.CanFormatRRM)
mmcOneValue.Add("Drive can format BD-R discs with RRM format");
if(ftr.CanLoad)
mmcOneValue.Add("Drive can load media");
if(ftr.CanMuteSeparateChannels)
mmcOneValue.Add("Drive is able to mute channels separately");
if(ftr.CanOverwriteSAOTrack)
mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs");
if(ftr.CanOverwriteTAOTrack)
mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs");
if(ftr.CanPlayCDAudio)
mmcOneValue.Add("Drive has an analogue audio output");
if(ftr.CanPseudoOverwriteBDR)
mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode");
if(ftr.CanReadAllDualR)
mmcOneValue.Add("Drive can read DVD-R DL from all recording modes");
if(ftr.CanReadAllDualRW)
mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes");
if(ftr.CanReadBD)
mmcOneValue.Add("Drive can read BD-ROM");
if(ftr.CanReadBDR)
mmcOneValue.Add("Drive can read BD-R Ver.1");
if(ftr.CanReadBDRE1)
mmcOneValue.Add("Drive can read BD-RE Ver.1");
if(ftr.CanReadBDRE2)
mmcOneValue.Add("Drive can read BD-RE Ver.2");
if(ftr.CanReadBDROM)
mmcOneValue.Add("Drive can read BD-ROM Ver.1");
if(ftr.CanReadBluBCA)
mmcOneValue.Add("Drive can read BD's Burst Cutting Area");
if(ftr.CanReadCD)
mmcOneValue.Add("Drive can read CD-ROM");
if(ftr.CanWriteCDMRW &&
ftr.CanReadDVDPlusMRW &&
ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW");
else if(ftr.CanReadDVDPlusMRW &&
ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write DVD+MRW");
else if(ftr.CanWriteCDMRW &&
ftr.CanReadDVDPlusMRW)
mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW");
else if(ftr.CanWriteCDMRW)
mmcOneValue.Add("Drive can read and write CD-MRW");
else if(ftr.CanReadDVDPlusMRW)
mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW");
else if(ftr.CanReadCDMRW)
mmcOneValue.Add("Drive can read CD-MRW");
if(ftr.CanReadCPRM_MKB)
mmcOneValue.Add("Drive supports reading Media Key Block of CPRM");
if(ftr.CanReadDDCD)
mmcOneValue.Add("Drive can read DDCDs");
if(ftr.CanReadDVD)
mmcOneValue.Add("Drive can read DVD");
if(ftr.CanWriteDVDPlusRW)
mmcOneValue.Add("Drive can read and write DVD+RW");
else if(ftr.CanReadDVDPlusRW)
mmcOneValue.Add("Drive can read DVD+RW");
if(ftr.CanWriteDVDPlusR)
mmcOneValue.Add("Drive can read and write DVD+R");
else if(ftr.CanReadDVDPlusR)
mmcOneValue.Add("Drive can read DVD+R");
if(ftr.CanWriteDVDPlusRDL)
mmcOneValue.Add("Drive can read and write DVD+R DL");
else if(ftr.CanReadDVDPlusRDL)
mmcOneValue.Add("Drive can read DVD+R DL");
if(ftr.CanReadDriveAACSCertificate)
mmcOneValue.Add("Drive supports reading the Drive Certificate");
if(ftr.CanReadHDDVD &&
ftr.CanReadHDDVDR &&
ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM");
else if(ftr.CanReadHDDVD &&
ftr.CanReadHDDVDR)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R");
else if(ftr.CanReadHDDVD &&
ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM");
else if(ftr.CanReadHDDVD)
mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW");
if(ftr.CanReadLeadInCDText)
mmcOneValue.Add("Drive can return CD-Text from Lead-In");
if(ftr.CanReadOldBDR)
mmcOneValue.Add("Drive can read BD-R pre-1.0");
if(ftr.CanReadOldBDRE)
mmcOneValue.Add("Drive can read BD-RE pre-1.0");
if(ftr.CanReadOldBDROM)
mmcOneValue.Add("Drive can read BD-ROM pre-1.0");
if(ftr.CanReadSpareAreaInformation)
mmcOneValue.Add("Drive can return Spare Area Information");
if(ftr.CanReportDriveSerial)
mmcOneValue.Add("Drive is to report drive serial number");
if(ftr.CanReportMediaSerial)
mmcOneValue.Add("Drive is to read media serial number");
if(ftr.CanTestWriteDDCDR)
mmcOneValue.Add("Drive can do a test writing with DDCD-R");
if(ftr.CanTestWriteDVD)
mmcOneValue.Add("Drive can do a test writing with DVDs");
if(ftr.CanTestWriteInSAO)
mmcOneValue.Add("Drive can do a test writing in Session at Once Mode");
if(ftr.CanTestWriteInTAO)
mmcOneValue.Add("Drive can do a test writing in Track at Once Mode");
if(ftr.CanUpgradeFirmware)
mmcOneValue.Add("Drive supports Microcode Upgrade");
if(ftr.ErrorRecoveryPage)
mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page");
if(ftr.Locked)
mmcOneValue.Add("Drive can lock media");
if(ftr.LogicalBlockSize > 0)
mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block");
if(ftr.MultiRead)
mmcOneValue.
Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
if(ftr.PhysicalInterfaceStandard.HasValue)
switch(ftr.PhysicalInterfaceStandard)
{
case PhysicalInterfaces.Unspecified:
mmcOneValue.Add("Drive uses an unspecified physical interface");
break;
case PhysicalInterfaces.SCSI:
mmcOneValue.Add("Drive uses SCSI interface");
break;
case PhysicalInterfaces.ATAPI:
mmcOneValue.Add("Drive uses ATAPI interface");
break;
case PhysicalInterfaces.IEEE1394:
mmcOneValue.Add("Drive uses IEEE-1394 interface");
break;
case PhysicalInterfaces.IEEE1394A:
mmcOneValue.Add("Drive uses IEEE-1394A interface");
break;
case PhysicalInterfaces.FC:
mmcOneValue.Add("Drive uses Fibre Channel interface");
break;
case PhysicalInterfaces.IEEE1394B:
mmcOneValue.Add("Drive uses IEEE-1394B interface");
break;
case PhysicalInterfaces.SerialATAPI:
mmcOneValue.Add("Drive uses Serial ATAPI interface");
break;
case PhysicalInterfaces.USB:
mmcOneValue.Add("Drive uses USB interface");
break;
case PhysicalInterfaces.Vendor:
mmcOneValue.Add("Drive uses a vendor unique interface");
break;
default:
mmcOneValue
.Add($"Drive uses an unknown interface with code {(uint) ftr.PhysicalInterfaceStandard}");
mmcOneValue.
Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}");
break;
}
if (ftr.PreventJumper) mmcOneValue.Add("Drive power ups locked");
if (ftr.SupportsBusEncryption) mmcOneValue.Add("Drive supports bus encryption");
if (ftr.CanWriteBD) mmcOneValue.Add("Drive can write BD-R or BD-RE");
if (ftr.CanWriteBDR) mmcOneValue.Add("Drive can write BD-R Ver.1");
if (ftr.CanWriteBDRE1) mmcOneValue.Add("Drive can write BD-RE Ver.1");
if (ftr.CanWriteBDRE2) mmcOneValue.Add("Drive can write BD-RE Ver.2");
if (ftr.CanWriteBusEncryptedBlocks) mmcOneValue.Add("Drive supports writing with bus encryption");
if (ftr.CanWriteCDRW) mmcOneValue.Add("Drive can write CD-RW");
if (ftr.CanWriteCDRWCAV) mmcOneValue.Add("Drive can write High-Speed CD-RW");
if (ftr.CanWriteCDSAO && !ftr.CanWriteRaw)
if(ftr.PreventJumper)
mmcOneValue.Add("Drive power ups locked");
if(ftr.SupportsBusEncryption)
mmcOneValue.Add("Drive supports bus encryption");
if(ftr.CanWriteBD)
mmcOneValue.Add("Drive can write BD-R or BD-RE");
if(ftr.CanWriteBDR)
mmcOneValue.Add("Drive can write BD-R Ver.1");
if(ftr.CanWriteBDRE1)
mmcOneValue.Add("Drive can write BD-RE Ver.1");
if(ftr.CanWriteBDRE2)
mmcOneValue.Add("Drive can write BD-RE Ver.2");
if(ftr.CanWriteBusEncryptedBlocks)
mmcOneValue.Add("Drive supports writing with bus encryption");
if(ftr.CanWriteCDRW)
mmcOneValue.Add("Drive can write CD-RW");
if(ftr.CanWriteCDRWCAV)
mmcOneValue.Add("Drive can write High-Speed CD-RW");
if(ftr.CanWriteCDSAO &&
!ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once Mode:");
else if (!ftr.CanWriteCDSAO && ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in raw Mode:");
else if (ftr.CanWriteCDSAO && ftr.CanWriteRaw)
else if(!ftr.CanWriteCDSAO &&
ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in raw Mode:");
else if(ftr.CanWriteCDSAO &&
ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once and in Raw Modes:");
if (ftr.CanWriteCDTAO) mmcOneValue.Add("Drive can write CDs in Track at Once Mode:");
if (ftr.CanWriteCSSManagedDVD) mmcOneValue.Add("Drive can write CSS managed DVDs");
if (ftr.CanWriteDDCDR) mmcOneValue.Add("Drive supports writing DDCD-R");
if (ftr.CanWriteDDCDRW) mmcOneValue.Add("Drive supports writing DDCD-RW");
if (ftr.CanWriteDVDPlusRWDL) mmcOneValue.Add("Drive can read and write DVD+RW DL");
else if (ftr.CanReadDVDPlusRWDL) mmcOneValue.Add("Drive can read DVD+RW DL");
if (ftr.CanWriteDVDR && ftr.CanWriteDVDRW && ftr.CanWriteDVDRDL)
if(ftr.CanWriteCDTAO)
mmcOneValue.Add("Drive can write CDs in Track at Once Mode:");
if(ftr.CanWriteCSSManagedDVD)
mmcOneValue.Add("Drive can write CSS managed DVDs");
if(ftr.CanWriteDDCDR)
mmcOneValue.Add("Drive supports writing DDCD-R");
if(ftr.CanWriteDDCDRW)
mmcOneValue.Add("Drive supports writing DDCD-RW");
if(ftr.CanWriteDVDPlusRWDL)
mmcOneValue.Add("Drive can read and write DVD+RW DL");
else if(ftr.CanReadDVDPlusRWDL)
mmcOneValue.Add("Drive can read DVD+RW DL");
if(ftr.CanWriteDVDR &&
ftr.CanWriteDVDRW &&
ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R, DVD-RW and DVD-R DL");
else if (ftr.CanWriteDVDR && ftr.CanWriteDVDRDL)
else if(ftr.CanWriteDVDR &&
ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R and DVD-R DL");
else if (ftr.CanWriteDVDR && ftr.CanWriteDVDRW) mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW");
else if (ftr.CanWriteDVDR) mmcOneValue.Add("Drive supports writing DVD-R");
if (ftr.CanWriteHDDVDR && ftr.CanWriteHDDVDRAM)
else if(ftr.CanWriteDVDR &&
ftr.CanWriteDVDRW)
mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW");
else if(ftr.CanWriteDVDR)
mmcOneValue.Add("Drive supports writing DVD-R");
if(ftr.CanWriteHDDVDR &&
ftr.CanWriteHDDVDRAM)
mmcOneValue.Add("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM");
else if (ftr.CanWriteHDDVDR) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R");
else if (ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM");
else if(ftr.CanWriteHDDVDR)
mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R");
else if(ftr.CanWriteHDDVDRAM)
mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM");
// TODO: Write HD DVD-RW
/*
else
mmcOneValue.Add("Drive can write HD DVD-RW");
*/
if (ftr.CanWriteOldBDR) mmcOneValue.Add("Drive can write BD-R pre-1.0");
if (ftr.CanWriteOldBDRE) mmcOneValue.Add("Drive can write BD-RE pre-1.0");
if (ftr.CanWriteRWSubchannelInTAO)
if(ftr.CanWriteOldBDR)
mmcOneValue.Add("Drive can write BD-R pre-1.0");
if(ftr.CanWriteOldBDRE)
mmcOneValue.Add("Drive can write BD-RE pre-1.0");
if(ftr.CanWriteRWSubchannelInTAO)
{
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Track at Once Mode");
if (ftr.CanWriteRawSubchannelInTAO)
if(ftr.CanWriteRawSubchannelInTAO)
mmcOneValue.Add("Drive accepts RAW R-W subchannel data in Track at Once Mode");
if (ftr.CanWritePackedSubchannelInTAO)
if(ftr.CanWritePackedSubchannelInTAO)
mmcOneValue.Add("Drive accepts Packed R-W subchannel data in Track at Once Mode");
}
if (ftr.CanWriteRWSubchannelInSAO)
if(ftr.CanWriteRWSubchannelInSAO)
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Session at Once Mode");
if (ftr.CanWriteRaw && ftr.CanWriteRawMultiSession)
if(ftr.CanWriteRaw &&
ftr.CanWriteRawMultiSession)
mmcOneValue.Add("Drive can write multi-session CDs in raw mode");
if (ftr.EmbeddedChanger)
if(ftr.EmbeddedChanger)
{
mmcOneValue.Add("Drive contains an embedded changer");
if (ftr.ChangerIsSideChangeCapable) mmcOneValue.Add("Drive can change disc side");
if (ftr.ChangerSupportsDiscPresent)
if(ftr.ChangerIsSideChangeCapable)
mmcOneValue.Add("Drive can change disc side");
if(ftr.ChangerSupportsDiscPresent)
mmcOneValue.Add("Drive is able to report slots contents after a reset or change");
mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots");
}
if (ftr.SupportsCSS && ftr.CSSVersion.HasValue)
if(ftr.SupportsCSS &&
ftr.CSSVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CSS/CPPM version {ftr.CSSVersion}");
else if (ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM");
if (ftr.SupportsCPRM && ftr.CPRMVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}");
else if (ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM");
if (ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading");
if (ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications");
if (ftr.FirmwareDate.HasValue) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
if (ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers");
if (ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands");
if (ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events");
else if(ftr.SupportsCSS)
mmcOneValue.Add("Drive supports DVD CSS/CPRM");
if (ftr.LoadingMechanismType.HasValue)
switch (ftr.LoadingMechanismType)
if(ftr.SupportsCPRM &&
ftr.CPRMVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}");
else if(ftr.SupportsCPRM)
mmcOneValue.Add("Drive supports DVD CPRM");
if(ftr.DBML)
mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading");
if(ftr.DVDMultiRead)
mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications");
if(ftr.FirmwareDate.HasValue)
mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
if(ftr.SupportsC2)
mmcOneValue.Add("Drive supports C2 Error Pointers");
if(ftr.SupportsDAP)
mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands");
if(ftr.SupportsDeviceBusyEvent)
mmcOneValue.Add("Drive supports Device Busy events");
if(ftr.LoadingMechanismType.HasValue)
switch(ftr.LoadingMechanismType)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
break;
case 1:
mmcOneValue.Add("Drive uses a tray");
break;
case 2:
mmcOneValue.Add("Drive is pop-up");
break;
case 4:
mmcOneValue.Add("Drive is a changer with individually changeable discs");
break;
case 5:
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add($"Drive uses unknown loading mechanism type {ftr.LoadingMechanismType}");
break;
}
if (ftr.SupportsHybridDiscs) mmcOneValue.Add("Drive is able to access Hybrid discs");
if (ftr.SupportsModePage1Ch)
if(ftr.SupportsHybridDiscs)
mmcOneValue.Add("Drive is able to access Hybrid discs");
if(ftr.SupportsModePage1Ch)
mmcOneValue.Add("Drive supports the Informational Exceptions Control mode page 1Ch");
if (ftr.SupportsOSSC)
if(ftr.SupportsOSSC)
mmcOneValue.Add("Drive supports the Trusted Computing Group Optical Security Subsystem Class");
if (ftr.SupportsPWP) mmcOneValue.Add("Drive supports set/release of PWP status");
if (ftr.SupportsSWPP) mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page");
if (ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc");
if (ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel");
if (ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS");
if (ftr.VolumeLevels.HasValue) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
if (ftr.SupportsWriteProtectPAC)
if(ftr.SupportsPWP)
mmcOneValue.Add("Drive supports set/release of PWP status");
if(ftr.SupportsSWPP)
mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page");
if(ftr.SupportsSecurDisc)
mmcOneValue.Add("Drive supports SecurDisc");
if(ftr.SupportsSeparateVolume)
mmcOneValue.Add("Drive supports separate volume per channel");
if(ftr.SupportsVCPS)
mmcOneValue.Add("Drive supports VCPS");
if(ftr.VolumeLevels.HasValue)
mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
if(ftr.SupportsWriteProtectPAC)
mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media");
if (ftr.SupportsWriteInhibitDCB)
if(ftr.SupportsWriteInhibitDCB)
mmcOneValue.Add("Drive supports writing the Write Inhibit DCB on DVD+RW media");
mmcOneValue.Sort();

View File

@@ -39,135 +39,188 @@ namespace DiscImageChef.Server
public static class ScsiMmcMode
{
/// <summary>
/// Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
/// rendering
/// Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET
/// in the rendering
/// </summary>
/// <param name="mode">MODE PAGE 2Ah part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param>
public static void Report(Modes.ModePage_2A mode, ref List<string> mmcOneValue)
{
if (mode.AudioPlay) mmcOneValue.Add("Drive can play audio");
if (mode.Mode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
if (mode.Mode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
if (mode.MultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
if(mode.AudioPlay)
mmcOneValue.Add("Drive can play audio");
if (mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio");
if (mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss");
if (mode.Subchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
if (mode.DeinterlaveSubchannel) mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
if (mode.C2Pointer) mmcOneValue.Add("Drive supports C2 pointers");
if (mode.UPC) mmcOneValue.Add("Drive can read Media Catalogue Number");
if (mode.ISRC) mmcOneValue.Add("Drive can read ISRC");
if(mode.Mode2Form1)
mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
switch (mode.LoadingMechanism)
if(mode.Mode2Form2)
mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
if(mode.MultiSession)
mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
if(mode.CDDACommand)
mmcOneValue.Add("Drive can read digital audio");
if(mode.AccurateCDDA)
mmcOneValue.Add("Drive can continue from streaming loss");
if(mode.Subchannel)
mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
if(mode.DeinterlaveSubchannel)
mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
if(mode.C2Pointer)
mmcOneValue.Add("Drive supports C2 pointers");
if(mode.UPC)
mmcOneValue.Add("Drive can read Media Catalogue Number");
if(mode.ISRC)
mmcOneValue.Add("Drive can read ISRC");
switch(mode.LoadingMechanism)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
break;
case 1:
mmcOneValue.Add("Drive uses a tray");
break;
case 2:
mmcOneValue.Add("Drive is pop-up");
break;
case 4:
mmcOneValue.Add("Drive is a changer with individually changeable discs");
break;
case 5:
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanism}");
break;
}
if (mode.Lock) mmcOneValue.Add("Drive can lock media");
if (mode.PreventJumper)
if(mode.Lock)
mmcOneValue.Add("Drive can lock media");
if(mode.PreventJumper)
{
mmcOneValue.Add("Drive power ups locked");
mmcOneValue.Add(mode.LockState
? "Drive is locked, media cannot be ejected or inserted"
: "Drive is not locked, media can be ejected and inserted");
mmcOneValue.Add(mode.LockState ? "Drive is locked, media cannot be ejected or inserted"
: "Drive is not locked, media can be ejected and inserted");
}
else
{
mmcOneValue.Add(mode.LockState
? "Drive is locked, media cannot be ejected, but if empty, can be inserted"
: "Drive is not locked, media can be ejected and inserted");
? "Drive is locked, media cannot be ejected, but if empty, can be inserted"
: "Drive is not locked, media can be ejected and inserted");
}
if (mode.Eject) mmcOneValue.Add("Drive can eject media");
if(mode.Eject)
mmcOneValue.Add("Drive can eject media");
if (mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently");
if (mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently");
if(mode.SeparateChannelMute)
mmcOneValue.Add("Each channel can be muted independently");
if (mode.SupportedVolumeLevels > 0)
if(mode.SeparateChannelVolume)
mmcOneValue.Add("Each channel's volume can be controlled independently");
if(mode.SupportedVolumeLevels > 0)
mmcOneValue.Add($"Drive supports {mode.SupportedVolumeLevels} volume levels");
if (mode.BufferSize > 0) mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer");
if (mode.MaximumSpeed > 0)
if(mode.BufferSize > 0)
mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer");
if(mode.MaximumSpeed > 0)
mmcOneValue.Add($"Drive's maximum reading speed is {mode.MaximumSpeed} Kbyte/sec.");
if (mode.CurrentSpeed > 0)
if(mode.CurrentSpeed > 0)
mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec.");
if (mode.ReadCDR)
if(mode.ReadCDR)
{
mmcOneValue.Add(mode.WriteCDR ? "Drive can read and write CD-R" : "Drive can read CD-R");
if (mode.Method2) mmcOneValue.Add("Drive supports reading CD-R packet media");
if(mode.Method2)
mmcOneValue.Add("Drive supports reading CD-R packet media");
}
if (mode.ReadCDRW)
if(mode.ReadCDRW)
mmcOneValue.Add(mode.WriteCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW");
if (mode.ReadDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
if (mode.ReadDVDR)
if(mode.ReadDVDROM)
mmcOneValue.Add("Drive can read DVD-ROM");
if(mode.ReadDVDR)
mmcOneValue.Add(mode.WriteDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R");
if (mode.ReadDVDRAM)
if(mode.ReadDVDRAM)
mmcOneValue.Add(mode.WriteDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM");
if (mode.Composite) mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
if (mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
if (mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
if(mode.Composite)
mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
if (mode.SDP) mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
if (mode.CurrentWriteSpeedSelected > 0)
if(mode.DigitalPort1)
mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
if(mode.DigitalPort2)
mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
if(mode.SDP)
mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
if(mode.CurrentWriteSpeedSelected > 0)
{
if (mode.RotationControlSelected == 0)
mmcOneValue
.Add(
$"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
else if (mode.RotationControlSelected == 1)
mmcOneValue
.Add(
$"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
if(mode.RotationControlSelected == 0)
mmcOneValue.
Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
else if(mode.RotationControlSelected == 1)
mmcOneValue.
Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
}
else
{
if (mode.MaxWriteSpeed > 0)
if(mode.MaxWriteSpeed > 0)
mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaxWriteSpeed} Kbyte/sec.");
if (mode.CurrentWriteSpeed > 0)
if(mode.CurrentWriteSpeed > 0)
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec.");
}
if (mode.WriteSpeedPerformanceDescriptors != null)
foreach (var descriptor in
if(mode.WriteSpeedPerformanceDescriptors != null)
foreach(Modes.ModePage_2A_WriteDescriptor descriptor in
mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0))
if (descriptor.RotationControl == 0)
if(descriptor.RotationControl == 0)
mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode");
else if (descriptor.RotationControl == 1)
mmcOneValue
.Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode");
else if(descriptor.RotationControl == 1)
mmcOneValue.
Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode");
if (mode.TestWrite) mmcOneValue.Add("Drive supports test writing");
if(mode.TestWrite)
mmcOneValue.Add("Drive supports test writing");
if (mode.ReadBarcode) mmcOneValue.Add("Drive can read barcode");
if(mode.ReadBarcode)
mmcOneValue.Add("Drive can read barcode");
if (mode.SCC) mmcOneValue.Add("Drive can read both sides of a disc");
if (mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
if(mode.SCC)
mmcOneValue.Add("Drive can read both sides of a disc");
if (mode.CMRSupported == 1) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
if(mode.LeadInPW)
mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
if (mode.BUF) mmcOneValue.Add("Drive supports buffer under-run free recording");
if(mode.CMRSupported == 1)
mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
if(mode.BUF)
mmcOneValue.Add("Drive supports buffer under-run free recording");
mmcOneValue.Sort();
mmcOneValue.Add("");

View File

@@ -39,195 +39,221 @@ namespace DiscImageChef.Server
public static class ScsiModeSense
{
/// <summary>
/// Takes the MODE PAGEs part of a device report and prints it as a list of values and another list of key=value pairs
/// to be sequenced by ASP.NET in the rendering
/// Takes the MODE PAGEs part of a device report and prints it as a list of values and another list of key=value
/// pairs to be sequenced by ASP.NET in the rendering
/// </summary>
/// <param name="modeSense">MODE PAGEs part of a device report</param>
/// <param name="vendor">SCSI vendor string</param>
/// <param name="deviceType">SCSI peripheral device type</param>
/// <param name="scsiOneValue">List to put values on</param>
/// <param name="modePages">List to put key=value pairs on</param>
public static void Report(ScsiMode modeSense, string vendor,
PeripheralDeviceTypes deviceType,
ref List<string> scsiOneValue, ref Dictionary<string, string> modePages)
public static void Report(ScsiMode modeSense, string vendor, PeripheralDeviceTypes deviceType,
ref List<string> scsiOneValue, ref Dictionary<string, string> modePages)
{
if (modeSense.MediumType.HasValue) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
if (modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
if (modeSense.BlockDescriptors != null)
foreach (var descriptor in modeSense.BlockDescriptors)
if (descriptor.Blocks.HasValue && descriptor.BlockLength.HasValue)
scsiOneValue
.Add(
$"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each");
if(modeSense.MediumType.HasValue)
scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
if(modeSense.WriteProtected)
scsiOneValue.Add("Device is write protected.");
if(modeSense.BlockDescriptors != null)
foreach(BlockDescriptor descriptor in modeSense.BlockDescriptors)
if(descriptor.Blocks.HasValue &&
descriptor.BlockLength.HasValue)
scsiOneValue.
Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each");
else
scsiOneValue.Add($"Density code {descriptor.Density:X2}h");
if (modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits");
if (modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled");
if (modeSense.BufferedMode.HasValue)
switch (modeSense.BufferedMode)
if(modeSense.DPOandFUA)
scsiOneValue.Add("Drive supports DPO and FUA bits");
if(modeSense.BlankCheckEnabled)
scsiOneValue.Add("Blank checking during write is enabled");
if(modeSense.BufferedMode.HasValue)
switch(modeSense.BufferedMode)
{
case 0:
scsiOneValue.Add("Device writes directly to media");
break;
case 1:
scsiOneValue.Add("Device uses a write cache");
break;
case 2:
scsiOneValue.Add("Device uses a write cache but doesn't return until cache is flushed");
break;
default:
scsiOneValue.Add($"Unknown buffered mode code 0x{modeSense.BufferedMode:X2}");
break;
}
if (modeSense.ModePages == null) return;
if(modeSense.ModePages == null)
return;
foreach (var page in modeSense.ModePages)
switch (page.page)
foreach(ScsiPage page in modeSense.ModePages)
switch(page.page)
{
case 0x00:
{
if (deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice &&
page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_00_SFF(page.value));
else
modePages
.Add(
page.subpage != 0
? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h"
: $"MODE page {page.page:X2}h",
modePages.
Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
"Unknown vendor mode page");
break;
}
case 0x01:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_01_MMC(page.value)
: Modes.PrettifyModePage_01(page.value));
else goto default;
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_01_MMC(page.value)
: Modes.PrettifyModePage_01(page.value));
else
goto default;
break;
}
case 0x02:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_02(page.value));
else goto default;
else
goto default;
break;
}
case 0x03:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_03(page.value));
else goto default;
else
goto default;
break;
}
case 0x04:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_04(page.value));
else goto default;
else
goto default;
break;
}
case 0x05:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_05(page.value));
else goto default;
else
goto default;
break;
}
case 0x06:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_06(page.value));
else goto default;
else
goto default;
break;
}
case 0x07:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_07_MMC(page.value)
: Modes.PrettifyModePage_07(page.value));
else goto default;
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_07_MMC(page.value)
: Modes.PrettifyModePage_07(page.value));
else
goto default;
break;
}
case 0x08:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_08(page.value));
else goto default;
else
goto default;
break;
}
case 0x0A:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A(page.value));
else if (page.subpage == 1)
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_0A_S01(page.value));
else goto default;
Modes.PrettifyModePage_0A_S01(page.value));
else
goto default;
break;
}
case 0x0B:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0B(page.value));
else goto default;
else
goto default;
break;
}
case 0x0D:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0D(page.value));
else goto default;
else
goto default;
break;
}
case 0x0E:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0E(page.value));
else goto default;
else
goto default;
break;
}
case 0x0F:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0F(page.value));
else goto default;
else
goto default;
break;
}
case 0x10:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.SequentialAccess
? Modes.PrettifyModePage_10_SSC(page.value)
: Modes.PrettifyModePage_10(page.value));
else goto default;
deviceType == PeripheralDeviceTypes.SequentialAccess
? Modes.PrettifyModePage_10_SSC(page.value)
: Modes.PrettifyModePage_10(page.value));
else
goto default;
break;
}
case 0x11:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_11(page.value));
else goto default;
else
goto default;
break;
}
@@ -235,152 +261,167 @@ namespace DiscImageChef.Server
case 0x13:
case 0x14:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_12_13_14(page.value));
else goto default;
else
goto default;
break;
}
case 0x1A:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A(page.value));
else if (page.subpage == 1)
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_1A_S01(page.value));
else goto default;
Modes.PrettifyModePage_1A_S01(page.value));
else
goto default;
break;
}
case 0x1B:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1B(page.value));
else goto default;
else
goto default;
break;
}
case 0x1C:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_1C_SFF(page.value)
: Modes.PrettifyModePage_1C(page.value));
else if (page.subpage == 1)
deviceType == PeripheralDeviceTypes.MultiMediaDevice
? Modes.PrettifyModePage_1C_SFF(page.value)
: Modes.PrettifyModePage_1C(page.value));
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_1C_S01(page.value));
else goto default;
Modes.PrettifyModePage_1C_S01(page.value));
else
goto default;
break;
}
case 0x1D:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1D(page.value));
else goto default;
else
goto default;
break;
}
case 0x21:
{
if (vendor == "CERTANCE")
if(vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_21(page.value));
else goto default;
else
goto default;
break;
}
case 0x22:
{
if (vendor == "CERTANCE")
if(vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_22(page.value));
else goto default;
else
goto default;
break;
}
case 0x24:
{
if (vendor == "IBM")
if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_24(page.value));
else goto default;
else
goto default;
break;
}
case 0x2A:
{
if (page.subpage == 0)
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_2A(page.value));
else goto default;
else
goto default;
break;
}
case 0x2F:
{
if (vendor == "IBM")
if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_2F(page.value));
else goto default;
else
goto default;
break;
}
case 0x30:
{
if (Modes.IsAppleModePage_30(page.value))
if(Modes.IsAppleModePage_30(page.value))
modePages.Add("MODE page 30h", "Drive identifies as an Apple OEM drive");
else goto default;
else
goto default;
break;
}
case 0x3B:
{
if (vendor == "HP")
if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3B(page.value));
else goto default;
else
goto default;
break;
}
case 0x3C:
{
if (vendor == "HP")
if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3C(page.value));
else goto default;
else
goto default;
break;
}
case 0x3D:
{
if (vendor == "IBM")
if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_3D(page.value));
else if (vendor == "HP")
else if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3D(page.value));
else goto default;
else
goto default;
break;
}
case 0x3E:
{
if (vendor == "FUJITSU")
if(vendor == "FUJITSU")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyFujitsuModePage_3E(page.value));
else if (vendor == "HP")
else if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3E(page.value));
else goto default;
else
goto default;
break;
}
default:
{
modePages.Add(
page.subpage != 0
? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h"
: $"MODE page {page.page:X2}h",
"Unknown mode page");
modePages.
Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
"Unknown mode page");
}
break;
}
var newModePages = new Dictionary<string, string>();
foreach (var kvp in modePages)
Dictionary<string, string> newModePages = new Dictionary<string, string>();
foreach(KeyValuePair<string, string> kvp in modePages)
newModePages.Add(kvp.Key,
string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "<br/>"));
string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "<br/>"));
modePages = newModePages;
}

View File

@@ -37,21 +37,21 @@ namespace DiscImageChef.Server
{
public static class SscTestedMedia
{
/// <summary>
/// Takes the tested media from SCSI Streaming devices of a device report and prints it as a list of values
/// </summary>
/// <summary>Takes the tested media from SCSI Streaming devices of a device report and prints it as a list of values</summary>
/// <param name="mediaOneValue">List to put values on</param>
/// <param name="testedMedia">List of tested media</param>
public static void Report(IEnumerable<TestedSequentialMedia> testedMedia, ref List<string> mediaOneValue)
{
foreach (var media in testedMedia)
foreach(TestedSequentialMedia media in testedMedia)
{
if (!string.IsNullOrWhiteSpace(media.MediumTypeName))
if(!string.IsNullOrWhiteSpace(media.MediumTypeName))
{
mediaOneValue.Add($"<i>Information for medium named \"{media.MediumTypeName}\"</i>");
if (media.MediumType.HasValue) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
if(media.MediumType.HasValue)
mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
}
else if (media.MediumType.HasValue)
else if(media.MediumType.HasValue)
{
mediaOneValue.Add($"<i>Information for medium type {media.MediumType:X2}h</i>");
}
@@ -60,13 +60,20 @@ namespace DiscImageChef.Server
mediaOneValue.Add("<i>Information for unknown medium type</i>");
}
if (!string.IsNullOrWhiteSpace(media.Manufacturer))
if(!string.IsNullOrWhiteSpace(media.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}");
if (!string.IsNullOrWhiteSpace(media.Model)) mediaOneValue.Add($"Medium model: {media.Model}");
if (media.Density.HasValue) mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
if (media.CanReadMediaSerial == true) mediaOneValue.Add("Drive can read medium serial number.");
if (media.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium.");
if(!string.IsNullOrWhiteSpace(media.Model))
mediaOneValue.Add($"Medium model: {media.Model}");
if(media.Density.HasValue)
mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
if(media.CanReadMediaSerial == true)
mediaOneValue.Add("Drive can read medium serial number.");
if(media.MediaIsRecognized)
mediaOneValue.Add("Drive recognizes this medium.");
mediaOneValue.Add("");
}

View File

@@ -43,323 +43,447 @@ namespace DiscImageChef.Server
{
var ctx = new DicServerContext();
if (newStats.Commands != null)
if(newStats.Commands != null)
{
if (newStats.Commands.Analyze > 0)
if(newStats.Commands.Analyze > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Analyze, Name = "analyze"});
else existing.Count += newStats.Commands.Analyze;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Analyze, Name = "analyze"
});
else
existing.Count += newStats.Commands.Analyze;
}
if (newStats.Commands.Benchmark > 0)
if(newStats.Commands.Benchmark > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "benchmark");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "benchmark");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Benchmark, Name = "benchmark"});
else existing.Count += newStats.Commands.Benchmark;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Benchmark, Name = "benchmark"
});
else
existing.Count += newStats.Commands.Benchmark;
}
if (newStats.Commands.Checksum > 0)
if(newStats.Commands.Checksum > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "checksum");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "checksum");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Checksum, Name = "checksum"});
else existing.Count += newStats.Commands.Checksum;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Checksum, Name = "checksum"
});
else
existing.Count += newStats.Commands.Checksum;
}
if (newStats.Commands.Compare > 0)
if(newStats.Commands.Compare > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "compare");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "compare");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Compare, Name = "compare"});
else existing.Count += newStats.Commands.Compare;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Compare, Name = "compare"
});
else
existing.Count += newStats.Commands.Compare;
}
if (newStats.Commands.CreateSidecar > 0)
if(newStats.Commands.CreateSidecar > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar");
if (existing == null)
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.CreateSidecar, Name = "create-sidecar"
});
else existing.Count += newStats.Commands.CreateSidecar;
else
existing.Count += newStats.Commands.CreateSidecar;
}
if (newStats.Commands.Decode > 0)
if(newStats.Commands.Decode > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "decode");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "decode");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Decode, Name = "decode"});
else existing.Count += newStats.Commands.Decode;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Decode, Name = "decode"
});
else
existing.Count += newStats.Commands.Decode;
}
if (newStats.Commands.DeviceInfo > 0)
if(newStats.Commands.DeviceInfo > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-info");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-info");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceInfo, Name = "device-info"});
else existing.Count += newStats.Commands.DeviceInfo;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.DeviceInfo, Name = "device-info"
});
else
existing.Count += newStats.Commands.DeviceInfo;
}
if (newStats.Commands.DeviceReport > 0)
if(newStats.Commands.DeviceReport > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-report");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-report");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceReport, Name = "device-report"});
else existing.Count += newStats.Commands.DeviceReport;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.DeviceReport, Name = "device-report"
});
else
existing.Count += newStats.Commands.DeviceReport;
}
if (newStats.Commands.DumpMedia > 0)
if(newStats.Commands.DumpMedia > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "dump-media");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "dump-media");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DumpMedia, Name = "dump-media"});
else existing.Count += newStats.Commands.DumpMedia;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.DumpMedia, Name = "dump-media"
});
else
existing.Count += newStats.Commands.DumpMedia;
}
if (newStats.Commands.Entropy > 0)
if(newStats.Commands.Entropy > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "entropy");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "entropy");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Entropy, Name = "entropy"});
else existing.Count += newStats.Commands.Entropy;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Entropy, Name = "entropy"
});
else
existing.Count += newStats.Commands.Entropy;
}
if (newStats.Commands.Formats > 0)
if(newStats.Commands.Formats > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "formats");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "formats");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Formats, Name = "formats"});
else existing.Count += newStats.Commands.Formats;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Formats, Name = "formats"
});
else
existing.Count += newStats.Commands.Formats;
}
if (newStats.Commands.MediaInfo > 0)
if(newStats.Commands.MediaInfo > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-info");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-info");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.MediaInfo, Name = "media-info"});
else existing.Count += newStats.Commands.MediaInfo;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.MediaInfo, Name = "media-info"
});
else
existing.Count += newStats.Commands.MediaInfo;
}
if (newStats.Commands.MediaScan > 0)
if(newStats.Commands.MediaScan > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-scan");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-scan");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.MediaScan, Name = "media-scan"});
else existing.Count += newStats.Commands.MediaScan;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.MediaScan, Name = "media-scan"
});
else
existing.Count += newStats.Commands.MediaScan;
}
if (newStats.Commands.PrintHex > 0)
if(newStats.Commands.PrintHex > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "printhex");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "printhex");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.PrintHex, Name = "printhex"});
else existing.Count += newStats.Commands.PrintHex;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.PrintHex, Name = "printhex"
});
else
existing.Count += newStats.Commands.PrintHex;
}
if (newStats.Commands.Verify > 0)
if(newStats.Commands.Verify > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "verify");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "verify");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Verify, Name = "verify"});
else existing.Count += newStats.Commands.Verify;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Verify, Name = "verify"
});
else
existing.Count += newStats.Commands.Verify;
}
if (newStats.Commands.Ls > 0)
if(newStats.Commands.Ls > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "ls");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "ls");
if (existing == null) ctx.Commands.Add(new Command {Count = newStats.Commands.Ls, Name = "ls"});
else existing.Count += newStats.Commands.Ls;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.Ls, Name = "ls"
});
else
existing.Count += newStats.Commands.Ls;
}
if (newStats.Commands.ExtractFiles > 0)
if(newStats.Commands.ExtractFiles > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "extract-files");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "extract-files");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ExtractFiles, Name = "extract-files"});
else existing.Count += newStats.Commands.ExtractFiles;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ExtractFiles, Name = "extract-files"
});
else
existing.Count += newStats.Commands.ExtractFiles;
}
if (newStats.Commands.ListDevices > 0)
if(newStats.Commands.ListDevices > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-devices");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-devices");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ListDevices, Name = "list-devices"});
else existing.Count += newStats.Commands.ListDevices;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ListDevices, Name = "list-devices"
});
else
existing.Count += newStats.Commands.ListDevices;
}
if (newStats.Commands.ListEncodings > 0)
if(newStats.Commands.ListEncodings > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings");
if (existing == null)
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ListEncodings, Name = "list-encodings"
});
else existing.Count += newStats.Commands.ListEncodings;
else
existing.Count += newStats.Commands.ListEncodings;
}
if (newStats.Commands.ConvertImage > 0)
if(newStats.Commands.ConvertImage > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "convert-image");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "convert-image");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ConvertImage, Name = "convert-image"});
else existing.Count += newStats.Commands.ConvertImage;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ConvertImage, Name = "convert-image"
});
else
existing.Count += newStats.Commands.ConvertImage;
}
if (newStats.Commands.ImageInfo > 0)
if(newStats.Commands.ImageInfo > 0)
{
var existing = ctx.Commands.FirstOrDefault(c => c.Name == "image-info");
Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "image-info");
if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ImageInfo, Name = "image-info"});
else existing.Count += newStats.Commands.ImageInfo;
if(existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ImageInfo, Name = "image-info"
});
else
existing.Count += newStats.Commands.ImageInfo;
}
}
if (newStats.OperatingSystems != null)
if(newStats.OperatingSystems != null)
{
foreach (var operatingSystem in newStats.OperatingSystems)
foreach(OsStats operatingSystem in newStats.OperatingSystems)
{
if (string.IsNullOrWhiteSpace(operatingSystem.name) ||
string.IsNullOrWhiteSpace(operatingSystem.version)) continue;
if(string.IsNullOrWhiteSpace(operatingSystem.name) ||
string.IsNullOrWhiteSpace(operatingSystem.version))
continue;
var existing =
ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
OperatingSystem existing =
ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
c.Version == operatingSystem.version);
if (existing == null)
if(existing == null)
ctx.OperatingSystems.Add(new OperatingSystem
{
Count = operatingSystem.Value,
Name = operatingSystem.name,
Count = operatingSystem.Value, Name = operatingSystem.name,
Version = operatingSystem.version
});
else existing.Count += operatingSystem.Value;
else
existing.Count += operatingSystem.Value;
}
}
else
{
var existing =
OperatingSystem existing =
ctx.OperatingSystems.FirstOrDefault(c => c.Name == "Linux" && c.Version == null);
if (existing == null) ctx.OperatingSystems.Add(new OperatingSystem {Count = 1, Name = "Linux"});
else existing.Count++;
if(existing == null)
ctx.OperatingSystems.Add(new OperatingSystem
{
Count = 1, Name = "Linux"
});
else
existing.Count++;
}
if (newStats.Versions != null)
if(newStats.Versions != null)
{
foreach (var nvs in newStats.Versions)
foreach(NameValueStats nvs in newStats.Versions)
{
if (string.IsNullOrWhiteSpace(nvs.name)) continue;
if(string.IsNullOrWhiteSpace(nvs.name))
continue;
var existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
Version existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
if (existing == null) ctx.Versions.Add(new Version {Count = nvs.Value, Value = nvs.name});
else existing.Count += nvs.Value;
if(existing == null)
ctx.Versions.Add(new Version
{
Count = nvs.Value, Value = nvs.name
});
else
existing.Count += nvs.Value;
}
}
else
{
var existing = ctx.Versions.FirstOrDefault(c => c.Value == "previous");
Version existing = ctx.Versions.FirstOrDefault(c => c.Value == "previous");
if (existing == null) ctx.Versions.Add(new Version {Count = 1, Value = "previous"});
else existing.Count++;
if(existing == null)
ctx.Versions.Add(new Version
{
Count = 1, Value = "previous"
});
else
existing.Count++;
}
if (newStats.Filesystems != null)
foreach (var nvs in newStats.Filesystems)
if(newStats.Filesystems != null)
foreach(NameValueStats nvs in newStats.Filesystems)
{
if (string.IsNullOrWhiteSpace(nvs.name)) continue;
if(string.IsNullOrWhiteSpace(nvs.name))
continue;
var existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
Filesystem existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
if (existing == null) ctx.Filesystems.Add(new Filesystem {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
if(existing == null)
ctx.Filesystems.Add(new Filesystem
{
Count = nvs.Value, Name = nvs.name
});
else
existing.Count += nvs.Value;
}
if (newStats.Partitions != null)
foreach (var nvs in newStats.Partitions)
if(newStats.Partitions != null)
foreach(NameValueStats nvs in newStats.Partitions)
{
if (string.IsNullOrWhiteSpace(nvs.name)) continue;
if(string.IsNullOrWhiteSpace(nvs.name))
continue;
var existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
Partition existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
if (existing == null) ctx.Partitions.Add(new Partition {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
if(existing == null)
ctx.Partitions.Add(new Partition
{
Count = nvs.Value, Name = nvs.name
});
else
existing.Count += nvs.Value;
}
if (newStats.MediaImages != null)
foreach (var nvs in newStats.MediaImages)
if(newStats.MediaImages != null)
foreach(NameValueStats nvs in newStats.MediaImages)
{
if (string.IsNullOrWhiteSpace(nvs.name)) continue;
if(string.IsNullOrWhiteSpace(nvs.name))
continue;
var existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
MediaFormat existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
if (existing == null) ctx.MediaFormats.Add(new MediaFormat {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
if(existing == null)
ctx.MediaFormats.Add(new MediaFormat
{
Count = nvs.Value, Name = nvs.name
});
else
existing.Count += nvs.Value;
}
if (newStats.Filters != null)
foreach (var nvs in newStats.Filters)
if(newStats.Filters != null)
foreach(NameValueStats nvs in newStats.Filters)
{
if (string.IsNullOrWhiteSpace(nvs.name)) continue;
if(string.IsNullOrWhiteSpace(nvs.name))
continue;
var existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
Filter existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
if (existing == null) ctx.Filters.Add(new Filter {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
if(existing == null)
ctx.Filters.Add(new Filter
{
Count = nvs.Value, Name = nvs.name
});
else
existing.Count += nvs.Value;
}
if (newStats.Devices != null)
foreach (var device in newStats.Devices)
if(newStats.Devices != null)
foreach(DeviceStats device in newStats.Devices)
{
if (string.IsNullOrWhiteSpace(device.Model)) continue;
if(string.IsNullOrWhiteSpace(device.Model))
continue;
if (!ctx.DeviceStats.Any(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer &&
c.Model == device.Model && c.Revision == device.Revision))
if(!ctx.DeviceStats.Any(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer &&
c.Model == device.Model && c.Revision == device.Revision))
ctx.DeviceStats.Add(new DeviceStat
{
Bus = device.Bus,
Manufacturer = device.Manufacturer,
Model = device.Model,
Bus = device.Bus, Manufacturer = device.Manufacturer, Model = device.Model,
Revision = device.Revision
});
}
if (newStats.Medias != null)
foreach (var media in newStats.Medias)
if(newStats.Medias != null)
foreach(MediaStats media in newStats.Medias)
{
if (string.IsNullOrWhiteSpace(media.type)) continue;
if(string.IsNullOrWhiteSpace(media.type))
continue;
var existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
Media existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
if (existing == null)
ctx.Medias.Add(new Media {Count = media.Value, Real = media.real, Type = media.type});
else existing.Count += media.Value;
if(existing == null)
ctx.Medias.Add(new Media
{
Count = media.Value, Real = media.real, Type = media.type
});
else
existing.Count += media.Value;
}
ctx.SaveChanges();

View File

@@ -36,23 +36,22 @@ namespace DiscImageChef.Server.App_Start
{
public static class TestedMedia
{
/// <summary>
/// Takes the tested media from a device report and prints it as a list of values
/// </summary>
/// <summary>Takes the tested media from a device report and prints it as a list of values</summary>
/// <param name="ata"><c>true</c> if device report is from an ATA device</param>
/// <param name="mediaOneValue">List to put values on</param>
/// <param name="testedMedias">List of tested media</param>
public static void Report(List<CommonTypes.Metadata.TestedMedia> testedMedias, ref List<string> mediaOneValue)
{
foreach (var testedMedia in testedMedias)
foreach(CommonTypes.Metadata.TestedMedia testedMedia in testedMedias)
{
if (!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
{
mediaOneValue.Add($"<i>Information for medium named \"{testedMedia.MediumTypeName}\"</i>");
if (testedMedia.MediumType != null)
if(testedMedia.MediumType != null)
mediaOneValue.Add($"Medium type code: {testedMedia.MediumType:X2}h");
}
else if (testedMedia.MediumType != null)
else if(testedMedia.MediumType != null)
{
mediaOneValue.Add($"<i>Information for medium type {testedMedia.MediumType:X2}h</i>");
}
@@ -61,265 +60,318 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add("<i>Information for unknown medium type</i>");
}
mediaOneValue.Add(testedMedia.MediaIsRecognized
? "Drive recognizes this medium."
: "Drive does not recognize this medium.");
mediaOneValue.Add(testedMedia.MediaIsRecognized ? "Drive recognizes this medium."
: "Drive does not recognize this medium.");
if (!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}");
if (!string.IsNullOrWhiteSpace(testedMedia.Model))
mediaOneValue.Add($"Medium model: {testedMedia.Model}");
if (testedMedia.Density != null) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
if (testedMedia.BlockSize != null)
if(!string.IsNullOrWhiteSpace(testedMedia.Model))
mediaOneValue.Add($"Medium model: {testedMedia.Model}");
if(testedMedia.Density != null)
mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
if(testedMedia.BlockSize != null)
mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes");
if (testedMedia.PhysicalBlockSize != null)
if(testedMedia.PhysicalBlockSize != null)
mediaOneValue.Add($"Physical sector size: {testedMedia.PhysicalBlockSize} bytes");
if (testedMedia.LongBlockSize != null)
if(testedMedia.LongBlockSize != null)
mediaOneValue.Add($"READ LONG sector size: {testedMedia.LongBlockSize} bytes");
if (testedMedia.Blocks != null && testedMedia.BlockSize != null)
if(testedMedia.Blocks != null &&
testedMedia.BlockSize != null)
{
mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each");
if (testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
.Add(
$"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if (testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
.Add(
$"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue.
Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue.
Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
.Add(
$"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
mediaOneValue.
Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if (testedMedia.CHS != null && testedMedia.CurrentCHS != null)
if(testedMedia.CHS != null &&
testedMedia.CurrentCHS != null)
{
var currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads *
int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads *
testedMedia.CurrentCHS.Sectors;
mediaOneValue
.Add(
$"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current");
mediaOneValue.
Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current");
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads} max., {testedMedia.CurrentCHS.Heads} current");
mediaOneValue
.Add(
$"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current");
mediaOneValue
.Add(
$"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current");
mediaOneValue
.Add(
$"Medium size in CHS mode: {(ulong) currentSectors * testedMedia.BlockSize} bytes, {(ulong) currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
mediaOneValue.
Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current");
mediaOneValue.
Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current");
mediaOneValue.
Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
else if (testedMedia.CHS != null)
else if(testedMedia.CHS != null)
{
var currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors;
int currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors;
mediaOneValue.Add($"Cylinders: {testedMedia.CHS.Cylinders}");
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads}");
mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}");
mediaOneValue.Add($"Sectors addressable in CHS mode: {currentSectors}");
mediaOneValue
.Add(
$"Medium size in CHS mode: {(ulong) currentSectors * testedMedia.BlockSize} bytes, {(ulong) currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
mediaOneValue.
Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if (testedMedia.LBASectors != null)
if(testedMedia.LBASectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}");
if ((ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
.Add(
$"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if ((ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
.Add(
$"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue.
Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue.
Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
.Add(
$"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
mediaOneValue.
Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if (testedMedia.LBA48Sectors != null)
if(testedMedia.LBA48Sectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}");
if (testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
.Add(
$"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if (testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
.Add(
$"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue.
Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue.
Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
.Add(
$"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
mediaOneValue.
Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
if (testedMedia.NominalRotationRate != null && testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF)
mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001
? "Medium does not rotate."
: $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
if(testedMedia.NominalRotationRate != null &&
testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF)
mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001 ? "Medium does not rotate."
: $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
if (testedMedia.BlockSize != null &&
testedMedia.PhysicalBlockSize != null &&
testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000)
mediaOneValue
.Add(
$"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
if(testedMedia.BlockSize != null &&
testedMedia.PhysicalBlockSize != null &&
testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000)
mediaOneValue.
Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
if (testedMedia.SupportsReadSectors == true)
if(testedMedia.SupportsReadSectors == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium");
if (testedMedia.SupportsReadRetry == true)
if(testedMedia.SupportsReadRetry == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in CHS mode with this medium");
if (testedMedia.SupportsReadDma == true)
if(testedMedia.SupportsReadDma == true)
mediaOneValue.Add("Device can use the READ DMA command in CHS mode with this medium");
if (testedMedia.SupportsReadDmaRetry == true)
if(testedMedia.SupportsReadDmaRetry == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in CHS mode with this medium");
if (testedMedia.SupportsReadLong == true)
if(testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG command in CHS mode with this medium");
if (testedMedia.SupportsReadLongRetry == true)
if(testedMedia.SupportsReadLongRetry == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in CHS mode with this medium");
if (testedMedia.SupportsReadLba == true)
if(testedMedia.SupportsReadLba == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 28-bit LBA mode with this medium");
if (testedMedia.SupportsReadRetryLba == true)
mediaOneValue
.Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium");
if (testedMedia.SupportsReadDmaLba == true)
if(testedMedia.SupportsReadRetryLba == true)
mediaOneValue.
Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaLba == true)
mediaOneValue.Add("Device can use the READ DMA command in 28-bit LBA mode with this medium");
if (testedMedia.SupportsReadDmaRetryLba == true)
if(testedMedia.SupportsReadDmaRetryLba == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in 28-bit LBA mode with this medium");
if (testedMedia.SupportsReadLongLba == true)
if(testedMedia.SupportsReadLongLba == true)
mediaOneValue.Add("Device can use the READ LONG command in 28-bit LBA mode with this medium");
if (testedMedia.SupportsReadLongRetryLba == true)
if(testedMedia.SupportsReadLongRetryLba == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in 28-bit LBA mode with this medium");
if (testedMedia.SupportsReadLba48 == true)
if(testedMedia.SupportsReadLba48 == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 48-bit LBA mode with this medium");
if (testedMedia.SupportsReadDmaLba48 == true)
if(testedMedia.SupportsReadDmaLba48 == true)
mediaOneValue.Add("Device can use the READ DMA command in 48-bit LBA mode with this medium");
if (testedMedia.SupportsSeek == true)
if(testedMedia.SupportsSeek == true)
mediaOneValue.Add("Device can use the SEEK command in CHS mode with this medium");
if (testedMedia.SupportsSeekLba == true)
if(testedMedia.SupportsSeekLba == true)
mediaOneValue.Add("Device can use the SEEK command in 28-bit LBA mode with this medium");
if (testedMedia.SupportsReadCapacity == true)
if(testedMedia.SupportsReadCapacity == true)
mediaOneValue.Add("Device can use the READ CAPACITY (10) command with this medium");
if (testedMedia.SupportsReadCapacity16 == true)
if(testedMedia.SupportsReadCapacity16 == true)
mediaOneValue.Add("Device can use the READ CAPACITY (16) command with this medium");
if (testedMedia.SupportsRead6 == true)
if(testedMedia.SupportsRead6 == true)
mediaOneValue.Add("Device can use the READ (6) command with this medium");
if (testedMedia.SupportsRead10 == true)
if(testedMedia.SupportsRead10 == true)
mediaOneValue.Add("Device can use the READ (10) command with this medium");
if (testedMedia.SupportsRead12 == true)
if(testedMedia.SupportsRead12 == true)
mediaOneValue.Add("Device can use the READ (12) command with this medium");
if (testedMedia.SupportsRead16 == true)
if(testedMedia.SupportsRead16 == true)
mediaOneValue.Add("Device can use the READ (16) command with this medium");
if (testedMedia.SupportsReadLong == true)
if(testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG (10) command with this medium");
if (testedMedia.SupportsReadLong16 == true)
if(testedMedia.SupportsReadLong16 == true)
mediaOneValue.Add("Device can use the READ LONG (16) command with this medium");
if (testedMedia.SupportsReadCd == true)
if(testedMedia.SupportsReadCd == true)
mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium");
if (testedMedia.SupportsReadCdMsf == true)
mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium");
if (testedMedia.SupportsReadCdRaw == true)
mediaOneValue
.Add(
"Device can use the READ CD command with LBA addressing with this medium to read raw sector");
if (testedMedia.SupportsReadCdMsfRaw == true)
mediaOneValue
.Add(
"Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector");
if (testedMedia.SupportsHLDTSTReadRawDVD == true)
if(testedMedia.SupportsReadCdMsf == true)
mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium");
if(testedMedia.SupportsReadCdRaw == true)
mediaOneValue.
Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector");
if(testedMedia.SupportsReadCdMsfRaw == true)
mediaOneValue.
Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector");
if(testedMedia.SupportsHLDTSTReadRawDVD == true)
mediaOneValue.Add("Device can use the HL-DT-ST vendor READ DVD (RAW) command with this medium");
if (testedMedia.SupportsNECReadCDDA == true)
if(testedMedia.SupportsNECReadCDDA == true)
mediaOneValue.Add("Device can use the NEC vendor READ CD-DA command with this medium");
if (testedMedia.SupportsPioneerReadCDDA == true)
if(testedMedia.SupportsPioneerReadCDDA == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA command with this medium");
if (testedMedia.SupportsPioneerReadCDDAMSF == true)
if(testedMedia.SupportsPioneerReadCDDAMSF == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA MSF command with this medium");
if (testedMedia.SupportsPlextorReadCDDA == true)
if(testedMedia.SupportsPlextorReadCDDA == true)
mediaOneValue.Add("Device can use the PLEXTOR vendor READ CD-DA command with this medium");
if (testedMedia.SupportsPlextorReadRawDVD == true)
if(testedMedia.SupportsPlextorReadRawDVD == true)
mediaOneValue.Add("Device can use the PLEXOR vendor READ DVD (RAW) command with this medium");
if (testedMedia.CanReadAACS == true)
if(testedMedia.CanReadAACS == true)
mediaOneValue.Add("Device can read the Advanced Access Content System from this medium");
if (testedMedia.CanReadADIP == true)
if(testedMedia.CanReadADIP == true)
mediaOneValue.Add("Device can read the DVD ADress-In-Pregroove from this medium");
if (testedMedia.CanReadATIP == true)
if(testedMedia.CanReadATIP == true)
mediaOneValue.Add("Device can read the CD Absolute-Time-In-Pregroove from this medium");
if (testedMedia.CanReadBCA == true)
if(testedMedia.CanReadBCA == true)
mediaOneValue.Add("Device can read the Burst Cutting Area from this medium");
if (testedMedia.CanReadC2Pointers == true)
if(testedMedia.CanReadC2Pointers == true)
mediaOneValue.Add("Device can report the C2 pointers when reading from this medium");
if (testedMedia.CanReadCMI == true)
if(testedMedia.CanReadCMI == true)
mediaOneValue.Add("Device can read the Copyright Management Information from this medium");
if (testedMedia.CanReadCorrectedSubchannel == true)
if(testedMedia.CanReadCorrectedSubchannel == true)
mediaOneValue.Add("Device can correct subchannels when reading from this medium");
if (testedMedia.CanReadCorrectedSubchannelWithC2 == true)
mediaOneValue
.Add("Device can correct subchannels and report the C2 pointers when reading from this medium");
if (testedMedia.CanReadDCB == true)
if(testedMedia.CanReadCorrectedSubchannelWithC2 == true)
mediaOneValue.
Add("Device can correct subchannels and report the C2 pointers when reading from this medium");
if(testedMedia.CanReadDCB == true)
mediaOneValue.Add("Device can read the Disc Control Blocks from this medium");
if (testedMedia.CanReadDDS == true)
if(testedMedia.CanReadDDS == true)
mediaOneValue.Add("Device can read the Disc Definition Structure from this medium");
if (testedMedia.CanReadDMI == true)
if(testedMedia.CanReadDMI == true)
mediaOneValue.Add("Device can read the Disc Manufacurer Information from this medium");
if (testedMedia.CanReadDiscInformation == true)
if(testedMedia.CanReadDiscInformation == true)
mediaOneValue.Add("Device can read the Disc Information from this medium");
if (testedMedia.CanReadFullTOC == true)
if(testedMedia.CanReadFullTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium, without processing it");
if (testedMedia.CanReadHDCMI == true)
if(testedMedia.CanReadHDCMI == true)
mediaOneValue.Add("Device can read the HD DVD Copyright Management Information from this medium");
if (testedMedia.CanReadLayerCapacity == true)
if(testedMedia.CanReadLayerCapacity == true)
mediaOneValue.Add("Device can read the layer capacity from this medium");
if (testedMedia.CanReadFirstTrackPreGap == true)
if(testedMedia.CanReadFirstTrackPreGap == true)
mediaOneValue.Add("Device can read the first track's pregap data");
if (testedMedia.CanReadLeadIn == true)
if(testedMedia.CanReadLeadIn == true)
mediaOneValue.Add("Device can read the Lead-In from this medium");
if (testedMedia.CanReadLeadOut == true)
if(testedMedia.CanReadLeadOut == true)
mediaOneValue.Add("Device can read the Lead-Out from this medium");
if (testedMedia.CanReadMediaID == true)
if(testedMedia.CanReadMediaID == true)
mediaOneValue.Add("Device can read the Media ID from this medium");
if (testedMedia.CanReadMediaSerial == true)
if(testedMedia.CanReadMediaSerial == true)
mediaOneValue.Add("Device can read the Media Serial Number from this medium");
if (testedMedia.CanReadPAC == true) mediaOneValue.Add("Device can read the PAC from this medium");
if (testedMedia.CanReadPFI == true)
if(testedMedia.CanReadPAC == true)
mediaOneValue.Add("Device can read the PAC from this medium");
if(testedMedia.CanReadPFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from this medium");
if (testedMedia.CanReadPMA == true)
if(testedMedia.CanReadPMA == true)
mediaOneValue.Add("Device can read the Power Management Area from this medium");
if (testedMedia.CanReadPQSubchannel == true)
if(testedMedia.CanReadPQSubchannel == true)
mediaOneValue.Add("Device can read the P to Q subchannels from this medium");
if (testedMedia.CanReadPQSubchannelWithC2 == true)
mediaOneValue
.Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers");
if (testedMedia.CanReadPRI == true)
if(testedMedia.CanReadPQSubchannelWithC2 == true)
mediaOneValue.
Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadPRI == true)
mediaOneValue.Add("Device can read the Pre-Recorded Information from this medium");
if (testedMedia.CanReadRWSubchannel == true)
if(testedMedia.CanReadRWSubchannel == true)
mediaOneValue.Add("Device can read the R to W subchannels from this medium");
if (testedMedia.CanReadRWSubchannelWithC2 == true)
mediaOneValue
.Add("Device can read the R to W subchannels from this medium reporting the C2 pointers");
if (testedMedia.CanReadRecordablePFI == true)
if(testedMedia.CanReadRWSubchannelWithC2 == true)
mediaOneValue.
Add("Device can read the R to W subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadRecordablePFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from Lead-In from this medium");
if (testedMedia.CanReadSpareAreaInformation == true)
if(testedMedia.CanReadSpareAreaInformation == true)
mediaOneValue.Add("Device can read the Spare Area Information from this medium");
if (testedMedia.CanReadTOC == true)
if(testedMedia.CanReadTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium");
mediaOneValue.Add("");