REFACTOR: Use preferred braces style.

This commit is contained in:
2017-12-20 23:07:46 +00:00
parent 4158d64854
commit e9443388ee
120 changed files with 1016 additions and 1975 deletions

View File

@@ -99,8 +99,10 @@ namespace DiscImageChef.Commands
else
{
if(options.Verbose)
{
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
}
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}

View File

@@ -168,8 +168,10 @@ namespace DiscImageChef.Commands
if(options.SeparatedTracks)
{
foreach(ChecksumType chk in trackChecksum.End())
{
DicConsole.WriteLine("Track {0}'s {1}: {2}", currentTrack.TrackSequence, chk.type,
chk.Value);
}
}
previousTrackEnd = currentTrack.TrackEndSector;

View File

@@ -77,8 +77,10 @@ namespace DiscImageChef.Commands
else
{
if(options.Verbose)
{
DicConsole.VerboseWriteLine("Input file 1 format identified by {0} ({1}).", input1Format.Name,
input1Format.PluginUuid);
}
else DicConsole.WriteLine("Input file 1 format identified by {0}.", input1Format.Name);
}
@@ -90,8 +92,10 @@ namespace DiscImageChef.Commands
else
{
if(options.Verbose)
{
DicConsole.VerboseWriteLine("Input file 2 format identified by {0} ({1}).", input2Format.Name,
input2Format.PluginUuid);
}
else DicConsole.WriteLine("Input file 2 format identified by {0}.", input2Format.Name);
}

View File

@@ -102,8 +102,10 @@ namespace DiscImageChef.Commands
else
{
if(options.Verbose)
{
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
}
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}
@@ -162,10 +164,7 @@ namespace DiscImageChef.Commands
string[] contents = Directory.GetFiles(options.InputFile, "*", SearchOption.TopDirectoryOnly);
List<string> files = new List<string>();
foreach(string file in contents)
{
if(new FileInfo(file).Length % options.BlockSize == 0) files.Add(file);
}
foreach(string file in contents) if(new FileInfo(file).Length % options.BlockSize == 0) files.Add(file);
files.Sort(StringComparer.CurrentCultureIgnoreCase);

View File

@@ -117,8 +117,10 @@ namespace DiscImageChef.Commands
{
byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY);
if(identify == null)
{
DicConsole
.WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image");
}
else
{
DicConsole.WriteLine("ATA IDENTIFY PACKET DEVICE command response:");

View File

@@ -48,10 +48,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix);
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);
@@ -605,8 +602,10 @@ namespace DiscImageChef.Commands
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current,
0x3F, 0xFF, 5, out duration);
if(sense || dev.Error)
{
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true,
ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
}
if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType);
@@ -615,16 +614,20 @@ namespace DiscImageChef.Commands
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F,
0xFF, 5, out duration);
if(sense || dev.Error)
{
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current,
0x3F, 0x00, 5, out duration);
}
if(sense || dev.Error) sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration);
if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType);
}
if(!sense)
{
DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_scsi_modesense.bin",
"SCSI MODE SENSE", modeBuf);
}
if(decMode.HasValue)
{
@@ -641,17 +644,23 @@ namespace DiscImageChef.Commands
{
if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice &&
page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_00_SFF(page.PageResponse));
}
else
{
if(page.Subpage != 0)
{
DicConsole
.WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h",
page.Page, page.Subpage);
}
else
{
DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h",
page.Page);
}
}
break;
}
@@ -660,12 +669,16 @@ namespace DiscImageChef.Commands
if(page.Subpage == 0)
{
if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_01_MMC(page
.PageResponse));
}
else
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_01(page.PageResponse));
}
}
else goto default;
@@ -674,8 +687,10 @@ namespace DiscImageChef.Commands
case 0x02:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_02(page.PageResponse));
}
else goto default;
break;
@@ -683,8 +698,10 @@ namespace DiscImageChef.Commands
case 0x03:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_03(page.PageResponse));
}
else goto default;
break;
@@ -692,8 +709,10 @@ namespace DiscImageChef.Commands
case 0x04:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_04(page.PageResponse));
}
else goto default;
break;
@@ -701,8 +720,10 @@ namespace DiscImageChef.Commands
case 0x05:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_05(page.PageResponse));
}
else goto default;
break;
@@ -710,8 +731,10 @@ namespace DiscImageChef.Commands
case 0x06:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_06(page.PageResponse));
}
else goto default;
break;
@@ -721,12 +744,16 @@ namespace DiscImageChef.Commands
if(page.Subpage == 0)
{
if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_07_MMC(page
.PageResponse));
}
else
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_07(page.PageResponse));
}
}
else goto default;
@@ -735,8 +762,10 @@ namespace DiscImageChef.Commands
case 0x08:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_08(page.PageResponse));
}
else goto default;
break;
@@ -744,11 +773,15 @@ namespace DiscImageChef.Commands
case 0x0A:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_0A(page.PageResponse));
}
else if(page.Subpage == 1)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_0A_S01(page.PageResponse));
}
else goto default;
break;
@@ -756,8 +789,10 @@ namespace DiscImageChef.Commands
case 0x0B:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_0B(page.PageResponse));
}
else goto default;
break;
@@ -765,8 +800,10 @@ namespace DiscImageChef.Commands
case 0x0D:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_0D(page.PageResponse));
}
else goto default;
break;
@@ -774,8 +811,10 @@ namespace DiscImageChef.Commands
case 0x0E:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_0E(page.PageResponse));
}
else goto default;
break;
@@ -783,8 +822,10 @@ namespace DiscImageChef.Commands
case 0x0F:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_0F(page.PageResponse));
}
else goto default;
break;
@@ -794,12 +835,16 @@ namespace DiscImageChef.Commands
if(page.Subpage == 0)
{
if(devType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_10_SSC(page
.PageResponse));
}
else
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_10(page.PageResponse));
}
}
else goto default;
@@ -808,8 +853,10 @@ namespace DiscImageChef.Commands
case 0x11:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_11(page.PageResponse));
}
else goto default;
break;
@@ -819,9 +866,11 @@ namespace DiscImageChef.Commands
case 0x14:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_12_13_14(page
.PageResponse));
}
else goto default;
break;
@@ -829,11 +878,15 @@ namespace DiscImageChef.Commands
case 0x1A:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_1A(page.PageResponse));
}
else if(page.Subpage == 1)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_1A_S01(page.PageResponse));
}
else goto default;
break;
@@ -841,8 +894,10 @@ namespace DiscImageChef.Commands
case 0x1B:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_1B(page.PageResponse));
}
else goto default;
break;
@@ -852,16 +907,22 @@ namespace DiscImageChef.Commands
if(page.Subpage == 0)
{
if(devType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_1C_SFF(page
.PageResponse));
}
else
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_1C(page.PageResponse));
}
}
else if(page.Subpage == 1)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_1C_S01(page.PageResponse));
}
else goto default;
break;
@@ -869,8 +930,10 @@ namespace DiscImageChef.Commands
case 0x1D:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_1D(page.PageResponse));
}
else goto default;
break;
@@ -879,9 +942,11 @@ namespace DiscImageChef.Commands
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE"
)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyCertanceModePage_21(page
.PageResponse));
}
else goto default;
break;
@@ -890,9 +955,11 @@ namespace DiscImageChef.Commands
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "CERTANCE"
)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyCertanceModePage_22(page
.PageResponse));
}
else goto default;
break;
@@ -900,8 +967,10 @@ namespace DiscImageChef.Commands
case 0x24:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyIBMModePage_24(page.PageResponse));
}
else goto default;
break;
@@ -909,8 +978,10 @@ namespace DiscImageChef.Commands
case 0x2A:
{
if(page.Subpage == 0)
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyModePage_2A(page.PageResponse));
}
else goto default;
break;
@@ -918,8 +989,10 @@ namespace DiscImageChef.Commands
case 0x2F:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyIBMModePage_2F(page.PageResponse));
}
else goto default;
break;
@@ -935,8 +1008,10 @@ namespace DiscImageChef.Commands
case 0x3B:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyHPModePage_3B(page.PageResponse));
}
else goto default;
break;
@@ -944,8 +1019,10 @@ namespace DiscImageChef.Commands
case 0x3C:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyHPModePage_3C(page.PageResponse));
}
else goto default;
break;
@@ -953,11 +1030,15 @@ namespace DiscImageChef.Commands
case 0x3D:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "IBM")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyIBMModePage_3D(page.PageResponse));
}
else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyHPModePage_3D(page.PageResponse));
}
else goto default;
break;
@@ -965,12 +1046,16 @@ namespace DiscImageChef.Commands
case 0x3E:
{
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyFujitsuModePage_3E(page
.PageResponse));
}
else if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "HP")
{
DicConsole.WriteLine(Decoders.SCSI.Modes
.PrettifyHPModePage_3E(page.PageResponse));
}
else goto default;
break;
@@ -978,8 +1063,10 @@ namespace DiscImageChef.Commands
default:
{
if(page.Subpage != 0)
{
DicConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h",
page.Page, page.Subpage);
}
else DicConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page);
break;
}
@@ -1196,8 +1283,10 @@ namespace DiscImageChef.Commands
}
}
else
{
DicConsole.DebugWriteLine("Device-Info command",
"GET CONFIGURATION returned no feature descriptors");
}
}
// TODO: DVD drives respond correctly to BD status.
@@ -1357,16 +1446,22 @@ namespace DiscImageChef.Commands
if(!plxtSense)
{
if(plxtPwrRecSelected > 0)
{
DicConsole
.WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)",
plxtPwrRecSelected, plxtPwrRecSelected / 177);
}
if(plxtPwrRecMax > 0)
{
DicConsole
.WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)",
plxtPwrRecMax, plxtPwrRecMax / 177);
}
if(plxtPwrRecLast > 0)
{
DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)",
plxtPwrRecLast, plxtPwrRecLast / 177);
}
}
}
else DicConsole.WriteLine("PoweRec is disabled");
@@ -1495,8 +1590,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadBlockLimits(out seqBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.ErrorWriteLine("READ BLOCK LIMITS:\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Device-Info command", options.OutputPrefix, "_ssc_readblocklimits.bin",
@@ -1507,8 +1604,10 @@ namespace DiscImageChef.Commands
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT:\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Device-Info command", options.OutputPrefix,
@@ -1525,8 +1624,10 @@ namespace DiscImageChef.Commands
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout,
out duration);
if(sense)
{
DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Device-Info command", options.OutputPrefix,

View File

@@ -47,10 +47,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Device-Report command", "--device={0}", options.DevicePath);
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);
@@ -100,7 +97,7 @@ namespace DiscImageChef.Commands
xmlFs.Close();
Core.Statistics.AddCommand("device-report");
if(Settings.Settings.Current.ShareReports) { Remote.SubmitReport(report); }
if(Settings.Settings.Current.ShareReports) Remote.SubmitReport(report);
}
}
}

View File

@@ -78,10 +78,7 @@ namespace DiscImageChef.Commands
}
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);

View File

@@ -119,9 +119,11 @@ namespace DiscImageChef.Commands
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
if(options.DuplicatedSectors)
{
DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})",
currentTrack.TrackSequence, uniqueSectorsPerTrack.Count,
(double)uniqueSectorsPerTrack.Count / (double)sectors);
}
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
DicConsole.WriteLine();
@@ -178,8 +180,10 @@ namespace DiscImageChef.Commands
if(options.DuplicatedSectors)
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
{
DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count,
(double)uniqueSectors.Count / (double)sectors);
}
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
Core.Statistics.AddCommand("entropy");

View File

@@ -100,8 +100,10 @@ namespace DiscImageChef.Commands
else
{
if(options.Verbose)
{
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
}
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}
@@ -252,9 +254,11 @@ namespace DiscImageChef.Commands
outputPath);
}
else
{
DicConsole
.ErrorWriteLine("Cannot write xattr {0} for {1}, output exists",
xattr, entry);
}
}
}
}
@@ -294,26 +298,34 @@ namespace DiscImageChef.Commands
outBuf.Length, entry, outputPath);
}
else
{
DicConsole.ErrorWriteLine("Error {0} reading file {1}",
error, entry);
}
}
else
{
DicConsole
.ErrorWriteLine("Cannot write file {0}, output exists",
entry);
}
}
else DicConsole.ErrorWriteLine("Error reading file {0}", entry);
}
}
else
{
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
error.ToString());
}
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
}
else
{
DicConsole.ErrorWriteLine("Unable to mount device, error {0}",
error.ToString());
}
}
}
}
@@ -391,9 +403,11 @@ namespace DiscImageChef.Commands
outputPath);
}
else
{
DicConsole
.ErrorWriteLine("Cannot write xattr {0} for {1}, output exists",
xattr, entry);
}
}
}
}
@@ -431,12 +445,16 @@ namespace DiscImageChef.Commands
outBuf.Length, entry, outputPath);
}
else
{
DicConsole.ErrorWriteLine("Error {0} reading file {1}", error,
entry);
}
}
else
{
DicConsole.ErrorWriteLine("Cannot write file {0}, output exists",
entry);
}
}
else DicConsole.ErrorWriteLine("Error reading file {0}", entry);
}
@@ -539,9 +557,11 @@ namespace DiscImageChef.Commands
outputPath);
}
else
{
DicConsole
.ErrorWriteLine("Cannot write xattr {0} for {1}, output exists",
xattr, entry);
}
}
}
}
@@ -579,12 +599,16 @@ namespace DiscImageChef.Commands
outBuf.Length, entry, outputPath);
}
else
{
DicConsole.ErrorWriteLine("Error {0} reading file {1}", error,
entry);
}
}
else
{
DicConsole.ErrorWriteLine("Cannot write file {0}, output exists",
entry);
}
}
else DicConsole.ErrorWriteLine("Error reading file {0}", entry);
}
@@ -670,9 +694,11 @@ namespace DiscImageChef.Commands
xattrBuf.Length, xattr, entry, outputPath);
}
else
{
DicConsole
.ErrorWriteLine("Cannot write xattr {0} for {1}, output exists",
xattr, entry);
}
}
}
}

View File

@@ -96,8 +96,10 @@ namespace DiscImageChef.Commands
else
{
if(options.Verbose)
{
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
}
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}
@@ -165,19 +167,20 @@ namespace DiscImageChef.Commands
{
List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir);
if(error == Errno.NoError)
{
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
}
if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else
{
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
error.ToString());
}
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
}
else
{
DicConsole.ErrorWriteLine("Unable to mount device, error {0}",
error.ToString());
}
}
}
}
@@ -195,10 +198,7 @@ namespace DiscImageChef.Commands
{
List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir);
if(error == Errno.NoError)
{
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
}
if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
@@ -237,10 +237,7 @@ namespace DiscImageChef.Commands
{
List<string> rootDir = new List<string>();
error = fs.ReadDir("/", ref rootDir);
if(error == Errno.NoError)
{
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
}
if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
else
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
@@ -286,10 +283,7 @@ namespace DiscImageChef.Commands
{
byte[] xattrBuf = new byte[0];
error = fs.GetXattr(entry, xattr, ref xattrBuf);
if(error == Errno.NoError)
{
DicConsole.WriteLine("\t\t{0}\t{1} bytes", xattr, xattrBuf.Length);
}
if(error == Errno.NoError) DicConsole.WriteLine("\t\t{0}\t{1} bytes", xattr, xattrBuf.Length);
}
}
}

View File

@@ -49,10 +49,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", options.OutputPrefix);
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);
@@ -194,15 +191,17 @@ namespace DiscImageChef.Commands
0x00, 5, out duration);
}
if(!sense && !dev.Error) { decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType); }
if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType);
if(sense || dev.Error || !decMode.HasValue)
{
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00,
5, out duration);
if(sense || dev.Error)
{
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F,
0x00, 5, out duration);
}
if(sense || dev.Error) sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration);
if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType);
@@ -338,8 +337,10 @@ namespace DiscImageChef.Commands
sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ GET CONFIGURATION:\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin",
@@ -446,21 +447,29 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Recognized Format Layers\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
// More like a drive information
/*
@@ -483,8 +492,10 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin",
@@ -554,8 +565,10 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin",
@@ -587,8 +600,10 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin",
@@ -606,19 +621,27 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdAacs, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD AACS\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion DVD-ROM and HD DVD-ROM
@@ -688,8 +711,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdramDds, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin",
@@ -700,8 +725,10 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.DvdramMediumStatus, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin",
@@ -712,8 +739,10 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: SAI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin",
@@ -730,11 +759,15 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.LastBorderOutRmd, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last-Out Border RMD\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion DVD-R and HD DVD-R
@@ -744,11 +777,15 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Pre-Recorded Info\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion DVD-R and DVD-RW
@@ -759,20 +796,28 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.DvdrMediaIdentifier, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R Media ID\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdrPhysicalInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R PFI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion DVD-R, DVD-RW and HD DVD-R
@@ -783,20 +828,28 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.Adip, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: ADIP\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.Dcb, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DCB\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion All DVD+
@@ -807,11 +860,15 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.HddvdCopyrightInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD CMI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion HD DVD-ROM
@@ -822,20 +879,28 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.HddvdrMediumStatus, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.HddvdrLastRmd, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last RMD\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion HD DVD-R
@@ -847,11 +912,15 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.DvdrLayerCapacity, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL
@@ -861,39 +930,55 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Middle Zone Start\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Jump Interval Size\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.ManualLayerJumpStartLba, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Remap Anchor Point\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion DVD-R DL
@@ -904,8 +989,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin",
@@ -915,11 +1002,15 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.Pac, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PAC\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion All Blu-ray
@@ -930,8 +1021,10 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.BdBurstCuttingArea, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin",
@@ -948,8 +1041,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.BdDds, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin",
@@ -960,8 +1055,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Cartridge Status\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin",
@@ -972,9 +1069,11 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.BdSpareAreaInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command",
"READ DISC STRUCTURE: Spare Area Information\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin",
@@ -985,17 +1084,23 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.RawDfl, 0, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Raw DFL\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf,
MmcDiscInformationDataTypes.TrackResources, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DicConsole.WriteLine("Track Resources Information:\n{0}",
@@ -1006,8 +1111,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.PowResources,
dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DicConsole.WriteLine("POW Resources Information:\n{0}",
@@ -1029,8 +1136,10 @@ namespace DiscImageChef.Commands
bool tocSense =
dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out duration);
if(tocSense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
toc = Decoders.CD.TOC.Decode(cmdBuf);
@@ -1045,8 +1154,10 @@ namespace DiscImageChef.Commands
// ATIP exists on blank CDs
sense = dev.ReadAtip(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: ATIP\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP",
@@ -1067,8 +1178,10 @@ namespace DiscImageChef.Commands
MmcDiscInformationDataTypes.DiscInformation, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 000b\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo =
@@ -1101,8 +1214,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadSessionInfo(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Session info\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin",
@@ -1131,10 +1246,7 @@ namespace DiscImageChef.Commands
((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) ==
Decoders.CD.TOC_CONTROL.DataTrack ||
(Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) ==
Decoders.CD.TOC_CONTROL.DataTrackIncremental))
{
allFirstSessionTracksAreAudio &= firstTrackLastSession != 1;
}
Decoders.CD.TOC_CONTROL.DataTrackIncremental)) allFirstSessionTracksAreAudio &= firstTrackLastSession != 1;
if((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) ==
Decoders.CD.TOC_CONTROL.DataTrack ||
@@ -1159,8 +1271,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Raw TOC\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin",
@@ -1169,8 +1283,10 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadPma(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: PMA\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP",
@@ -1180,15 +1296,19 @@ namespace DiscImageChef.Commands
sense = dev.ReadCdText(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: CD-TEXT\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin",
"SCSI READ TOC/PMA/ATIP", cmdBuf);
if(Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue)
{
DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}",
Decoders.CD.CDTextOnLeadIn.Prettify(cmdBuf));
}
}
}
}
@@ -1201,8 +1321,10 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin",
@@ -1224,11 +1346,15 @@ namespace DiscImageChef.Commands
MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout,
out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin",
"SCSI READ DISC STRUCTURE", cmdBuf);
}
}
#endregion Nintendo
}
@@ -1248,11 +1374,15 @@ namespace DiscImageChef.Commands
{
sense = dev.KreonExtractSs(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "KREON EXTRACT SS:\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS",
cmdBuf);
}
if(Decoders.Xbox.SS.Decode(cmdBuf).HasValue)
DicConsole.WriteLine("Xbox Security Sector:\n{0}", Decoders.Xbox.SS.Prettify(cmdBuf));
@@ -1356,8 +1486,10 @@ namespace DiscImageChef.Commands
#endregion Xbox
if(dskType == MediaType.Unknown)
{
dskType = MediaTypeFromScsi.Get((byte)dev.ScsiType, dev.Manufacturer, dev.Model, scsiMediumType,
scsiDensityCode, blocks, blockSize);
}
if(dskType == MediaType.Unknown && dev.IsUsb && containsFloppyPage) dskType = MediaType.FlashDrive;
@@ -1366,8 +1498,10 @@ namespace DiscImageChef.Commands
sense = dev.ReadMediaSerialNumber(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if(sense)
{
DicConsole.DebugWriteLine("Media-Info command", "READ MEDIA SERIAL NUMBER\n{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
else
{
DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin",

View File

@@ -48,10 +48,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", options.IbgLogPath);
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);
@@ -108,8 +105,10 @@ namespace DiscImageChef.Commands
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
if(results.SeekTotal != 0 || results.SeekMin != double.MaxValue || results.SeekMax != double.MinValue)
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
{
DicConsole.WriteLine("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)",
results.SeekTimes, results.SeekMax, results.SeekMin, results.SeekTotal / 1000);
}
Core.Statistics.AddMediaScan((long)results.A, (long)results.B, (long)results.C, (long)results.D,
(long)results.E, (long)results.F, (long)results.Blocks, (long)results.Errored,

View File

@@ -52,50 +52,80 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Commands statistics");
DicConsole.WriteLine("===================");
if(Core.Statistics.AllStats.Commands.Analyze > 0)
{
DicConsole.WriteLine("You have called the Analyze command {0} times",
Core.Statistics.AllStats.Commands.Analyze);
}
if(Core.Statistics.AllStats.Commands.Benchmark > 0)
{
DicConsole.WriteLine("You have called the Benchmark command {0} times",
Core.Statistics.AllStats.Commands.Benchmark);
}
if(Core.Statistics.AllStats.Commands.Checksum > 0)
{
DicConsole.WriteLine("You have called the Checksum command {0} times",
Core.Statistics.AllStats.Commands.Checksum);
}
if(Core.Statistics.AllStats.Commands.Compare > 0)
{
DicConsole.WriteLine("You have called the Compare command {0} times",
Core.Statistics.AllStats.Commands.Compare);
}
if(Core.Statistics.AllStats.Commands.CreateSidecar > 0)
{
DicConsole.WriteLine("You have called the Create-Sidecar command {0} times",
Core.Statistics.AllStats.Commands.CreateSidecar);
}
if(Core.Statistics.AllStats.Commands.Decode > 0)
{
DicConsole.WriteLine("You have called the Decode command {0} times",
Core.Statistics.AllStats.Commands.Decode);
}
if(Core.Statistics.AllStats.Commands.DeviceInfo > 0)
{
DicConsole.WriteLine("You have called the Device-Info command {0} times",
Core.Statistics.AllStats.Commands.DeviceInfo);
}
if(Core.Statistics.AllStats.Commands.DeviceReport > 0)
{
DicConsole.WriteLine("You have called the Device-Report command {0} times",
Core.Statistics.AllStats.Commands.DeviceReport);
}
if(Core.Statistics.AllStats.Commands.DumpMedia > 0)
{
DicConsole.WriteLine("You have called the Dump-Media command {0} times",
Core.Statistics.AllStats.Commands.DumpMedia);
}
if(Core.Statistics.AllStats.Commands.Entropy > 0)
{
DicConsole.WriteLine("You have called the Entropy command {0} times",
Core.Statistics.AllStats.Commands.Entropy);
}
if(Core.Statistics.AllStats.Commands.Formats > 0)
{
DicConsole.WriteLine("You have called the Formats command {0} times",
Core.Statistics.AllStats.Commands.Formats);
}
if(Core.Statistics.AllStats.Commands.MediaInfo > 0)
{
DicConsole.WriteLine("You have called the Media-Info command {0} times",
Core.Statistics.AllStats.Commands.MediaInfo);
}
if(Core.Statistics.AllStats.Commands.MediaScan > 0)
{
DicConsole.WriteLine("You have called the Media-Scan command {0} times",
Core.Statistics.AllStats.Commands.MediaScan);
}
if(Core.Statistics.AllStats.Commands.PrintHex > 0)
{
DicConsole.WriteLine("You have called the Print-Hex command {0} times",
Core.Statistics.AllStats.Commands.PrintHex);
}
if(Core.Statistics.AllStats.Commands.Verify > 0)
{
DicConsole.WriteLine("You have called the Verify command {0} times",
Core.Statistics.AllStats.Commands.Verify);
}
DicConsole.WriteLine();
thereAreStats = true;
}
@@ -104,10 +134,7 @@ namespace DiscImageChef.Commands
{
DicConsole.WriteLine("Benchmark statistics");
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",
Core.Statistics.AllStats.Benchmark.Sequential);
@@ -172,9 +199,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Device statistics");
DicConsole.WriteLine("=================");
foreach(DeviceStats ds in Core.Statistics.AllStats.Devices)
{
DicConsole
.WriteLine("Device model {0}, manufactured by {1}, with revision {2} and attached via {3}.",
ds.Model, ds.Manufacturer, ds.Revision, ds.Bus);
}
DicConsole.WriteLine();
thereAreStats = true;
@@ -187,11 +216,15 @@ namespace DiscImageChef.Commands
foreach(MediaStats ms in Core.Statistics.AllStats.Medias)
{
if(ms.real)
{
DicConsole.WriteLine("Media type {0} has been found {1} times in a real device.", ms.type,
ms.Value);
}
else
{
DicConsole.WriteLine("Media type {0} has been found {1} times in a media image.", ms.type,
ms.Value);
}
}
DicConsole.WriteLine();

View File

@@ -140,12 +140,16 @@ namespace DiscImageChef.Commands
bool? tempStatus;
if(remainingSectors < 512)
{
tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors,
currentTrack.TrackSequence, out tempfailingLbas,
out tempunknownLbas);
}
else
{
tempStatus = inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence,
out tempfailingLbas, out tempunknownLbas);
}
if(checkStatus == null || tempStatus == null) checkStatus = null;
else if(checkStatus == false || tempStatus == false) checkStatus = false;
@@ -188,11 +192,15 @@ namespace DiscImageChef.Commands
bool? tempStatus;
if(remainingSectors < 512)
{
tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors,
out tempfailingLbas, out tempunknownLbas);
}
else
{
tempStatus =
inputFormat.VerifySectors(currentSector, 512, out tempfailingLbas, out tempunknownLbas);
}
if(checkStatus == null || tempStatus == null) checkStatus = null;
else if(checkStatus == false || tempStatus == false) checkStatus = false;