REFACTOR: Final cleanup of DiscImageChef.

This commit is contained in:
2017-12-23 04:48:17 +00:00
parent 5784f342ab
commit d4bfbf2cae
17 changed files with 535 additions and 514 deletions

View File

@@ -155,8 +155,7 @@ namespace DiscImageChef.Commands
doneSectors += sectors - doneSectors; doneSectors += sectors - doneSectors;
} }
if(options.WholeDisc) if(options.WholeDisc) mediaChecksum?.Update(sector);
mediaChecksum?.Update(sector);
if(options.SeparatedTracks) trackChecksum?.Update(sector); if(options.SeparatedTracks) trackChecksum?.Update(sector);
} }

View File

@@ -128,7 +128,9 @@ namespace DiscImageChef.Commands
image1Info.ImageHasPartitions = input1Format.ImageHasPartitions(); image1Info.ImageHasPartitions = input1Format.ImageHasPartitions();
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { image1Sessions = input1Format.GetSessions(); } try { image1Sessions = input1Format.GetSessions(); }
catch { // ignored catch
{
// ignored
} }
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
image1Info.ImageHasSessions |= image1Sessions.Count > 0; image1Info.ImageHasSessions |= image1Sessions.Count > 0;
@@ -180,16 +182,20 @@ namespace DiscImageChef.Commands
image1DiskTags.Add(disktag, temparray); image1DiskTags.Add(disktag, temparray);
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
} }
image2Info.ImageHasPartitions = input2Format.ImageHasPartitions(); image2Info.ImageHasPartitions = input2Format.ImageHasPartitions();
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { image2Sessions = input2Format.GetSessions(); } try { image2Sessions = input2Format.GetSessions(); }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
image2Info.ImageHasSessions |= image2Sessions.Count > 0; image2Info.ImageHasSessions |= image2Sessions.Count > 0;
image2Info.ImageSize = input2Format.GetImageSize(); image2Info.ImageSize = input2Format.GetImageSize();
@@ -240,8 +246,10 @@ namespace DiscImageChef.Commands
image2DiskTags.Add(disktag, temparray); image2DiskTags.Add(disktag, temparray);
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
} }
@@ -462,8 +470,10 @@ namespace DiscImageChef.Commands
} }
} }
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
} }

View File

@@ -133,8 +133,7 @@ namespace DiscImageChef.Commands
FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"), FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"),
FileMode.CreateNew); FileMode.CreateNew);
XmlSerializer xmlSer = XmlSerializer xmlSer = new XmlSerializer(typeof(CICMMetadataType));
new XmlSerializer(typeof(CICMMetadataType));
xmlSer.Serialize(xmlFs, sidecar); xmlSer.Serialize(xmlFs, sidecar);
xmlFs.Close(); xmlFs.Close();
@@ -155,7 +154,8 @@ namespace DiscImageChef.Commands
} }
string[] contents = Directory.GetFiles(options.InputFile, "*", SearchOption.TopDirectoryOnly); string[] contents = Directory.GetFiles(options.InputFile, "*", SearchOption.TopDirectoryOnly);
List<string> files = contents.Where(file => new FileInfo(file).Length % options.BlockSize == 0).ToList(); List<string> files = contents.Where(file => new FileInfo(file).Length % options.BlockSize == 0)
.ToList();
files.Sort(StringComparer.CurrentCultureIgnoreCase); files.Sort(StringComparer.CurrentCultureIgnoreCase);
@@ -169,17 +169,13 @@ namespace DiscImageChef.Commands
FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"), FileStream(Path.Combine(Path.GetDirectoryName(options.InputFile) ?? throw new InvalidOperationException(), Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml"),
FileMode.CreateNew); FileMode.CreateNew);
XmlSerializer xmlSer = XmlSerializer xmlSer = new XmlSerializer(typeof(CICMMetadataType));
new XmlSerializer(typeof(CICMMetadataType));
xmlSer.Serialize(xmlFs, sidecar); xmlSer.Serialize(xmlFs, sidecar);
xmlFs.Close(); xmlFs.Close();
Core.Statistics.AddCommand("create-sidecar"); Core.Statistics.AddCommand("create-sidecar");
} }
else else DicConsole.ErrorWriteLine("The specified input file cannot be found.");
{
DicConsole.ErrorWriteLine("The specified input file cannot be found.");
}
} }
} }
} }

View File

@@ -53,7 +53,8 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix); DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix);
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' &&
char.IsLetter(options.DevicePath[0])) options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; char.IsLetter(options.DevicePath[0]))
options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':';
Device dev = new Device(options.DevicePath); Device dev = new Device(options.DevicePath);
@@ -105,9 +106,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", CIS.PrettifyDeviceGeometryTuple(tuple)); DicConsole.WriteLine("{0}", CIS.PrettifyDeviceGeometryTuple(tuple));
break; break;
case TupleCodes.CISTPL_MANFID: case TupleCodes.CISTPL_MANFID:
DicConsole.WriteLine("{0}", DicConsole.WriteLine("{0}", CIS.PrettifyManufacturerIdentificationTuple(tuple));
CIS
.PrettifyManufacturerIdentificationTuple(tuple));
break; break;
case TupleCodes.CISTPL_VERS_1: case TupleCodes.CISTPL_VERS_1:
DicConsole.WriteLine("{0}", CIS.PrettifyLevel1VersionTuple(tuple)); DicConsole.WriteLine("{0}", CIS.PrettifyLevel1VersionTuple(tuple));
@@ -284,21 +283,21 @@ namespace DiscImageChef.Commands
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
DicConsole.WriteLine("ASCII Page {0:X2}h: {1}", page, DicConsole.WriteLine("ASCII Page {0:X2}h: {1}", page, EVPD.DecodeASCIIPage(inqBuf));
EVPD.DecodeASCIIPage(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x80) else if(page == 0x80)
{ {
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
DicConsole.WriteLine("Unit Serial Number: {0}", DicConsole.WriteLine("Unit Serial Number: {0}", EVPD.DecodePage80(inqBuf));
EVPD.DecodePage80(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x81) else if(page == 0x81)
{ {
@@ -307,7 +306,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_81(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_81(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x82) else if(page == 0x82)
{ {
@@ -317,7 +317,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("ASCII implemented operating definitions: {0}", DicConsole.WriteLine("ASCII implemented operating definitions: {0}",
EVPD.DecodePage82(inqBuf)); EVPD.DecodePage82(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x83) else if(page == 0x83)
{ {
@@ -326,7 +327,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_83(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_83(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x84) else if(page == 0x84)
{ {
@@ -335,7 +337,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_84(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_84(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x85) else if(page == 0x85)
{ {
@@ -344,7 +347,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_85(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_85(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x86) else if(page == 0x86)
{ {
@@ -353,7 +357,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_86(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_86(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0x89) else if(page == 0x89)
{ {
@@ -362,7 +367,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_89(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_89(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xB0) else if(page == 0xB0)
{ {
@@ -371,7 +377,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_B0(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_B0(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xB1) else if(page == 0xB1)
{ {
@@ -381,7 +388,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Manufacturer-assigned Serial Number: {0}", DicConsole.WriteLine("Manufacturer-assigned Serial Number: {0}",
EVPD.DecodePageB1(inqBuf)); EVPD.DecodePageB1(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xB2) else if(page == 0xB2)
{ {
@@ -391,7 +399,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("TapeAlert Supported Flags Bitmap: 0x{0:X16}", DicConsole.WriteLine("TapeAlert Supported Flags Bitmap: 0x{0:X16}",
EVPD.DecodePageB2(inqBuf)); EVPD.DecodePageB2(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xB3) else if(page == 0xB3)
{ {
@@ -401,7 +410,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Automation Device Serial Number: {0}", DicConsole.WriteLine("Automation Device Serial Number: {0}",
EVPD.DecodePageB3(inqBuf)); EVPD.DecodePageB3(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xB4) else if(page == 0xB4)
{ {
@@ -411,7 +421,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Data Transfer Device Element Address: 0x{0}", DicConsole.WriteLine("Data Transfer Device Element Address: 0x{0}",
EVPD.DecodePageB4(inqBuf)); EVPD.DecodePageB4(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xC0 && else if(page == 0xC0 &&
StringHandlers StringHandlers
@@ -423,7 +434,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Quantum(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Quantum(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xC0 && else if(page == 0xC0 &&
StringHandlers StringHandlers
@@ -435,7 +447,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Seagate(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Seagate(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xC0 && else if(page == 0xC0 &&
StringHandlers StringHandlers
@@ -447,7 +460,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_IBM(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_IBM(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xC1 && else if(page == 0xC1 &&
StringHandlers StringHandlers
@@ -459,7 +473,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C1_IBM(inqBuf)); DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C1_IBM(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if((page == 0xC0 || page == 0xC1) && else if((page == 0xC0 || page == 0xC1) &&
StringHandlers StringHandlers
@@ -469,10 +484,10 @@ namespace DiscImageChef.Commands
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
DicConsole.WriteLine("{0}", DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_C1_Certance(inqBuf));
EVPD.PrettifyPage_C0_C1_Certance(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if( else if(
(page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5 || page == 0xC6) && (page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5 || page == 0xC6) &&
@@ -482,11 +497,10 @@ namespace DiscImageChef.Commands
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
DicConsole.WriteLine("{0}", DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(inqBuf));
EVPD
.PrettifyPage_C2_C3_C4_C5_C6_Certance(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if((page == 0xC0 || page == 0xC1 || page == 0xC2 || page == 0xC3 || page == 0xC4 || else if((page == 0xC0 || page == 0xC1 || page == 0xC2 || page == 0xC3 || page == 0xC4 ||
page == 0xC5) && page == 0xC5) &&
@@ -497,10 +511,10 @@ namespace DiscImageChef.Commands
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
DicConsole.WriteLine("{0}", DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_to_C5_HP(inqBuf));
EVPD.PrettifyPage_C0_to_C5_HP(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else if(page == 0xDF && else if(page == 0xDF &&
StringHandlers StringHandlers
@@ -510,10 +524,10 @@ namespace DiscImageChef.Commands
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(sense) continue; if(sense) continue;
DicConsole.WriteLine("{0}", DicConsole.WriteLine("{0}", EVPD.PrettifyPage_DF_Certance(inqBuf));
EVPD.PrettifyPage_DF_Certance(inqBuf));
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
else else
{ {
@@ -525,16 +539,16 @@ namespace DiscImageChef.Commands
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if(!sense) if(!sense)
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
$"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h",
inqBuf);
} }
} }
Modes.DecodedMode? decMode = null; Modes.DecodedMode? decMode = null;
PeripheralDeviceTypes devType = PeripheralDeviceTypes devType = (PeripheralDeviceTypes)inq.Value.PeripheralDeviceType;
(PeripheralDeviceTypes)inq.Value.PeripheralDeviceType;
sense = dev.ModeSense10(out byte[] modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, sense = dev.ModeSense10(out byte[] modeBuf, out senseBuf, false, true,
0x3F, 0xFF, 5, out _); ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out _);
if(sense || dev.Error) if(sense || dev.Error)
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true,
ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _); ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _);
@@ -568,10 +582,8 @@ namespace DiscImageChef.Commands
{ {
case 0x00: case 0x00:
{ {
if(devType == PeripheralDeviceTypes.MultiMediaDevice && if(devType == PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0)
page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_00_SFF(page.PageResponse));
DicConsole.WriteLine(Modes
.PrettifyModePage_00_SFF(page.PageResponse));
else else
{ {
if(page.Subpage != 0) if(page.Subpage != 0)
@@ -588,12 +600,8 @@ namespace DiscImageChef.Commands
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.MultiMediaDevice) if(devType == PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_01_MMC(page.PageResponse));
.PrettifyModePage_01_MMC(page else DicConsole.WriteLine(Modes.PrettifyModePage_01(page.PageResponse));
.PageResponse));
else
DicConsole.WriteLine(Modes
.PrettifyModePage_01(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -601,8 +609,7 @@ namespace DiscImageChef.Commands
case 0x02: case 0x02:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_02(page.PageResponse));
.PrettifyModePage_02(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -610,8 +617,7 @@ namespace DiscImageChef.Commands
case 0x03: case 0x03:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_03(page.PageResponse));
.PrettifyModePage_03(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -619,8 +625,7 @@ namespace DiscImageChef.Commands
case 0x04: case 0x04:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_04(page.PageResponse));
.PrettifyModePage_04(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -628,8 +633,7 @@ namespace DiscImageChef.Commands
case 0x05: case 0x05:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_05(page.PageResponse));
.PrettifyModePage_05(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -637,8 +641,7 @@ namespace DiscImageChef.Commands
case 0x06: case 0x06:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_06(page.PageResponse));
.PrettifyModePage_06(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -647,12 +650,8 @@ namespace DiscImageChef.Commands
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.MultiMediaDevice) if(devType == PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_07_MMC(page.PageResponse));
.PrettifyModePage_07_MMC(page else DicConsole.WriteLine(Modes.PrettifyModePage_07(page.PageResponse));
.PageResponse));
else
DicConsole.WriteLine(Modes
.PrettifyModePage_07(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -660,8 +659,7 @@ namespace DiscImageChef.Commands
case 0x08: case 0x08:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_08(page.PageResponse));
.PrettifyModePage_08(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -669,11 +667,9 @@ namespace DiscImageChef.Commands
case 0x0A: case 0x0A:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_0A(page.PageResponse));
.PrettifyModePage_0A(page.PageResponse));
else if(page.Subpage == 1) else if(page.Subpage == 1)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_0A_S01(page.PageResponse));
.PrettifyModePage_0A_S01(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -681,8 +677,7 @@ namespace DiscImageChef.Commands
case 0x0B: case 0x0B:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_0B(page.PageResponse));
.PrettifyModePage_0B(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -690,8 +685,7 @@ namespace DiscImageChef.Commands
case 0x0D: case 0x0D:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_0D(page.PageResponse));
.PrettifyModePage_0D(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -699,8 +693,7 @@ namespace DiscImageChef.Commands
case 0x0E: case 0x0E:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_0E(page.PageResponse));
.PrettifyModePage_0E(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -708,8 +701,7 @@ namespace DiscImageChef.Commands
case 0x0F: case 0x0F:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_0F(page.PageResponse));
.PrettifyModePage_0F(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -718,12 +710,8 @@ namespace DiscImageChef.Commands
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.SequentialAccess) if(devType == PeripheralDeviceTypes.SequentialAccess)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_10_SSC(page.PageResponse));
.PrettifyModePage_10_SSC(page else DicConsole.WriteLine(Modes.PrettifyModePage_10(page.PageResponse));
.PageResponse));
else
DicConsole.WriteLine(Modes
.PrettifyModePage_10(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -731,8 +719,7 @@ namespace DiscImageChef.Commands
case 0x11: case 0x11:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_11(page.PageResponse));
.PrettifyModePage_11(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -742,9 +729,7 @@ namespace DiscImageChef.Commands
case 0x14: case 0x14:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_12_13_14(page.PageResponse));
.PrettifyModePage_12_13_14(page
.PageResponse));
else goto default; else goto default;
break; break;
@@ -752,11 +737,9 @@ namespace DiscImageChef.Commands
case 0x1A: case 0x1A:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_1A(page.PageResponse));
.PrettifyModePage_1A(page.PageResponse));
else if(page.Subpage == 1) else if(page.Subpage == 1)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_1A_S01(page.PageResponse));
.PrettifyModePage_1A_S01(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -764,8 +747,7 @@ namespace DiscImageChef.Commands
case 0x1B: case 0x1B:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_1B(page.PageResponse));
.PrettifyModePage_1B(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -774,15 +756,10 @@ namespace DiscImageChef.Commands
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
if(devType == PeripheralDeviceTypes.MultiMediaDevice) if(devType == PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_1C_SFF(page.PageResponse));
.PrettifyModePage_1C_SFF(page else DicConsole.WriteLine(Modes.PrettifyModePage_1C(page.PageResponse));
.PageResponse));
else
DicConsole.WriteLine(Modes
.PrettifyModePage_1C(page.PageResponse));
else if(page.Subpage == 1) else if(page.Subpage == 1)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_1C_S01(page.PageResponse));
.PrettifyModePage_1C_S01(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -790,8 +767,7 @@ namespace DiscImageChef.Commands
case 0x1D: case 0x1D:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_1D(page.PageResponse));
.PrettifyModePage_1D(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -799,10 +775,7 @@ namespace DiscImageChef.Commands
case 0x21: case 0x21:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE" if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE"
) ) DicConsole.WriteLine(Modes.PrettifyCertanceModePage_21(page.PageResponse));
DicConsole.WriteLine(Modes
.PrettifyCertanceModePage_21(page
.PageResponse));
else goto default; else goto default;
break; break;
@@ -810,10 +783,7 @@ namespace DiscImageChef.Commands
case 0x22: case 0x22:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE" if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE"
) ) DicConsole.WriteLine(Modes.PrettifyCertanceModePage_22(page.PageResponse));
DicConsole.WriteLine(Modes
.PrettifyCertanceModePage_22(page
.PageResponse));
else goto default; else goto default;
break; break;
@@ -821,8 +791,7 @@ namespace DiscImageChef.Commands
case 0x24: case 0x24:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyIBMModePage_24(page.PageResponse));
.PrettifyIBMModePage_24(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -830,8 +799,7 @@ namespace DiscImageChef.Commands
case 0x2A: case 0x2A:
{ {
if(page.Subpage == 0) if(page.Subpage == 0)
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyModePage_2A(page.PageResponse));
.PrettifyModePage_2A(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -839,8 +807,7 @@ namespace DiscImageChef.Commands
case 0x2F: case 0x2F:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyIBMModePage_2F(page.PageResponse));
.PrettifyIBMModePage_2F(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -856,8 +823,7 @@ namespace DiscImageChef.Commands
case 0x3B: case 0x3B:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyHPModePage_3B(page.PageResponse));
.PrettifyHPModePage_3B(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -865,8 +831,7 @@ namespace DiscImageChef.Commands
case 0x3C: case 0x3C:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyHPModePage_3C(page.PageResponse));
.PrettifyHPModePage_3C(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -874,11 +839,9 @@ namespace DiscImageChef.Commands
case 0x3D: case 0x3D:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM") if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyIBMModePage_3D(page.PageResponse));
.PrettifyIBMModePage_3D(page.PageResponse));
else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyHPModePage_3D(page.PageResponse));
.PrettifyHPModePage_3D(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -886,12 +849,9 @@ namespace DiscImageChef.Commands
case 0x3E: case 0x3E:
{ {
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU") if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyFujitsuModePage_3E(page.PageResponse));
.PrettifyFujitsuModePage_3E(page
.PageResponse));
else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP") else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
DicConsole.WriteLine(Modes DicConsole.WriteLine(Modes.PrettifyHPModePage_3E(page.PageResponse));
.PrettifyHPModePage_3E(page.PageResponse));
else goto default; else goto default;
break; break;
@@ -907,20 +867,20 @@ namespace DiscImageChef.Commands
} }
} }
switch(devType) { switch(devType)
{
case PeripheralDeviceTypes.MultiMediaDevice: case PeripheralDeviceTypes.MultiMediaDevice:
sense = dev.GetConfiguration(out byte[] confBuf, out senseBuf, dev.Timeout, out _); sense = dev.GetConfiguration(out byte[] confBuf, out senseBuf, dev.Timeout, out _);
if(!sense) if(!sense)
{ {
DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_mmc_getconfiguration.bin", DataFile.WriteTo("Device-Info command", options.OutputPrefix,
"MMC GET CONFIGURATION", confBuf); "_mmc_getconfiguration.bin", "MMC GET CONFIGURATION", confBuf);
Features.SeparatedFeatures ftr = Features.SeparatedFeatures ftr = Features.Separate(confBuf);
Features.Separate(confBuf);
DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes", DicConsole.DebugWriteLine("Device-Info command",
ftr.DataLength); "GET CONFIGURATION length is {0} bytes", ftr.DataLength);
DicConsole.DebugWriteLine("Device-Info command", DicConsole.DebugWriteLine("Device-Info command",
"GET CONFIGURATION current profile is {0:X4}h", "GET CONFIGURATION current profile is {0:X4}h",
ftr.CurrentProfile); ftr.CurrentProfile);
@@ -1188,8 +1148,9 @@ namespace DiscImageChef.Commands
plxtBuf = new byte[256 * 4]; plxtBuf = new byte[256 * 4];
for(byte i = 0; i < 4; i++) for(byte i = 0; i < 4; i++)
{ {
plxtSense = dev.PlextorReadEepromBlock(out byte[] plxtBufSmall, out senseBuf, i, 256, plxtSense = dev.PlextorReadEepromBlock(out byte[] plxtBufSmall,
dev.Timeout, out _); out senseBuf, i, 256, dev.Timeout,
out _);
if(plxtSense) break; if(plxtSense) break;
Array.Copy(plxtBufSmall, 0, plxtBuf, i * 256, 256); Array.Copy(plxtBufSmall, 0, plxtBuf, i * 256, 256);
@@ -1249,8 +1210,8 @@ namespace DiscImageChef.Commands
} }
} }
plxtSense = dev.PlextorGetPoweRec(out senseBuf, out bool plxtPwrRecEnabled, out ushort plxtPwrRecSpeed, plxtSense = dev.PlextorGetPoweRec(out senseBuf, out bool plxtPwrRecEnabled,
dev.Timeout, out _); out ushort plxtPwrRecSpeed, dev.Timeout, out _);
if(!plxtSense) if(!plxtSense)
{ {
DicConsole.Write("Drive supports PoweRec"); DicConsole.Write("Drive supports PoweRec");
@@ -1263,8 +1224,8 @@ namespace DiscImageChef.Commands
else DicConsole.WriteLine("."); else DicConsole.WriteLine(".");
plxtSense = dev.PlextorGetSpeeds(out senseBuf, out ushort plxtPwrRecSelected, plxtSense = dev.PlextorGetSpeeds(out senseBuf, out ushort plxtPwrRecSelected,
out ushort plxtPwrRecMax, out ushort plxtPwrRecLast, dev.Timeout, out ushort plxtPwrRecMax,
out _); out ushort plxtPwrRecLast, dev.Timeout, out _);
if(!plxtSense) if(!plxtSense)
{ {
@@ -1303,7 +1264,8 @@ namespace DiscImageChef.Commands
if(plxtBuf[4] > 0) if(plxtBuf[4] > 0)
DicConsole.WriteLine("\tCD write speed limited to {0}x", plxtBuf[4]); DicConsole.WriteLine("\tCD write speed limited to {0}x", plxtBuf[4]);
if(plxtBuf[6] > 0) if(plxtBuf[6] > 0)
DicConsole.WriteLine("\tTray eject speed limited to {0}", -(plxtBuf[6] + 48)); DicConsole.WriteLine("\tTray eject speed limited to {0}",
-(plxtBuf[6] + 48));
if(plxtBuf[7] > 0) if(plxtBuf[7] > 0)
DicConsole.WriteLine("\tTray eject speed limited to {0}", plxtBuf[7] - 47); DicConsole.WriteLine("\tTray eject speed limited to {0}", plxtBuf[7] - 47);
} }
@@ -1333,8 +1295,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Drive currently forces single session"); DicConsole.WriteLine("Drive currently forces single session");
} }
plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, false, dev.Timeout, plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, false, dev.Timeout, out _);
out _);
if(!plxtSense) DicConsole.WriteLine("Drive supports Plextor VariRec"); if(!plxtSense) DicConsole.WriteLine("Drive supports Plextor VariRec");
if(plxtDvd) if(plxtDvd)
@@ -1357,8 +1318,8 @@ namespace DiscImageChef.Commands
#endregion Plextor #endregion Plextor
if(inq.Value.KreonPresent) if(inq.Value.KreonPresent)
{ if(!dev.KreonGetFeatureList(out senseBuf, out KreonFeatures krFeatures, dev.Timeout,
if(!dev.KreonGetFeatureList(out senseBuf, out KreonFeatures krFeatures, dev.Timeout, out _)) out _))
{ {
DicConsole.WriteLine("Drive has kreon firmware:"); DicConsole.WriteLine("Drive has kreon firmware:");
if(krFeatures.HasFlag(KreonFeatures.ChallengeResponse)) if(krFeatures.HasFlag(KreonFeatures.ChallengeResponse))
@@ -1382,18 +1343,16 @@ namespace DiscImageChef.Commands
if(krFeatures.HasFlag(KreonFeatures.ErrorSkipping)) if(krFeatures.HasFlag(KreonFeatures.ErrorSkipping))
DicConsole.WriteLine("\tCan skip read errors"); DicConsole.WriteLine("\tCan skip read errors");
} }
}
break; break;
case PeripheralDeviceTypes.SequentialAccess: case PeripheralDeviceTypes.SequentialAccess:
sense = dev.ReadBlockLimits(out byte[] seqBuf, out senseBuf, dev.Timeout, out _); sense = dev.ReadBlockLimits(out byte[] seqBuf, out senseBuf, dev.Timeout, out _);
if(sense) if(sense)
DicConsole.ErrorWriteLine("READ BLOCK LIMITS:\n{0}", DicConsole.ErrorWriteLine("READ BLOCK LIMITS:\n{0}", Sense.PrettifySense(senseBuf));
Sense.PrettifySense(senseBuf));
else else
{ {
DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ssc_readblocklimits.bin", DataFile.WriteTo("Device-Info command", options.OutputPrefix,
"SSC READ BLOCK LIMITS", seqBuf); "_ssc_readblocklimits.bin", "SSC READ BLOCK LIMITS", seqBuf);
DicConsole.WriteLine("Block limits for device:"); DicConsole.WriteLine("Block limits for device:");
DicConsole.WriteLine(BlockLimits.Prettify(seqBuf)); DicConsole.WriteLine(BlockLimits.Prettify(seqBuf));
} }
@@ -1406,8 +1365,7 @@ namespace DiscImageChef.Commands
{ {
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
"_ssc_reportdensitysupport.bin", "SSC REPORT DENSITY SUPPORT", seqBuf); "_ssc_reportdensitysupport.bin", "SSC REPORT DENSITY SUPPORT", seqBuf);
DensitySupport.DensitySupportHeader? dens = DensitySupport.DensitySupportHeader? dens = DensitySupport.DecodeDensity(seqBuf);
DensitySupport.DecodeDensity(seqBuf);
if(dens.HasValue) if(dens.HasValue)
{ {
DicConsole.WriteLine("Densities supported by device:"); DicConsole.WriteLine("Densities supported by device:");
@@ -1415,8 +1373,7 @@ namespace DiscImageChef.Commands
} }
} }
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}", DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -1425,8 +1382,7 @@ namespace DiscImageChef.Commands
DataFile.WriteTo("Device-Info command", options.OutputPrefix, DataFile.WriteTo("Device-Info command", options.OutputPrefix,
"_ssc_reportdensitysupport_medium.bin", "_ssc_reportdensitysupport_medium.bin",
"SSC REPORT DENSITY SUPPORT (MEDIUM)", seqBuf); "SSC REPORT DENSITY SUPPORT (MEDIUM)", seqBuf);
DensitySupport.MediaTypeSupportHeader? meds = DensitySupport.MediaTypeSupportHeader? meds = DensitySupport.DecodeMediumType(seqBuf);
DensitySupport.DecodeMediumType(seqBuf);
if(meds.HasValue) if(meds.HasValue)
{ {
DicConsole.WriteLine("Medium types supported by device:"); DicConsole.WriteLine("Medium types supported by device:");

View File

@@ -50,7 +50,8 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Device-Report command", "--device={0}", options.DevicePath); DicConsole.DebugWriteLine("Device-Report command", "--device={0}", options.DevicePath);
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' &&
char.IsLetter(options.DevicePath[0])) options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; char.IsLetter(options.DevicePath[0]))
options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':';
Device dev = new Device(options.DevicePath); Device dev = new Device(options.DevicePath);
@@ -94,8 +95,7 @@ namespace DiscImageChef.Commands
FileStream xmlFs = new FileStream(xmlFile, FileMode.Create); FileStream xmlFs = new FileStream(xmlFile, FileMode.Create);
XmlSerializer xmlSer = XmlSerializer xmlSer = new XmlSerializer(typeof(Metadata.DeviceReport));
new XmlSerializer(typeof(Metadata.DeviceReport));
xmlSer.Serialize(xmlFs, report); xmlSer.Serialize(xmlFs, report);
xmlFs.Close(); xmlFs.Close();
Core.Statistics.AddCommand("device-report"); Core.Statistics.AddCommand("device-report");

View File

@@ -75,7 +75,8 @@ namespace DiscImageChef.Commands
} }
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' &&
char.IsLetter(options.DevicePath[0])) options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; char.IsLetter(options.DevicePath[0]))
options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':';
Device dev = new Device(options.DevicePath); Device dev = new Device(options.DevicePath);

View File

@@ -108,7 +108,8 @@ namespace DiscImageChef.Commands
trackSize += (ulong)sector.LongLength; trackSize += (ulong)sector.LongLength;
} }
entropy += entTable.Select(l => (double)l / (double)trackSize).Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum(); entropy += entTable.Select(l => (double)l / (double)trackSize)
.Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum();
DicConsole.WriteLine("Entropy for track {0} is {1:F4}.", currentTrack.TrackSequence, entropy); DicConsole.WriteLine("Entropy for track {0} is {1:F4}.", currentTrack.TrackSequence, entropy);
@@ -154,7 +155,8 @@ namespace DiscImageChef.Commands
diskSize += (ulong)sector.LongLength; diskSize += (ulong)sector.LongLength;
} }
entropy += entTable.Select(l => (double)l / (double)diskSize).Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum(); entropy += entTable.Select(l => (double)l / (double)diskSize)
.Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum();
DicConsole.WriteLine(); DicConsole.WriteLine();

View File

@@ -175,7 +175,10 @@ namespace DiscImageChef.Commands
{ {
FileEntryInfo stat = new FileEntryInfo(); FileEntryInfo stat = new FileEntryInfo();
string volumeName = string.IsNullOrEmpty(fs.XmlFSType.VolumeName) ? "NO NAME" : fs.XmlFSType.VolumeName; string volumeName =
string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, ref stat);
if(error == Errno.NoError) if(error == Errno.NoError)
@@ -197,44 +200,38 @@ namespace DiscImageChef.Commands
Directory Directory
.CreateDirectory(Path.Combine(options.OutputDir, .CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type, fs.XmlFSType.Type,
volumeName, volumeName, ".xattrs",
".xattrs",
xattr)); xattr));
outputPath = outputPath =
Path.Combine(options.OutputDir, Path.Combine(options.OutputDir, fs.XmlFSType.Type,
fs.XmlFSType.Type, volumeName, volumeName, ".xattrs", xattr, entry);
".xattrs", xattr, entry);
if(!File.Exists(outputPath)) if(!File.Exists(outputPath))
{ {
outputFile = outputFile =
new FileStream(outputPath, new FileStream(outputPath, FileMode.CreateNew,
FileMode.CreateNew,
FileAccess.ReadWrite, FileAccess.ReadWrite,
FileShare.None); FileShare.None);
outputFile.Write(xattrBuf, 0, xattrBuf.Length); outputFile.Write(xattrBuf, 0, xattrBuf.Length);
outputFile.Close(); outputFile.Close();
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch
{ {
fi.CreationTimeUtc = stat.CreationTimeUtc; // ignored
} }
catch { // ignored try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
} catch
try
{ {
fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; // ignored
} }
catch { // ignored try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
} catch
try
{ {
fi.LastAccessTimeUtc = stat.AccessTimeUtc; // ignored
} }
catch { // ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole DicConsole
.WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}",
@@ -272,14 +269,20 @@ namespace DiscImageChef.Commands
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { fi.CreationTimeUtc = stat.CreationTimeUtc; } try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", DicConsole.WriteLine("Written {0} bytes of file {1} to {2}",
outBuf.Length, entry, outputPath); outBuf.Length, entry, outputPath);
@@ -325,7 +328,10 @@ namespace DiscImageChef.Commands
{ {
FileEntryInfo stat = new FileEntryInfo(); FileEntryInfo stat = new FileEntryInfo();
string volumeName = string.IsNullOrEmpty(fs.XmlFSType.VolumeName) ? "NO NAME" : fs.XmlFSType.VolumeName; string volumeName =
string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, ref stat);
if(error == Errno.NoError) if(error == Errno.NoError)
@@ -346,8 +352,8 @@ namespace DiscImageChef.Commands
Directory.CreateDirectory(Path.Combine(options.OutputDir, Directory.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type, fs.XmlFSType.Type,
volumeName, volumeName, ".xattrs",
".xattrs", xattr)); xattr));
outputPath = outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type, Path.Combine(options.OutputDir, fs.XmlFSType.Type,
@@ -357,26 +363,30 @@ namespace DiscImageChef.Commands
{ {
outputFile = outputFile =
new FileStream(outputPath, FileMode.CreateNew, new FileStream(outputPath, FileMode.CreateNew,
FileAccess.ReadWrite, FileAccess.ReadWrite, FileShare.None);
FileShare.None);
outputFile.Write(xattrBuf, 0, xattrBuf.Length); outputFile.Write(xattrBuf, 0, xattrBuf.Length);
outputFile.Close(); outputFile.Close();
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { fi.CreationTimeUtc = stat.CreationTimeUtc; } try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole DicConsole
.WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}",
xattrBuf.Length, xattr, entry, xattrBuf.Length, xattr, entry, outputPath);
outputPath);
} }
else else
DicConsole DicConsole
@@ -407,14 +417,20 @@ namespace DiscImageChef.Commands
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { fi.CreationTimeUtc = stat.CreationTimeUtc; } try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", DicConsole.WriteLine("Written {0} bytes of file {1} to {2}",
outBuf.Length, entry, outputPath); outBuf.Length, entry, outputPath);
@@ -471,7 +487,10 @@ namespace DiscImageChef.Commands
{ {
FileEntryInfo stat = new FileEntryInfo(); FileEntryInfo stat = new FileEntryInfo();
string volumeName = string.IsNullOrEmpty(fs.XmlFSType.VolumeName) ? "NO NAME" : fs.XmlFSType.VolumeName; string volumeName =
string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, ref stat);
if(error == Errno.NoError) if(error == Errno.NoError)
@@ -492,8 +511,8 @@ namespace DiscImageChef.Commands
Directory.CreateDirectory(Path.Combine(options.OutputDir, Directory.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type, fs.XmlFSType.Type,
volumeName, volumeName, ".xattrs",
".xattrs", xattr)); xattr));
outputPath = outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type, Path.Combine(options.OutputDir, fs.XmlFSType.Type,
@@ -503,26 +522,30 @@ namespace DiscImageChef.Commands
{ {
outputFile = outputFile =
new FileStream(outputPath, FileMode.CreateNew, new FileStream(outputPath, FileMode.CreateNew,
FileAccess.ReadWrite, FileAccess.ReadWrite, FileShare.None);
FileShare.None);
outputFile.Write(xattrBuf, 0, xattrBuf.Length); outputFile.Write(xattrBuf, 0, xattrBuf.Length);
outputFile.Close(); outputFile.Close();
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { fi.CreationTimeUtc = stat.CreationTimeUtc; } try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole DicConsole
.WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}",
xattrBuf.Length, xattr, entry, xattrBuf.Length, xattr, entry, outputPath);
outputPath);
} }
else else
DicConsole DicConsole
@@ -553,14 +576,20 @@ namespace DiscImageChef.Commands
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { fi.CreationTimeUtc = stat.CreationTimeUtc; } try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", DicConsole.WriteLine("Written {0} bytes of file {1} to {2}",
outBuf.Length, entry, outputPath); outBuf.Length, entry, outputPath);
@@ -588,10 +617,8 @@ namespace DiscImageChef.Commands
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin); plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
DicConsole.WriteLine($"Identified by {plugin.Name}."); DicConsole.WriteLine($"Identified by {plugin.Name}.");
Filesystem fs = (Filesystem)plugin Filesystem fs = (Filesystem)plugin
.GetType().GetConstructor(new[] .GetType().GetConstructor(new[] {typeof(ImagePlugin), typeof(Partition), typeof(Encoding)})
{ .Invoke(new object[] {imageFormat, wholePart, null});
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
}).Invoke(new object[] {imageFormat, wholePart, null});
error = fs.Mount(options.Debug); error = fs.Mount(options.Debug);
if(error == Errno.NoError) if(error == Errno.NoError)
{ {
@@ -602,7 +629,9 @@ namespace DiscImageChef.Commands
{ {
FileEntryInfo stat = new FileEntryInfo(); FileEntryInfo stat = new FileEntryInfo();
string volumeName = string.IsNullOrEmpty(fs.XmlFSType.VolumeName) ? "NO NAME" : fs.XmlFSType.VolumeName; string volumeName = string.IsNullOrEmpty(fs.XmlFSType.VolumeName)
? "NO NAME"
: fs.XmlFSType.VolumeName;
error = fs.Stat(entry, ref stat); error = fs.Stat(entry, ref stat);
if(error == Errno.NoError) if(error == Errno.NoError)
@@ -622,9 +651,8 @@ namespace DiscImageChef.Commands
if(error != Errno.NoError) continue; if(error != Errno.NoError) continue;
Directory.CreateDirectory(Path.Combine(options.OutputDir, Directory.CreateDirectory(Path.Combine(options.OutputDir,
fs.XmlFSType.Type, fs.XmlFSType.Type, volumeName,
volumeName, ".xattrs", ".xattrs", xattr));
xattr));
outputPath = outputPath =
Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName, Path.Combine(options.OutputDir, fs.XmlFSType.Type, volumeName,
@@ -640,14 +668,20 @@ namespace DiscImageChef.Commands
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { fi.CreationTimeUtc = stat.CreationTimeUtc; } try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole DicConsole
.WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}", .WriteLine("Written {0} bytes of xattr {1} from file {2} to {3}",
@@ -680,14 +714,20 @@ namespace DiscImageChef.Commands
FileInfo fi = new FileInfo(outputPath); FileInfo fi = new FileInfo(outputPath);
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
try { fi.CreationTimeUtc = stat.CreationTimeUtc; } try { fi.CreationTimeUtc = stat.CreationTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; } try { fi.LastWriteTimeUtc = stat.LastWriteTimeUtc; }
catch { // ignored catch
} {
// ignored
}
try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; } try { fi.LastAccessTimeUtc = stat.AccessTimeUtc; }
catch { // ignored catch
} {
// ignored
}
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", outBuf.Length, DicConsole.WriteLine("Written {0} bytes of file {1} to {2}", outBuf.Length,
entry, outputPath); entry, outputPath);

View File

@@ -39,16 +39,21 @@ namespace DiscImageChef.Commands
{ {
static class ListEncodings static class ListEncodings
{ {
struct CommonEncodingInfo internal static void DoList()
{ {
public string Name; List<CommonEncodingInfo> encodings = Encoding
public string DisplayName; .GetEncodings()
} .Select(info => new CommonEncodingInfo
{
internal static void DoList(ListEncodingsOptions encodingOptions) Name = info.Name,
{ DisplayName = info.GetEncoding().EncodingName
List<CommonEncodingInfo> encodings = Encoding.GetEncodings().Select(info => new CommonEncodingInfo {Name = info.Name, DisplayName = info.GetEncoding().EncodingName}).ToList(); }).ToList();
encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings().Select(info => new CommonEncodingInfo {Name = info.Name, DisplayName = info.DisplayName})); encodings.AddRange(Claunia.Encoding.Encoding.GetEncodings()
.Select(info => new CommonEncodingInfo
{
Name = info.Name,
DisplayName = info.DisplayName
}));
DicConsole.WriteLine("{0,-16} {1,-8}", "Name", "Description"); DicConsole.WriteLine("{0,-16} {1,-8}", "Name", "Description");
@@ -57,5 +62,11 @@ namespace DiscImageChef.Commands
Core.Statistics.AddCommand("list-encodings"); Core.Statistics.AddCommand("list-encodings");
} }
struct CommonEncodingInfo
{
public string Name;
public string DisplayName;
}
} }
} }

View File

@@ -150,8 +150,7 @@ namespace DiscImageChef.Commands
.GetType().GetConstructor(new[] .GetType().GetConstructor(new[]
{ {
typeof(ImagePlugin), typeof(Partition), typeof(Encoding) typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
}) })?.Invoke(new object[] {imageFormat, partitions[i], null});
?.Invoke(new object[] {imageFormat, partitions[i], null});
if(fs == null) continue; if(fs == null) continue;
@@ -194,8 +193,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type); Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
} }
@@ -225,8 +223,7 @@ namespace DiscImageChef.Commands
.GetType().GetConstructor(new[] .GetType().GetConstructor(new[]
{ {
typeof(ImagePlugin), typeof(Partition), typeof(Encoding) typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
}) })?.Invoke(new object[] {imageFormat, wholePart, null});
?.Invoke(new object[] {imageFormat, wholePart, null});
if(fs == null) continue; if(fs == null) continue;
error = fs.Mount(options.Debug); error = fs.Mount(options.Debug);
@@ -237,8 +234,7 @@ namespace DiscImageChef.Commands
if(error == Errno.NoError) if(error == Errno.NoError)
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry); foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
error.ToString());
Core.Statistics.AddFilesystem(fs.XmlFSType.Type); Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
} }

View File

@@ -62,7 +62,8 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", options.OutputPrefix); DicConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", options.OutputPrefix);
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' &&
char.IsLetter(options.DevicePath[0])) options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; char.IsLetter(options.DevicePath[0]))
options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':';
Device dev = new Device(options.DevicePath); Device dev = new Device(options.DevicePath);
@@ -194,8 +195,8 @@ namespace DiscImageChef.Commands
Modes.DecodedMode? decMode = null; Modes.DecodedMode? decMode = null;
PeripheralDeviceTypes devType = dev.ScsiType; PeripheralDeviceTypes devType = dev.ScsiType;
sense = dev.ModeSense10(out byte[] modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, sense = dev.ModeSense10(out byte[] modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current,
0xFF, 5, out _); 0x3F, 0xFF, 5, out _);
if(sense || dev.Error) if(sense || dev.Error)
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F,
0x00, 5, out _); 0x00, 5, out _);
@@ -227,10 +228,13 @@ namespace DiscImageChef.Commands
if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1) if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1)
scsiDensityCode = (byte)decMode.Value.Header.BlockDescriptors[0].Density; scsiDensityCode = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
containsFloppyPage = decMode.Value.Pages.Aggregate(containsFloppyPage, (current, modePage) => current | modePage.Page == 0x05); containsFloppyPage =
decMode.Value.Pages.Aggregate(containsFloppyPage,
(current, modePage) => current | (modePage.Page == 0x05));
} }
switch(dev.ScsiType) { switch(dev.ScsiType)
{
case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.MultiMediaDevice: case PeripheralDeviceTypes.MultiMediaDevice:
case PeripheralDeviceTypes.OCRWDevice: case PeripheralDeviceTypes.OCRWDevice:
@@ -273,8 +277,8 @@ namespace DiscImageChef.Commands
if(blocks != 0 && blockSize != 0) if(blocks != 0 && blockSize != 0)
{ {
blocks++; blocks++;
DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", blocks, DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)",
blockSize, blocks * blockSize); blocks, blockSize, blocks * blockSize);
} }
break; break;
case PeripheralDeviceTypes.SequentialAccess: case PeripheralDeviceTypes.SequentialAccess:
@@ -289,8 +293,7 @@ namespace DiscImageChef.Commands
{ {
DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin",
"SSC REPORT DENSITY SUPPORT (MEDIA)", seqBuf); "SSC REPORT DENSITY SUPPORT (MEDIA)", seqBuf);
DensitySupport.DensitySupportHeader? dens = DensitySupport.DensitySupportHeader? dens = DensitySupport.DecodeDensity(seqBuf);
DensitySupport.DecodeDensity(seqBuf);
if(dens.HasValue) if(dens.HasValue)
{ {
DicConsole.WriteLine("Densities supported by currently inserted media:"); DicConsole.WriteLine("Densities supported by currently inserted media:");
@@ -309,8 +312,7 @@ namespace DiscImageChef.Commands
DataFile.WriteTo("Media-Info command", outputPrefix, DataFile.WriteTo("Media-Info command", outputPrefix,
"_ssc_reportdensitysupport_medium_media.bin", "_ssc_reportdensitysupport_medium_media.bin",
"SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", seqBuf); "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", seqBuf);
DensitySupport.MediaTypeSupportHeader? meds = DensitySupport.MediaTypeSupportHeader? meds = DensitySupport.DecodeMediumType(seqBuf);
DensitySupport.DecodeMediumType(seqBuf);
if(meds.HasValue) if(meds.HasValue)
{ {
DicConsole.WriteLine("Medium types currently inserted in device:"); DicConsole.WriteLine("Medium types currently inserted in device:");
@@ -443,8 +445,7 @@ namespace DiscImageChef.Commands
} }
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout, MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Recognized Format Layers\n{0}", "READ DISC STRUCTURE: Recognized Format Layers\n{0}",
@@ -453,8 +454,7 @@ namespace DiscImageChef.Commands
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin",
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -480,8 +480,7 @@ namespace DiscImageChef.Commands
dskType == MediaType.HDDVDRW || dskType == MediaType.HDDVDRWDL) dskType == MediaType.HDDVDRW || dskType == MediaType.HDDVDRWDL)
{ {
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -535,7 +534,9 @@ namespace DiscImageChef.Commands
dskType = MediaType.HDDVDRW; dskType = MediaType.HDDVDRW;
break; break;
case DiskCategory.Nintendo: case DiskCategory.Nintendo:
dskType = decPfi.Value.DiscSize == DVDSize.Eighty ? MediaType.GOD : MediaType.WOD; dskType = decPfi.Value.DiscSize == DVDSize.Eighty
? MediaType.GOD
: MediaType.WOD;
break; break;
case DiskCategory.UMD: case DiskCategory.UMD:
dskType = MediaType.UMD; dskType = MediaType.UMD;
@@ -578,8 +579,7 @@ namespace DiscImageChef.Commands
if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM) if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM)
{ {
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -587,20 +587,19 @@ namespace DiscImageChef.Commands
{ {
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin",
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
DicConsole.WriteLine("Lead-In CMI:\n{0}", DicConsole.WriteLine("Lead-In CMI:\n{0}", CSS_CPRM.PrettifyLeadInCopyright(cmdBuf));
CSS_CPRM.PrettifyLeadInCopyright(cmdBuf));
} }
} }
#endregion DVD-ROM #endregion DVD-ROM
#region DVD-ROM and HD DVD-ROM #region DVD-ROM and HD DVD-ROM
switch(dskType) { switch(dskType)
{
case MediaType.DVDDownload: case MediaType.DVDDownload:
case MediaType.DVDROM: case MediaType.DVDROM:
case MediaType.HDDVDROM: case MediaType.HDDVDROM:
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -630,8 +629,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Disc Definition Structure:\n{0}", DDS.Prettify(cmdBuf)); DicConsole.WriteLine("Disc Definition Structure:\n{0}", DDS.Prettify(cmdBuf));
} }
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdramMediumStatus, 0, dev.Timeout, MmcDiscStructureFormat.DvdramMediumStatus, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -657,10 +655,10 @@ namespace DiscImageChef.Commands
case MediaType.DVDR: case MediaType.DVDR:
case MediaType.HDDVDR: case MediaType.HDDVDR:
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.LastBorderOutRmd, 0, dev.Timeout, MmcDiscStructureFormat.LastBorderOutRmd, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last-Out Border RMD\n{0}", DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Last-Out Border RMD\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin",
@@ -749,7 +747,8 @@ namespace DiscImageChef.Commands
} }
#endregion DVD-R and DVD-RW #endregion DVD-R and DVD-RW
switch(dskType) { switch(dskType)
{
#region DVD-R, DVD-RW and HD DVD-R #region DVD-R, DVD-RW and HD DVD-R
case MediaType.DVDR: case MediaType.DVDR:
case MediaType.DVDRW: case MediaType.DVDRW:
@@ -774,6 +773,7 @@ namespace DiscImageChef.Commands
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
break; break;
#endregion DVD-R, DVD-RW and HD DVD-R #endregion DVD-R, DVD-RW and HD DVD-R
#region All DVD+ #region All DVD+
case MediaType.DVDPR: case MediaType.DVDPR:
case MediaType.DVDPRDL: case MediaType.DVDPRDL:
@@ -798,6 +798,7 @@ namespace DiscImageChef.Commands
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
break; break;
#endregion All DVD+ #endregion All DVD+
#region HD DVD-ROM #region HD DVD-ROM
case MediaType.HDDVDROM: case MediaType.HDDVDROM:
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
@@ -817,8 +818,7 @@ namespace DiscImageChef.Commands
if(dskType == MediaType.HDDVDR) if(dskType == MediaType.HDDVDR)
{ {
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.HddvdrMediumStatus, 0, dev.Timeout, MmcDiscStructureFormat.HddvdrMediumStatus, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}", "READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}",
@@ -842,8 +842,7 @@ namespace DiscImageChef.Commands
dskType == MediaType.DVDPRWDL) dskType == MediaType.DVDPRWDL)
{ {
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdrLayerCapacity, 0, dev.Timeout, MmcDiscStructureFormat.DvdrLayerCapacity, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -853,22 +852,24 @@ namespace DiscImageChef.Commands
} }
#endregion DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL #endregion DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL
switch(dskType) { switch(dskType)
{
#region DVD-R DL #region DVD-R DL
case MediaType.DVDRDL: case MediaType.DVDRDL:
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out _); MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Middle Zone Start\n{0}", DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Middle Zone Start\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin",
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout, MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Jump Interval Size\n{0}", DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Jump Interval Size\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin",
@@ -884,16 +885,18 @@ namespace DiscImageChef.Commands
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin",
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout, MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Remap Anchor Point\n{0}", DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Remap Anchor Point\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", DataFile.WriteTo("Media-Info command", outputPrefix,
"SCSI READ DISC STRUCTURE", cmdBuf); "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE",
cmdBuf);
break; break;
#endregion DVD-R DL #endregion DVD-R DL
#region All Blu-ray #region All Blu-ray
case MediaType.BDR: case MediaType.BDR:
case MediaType.BDRE: case MediaType.BDRE:
@@ -923,13 +926,12 @@ namespace DiscImageChef.Commands
#endregion All Blu-ray #endregion All Blu-ray
} }
switch(dskType)
switch(dskType) { {
#region BD-ROM only #region BD-ROM only
case MediaType.BDROM: case MediaType.BDROM:
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.BdBurstCuttingArea, 0, dev.Timeout, MmcDiscStructureFormat.BdBurstCuttingArea, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -941,6 +943,7 @@ namespace DiscImageChef.Commands
} }
break; break;
#endregion BD-ROM only #endregion BD-ROM only
#region Writable Blu-ray only #region Writable Blu-ray only
case MediaType.BDR: case MediaType.BDR:
case MediaType.BDRE: case MediaType.BDRE:
@@ -961,7 +964,8 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out _); MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Cartridge Status\n{0}", DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Cartridge Status\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
{ {
@@ -980,8 +984,7 @@ namespace DiscImageChef.Commands
{ {
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin",
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
DicConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", DicConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", DI.Prettify(cmdBuf));
DI.Prettify(cmdBuf));
} }
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.RawDfl, 0, dev.Timeout, out _); MmcDiscStructureFormat.RawDfl, 0, dev.Timeout, out _);
@@ -992,32 +995,30 @@ namespace DiscImageChef.Commands
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin",
"SCSI READ DISC STRUCTURE", cmdBuf); "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf,
MmcDiscInformationDataTypes.TrackResources, dev.Timeout, MmcDiscInformationDataTypes.TrackResources, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
{ {
DicConsole.WriteLine("Track Resources Information:\n{0}", DicConsole.WriteLine("Track Resources Information:\n{0}", DiscInformation.Prettify(cmdBuf));
DiscInformation.Prettify(cmdBuf));
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin",
"SCSI READ DISC INFORMATION", cmdBuf); "SCSI READ DISC INFORMATION", cmdBuf);
} }
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.PowResources, sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf,
dev.Timeout, out _); MmcDiscInformationDataTypes.PowResources, dev.Timeout, out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
{ {
DicConsole.WriteLine("POW Resources Information:\n{0}", DicConsole.WriteLine("POW Resources Information:\n{0}", DiscInformation.Prettify(cmdBuf));
DiscInformation.Prettify(cmdBuf));
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin",
"SCSI READ DISC INFORMATION", cmdBuf); "SCSI READ DISC INFORMATION", cmdBuf);
} }
break; break;
#endregion Writable Blu-ray only #endregion Writable Blu-ray only
#region CDs #region CDs
case MediaType.CD: case MediaType.CD:
case MediaType.CDR: case MediaType.CDR:
@@ -1028,8 +1029,7 @@ namespace DiscImageChef.Commands
// We discarded all discs that falsify a TOC before requesting a real TOC // We discarded all discs that falsify a TOC before requesting a real TOC
// No TOC, no CD (or an empty one) // No TOC, no CD (or an empty one)
bool tocSense = bool tocSense = dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out _);
dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out _);
if(tocSense) if(tocSense)
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -1073,14 +1073,14 @@ namespace DiscImageChef.Commands
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
{ {
DiscInformation.StandardDiscInformation? discInfo = DiscInformation.StandardDiscInformation? discInfo = DiscInformation.Decode000b(cmdBuf);
DiscInformation.Decode000b(cmdBuf);
if(discInfo.HasValue) if(discInfo.HasValue)
{ {
DicConsole.WriteLine("Standard Disc Information:\n{0}", DicConsole.WriteLine("Standard Disc Information:\n{0}",
DiscInformation.Prettify000b(discInfo)); DiscInformation.Prettify000b(discInfo));
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", DataFile.WriteTo("Media-Info command", outputPrefix,
"SCSI READ DISC INFORMATION", cmdBuf); "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION",
cmdBuf);
// If it is a read-only CD, check CD type if available // If it is a read-only CD, check CD type if available
if(dskType == MediaType.CD) if(dskType == MediaType.CD)
@@ -1127,15 +1127,12 @@ namespace DiscImageChef.Commands
foreach(TOC.CDTOCTrackDataDescriptor track in toc.Value.TrackDescriptors) foreach(TOC.CDTOCTrackDataDescriptor track in toc.Value.TrackDescriptors)
{ {
if(track.TrackNumber == 1 && if(track.TrackNumber == 1 &&
((TocControl)(track.CONTROL & 0x0D) == ((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack ||
TocControl.DataTrack || (TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrackIncremental))
(TocControl)(track.CONTROL & 0x0D) == allFirstSessionTracksAreAudio &= firstTrackLastSession != 1;
TocControl.DataTrackIncremental)) allFirstSessionTracksAreAudio &= firstTrackLastSession != 1;
if((TocControl)(track.CONTROL & 0x0D) == if((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack ||
TocControl.DataTrack || (TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrackIncremental)
(TocControl)(track.CONTROL & 0x0D) ==
TocControl.DataTrackIncremental)
{ {
hasDataTrack = true; hasDataTrack = true;
allFirstSessionTracksAreAudio &= track.TrackNumber >= firstTrackLastSession; allFirstSessionTracksAreAudio &= track.TrackNumber >= firstTrackLastSession;
@@ -1168,8 +1165,8 @@ namespace DiscImageChef.Commands
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
else else
{ {
DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin",
cmdBuf); "SCSI READ TOC/PMA/ATIP", cmdBuf);
DicConsole.WriteLine("PMA:\n{0}", PMA.Prettify(cmdBuf)); DicConsole.WriteLine("PMA:\n{0}", PMA.Prettify(cmdBuf));
} }
@@ -1182,8 +1179,7 @@ namespace DiscImageChef.Commands
DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin",
"SCSI READ TOC/PMA/ATIP", cmdBuf); "SCSI READ TOC/PMA/ATIP", cmdBuf);
if(CDTextOnLeadIn.Decode(cmdBuf).HasValue) if(CDTextOnLeadIn.Decode(cmdBuf).HasValue)
DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", CDTextOnLeadIn.Prettify(cmdBuf));
CDTextOnLeadIn.Prettify(cmdBuf));
} }
} }
@@ -1195,8 +1191,7 @@ namespace DiscImageChef.Commands
if(dskType == MediaType.Unknown && blocks > 0) if(dskType == MediaType.Unknown && blocks > 0)
{ {
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
out _);
if(sense) if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}",
Sense.PrettifySense(senseBuf)); Sense.PrettifySense(senseBuf));
@@ -1210,14 +1205,18 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("PFI:\n{0}", PFI.Prettify(cmdBuf)); DicConsole.WriteLine("PFI:\n{0}", PFI.Prettify(cmdBuf));
if(nintendoPfi.Value.DiskCategory == DiskCategory.Nintendo && if(nintendoPfi.Value.DiskCategory == DiskCategory.Nintendo &&
nintendoPfi.Value.PartVersion == 15) nintendoPfi.Value.PartVersion == 15)
switch(nintendoPfi.Value.DiscSize) { switch(nintendoPfi.Value.DiscSize)
case DVDSize.Eighty: dskType = MediaType.GOD; {
case DVDSize.Eighty:
dskType = MediaType.GOD;
break; break;
case DVDSize.OneTwenty: dskType = MediaType.WOD; case DVDSize.OneTwenty:
dskType = MediaType.WOD;
break; break;
} }
} }
} }
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0, sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout,
out _); out _);
@@ -1232,7 +1231,8 @@ namespace DiscImageChef.Commands
} }
#region Xbox #region Xbox
switch(dskType) { switch(dskType)
{
case MediaType.XGD: case MediaType.XGD:
case MediaType.XGD2: case MediaType.XGD2:
case MediaType.XGD3: case MediaType.XGD3:
@@ -1305,7 +1305,8 @@ namespace DiscImageChef.Commands
return; return;
} }
gameSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]) + 1; gameSize = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]) +
1;
DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors", DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors",
gameSize); gameSize);
@@ -1334,7 +1335,8 @@ namespace DiscImageChef.Commands
return; return;
} }
DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors", totalSize); DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors",
totalSize);
middleZone = middleZone =
totalSize - (PFI.Decode(cmdBuf).Value.Layer0EndPSN - totalSize - (PFI.Decode(cmdBuf).Value.Layer0EndPSN -
PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1; PFI.Decode(cmdBuf).Value.DataAreaStartPSN + 1) - gameSize + 1;

View File

@@ -48,7 +48,8 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", options.IbgLogPath); DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", options.IbgLogPath);
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' &&
char.IsLetter(options.DevicePath[0])) options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':'; char.IsLetter(options.DevicePath[0]))
options.DevicePath = "\\\\.\\" + char.ToUpper(options.DevicePath[0]) + ':';
Device dev = new Device(options.DevicePath); Device dev = new Device(options.DevicePath);

View File

@@ -88,7 +88,9 @@ namespace DiscImageChef.Commands
} }
} }
byte[] sector = options.LongSectors ? inputFormat.ReadSectorLong(options.StartSector + i) : inputFormat.ReadSector(options.StartSector + i); byte[] sector = options.LongSectors
? inputFormat.ReadSectorLong(options.StartSector + i)
: inputFormat.ReadSector(options.StartSector + i);
DiscImageChef.PrintHex.PrintHexArray(sector, options.WidthBytes); DiscImageChef.PrintHex.PrintHexArray(sector, options.WidthBytes);
} }

View File

@@ -104,7 +104,8 @@ namespace DiscImageChef.Commands
{ {
DicConsole.WriteLine("Benchmark statistics"); DicConsole.WriteLine("Benchmark statistics");
DicConsole.WriteLine("===================="); DicConsole.WriteLine("====================");
foreach(ChecksumStats chk in Core.Statistics.AllStats.Benchmark.Checksum) DicConsole.WriteLine("Took {0} seconds to calculate {1} algorithm", chk.Value, chk.algorithm); foreach(ChecksumStats chk in Core.Statistics.AllStats.Benchmark.Checksum)
DicConsole.WriteLine("Took {0} seconds to calculate {1} algorithm", chk.Value, chk.algorithm);
DicConsole.WriteLine("Took {0} seconds to calculate all algorithms sequentially", DicConsole.WriteLine("Took {0} seconds to calculate all algorithms sequentially",
Core.Statistics.AllStats.Benchmark.Sequential); Core.Statistics.AllStats.Benchmark.Sequential);
@@ -182,8 +183,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Media statistics"); DicConsole.WriteLine("Media statistics");
DicConsole.WriteLine("================"); DicConsole.WriteLine("================");
foreach(MediaStats ms in Core.Statistics.AllStats.Medias) foreach(MediaStats ms in Core.Statistics.AllStats.Medias)
DicConsole.WriteLine("Media type {0} has been found {1} times in a {2} image.", ms.type, DicConsole.WriteLine("Media type {0} has been found {1} times in a {2} image.", ms.type, ms.Value,
ms.Value, ms.real ? "real" : "media"); ms.real ? "real" : "media");
DicConsole.WriteLine(); DicConsole.WriteLine();
thereAreStats = true; thereAreStats = true;

View File

@@ -241,14 +241,12 @@ namespace DiscImageChef.Commands
DicConsole.VerboseWriteLine("LBAs with error:"); DicConsole.VerboseWriteLine("LBAs with error:");
if(failingLbas.Count == (int)inputFormat.GetSectors()) if(failingLbas.Count == (int)inputFormat.GetSectors())
DicConsole.VerboseWriteLine("\tall sectors."); DicConsole.VerboseWriteLine("\tall sectors.");
else else foreach(ulong t in failingLbas) DicConsole.VerboseWriteLine("\t{0}", t);
foreach(ulong t in failingLbas) DicConsole.VerboseWriteLine("\t{0}", t);
DicConsole.WriteLine("LBAs without checksum:"); DicConsole.WriteLine("LBAs without checksum:");
if(unknownLbas.Count == (int)inputFormat.GetSectors()) if(unknownLbas.Count == (int)inputFormat.GetSectors())
DicConsole.VerboseWriteLine("\tall sectors."); DicConsole.VerboseWriteLine("\tall sectors.");
else else foreach(ulong t in unknownLbas) DicConsole.VerboseWriteLine("\t{0}", t);
foreach(ulong t in unknownLbas) DicConsole.VerboseWriteLine("\t{0}", t);
} }
DicConsole.WriteLine("Total sectors........... {0}", inputFormat.GetSectors()); DicConsole.WriteLine("Total sectors........... {0}", inputFormat.GetSectors());

View File

@@ -51,130 +51,136 @@ namespace DiscImageChef
Statistics.LoadStats(); Statistics.LoadStats();
if(Settings.Settings.Current.Stats.ShareStats) Statistics.SubmitStats(); if(Settings.Settings.Current.Stats.ShareStats) Statistics.SubmitStats();
Parser.Default Parser.Default.ParseArguments(args, typeof(AnalyzeOptions), typeof(CompareOptions), typeof(ChecksumOptions),
.ParseArguments(args, typeof(AnalyzeOptions), typeof(CompareOptions), typeof(ChecksumOptions), typeof(EntropyOptions), typeof(VerifyOptions), typeof(PrintHexOptions), typeof(DecodeOptions), typeof(DeviceInfoOptions), typeof(MediaInfoOptions), typeof(MediaScanOptions), typeof(FormatsOptions), typeof(BenchmarkOptions), typeof(CreateSidecarOptions), typeof(DumpMediaOptions), typeof(DeviceReportOptions), typeof(ConfigureOptions), typeof(StatsOptions), typeof(LsOptions), typeof(ExtractFilesOptions), typeof(ListDevicesOptions), typeof(ListEncodingsOptions)).WithParsed<AnalyzeOptions>(opts => typeof(EntropyOptions), typeof(VerifyOptions), typeof(PrintHexOptions),
{ typeof(DecodeOptions), typeof(DeviceInfoOptions), typeof(MediaInfoOptions),
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; typeof(MediaScanOptions), typeof(FormatsOptions), typeof(BenchmarkOptions),
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; typeof(CreateSidecarOptions), typeof(DumpMediaOptions),
PrintCopyright(); typeof(DeviceReportOptions), typeof(ConfigureOptions), typeof(StatsOptions),
Analyze.DoAnalyze(opts); typeof(LsOptions), typeof(ExtractFilesOptions), typeof(ListDevicesOptions),
}).WithParsed<CompareOptions>(opts => typeof(ListEncodingsOptions)).WithParsed<AnalyzeOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Compare.DoCompare(opts); Analyze.DoAnalyze(opts);
}).WithParsed<ChecksumOptions>(opts => }).WithParsed<CompareOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Checksum.DoChecksum(opts); Compare.DoCompare(opts);
}).WithParsed<EntropyOptions>(opts => }).WithParsed<ChecksumOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Entropy.DoEntropy(opts); Checksum.DoChecksum(opts);
}).WithParsed<VerifyOptions>(opts => }).WithParsed<EntropyOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Verify.DoVerify(opts); Entropy.DoEntropy(opts);
}).WithParsed<PrintHexOptions>(opts => }).WithParsed<VerifyOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Commands.PrintHex.DoPrintHex(opts); Verify.DoVerify(opts);
}).WithParsed<DecodeOptions>(opts => }).WithParsed<PrintHexOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Decode.DoDecode(opts); Commands.PrintHex.DoPrintHex(opts);
}).WithParsed<DeviceInfoOptions>(opts => }).WithParsed<DecodeOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
DeviceInfo.DoDeviceInfo(opts); Decode.DoDecode(opts);
}).WithParsed<MediaInfoOptions>(opts => }).WithParsed<DeviceInfoOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
MediaInfo.DoMediaInfo(opts); DeviceInfo.DoDeviceInfo(opts);
}).WithParsed<MediaScanOptions>(opts => }).WithParsed<MediaInfoOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
MediaScan.DoMediaScan(opts); MediaInfo.DoMediaInfo(opts);
}).WithParsed<FormatsOptions>(opts => }).WithParsed<MediaScanOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Formats.ListFormats(opts); MediaScan.DoMediaScan(opts);
}).WithParsed<BenchmarkOptions>(opts => }).WithParsed<FormatsOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Benchmark.DoBenchmark(opts); Formats.ListFormats(opts);
}).WithParsed<CreateSidecarOptions>(opts => }).WithParsed<BenchmarkOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
CreateSidecar.DoSidecar(opts); Benchmark.DoBenchmark(opts);
}).WithParsed<DumpMediaOptions>(opts => }).WithParsed<CreateSidecarOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
DumpMedia.DoDumpMedia(opts); CreateSidecar.DoSidecar(opts);
}).WithParsed<DeviceReportOptions>(opts => }).WithParsed<DumpMediaOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
DeviceReport.DoDeviceReport(opts); DumpMedia.DoDumpMedia(opts);
}).WithParsed<LsOptions>(opts => }).WithParsed<DeviceReportOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
Ls.DoLs(opts); DeviceReport.DoDeviceReport(opts);
}).WithParsed<ExtractFilesOptions>(opts => }).WithParsed<LsOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
ExtractFiles.DoExtractFiles(opts); Ls.DoLs(opts);
}).WithParsed<ListDevicesOptions>(opts => }).WithParsed<ExtractFilesOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
ListDevices.DoListDevices(opts); ExtractFiles.DoExtractFiles(opts);
}).WithParsed<ListEncodingsOptions>(opts => }).WithParsed<ListDevicesOptions>(opts =>
{ {
if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine; if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine; if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
PrintCopyright(); PrintCopyright();
ListEncodings.DoList(opts); ListDevices.DoListDevices(opts);
}).WithParsed<ConfigureOptions>(opts => }).WithParsed<ListEncodingsOptions>(opts =>
{ {
PrintCopyright(); if(opts.Debug) DicConsole.DebugWriteLineEvent += System.Console.Error.WriteLine;
Configure.DoConfigure(); if(opts.Verbose) DicConsole.VerboseWriteLineEvent += System.Console.WriteLine;
}).WithParsed<StatsOptions>(opts => PrintCopyright();
{ ListEncodings.DoList();
PrintCopyright(); }).WithParsed<ConfigureOptions>(opts =>
Commands.Statistics.ShowStats(); {
}).WithNotParsed(errs => Environment.Exit(1)); PrintCopyright();
Configure.DoConfigure();
}).WithParsed<StatsOptions>(opts =>
{
PrintCopyright();
Commands.Statistics.ShowStats();
}).WithNotParsed(errs => Environment.Exit(1));
Statistics.SaveStats(); Statistics.SaveStats();
} }

View File

@@ -68,7 +68,7 @@ namespace DiscImageChef
} }
internal static void UpdateTwoProgress(string text, long current, long maximum, string text2, long current2, internal static void UpdateTwoProgress(string text, long current, long maximum, string text2, long current2,
long maximum2) long maximum2)
{ {
DicConsole.Write("\r" + text + ": " + text2); DicConsole.Write("\r" + text + ": " + text2);
} }