REFACTOR: Convert 'if' statement to 'switch' statement.

This commit is contained in:
2017-12-21 04:43:29 +00:00
parent df2fb651e4
commit 9cd1869d1d
55 changed files with 4429 additions and 4192 deletions

View File

@@ -457,15 +457,19 @@ namespace DiscImageChef.Decoders.CD
switch(sec)
{
case 15:
if(frm == 00) return "TDK Corporation";
if(frm == 10) return "Ritek Co.";
if(frm == 20) return "Mitsubishi Chemical Corporation";
if(frm == 30) return "NAN-YA Plastics Corporation";
switch(frm) {
case 00: return "TDK Corporation";
case 10: return "Ritek Co.";
case 20: return "Mitsubishi Chemical Corporation";
case 30: return "NAN-YA Plastics Corporation";
}
break;
case 16:
if(frm == 20) return "Shenzen SG&Gast Digital Optical Discs";
if(frm == 30) return "Grand Advance Technology Ltd.";
switch(frm) {
case 20: return "Shenzen SG&Gast Digital Optical Discs";
case 30: return "Grand Advance Technology Ltd.";
}
break;
case 17:
@@ -473,8 +477,10 @@ namespace DiscImageChef.Decoders.CD
break;
case 18:
if(frm == 10) return "Wealth Fair Investment Ltd.";
if(frm == 60) return "Taroko International Co. Ltd.";
switch(frm) {
case 10: return "Wealth Fair Investment Ltd.";
case 60: return "Taroko International Co. Ltd.";
}
break;
case 20:
@@ -482,88 +488,106 @@ namespace DiscImageChef.Decoders.CD
break;
case 21:
if(frm == 10) return "Grupo Condor S.L.";
if(frm == 30) return "Bestdisc Technology Corporation";
if(frm == 40) return "Optical Disc Manufacturing Equipment";
if(frm == 50) return "Sound Sound Multi-Media Development Ltd.";
switch(frm) {
case 10: return "Grupo Condor S.L.";
case 30: return "Bestdisc Technology Corporation";
case 40: return "Optical Disc Manufacturing Equipment";
case 50: return "Sound Sound Multi-Media Development Ltd.";
}
break;
case 22:
if(frm == 00) return "Woongjin Media Corp.";
if(frm == 10) return "Seantram Technology Inc.";
if(frm == 20) return "Advanced Digital Media";
if(frm == 30) return "EXIMPO";
if(frm == 40) return "CIS Technology Inc.";
if(frm == 50) return "Hong Kong Digital Technology Co., Ltd.";
if(frm == 60) return "Acer Media Technology, Inc.";
switch(frm) {
case 00: return "Woongjin Media Corp.";
case 10: return "Seantram Technology Inc.";
case 20: return "Advanced Digital Media";
case 30: return "EXIMPO";
case 40: return "CIS Technology Inc.";
case 50: return "Hong Kong Digital Technology Co., Ltd.";
case 60: return "Acer Media Technology, Inc.";
}
break;
case 23:
if(frm == 00) return "Matsushita Electric Industrial Co., Ltd.";
if(frm == 10) return "Doremi Media Co., Ltd.";
if(frm == 20) return "Nacar Media s.r.l.";
if(frm == 30) return "Audio Distributors Co., Ltd.";
if(frm == 40) return "Victor Company of Japan, Ltd.";
if(frm == 50) return "Optrom Inc.";
if(frm == 60) return "Customer Pressing Oosterhout";
switch(frm) {
case 00: return "Matsushita Electric Industrial Co., Ltd.";
case 10: return "Doremi Media Co., Ltd.";
case 20: return "Nacar Media s.r.l.";
case 30: return "Audio Distributors Co., Ltd.";
case 40: return "Victor Company of Japan, Ltd.";
case 50: return "Optrom Inc.";
case 60: return "Customer Pressing Oosterhout";
}
break;
case 24:
if(frm == 00) return "Taiyo Yuden Company Ltd.";
if(frm == 10) return "SONY Corporation";
if(frm == 20) return "Computer Support Italy s.r.l.";
if(frm == 30) return "Unitech Japan Inc.";
if(frm == 40) return "kdg mediatech AG";
if(frm == 50) return "Guann Yinn Co., Ltd.";
if(frm == 60) return "Harmonic Hall Optical Disc Ltd.";
switch(frm) {
case 00: return "Taiyo Yuden Company Ltd.";
case 10: return "SONY Corporation";
case 20: return "Computer Support Italy s.r.l.";
case 30: return "Unitech Japan Inc.";
case 40: return "kdg mediatech AG";
case 50: return "Guann Yinn Co., Ltd.";
case 60: return "Harmonic Hall Optical Disc Ltd.";
}
break;
case 25:
if(frm == 00) return "MPO";
if(frm == 20) return "Hitachi Maxell, Ltd.";
if(frm == 30) return "Infodisc Technology Co. Ltd.";
if(frm == 40) return "Vivastar AG";
if(frm == 50) return "AMS Technology Inc.";
if(frm == 60) return "Xcitec Inc.";
switch(frm) {
case 00: return "MPO";
case 20: return "Hitachi Maxell, Ltd.";
case 30: return "Infodisc Technology Co. Ltd.";
case 40: return "Vivastar AG";
case 50: return "AMS Technology Inc.";
case 60: return "Xcitec Inc.";
}
break;
case 26:
if(frm == 00) return "Fornet International Pte Ltd.";
if(frm == 10) return "POSTECH Corporation";
if(frm == 20) return "SKC Co., Ltd.";
if(frm == 30) return "Optical Disc Corporation";
if(frm == 40) return "FUJI Photo Film Co., Ltd.";
if(frm == 50) return "Lead Data Inc.";
if(frm == 60) return "CMC Magnetics Corporation";
switch(frm) {
case 00: return "Fornet International Pte Ltd.";
case 10: return "POSTECH Corporation";
case 20: return "SKC Co., Ltd.";
case 30: return "Optical Disc Corporation";
case 40: return "FUJI Photo Film Co., Ltd.";
case 50: return "Lead Data Inc.";
case 60: return "CMC Magnetics Corporation";
}
break;
case 27:
if(frm == 00) return "Digital Storage Technology Co., Ltd.";
if(frm == 10) return "Plasmon Data systems Ltd.";
if(frm == 20) return "Princo Corporation";
if(frm == 30) return "Pioneer Video Corporation";
if(frm == 40) return "Kodak Japan Ltd.";
if(frm == 50) return "Mitsui Chemicals, Inc.";
if(frm == 60) return "Ricoh Company Ltd.";
switch(frm) {
case 00: return "Digital Storage Technology Co., Ltd.";
case 10: return "Plasmon Data systems Ltd.";
case 20: return "Princo Corporation";
case 30: return "Pioneer Video Corporation";
case 40: return "Kodak Japan Ltd.";
case 50: return "Mitsui Chemicals, Inc.";
case 60: return "Ricoh Company Ltd.";
}
break;
case 28:
if(frm == 00) return "Opti.Me.S. S.p.A.";
if(frm == 10) return "Gigastore Corporation";
if(frm == 20) return "Multi Media Masters & Machinary SA";
if(frm == 30) return "Auvistar Industry Co., Ltd.";
if(frm == 40) return "King Pro Mediatek Inc.";
if(frm == 50) return "Delphi Technology Inc.";
if(frm == 60) return "Friendly CD-Tek Co.";
switch(frm) {
case 00: return "Opti.Me.S. S.p.A.";
case 10: return "Gigastore Corporation";
case 20: return "Multi Media Masters & Machinary SA";
case 30: return "Auvistar Industry Co., Ltd.";
case 40: return "King Pro Mediatek Inc.";
case 50: return "Delphi Technology Inc.";
case 60: return "Friendly CD-Tek Co.";
}
break;
case 29:
if(frm == 00) return "Taeil Media Co., Ltd.";
if(frm == 10) return "Vanguard Disc Inc.";
if(frm == 20) return "Unidisc Technology Co., Ltd.";
if(frm == 30) return "Hile Optical Disc Technology Corp.";
if(frm == 40) return "Viva Magnetics Ltd.";
if(frm == 50) return "General Magnetics Ltd.";
switch(frm) {
case 00: return "Taeil Media Co., Ltd.";
case 10: return "Vanguard Disc Inc.";
case 20: return "Unidisc Technology Co., Ltd.";
case 30: return "Hile Optical Disc Technology Corp.";
case 40: return "Viva Magnetics Ltd.";
case 50: return "General Magnetics Ltd.";
}
break;
case 30:
@@ -571,13 +595,17 @@ namespace DiscImageChef.Decoders.CD
break;
case 31:
if(frm == 00) return "Ritek Co.";
if(frm == 30) return "Grand Advance Technology Ltd.";
switch(frm) {
case 00: return "Ritek Co.";
case 30: return "Grand Advance Technology Ltd.";
}
break;
case 32:
if(frm == 00) return "TDK Corporation";
if(frm == 10) return "Prodisc Technology Inc.";
switch(frm) {
case 00: return "TDK Corporation";
case 10: return "Prodisc Technology Inc.";
}
break;
case 34:
@@ -589,61 +617,75 @@ namespace DiscImageChef.Decoders.CD
break;
case 45:
if(frm == 00) return "Fornet International Pte Ltd.";
if(frm == 10) return "Unitech Japan Inc.";
if(frm == 20) return "Acer Media Technology, Inc.";
if(frm == 40) return "CIS Technology Inc.";
if(frm == 50) return "Guann Yinn Co., Ltd.";
if(frm == 60) return "Xcitec Inc.";
switch(frm) {
case 00: return "Fornet International Pte Ltd.";
case 10: return "Unitech Japan Inc.";
case 20: return "Acer Media Technology, Inc.";
case 40: return "CIS Technology Inc.";
case 50: return "Guann Yinn Co., Ltd.";
case 60: return "Xcitec Inc.";
}
break;
case 46:
if(frm == 00) return "Taiyo Yuden Company Ltd.";
if(frm == 10) return "Hong Kong Digital Technology Co., Ltd.";
if(frm == 20) return "Multi Media Masters & Machinary SA";
if(frm == 30) return "Computer Support Italy s.r.l.";
if(frm == 40) return "FUJI Photo Film Co., Ltd.";
if(frm == 50) return "Auvistar Industry Co., Ltd.";
if(frm == 60) return "CMC Magnetics Corporation";
switch(frm) {
case 00: return "Taiyo Yuden Company Ltd.";
case 10: return "Hong Kong Digital Technology Co., Ltd.";
case 20: return "Multi Media Masters & Machinary SA";
case 30: return "Computer Support Italy s.r.l.";
case 40: return "FUJI Photo Film Co., Ltd.";
case 50: return "Auvistar Industry Co., Ltd.";
case 60: return "CMC Magnetics Corporation";
}
break;
case 47:
if(frm == 10) return "Hitachi Maxell, Ltd.";
if(frm == 20) return "Princo Corporation";
if(frm == 40) return "POSTECH Corporation";
if(frm == 50) return "Ritek Co.";
if(frm == 60) return "Prodisc Technology Inc.";
switch(frm) {
case 10: return "Hitachi Maxell, Ltd.";
case 20: return "Princo Corporation";
case 40: return "POSTECH Corporation";
case 50: return "Ritek Co.";
case 60: return "Prodisc Technology Inc.";
}
break;
case 48:
if(frm == 00) return "Ricoh Company Ltd.";
if(frm == 10) return "Kodak Japan Ltd.";
if(frm == 20) return "Plasmon Data systems Ltd.";
if(frm == 30) return "Pioneer Video Corporation";
if(frm == 40) return "Digital Storage Technology Co., Ltd.";
if(frm == 50) return "Mitsui Chemicals, Inc.";
if(frm == 60) return "Lead Data Inc.";
switch(frm) {
case 00: return "Ricoh Company Ltd.";
case 10: return "Kodak Japan Ltd.";
case 20: return "Plasmon Data systems Ltd.";
case 30: return "Pioneer Video Corporation";
case 40: return "Digital Storage Technology Co., Ltd.";
case 50: return "Mitsui Chemicals, Inc.";
case 60: return "Lead Data Inc.";
}
break;
case 49:
if(frm == 00) return "TDK Corporation";
if(frm == 10) return "Gigastore Corporation";
if(frm == 20) return "King Pro Mediatek Inc.";
if(frm == 30) return "Opti.Me.S. S.p.A.";
if(frm == 40) return "Victor Company of Japan, Ltd.";
if(frm == 60) return "Matsushita Electric Industrial Co., Ltd.";
switch(frm) {
case 00: return "TDK Corporation";
case 10: return "Gigastore Corporation";
case 20: return "King Pro Mediatek Inc.";
case 30: return "Opti.Me.S. S.p.A.";
case 40: return "Victor Company of Japan, Ltd.";
case 60: return "Matsushita Electric Industrial Co., Ltd.";
}
break;
case 50:
if(frm == 10) return "Vanguard Disc Inc.";
if(frm == 20) return "Mitsubishi Chemical Corporation";
if(frm == 30) return "CDA Datenträger Albrechts GmbH";
switch(frm) {
case 10: return "Vanguard Disc Inc.";
case 20: return "Mitsubishi Chemical Corporation";
case 30: return "CDA Datenträger Albrechts GmbH";
}
break;
case 51:
if(frm == 10) return "Grand Advance Technology Ltd.";
if(frm == 20) return "Infodisc Technology Co. Ltd.";
if(frm == 50) return "Hile Optical Disc Technology Corp.";
switch(frm) {
case 10: return "Grand Advance Technology Ltd.";
case 20: return "Infodisc Technology Co. Ltd.";
case 50: return "Hile Optical Disc Technology Corp.";
}
break;
}

View File

@@ -1078,138 +1078,135 @@ namespace DiscImageChef.Decoders.DVD
pfi.Layer0EndPSN = (uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]);
pfi.BCA |= (response[20] & 0x80) == 0x80;
// UMD
if(pfi.DiskCategory == DiskCategory.UMD) pfi.MediaAttribute = (ushort)((response[21] << 8) + response[22]);
switch(pfi.DiskCategory) {
// UMD
case DiskCategory.UMD: pfi.MediaAttribute = (ushort)((response[21] << 8) + response[22]);
break;
// DVD-RAM
case DiskCategory.DVDRAM:
pfi.DiscType = (DVDRAMDiscType)response[36];
// DVD-RAM
if(pfi.DiskCategory == DiskCategory.DVDRAM)
{
pfi.DiscType = (DVDRAMDiscType)response[36];
if(pfi.PartVersion == 1)
{
pfi.Velocity = response[52];
pfi.ReadPower = response[53];
pfi.PeakPower = response[54];
pfi.BiasPower = response[55];
pfi.FirstPulseStart = response[56];
pfi.FirstPulseEnd = response[57];
pfi.MultiPulseDuration = response[58];
pfi.LastPulseStart = response[59];
pfi.LastPulseEnd = response[60];
pfi.BiasPowerDuration = response[61];
pfi.PeakPowerGroove = response[62];
pfi.BiasPowerGroove = response[63];
pfi.FirstPulseStartGroove = response[64];
pfi.FirstPulseEndGroove = response[65];
pfi.MultiplePulseDurationGroove = response[66];
pfi.LastPulseStartGroove = response[67];
pfi.LastPulseEndGroove = response[68];
pfi.BiasPowerDurationGroove = response[69];
}
else if(pfi.PartVersion == 6)
{
pfi.Velocity = response[504];
pfi.ReadPower = response[505];
pfi.AdaptativeWritePulseControlFlag |= (response[506] & 0x80) == 0x80;
pfi.PeakPower = response[507];
pfi.BiasPower1 = response[508];
pfi.BiasPower2 = response[509];
pfi.BiasPower3 = response[510];
pfi.PeakPowerGroove = response[511];
pfi.BiasPower1Groove = response[512];
pfi.BiasPower2Groove = response[513];
pfi.BiasPower3Groove = response[514];
pfi.FirstPulseEnd = response[515];
pfi.FirstPulseDuration = response[516];
pfi.MultiPulseDuration = response[518];
pfi.LastPulseStart = response[519];
pfi.BiasPower2Duration = response[520];
pfi.FirstPulseStart3TSpace3T = response[521];
pfi.FirstPulseStart4TSpace3T = response[522];
pfi.FirstPulseStart5TSpace3T = response[523];
pfi.FirstPulseStartSpace3T = response[524];
pfi.FirstPulseStart3TSpace4T = response[525];
pfi.FirstPulseStart4TSpace4T = response[526];
pfi.FirstPulseStart5TSpace4T = response[527];
pfi.FirstPulseStartSpace4T = response[528];
pfi.FirstPulseStart3TSpace5T = response[529];
pfi.FirstPulseStart4TSpace5T = response[530];
pfi.FirstPulseStart5TSpace5T = response[531];
pfi.FirstPulseStartSpace5T = response[532];
pfi.FirstPulseStart3TSpace = response[533];
pfi.FirstPulseStart4TSpace = response[534];
pfi.FirstPulseStart5TSpace = response[535];
pfi.FirstPulseStartSpace = response[536];
pfi.FirstPulse3TStartTSpace3T = response[537];
pfi.FirstPulse4TStartTSpace3T = response[538];
pfi.FirstPulse5TStartTSpace3T = response[539];
pfi.FirstPulseStartTSpace3T = response[540];
pfi.FirstPulse3TStartTSpace4T = response[541];
pfi.FirstPulse4TStartTSpace4T = response[542];
pfi.FirstPulse5TStartTSpace4T = response[543];
pfi.FirstPulseStartTSpace4T = response[544];
pfi.FirstPulse3TStartTSpace5T = response[545];
pfi.FirstPulse4TStartTSpace5T = response[546];
pfi.FirstPulse5TStartTSpace5T = response[547];
pfi.FirstPulseStartTSpace5T = response[548];
pfi.FirstPulse3TStartTSpace = response[549];
pfi.FirstPulse4TStartTSpace = response[550];
pfi.FirstPulse5TStartTSpace = response[551];
pfi.FirstPulseStartTSpace = response[552];
tmp = new byte[48];
Array.Copy(response, 553, tmp, 0, 48);
pfi.DiskManufacturer = StringHandlers.SpacePaddedToString(tmp);
tmp = new byte[16];
Array.Copy(response, 601, tmp, 0, 16);
pfi.DiskManufacturerSupplementary = StringHandlers.SpacePaddedToString(tmp);
pfi.WritePowerControlParams = new byte[2];
pfi.WritePowerControlParams[0] = response[617];
pfi.WritePowerControlParams[1] = response[618];
pfi.PowerRatioLandThreshold = response[619];
pfi.TargetAsymmetry = response[620];
pfi.TemporaryPeakPower = response[621];
pfi.TemporaryBiasPower1 = response[622];
pfi.TemporaryBiasPower2 = response[623];
pfi.TemporaryBiasPower3 = response[624];
pfi.PowerRatioGrooveThreshold = response[625];
pfi.PowerRatioLandThreshold6T = response[626];
pfi.PowerRatioGrooveThreshold6T = response[627];
}
}
// DVD-R and DVD-RW
if(pfi.DiskCategory == DiskCategory.DVDR && pfi.PartVersion < 6 ||
pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion < 3)
{
pfi.CurrentBorderOutSector =
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector =
(uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
}
// DVD+RW
if(pfi.DiskCategory == DiskCategory.DVDPRW)
{
pfi.RecordingVelocity = response[36];
pfi.ReadPowerMaxVelocity = response[37];
pfi.PIndMaxVelocity = response[38];
pfi.PMaxVelocity = response[39];
pfi.E1MaxVelocity = response[40];
pfi.E2MaxVelocity = response[41];
pfi.YTargetMaxVelocity = response[42];
pfi.ReadPowerRefVelocity = response[43];
pfi.PIndRefVelocity = response[44];
pfi.PRefVelocity = response[45];
pfi.E1RefVelocity = response[46];
pfi.E2RefVelocity = response[47];
pfi.YTargetRefVelocity = response[48];
pfi.ReadPowerMinVelocity = response[49];
pfi.PIndMinVelocity = response[50];
pfi.PMinVelocity = response[51];
pfi.E1MinVelocity = response[52];
pfi.E2MinVelocity = response[53];
pfi.YTargetMinVelocity = response[54];
if(pfi.PartVersion == 1)
{
pfi.Velocity = response[52];
pfi.ReadPower = response[53];
pfi.PeakPower = response[54];
pfi.BiasPower = response[55];
pfi.FirstPulseStart = response[56];
pfi.FirstPulseEnd = response[57];
pfi.MultiPulseDuration = response[58];
pfi.LastPulseStart = response[59];
pfi.LastPulseEnd = response[60];
pfi.BiasPowerDuration = response[61];
pfi.PeakPowerGroove = response[62];
pfi.BiasPowerGroove = response[63];
pfi.FirstPulseStartGroove = response[64];
pfi.FirstPulseEndGroove = response[65];
pfi.MultiplePulseDurationGroove = response[66];
pfi.LastPulseStartGroove = response[67];
pfi.LastPulseEndGroove = response[68];
pfi.BiasPowerDurationGroove = response[69];
}
else if(pfi.PartVersion == 6)
{
pfi.Velocity = response[504];
pfi.ReadPower = response[505];
pfi.AdaptativeWritePulseControlFlag |= (response[506] & 0x80) == 0x80;
pfi.PeakPower = response[507];
pfi.BiasPower1 = response[508];
pfi.BiasPower2 = response[509];
pfi.BiasPower3 = response[510];
pfi.PeakPowerGroove = response[511];
pfi.BiasPower1Groove = response[512];
pfi.BiasPower2Groove = response[513];
pfi.BiasPower3Groove = response[514];
pfi.FirstPulseEnd = response[515];
pfi.FirstPulseDuration = response[516];
pfi.MultiPulseDuration = response[518];
pfi.LastPulseStart = response[519];
pfi.BiasPower2Duration = response[520];
pfi.FirstPulseStart3TSpace3T = response[521];
pfi.FirstPulseStart4TSpace3T = response[522];
pfi.FirstPulseStart5TSpace3T = response[523];
pfi.FirstPulseStartSpace3T = response[524];
pfi.FirstPulseStart3TSpace4T = response[525];
pfi.FirstPulseStart4TSpace4T = response[526];
pfi.FirstPulseStart5TSpace4T = response[527];
pfi.FirstPulseStartSpace4T = response[528];
pfi.FirstPulseStart3TSpace5T = response[529];
pfi.FirstPulseStart4TSpace5T = response[530];
pfi.FirstPulseStart5TSpace5T = response[531];
pfi.FirstPulseStartSpace5T = response[532];
pfi.FirstPulseStart3TSpace = response[533];
pfi.FirstPulseStart4TSpace = response[534];
pfi.FirstPulseStart5TSpace = response[535];
pfi.FirstPulseStartSpace = response[536];
pfi.FirstPulse3TStartTSpace3T = response[537];
pfi.FirstPulse4TStartTSpace3T = response[538];
pfi.FirstPulse5TStartTSpace3T = response[539];
pfi.FirstPulseStartTSpace3T = response[540];
pfi.FirstPulse3TStartTSpace4T = response[541];
pfi.FirstPulse4TStartTSpace4T = response[542];
pfi.FirstPulse5TStartTSpace4T = response[543];
pfi.FirstPulseStartTSpace4T = response[544];
pfi.FirstPulse3TStartTSpace5T = response[545];
pfi.FirstPulse4TStartTSpace5T = response[546];
pfi.FirstPulse5TStartTSpace5T = response[547];
pfi.FirstPulseStartTSpace5T = response[548];
pfi.FirstPulse3TStartTSpace = response[549];
pfi.FirstPulse4TStartTSpace = response[550];
pfi.FirstPulse5TStartTSpace = response[551];
pfi.FirstPulseStartTSpace = response[552];
tmp = new byte[48];
Array.Copy(response, 553, tmp, 0, 48);
pfi.DiskManufacturer = StringHandlers.SpacePaddedToString(tmp);
tmp = new byte[16];
Array.Copy(response, 601, tmp, 0, 16);
pfi.DiskManufacturerSupplementary = StringHandlers.SpacePaddedToString(tmp);
pfi.WritePowerControlParams = new byte[2];
pfi.WritePowerControlParams[0] = response[617];
pfi.WritePowerControlParams[1] = response[618];
pfi.PowerRatioLandThreshold = response[619];
pfi.TargetAsymmetry = response[620];
pfi.TemporaryPeakPower = response[621];
pfi.TemporaryBiasPower1 = response[622];
pfi.TemporaryBiasPower2 = response[623];
pfi.TemporaryBiasPower3 = response[624];
pfi.PowerRatioGrooveThreshold = response[625];
pfi.PowerRatioLandThreshold6T = response[626];
pfi.PowerRatioGrooveThreshold6T = response[627];
}
break;
// DVD-R and DVD-RW
case DiskCategory.DVDR when pfi.PartVersion < 6:
case DiskCategory.DVDRW when pfi.PartVersion < 3:
pfi.CurrentBorderOutSector =
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector =
(uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
break;
// DVD+RW
case DiskCategory.DVDPRW:
pfi.RecordingVelocity = response[36];
pfi.ReadPowerMaxVelocity = response[37];
pfi.PIndMaxVelocity = response[38];
pfi.PMaxVelocity = response[39];
pfi.E1MaxVelocity = response[40];
pfi.E2MaxVelocity = response[41];
pfi.YTargetMaxVelocity = response[42];
pfi.ReadPowerRefVelocity = response[43];
pfi.PIndRefVelocity = response[44];
pfi.PRefVelocity = response[45];
pfi.E1RefVelocity = response[46];
pfi.E2RefVelocity = response[47];
pfi.YTargetRefVelocity = response[48];
pfi.ReadPowerMinVelocity = response[49];
pfi.PIndMinVelocity = response[50];
pfi.PMinVelocity = response[51];
pfi.E1MinVelocity = response[52];
pfi.E2MinVelocity = response[53];
pfi.YTargetMinVelocity = response[54];
break;
}
// DVD+R, DVD+RW, DVD+R DL and DVD+RW DL
@@ -1230,95 +1227,94 @@ namespace DiscImageChef.Decoders.DVD
pfi.PFIUsedInADIP = response[35];
}
// DVD+RW
if(pfi.DiskCategory == DiskCategory.DVDPRW && pfi.PartVersion == 2)
{
pfi.TopFirstPulseDuration = response[55];
pfi.MultiPulseDuration = response[56];
pfi.FirstPulseLeadTime = response[57];
pfi.EraseLeadTimeRefVelocity = response[58];
pfi.EraseLeadTimeUppVelocity = response[59];
switch(pfi.DiskCategory) {
// DVD+RW
case DiskCategory.DVDPRW when pfi.PartVersion == 2:
pfi.TopFirstPulseDuration = response[55];
pfi.MultiPulseDuration = response[56];
pfi.FirstPulseLeadTime = response[57];
pfi.EraseLeadTimeRefVelocity = response[58];
pfi.EraseLeadTimeUppVelocity = response[59];
break;
// DVD+R and DVD+R DL
case DiskCategory.DVDPR:
case DiskCategory.DVDPRDL:
pfi.PrimaryVelocity = response[36];
pfi.UpperVelocity = response[37];
pfi.Wavelength = response[38];
pfi.NormalizedPowerDependency = response[39];
pfi.MaximumPowerAtPrimaryVelocity = response[40];
pfi.PindAtPrimaryVelocity = response[41];
pfi.BtargetAtPrimaryVelocity = response[42];
pfi.MaximumPowerAtUpperVelocity = response[43];
pfi.PindAtUpperVelocity = response[44];
pfi.BtargetAtUpperVelocity = response[45];
pfi.FirstPulseDuration4TPrimaryVelocity = response[46];
pfi.FirstPulseDuration3TPrimaryVelocity = response[47];
pfi.MultiPulseDurationPrimaryVelocity = response[48];
pfi.LastPulseDurationPrimaryVelocity = response[49];
pfi.FirstPulseLeadTime4TPrimaryVelocity = response[50];
pfi.FirstPulseLeadTime3TPrimaryVelocity = response[51];
pfi.FirstPulseLeadingEdgePrimaryVelocity = response[52];
pfi.FirstPulseDuration4TUpperVelocity = response[53];
pfi.FirstPulseDuration3TUpperVelocity = response[54];
pfi.MultiPulseDurationUpperVelocity = response[55];
pfi.LastPulseDurationUpperVelocity = response[56];
pfi.FirstPulseLeadTime4TUpperVelocity = response[57];
pfi.FirstPulseLeadTime3TUpperVelocity = response[58];
pfi.FirstPulseLeadingEdgeUpperVelocity = response[59];
break;
}
// DVD+R and DVD+R DL
if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRDL)
{
pfi.PrimaryVelocity = response[36];
pfi.UpperVelocity = response[37];
pfi.Wavelength = response[38];
pfi.NormalizedPowerDependency = response[39];
pfi.MaximumPowerAtPrimaryVelocity = response[40];
pfi.PindAtPrimaryVelocity = response[41];
pfi.BtargetAtPrimaryVelocity = response[42];
pfi.MaximumPowerAtUpperVelocity = response[43];
pfi.PindAtUpperVelocity = response[44];
pfi.BtargetAtUpperVelocity = response[45];
pfi.FirstPulseDuration4TPrimaryVelocity = response[46];
pfi.FirstPulseDuration3TPrimaryVelocity = response[47];
pfi.MultiPulseDurationPrimaryVelocity = response[48];
pfi.LastPulseDurationPrimaryVelocity = response[49];
pfi.FirstPulseLeadTime4TPrimaryVelocity = response[50];
pfi.FirstPulseLeadTime3TPrimaryVelocity = response[51];
pfi.FirstPulseLeadingEdgePrimaryVelocity = response[52];
pfi.FirstPulseDuration4TUpperVelocity = response[53];
pfi.FirstPulseDuration3TUpperVelocity = response[54];
pfi.MultiPulseDurationUpperVelocity = response[55];
pfi.LastPulseDurationUpperVelocity = response[56];
pfi.FirstPulseLeadTime4TUpperVelocity = response[57];
pfi.FirstPulseLeadTime3TUpperVelocity = response[58];
pfi.FirstPulseLeadingEdgeUpperVelocity = response[59];
}
// DVD+R DL
if(pfi.DiskCategory == DiskCategory.DVDPRDL) pfi.LayerStructure = (DVDLayerStructure)((response[34] & 0xC0) >> 6);
// DVD+RW DL
if(pfi.DiskCategory == DiskCategory.DVDPRWDL)
{
pfi.BasicPrimaryVelocity = response[36];
pfi.MaxReadPowerPrimaryVelocity = response[37];
pfi.PindPrimaryVelocity = response[38];
pfi.PPrimaryVelocity = response[39];
pfi.E1PrimaryVelocity = response[40];
pfi.E2PrimaryVelocity = response[41];
pfi.YtargetPrimaryVelocity = response[42];
pfi.BOptimumPrimaryVelocity = response[43];
pfi.TFirstPulseDuration = response[46];
pfi.TMultiPulseDuration = response[47];
pfi.FirstPulseLeadTimeAnyRun = response[48];
pfi.FirstPulseLeadTimeRun3T = response[49];
pfi.LastPulseLeadTimeAnyRun = response[50];
pfi.LastPulseLeadTime3T = response[51];
pfi.LastPulseLeadTime4T = response[52];
pfi.ErasePulseLeadTimeAny = response[53];
pfi.ErasePulseLeadTime3T = response[54];
pfi.ErasePulseLeadTime4T = response[55];
}
// DVD-R DL and DVD-RW DL
if(pfi.DiskCategory == DiskCategory.DVDR && pfi.PartVersion == 6 ||
pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion == 3)
{
pfi.MaxRecordingSpeed = (DVDRecordingSpeed)response[21];
pfi.MinRecordingSpeed = (DVDRecordingSpeed)response[22];
pfi.RecordingSpeed1 = (DVDRecordingSpeed)response[23];
pfi.RecordingSpeed2 = (DVDRecordingSpeed)response[24];
pfi.RecordingSpeed3 = (DVDRecordingSpeed)response[25];
pfi.RecordingSpeed4 = (DVDRecordingSpeed)response[26];
pfi.RecordingSpeed5 = (DVDRecordingSpeed)response[27];
pfi.RecordingSpeed6 = (DVDRecordingSpeed)response[28];
pfi.RecordingSpeed7 = (DVDRecordingSpeed)response[29];
pfi.Class = response[30];
pfi.ExtendedVersion = response[31];
pfi.CurrentBorderOutSector =
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector =
(uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
pfi.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01;
pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02;
pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08;
pfi.ARCharLayer1 = (byte)(response[45] & 0x0F);
pfi.TrackPolarityLayer1 = (byte)((response[45] & 0xF0) >> 4);
switch(pfi.DiskCategory) {
// DVD+R DL
case DiskCategory.DVDPRDL: pfi.LayerStructure = (DVDLayerStructure)((response[34] & 0xC0) >> 6);
break;
// DVD+RW DL
case DiskCategory.DVDPRWDL:
pfi.BasicPrimaryVelocity = response[36];
pfi.MaxReadPowerPrimaryVelocity = response[37];
pfi.PindPrimaryVelocity = response[38];
pfi.PPrimaryVelocity = response[39];
pfi.E1PrimaryVelocity = response[40];
pfi.E2PrimaryVelocity = response[41];
pfi.YtargetPrimaryVelocity = response[42];
pfi.BOptimumPrimaryVelocity = response[43];
pfi.TFirstPulseDuration = response[46];
pfi.TMultiPulseDuration = response[47];
pfi.FirstPulseLeadTimeAnyRun = response[48];
pfi.FirstPulseLeadTimeRun3T = response[49];
pfi.LastPulseLeadTimeAnyRun = response[50];
pfi.LastPulseLeadTime3T = response[51];
pfi.LastPulseLeadTime4T = response[52];
pfi.ErasePulseLeadTimeAny = response[53];
pfi.ErasePulseLeadTime3T = response[54];
pfi.ErasePulseLeadTime4T = response[55];
break;
// DVD-R DL and DVD-RW DL
case DiskCategory.DVDR when pfi.PartVersion == 6:
case DiskCategory.DVDRW when pfi.PartVersion == 3:
pfi.MaxRecordingSpeed = (DVDRecordingSpeed)response[21];
pfi.MinRecordingSpeed = (DVDRecordingSpeed)response[22];
pfi.RecordingSpeed1 = (DVDRecordingSpeed)response[23];
pfi.RecordingSpeed2 = (DVDRecordingSpeed)response[24];
pfi.RecordingSpeed3 = (DVDRecordingSpeed)response[25];
pfi.RecordingSpeed4 = (DVDRecordingSpeed)response[26];
pfi.RecordingSpeed5 = (DVDRecordingSpeed)response[27];
pfi.RecordingSpeed6 = (DVDRecordingSpeed)response[28];
pfi.RecordingSpeed7 = (DVDRecordingSpeed)response[29];
pfi.Class = response[30];
pfi.ExtendedVersion = response[31];
pfi.CurrentBorderOutSector =
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector =
(uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
pfi.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01;
pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02;
pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08;
pfi.ARCharLayer1 = (byte)(response[45] & 0x0F);
pfi.TrackPolarityLayer1 = (byte)((response[45] & 0xF0) >> 4);
break;
}
return pfi;
@@ -1351,10 +1347,13 @@ namespace DiscImageChef.Decoders.DVD
{
case DiskCategory.DVDROM:
sb.AppendFormat(categorySentence, sizeString, "DVD-ROM", decoded.PartVersion).AppendLine();
if(decoded.DiscSize == DVDSize.OneTwenty && decoded.PartVersion == 1)
sb.AppendLine("Disc claims conformation to ECMA-267");
if(decoded.DiscSize == DVDSize.Eighty && decoded.PartVersion == 1)
sb.AppendLine("Disc claims conformation to ECMA-268");
switch(decoded.DiscSize) {
case DVDSize.OneTwenty when decoded.PartVersion == 1: sb.AppendLine("Disc claims conformation to ECMA-267");
break;
case DVDSize.Eighty when decoded.PartVersion == 1: sb.AppendLine("Disc claims conformation to ECMA-268");
break;
}
break;
case DiskCategory.DVDRAM:
sb.AppendFormat(categorySentence, sizeString, "DVD-RAM", decoded.PartVersion).AppendLine();
@@ -1580,61 +1579,58 @@ namespace DiscImageChef.Decoders.DVD
if(decoded.BCA) sb.AppendLine("Disc has a burst cutting area");
if(decoded.DiskCategory == DiskCategory.UMD)
sb.AppendFormat("Media attribute is {0}", decoded.MediaAttribute).AppendLine();
switch(decoded.DiskCategory) {
case DiskCategory.UMD: sb.AppendFormat("Media attribute is {0}", decoded.MediaAttribute).AppendLine();
break;
case DiskCategory.DVDRAM:
switch(decoded.DiscType)
{
case DVDRAMDiscType.Cased:
sb.AppendLine("Disc shall be recorded with a case");
break;
case DVDRAMDiscType.Uncased:
sb.AppendLine("Disc can be recorded with or without a case");
break;
default:
sb.AppendFormat("Unknown DVD-RAM case type key {0}", decoded.DiscType).AppendLine();
break;
}
if(decoded.DiskCategory == DiskCategory.DVDRAM)
{
switch(decoded.DiscType)
{
case DVDRAMDiscType.Cased:
sb.AppendLine("Disc shall be recorded with a case");
break;
case DVDRAMDiscType.Uncased:
sb.AppendLine("Disc can be recorded with or without a case");
break;
default:
sb.AppendFormat("Unknown DVD-RAM case type key {0}", decoded.DiscType).AppendLine();
break;
}
if(decoded.PartVersion == 6)
{
sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturer).AppendLine();
sb.AppendFormat("Disc manufacturer supplementary information is {0}",
decoded.DiskManufacturerSupplementary).AppendLine();
}
if(decoded.PartVersion == 6)
{
sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturer).AppendLine();
sb.AppendFormat("Disc manufacturer supplementary information is {0}",
decoded.DiskManufacturerSupplementary).AppendLine();
}
break;
case DiskCategory.DVDR when decoded.PartVersion < 6:
case DiskCategory.DVDRW when decoded.PartVersion < 3:
sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector)
.AppendLine();
sb.AppendFormat("Next Border-In first sector is PSN {0:X}h", decoded.NextBorderInSector).AppendLine();
break;
case DiskCategory.DVDPR:
case DiskCategory.DVDPRW:
case DiskCategory.DVDPRDL:
case DiskCategory.DVDPRWDL:
if(decoded.VCPS) sb.AppendLine("Disc contains extended information for VCPS");
sb.AppendFormat("Disc application code is {0}", decoded.ApplicationCode).AppendLine();
sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturerID).AppendLine();
sb.AppendFormat("Disc media type is {0}", decoded.MediaTypeID).AppendLine();
sb.AppendFormat("Disc product revision is {0}", decoded.ProductRevision).AppendLine();
break;
}
if(decoded.DiskCategory == DiskCategory.DVDR && decoded.PartVersion < 6 ||
decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion < 3)
{
sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector)
.AppendLine();
sb.AppendFormat("Next Border-In first sector is PSN {0:X}h", decoded.NextBorderInSector).AppendLine();
}
if((decoded.DiskCategory != DiskCategory.DVDR || decoded.PartVersion < 6) &&
(decoded.DiskCategory != DiskCategory.DVDRW || decoded.PartVersion < 3)) return sb.ToString();
if(decoded.DiskCategory == DiskCategory.DVDPR || decoded.DiskCategory == DiskCategory.DVDPRW ||
decoded.DiskCategory == DiskCategory.DVDPRDL || decoded.DiskCategory == DiskCategory.DVDPRWDL)
{
if(decoded.VCPS) sb.AppendLine("Disc contains extended information for VCPS");
sb.AppendFormat("Disc application code is {0}", decoded.ApplicationCode).AppendLine();
sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturerID).AppendLine();
sb.AppendFormat("Disc media type is {0}", decoded.MediaTypeID).AppendLine();
sb.AppendFormat("Disc product revision is {0}", decoded.ProductRevision).AppendLine();
}
if(decoded.DiskCategory == DiskCategory.DVDR && decoded.PartVersion >= 6 ||
decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion >= 3)
{
sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h",
decoded.CurrentRMDExtraBorderPSN).AppendLine();
sb.AppendFormat("PFI in extra Border zone starts at PSN {0:X}h", decoded.PFIExtraBorderPSN)
.AppendLine();
if(!decoded.PreRecordedControlDataInv) sb.AppendLine("Control Data Zone is pre-recorded");
if(decoded.PreRecordedLeadIn) sb.AppendLine("Lead-In is pre-recorded");
if(decoded.PreRecordedLeadOut) sb.AppendLine("Lead-Out is pre-recorded");
}
sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h",
decoded.CurrentRMDExtraBorderPSN).AppendLine();
sb.AppendFormat("PFI in extra Border zone starts at PSN {0:X}h", decoded.PFIExtraBorderPSN)
.AppendLine();
if(!decoded.PreRecordedControlDataInv) sb.AppendLine("Control Data Zone is pre-recorded");
if(decoded.PreRecordedLeadIn) sb.AppendLine("Lead-In is pre-recorded");
if(decoded.PreRecordedLeadOut) sb.AppendLine("Lead-Out is pre-recorded");
return sb.ToString();
}

View File

@@ -407,11 +407,14 @@ namespace DiscImageChef.Decoders.SCSI
if(descriptor.Length + position + 4 >= pageResponse.Length)
descriptor.Length = (byte)(pageResponse.Length - position - 4);
Array.Copy(pageResponse, position + 4, descriptor.Binary, 0, descriptor.Length);
if(descriptor.CodeSet == IdentificationCodeSet.ASCII)
descriptor.ASCII = StringHandlers.CToString(descriptor.Binary);
else if(descriptor.CodeSet == IdentificationCodeSet.UTF8)
descriptor.ASCII = Encoding.UTF8.GetString(descriptor.Binary);
else descriptor.ASCII = "";
switch(descriptor.CodeSet) {
case IdentificationCodeSet.ASCII: descriptor.ASCII = StringHandlers.CToString(descriptor.Binary);
break;
case IdentificationCodeSet.UTF8: descriptor.ASCII = Encoding.UTF8.GetString(descriptor.Binary);
break;
default: descriptor.ASCII = "";
break;
}
position += 4 + descriptor.Length;
descriptors.Add(descriptor);
@@ -516,28 +519,36 @@ namespace DiscImageChef.Decoders.SCSI
switch(descriptor.Type)
{
case IdentificationTypes.NoAuthority:
if(descriptor.CodeSet == IdentificationCodeSet.ASCII ||
descriptor.CodeSet == IdentificationCodeSet.UTF8)
sb.AppendFormat("\tVendor descriptor contains: {0}", descriptor.ASCII).AppendLine();
else if(descriptor.CodeSet == IdentificationCodeSet.Binary)
sb.AppendFormat("\tVendor descriptor contains binary data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine();
else
sb.AppendFormat("\tVendor descriptor contains unknown kind {1} of data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.CodeSet).AppendLine();
switch(descriptor.CodeSet) {
case IdentificationCodeSet.ASCII:
case IdentificationCodeSet.UTF8: sb.AppendFormat("\tVendor descriptor contains: {0}", descriptor.ASCII).AppendLine();
break;
case IdentificationCodeSet.Binary:
sb.AppendFormat("\tVendor descriptor contains binary data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine();
break;
default:
sb.AppendFormat("\tVendor descriptor contains unknown kind {1} of data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.CodeSet).AppendLine();
break;
}
break;
case IdentificationTypes.Inquiry:
if(descriptor.CodeSet == IdentificationCodeSet.ASCII ||
descriptor.CodeSet == IdentificationCodeSet.UTF8)
sb.AppendFormat("\tInquiry descriptor contains: {0}", descriptor.ASCII).AppendLine();
else if(descriptor.CodeSet == IdentificationCodeSet.Binary)
sb.AppendFormat("\tInquiry descriptor contains binary data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine();
else
sb.AppendFormat("\tInquiry descriptor contains unknown kind {1} of data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.CodeSet).AppendLine();
switch(descriptor.CodeSet) {
case IdentificationCodeSet.ASCII:
case IdentificationCodeSet.UTF8: sb.AppendFormat("\tInquiry descriptor contains: {0}", descriptor.ASCII).AppendLine();
break;
case IdentificationCodeSet.Binary:
sb.AppendFormat("\tInquiry descriptor contains binary data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40)).AppendLine();
break;
default:
sb.AppendFormat("\tInquiry descriptor contains unknown kind {1} of data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.CodeSet).AppendLine();
break;
}
break;
case IdentificationTypes.EUI:
if(descriptor.CodeSet == IdentificationCodeSet.ASCII ||
@@ -705,18 +716,24 @@ namespace DiscImageChef.Decoders.SCSI
break;
default:
if(descriptor.CodeSet == IdentificationCodeSet.ASCII ||
descriptor.CodeSet == IdentificationCodeSet.UTF8)
sb.AppendFormat("\tUnknown descriptor type {1} contains: {0}", descriptor.ASCII,
(byte)descriptor.Type).AppendLine();
else if(descriptor.CodeSet == IdentificationCodeSet.Binary)
sb.AppendFormat("\tUnknown descriptor type {1} contains binary data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.Type).AppendLine();
else
sb.AppendFormat("Inquiry descriptor type {2} contains unknown kind {1} of data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.CodeSet, (byte)descriptor.Type).AppendLine();
switch(descriptor.CodeSet) {
case IdentificationCodeSet.ASCII:
case IdentificationCodeSet.UTF8:
sb.AppendFormat("\tUnknown descriptor type {1} contains: {0}", descriptor.ASCII,
(byte)descriptor.Type).AppendLine();
break;
case IdentificationCodeSet.Binary:
sb.AppendFormat("\tUnknown descriptor type {1} contains binary data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.Type).AppendLine();
break;
default:
sb.AppendFormat("Inquiry descriptor type {2} contains unknown kind {1} of data (hex): {0}",
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
(byte)descriptor.CodeSet, (byte)descriptor.Type).AppendLine();
break;
}
break;
}
}
@@ -1205,38 +1222,41 @@ namespace DiscImageChef.Decoders.SCSI
sb.AppendLine("SCSI Extended INQUIRY Data:");
if(page.PeripheralDeviceType == PeripheralDeviceTypes.DirectAccess ||
page.PeripheralDeviceType == PeripheralDeviceTypes.SCSIZonedBlockDevice)
switch(page.SPT)
{
case 0:
sb.AppendLine("Logical unit supports type 1 protection");
break;
case 1:
sb.AppendLine("Logical unit supports types 1 and 2 protection");
break;
case 2:
sb.AppendLine("Logical unit supports type 2 protection");
break;
case 3:
sb.AppendLine("Logical unit supports types 1 and 3 protection");
break;
case 4:
sb.AppendLine("Logical unit supports type 3 protection");
break;
case 5:
sb.AppendLine("Logical unit supports types 2 and 3 protection");
break;
case 7:
sb.AppendLine("Logical unit supports types 1, 2 and 3 protection");
break;
default:
sb.AppendFormat("Logical unit supports unknown protection defined by code {0}", (byte)page.SPT)
.AppendLine();
break;
}
else if(page.PeripheralDeviceType == PeripheralDeviceTypes.SequentialAccess && page.SPT == 1)
sb.AppendLine("Logical unit supports logical block protection");
switch(page.PeripheralDeviceType) {
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.SCSIZonedBlockDevice:
switch(page.SPT)
{
case 0:
sb.AppendLine("Logical unit supports type 1 protection");
break;
case 1:
sb.AppendLine("Logical unit supports types 1 and 2 protection");
break;
case 2:
sb.AppendLine("Logical unit supports type 2 protection");
break;
case 3:
sb.AppendLine("Logical unit supports types 1 and 3 protection");
break;
case 4:
sb.AppendLine("Logical unit supports type 3 protection");
break;
case 5:
sb.AppendLine("Logical unit supports types 2 and 3 protection");
break;
case 7:
sb.AppendLine("Logical unit supports types 1, 2 and 3 protection");
break;
default:
sb.AppendFormat("Logical unit supports unknown protection defined by code {0}", (byte)page.SPT)
.AppendLine();
break;
}
break;
case PeripheralDeviceTypes.SequentialAccess when page.SPT == 1: sb.AppendLine("Logical unit supports logical block protection");
break;
}
if(page.GRD_CHK) sb.AppendLine("Device checks the logical block guard");
if(page.APP_CHK) sb.AppendLine("Device checks the logical block application tag");

View File

@@ -100,27 +100,24 @@ namespace DiscImageChef.Decoders.SCSI
}
}
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
{
header.WriteProtected = (modeResponse[3] & 0x80) == 0x80;
header.DPOFUA = (modeResponse[3] & 0x10) == 0x10;
}
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
{
header.WriteProtected = (modeResponse[3] & 0x80) == 0x80;
header.Speed = (byte)(modeResponse[3] & 0x0F);
header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4);
}
if(deviceType == PeripheralDeviceTypes.PrinterDevice)
header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4);
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
{
header.WriteProtected = (modeResponse[3] & 0x80) == 0x80;
header.EBC = (modeResponse[3] & 0x01) == 0x01;
header.DPOFUA = (modeResponse[3] & 0x10) == 0x10;
switch(deviceType) {
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.MultiMediaDevice:
header.WriteProtected = (modeResponse[3] & 0x80) == 0x80;
header.DPOFUA = (modeResponse[3] & 0x10) == 0x10;
break;
case PeripheralDeviceTypes.SequentialAccess:
header.WriteProtected = (modeResponse[3] & 0x80) == 0x80;
header.Speed = (byte)(modeResponse[3] & 0x0F);
header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4);
break;
case PeripheralDeviceTypes.PrinterDevice: header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4);
break;
case PeripheralDeviceTypes.OpticalDevice:
header.WriteProtected = (modeResponse[3] & 0x80) == 0x80;
header.EBC = (modeResponse[3] & 0x01) == 0x01;
header.DPOFUA = (modeResponse[3] & 0x10) == 0x10;
break;
}
return header;
@@ -217,26 +214,24 @@ namespace DiscImageChef.Decoders.SCSI
hdr[2] = (byte)header.MediumType;
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
{
if(header.WriteProtected) hdr[3] += 0x80;
if(header.DPOFUA) hdr[3] += 0x10;
}
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
{
if(header.WriteProtected) hdr[3] += 0x80;
hdr[3] += (byte)(header.Speed & 0x0F);
hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
}
if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
{
if(header.WriteProtected) hdr[3] += 0x80;
if(header.EBC) hdr[3] += 0x01;
if(header.DPOFUA) hdr[3] += 0x10;
switch(deviceType) {
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.MultiMediaDevice:
if(header.WriteProtected) hdr[3] += 0x80;
if(header.DPOFUA) hdr[3] += 0x10;
break;
case PeripheralDeviceTypes.SequentialAccess:
if(header.WriteProtected) hdr[3] += 0x80;
hdr[3] += (byte)(header.Speed & 0x0F);
hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
break;
case PeripheralDeviceTypes.PrinterDevice: hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
break;
case PeripheralDeviceTypes.OpticalDevice:
if(header.WriteProtected) hdr[3] += 0x80;
if(header.EBC) hdr[3] += 0x01;
if(header.DPOFUA) hdr[3] += 0x10;
break;
}
if(longLBA) hdr[4] += 0x01;

View File

@@ -60,27 +60,24 @@ namespace DiscImageChef.Decoders.SCSI
}
}
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
{
header.WriteProtected = (modeResponse[2] & 0x80) == 0x80;
header.DPOFUA = (modeResponse[2] & 0x10) == 0x10;
}
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
{
header.WriteProtected = (modeResponse[2] & 0x80) == 0x80;
header.Speed = (byte)(modeResponse[2] & 0x0F);
header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4);
}
if(deviceType == PeripheralDeviceTypes.PrinterDevice)
header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4);
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
{
header.WriteProtected = (modeResponse[2] & 0x80) == 0x80;
header.EBC = (modeResponse[2] & 0x01) == 0x01;
header.DPOFUA = (modeResponse[2] & 0x10) == 0x10;
switch(deviceType) {
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.MultiMediaDevice:
header.WriteProtected = (modeResponse[2] & 0x80) == 0x80;
header.DPOFUA = (modeResponse[2] & 0x10) == 0x10;
break;
case PeripheralDeviceTypes.SequentialAccess:
header.WriteProtected = (modeResponse[2] & 0x80) == 0x80;
header.Speed = (byte)(modeResponse[2] & 0x0F);
header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4);
break;
case PeripheralDeviceTypes.PrinterDevice: header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4);
break;
case PeripheralDeviceTypes.OpticalDevice:
header.WriteProtected = (modeResponse[2] & 0x80) == 0x80;
header.EBC = (modeResponse[2] & 0x01) == 0x01;
header.DPOFUA = (modeResponse[2] & 0x10) == 0x10;
break;
}
return header;
@@ -157,7 +154,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
public static byte[] EncodeModeHeader6(ModeHeader header, PeripheralDeviceTypes deviceType)
{
byte[] hdr;
@@ -167,26 +164,24 @@ namespace DiscImageChef.Decoders.SCSI
hdr[1] = (byte)header.MediumType;
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
{
if(header.WriteProtected) hdr[2] += 0x80;
if(header.DPOFUA) hdr[2] += 0x10;
}
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
{
if(header.WriteProtected) hdr[2] += 0x80;
hdr[2] += (byte)(header.Speed & 0x0F);
hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
}
if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
{
if(header.WriteProtected) hdr[2] += 0x80;
if(header.EBC) hdr[2] += 0x01;
if(header.DPOFUA) hdr[2] += 0x10;
switch(deviceType) {
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.MultiMediaDevice:
if(header.WriteProtected) hdr[2] += 0x80;
if(header.DPOFUA) hdr[2] += 0x10;
break;
case PeripheralDeviceTypes.SequentialAccess:
if(header.WriteProtected) hdr[2] += 0x80;
hdr[2] += (byte)(header.Speed & 0x0F);
hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
break;
case PeripheralDeviceTypes.PrinterDevice: hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
break;
case PeripheralDeviceTypes.OpticalDevice:
if(header.WriteProtected) hdr[2] += 0x80;
if(header.EBC) hdr[2] += 0x01;
if(header.DPOFUA) hdr[2] += 0x10;
break;
}
if(header.BlockDescriptors != null)

View File

@@ -234,28 +234,30 @@ namespace DiscImageChef.Decoders.Xbox
sb.Append("-");
if(decoded.CatalogNumber.Length == 13)
{
for(int i = 8; i < 10; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
switch(decoded.CatalogNumber.Length) {
case 13:
for(int i = 8; i < 10; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
sb.Append("-");
for(int i = 10; i < 13; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
}
else if(decoded.CatalogNumber.Length == 14)
{
for(int i = 8; i < 11; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
sb.Append("-");
for(int i = 10; i < 13; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
sb.Append("-");
for(int i = 11; i < 14; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
}
else
{
for(int i = 8; i < decoded.CatalogNumber.Length - 3; i++)
sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
break;
case 14:
for(int i = 8; i < 11; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
sb.Append("-");
for(int i = decoded.CatalogNumber.Length - 3; i < decoded.CatalogNumber.Length; i++)
sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
sb.Append("-");
for(int i = 11; i < 14; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
break;
default:
for(int i = 8; i < decoded.CatalogNumber.Length - 3; i++)
sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
sb.Append("-");
for(int i = decoded.CatalogNumber.Length - 3; i < decoded.CatalogNumber.Length; i++)
sb.AppendFormat("{0}", decoded.CatalogNumber[i]);
break;
}
sb.AppendLine();