mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Invert 'if' statement to reduce nesting.
This commit is contained in:
@@ -370,13 +370,12 @@ namespace DiscImageChef.Core
|
||||
chks.Add(chk);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
chk = new ChecksumType();
|
||||
chk.type = ChecksumTypeType.spamsum;
|
||||
chk.Value = ssctx.End();
|
||||
chks.Add(chk);
|
||||
}
|
||||
if(!enabled.HasFlag(EnableChecksum.SpamSum)) return chks;
|
||||
|
||||
chk = new ChecksumType();
|
||||
chk.type = ChecksumTypeType.spamsum;
|
||||
chk.Value = ssctx.End();
|
||||
chks.Add(chk);
|
||||
|
||||
return chks;
|
||||
}
|
||||
@@ -617,13 +616,12 @@ namespace DiscImageChef.Core
|
||||
dataChecksums.Add(chk);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
chk = new ChecksumType();
|
||||
chk.type = ChecksumTypeType.spamsum;
|
||||
chk.Value = ssctxData.End();
|
||||
dataChecksums.Add(chk);
|
||||
}
|
||||
if(!enabled.HasFlag(EnableChecksum.SpamSum)) return dataChecksums;
|
||||
|
||||
chk = new ChecksumType();
|
||||
chk.type = ChecksumTypeType.spamsum;
|
||||
chk.Value = ssctxData.End();
|
||||
dataChecksums.Add(chk);
|
||||
|
||||
return dataChecksums;
|
||||
}
|
||||
|
||||
@@ -104,25 +104,24 @@ namespace DiscImageChef.Core
|
||||
public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null,
|
||||
bool overwrite = false)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(filename))
|
||||
{
|
||||
if(File.Exists(filename))
|
||||
if(overwrite) File.Delete(filename);
|
||||
else
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Not overwriting file {0}", filename);
|
||||
return;
|
||||
}
|
||||
if(string.IsNullOrEmpty(filename)) return;
|
||||
|
||||
try
|
||||
if(File.Exists(filename))
|
||||
if(overwrite) File.Delete(filename);
|
||||
else
|
||||
{
|
||||
DicConsole.DebugWriteLine(who, "Writing " + whatWriting + " to {0}", filename);
|
||||
FileStream outputFs = new FileStream(filename, FileMode.CreateNew);
|
||||
outputFs.Write(data, 0, data.Length);
|
||||
outputFs.Close();
|
||||
DicConsole.ErrorWriteLine("Not overwriting file {0}", filename);
|
||||
return;
|
||||
}
|
||||
catch { DicConsole.ErrorWriteLine("Unable to write file {0}", filename); }
|
||||
|
||||
try
|
||||
{
|
||||
DicConsole.DebugWriteLine(who, "Writing " + whatWriting + " to {0}", filename);
|
||||
FileStream outputFs = new FileStream(filename, FileMode.CreateNew);
|
||||
outputFs.Write(data, 0, data.Length);
|
||||
outputFs.Close();
|
||||
}
|
||||
catch { DicConsole.ErrorWriteLine("Unable to write file {0}", filename); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,13 +504,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, partitions[i]))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
if(!plugin.Identify(imageFormat, partitions[i])) continue;
|
||||
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
@@ -540,13 +539,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, wholePart))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
if(!plugin.Identify(imageFormat, wholePart)) continue;
|
||||
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
|
||||
@@ -715,22 +715,21 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
totalDuration += cmdDuration;
|
||||
}
|
||||
|
||||
if(!sense && !dev.Error || runningPersistent)
|
||||
{
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
dumpLog.WriteLine("Correctly retried sector {0} in pass {1}.", badSector, pass);
|
||||
}
|
||||
if((sense || dev.Error) && !runningPersistent) continue;
|
||||
|
||||
if(separateSubchannel)
|
||||
{
|
||||
dumpFile.WriteAt(readBuffer, badSector, (uint)sectorSize, 0, sectorSize);
|
||||
subFile.WriteAt(readBuffer, badSector, subSize, sectorSize, (int)subSize);
|
||||
}
|
||||
else dumpFile.WriteAt(readBuffer, badSector, blockSize);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
dumpLog.WriteLine("Correctly retried sector {0} in pass {1}.", badSector, pass);
|
||||
}
|
||||
|
||||
if(separateSubchannel)
|
||||
{
|
||||
dumpFile.WriteAt(readBuffer, badSector, (uint)sectorSize, 0, sectorSize);
|
||||
subFile.WriteAt(readBuffer, badSector, subSize, sectorSize, (int)subSize);
|
||||
}
|
||||
else dumpFile.WriteAt(readBuffer, badSector, blockSize);
|
||||
}
|
||||
|
||||
if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0)
|
||||
|
||||
@@ -78,31 +78,29 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
if(oldtry.Software == null) throw new Exception("Found corrupt resume file, cannot continue...");
|
||||
|
||||
if(oldtry.Software.Name == "DiscImageChef" &&
|
||||
oldtry.Software.OperatingSystem == platform.ToString() &&
|
||||
oldtry.Software.Version == Version.GetVersion())
|
||||
{
|
||||
if(removable && (oldtry.Manufacturer != manufacturer || oldtry.Model != model ||
|
||||
oldtry.Serial != serial)) continue;
|
||||
if(oldtry.Software.Name != "DiscImageChef" ||
|
||||
oldtry.Software.OperatingSystem != platform.ToString() ||
|
||||
oldtry.Software.Version != Version.GetVersion()) continue;
|
||||
|
||||
currentTry = oldtry;
|
||||
extents = ExtentsConverter.FromMetadata(currentTry.Extents);
|
||||
break;
|
||||
}
|
||||
if(removable && (oldtry.Manufacturer != manufacturer || oldtry.Model != model ||
|
||||
oldtry.Serial != serial)) continue;
|
||||
|
||||
currentTry = oldtry;
|
||||
extents = ExtentsConverter.FromMetadata(currentTry.Extents);
|
||||
break;
|
||||
}
|
||||
|
||||
if(currentTry == null)
|
||||
if(currentTry != null) return;
|
||||
|
||||
currentTry = new DumpHardwareType
|
||||
{
|
||||
currentTry = new DumpHardwareType
|
||||
{
|
||||
Software = Version.GetSoftwareType(platform),
|
||||
Manufacturer = manufacturer,
|
||||
Model = model,
|
||||
Serial = serial
|
||||
};
|
||||
resume.Tries.Add(currentTry);
|
||||
extents = new ExtentsULong();
|
||||
}
|
||||
Software = Version.GetSoftwareType(platform),
|
||||
Manufacturer = manufacturer,
|
||||
Model = model,
|
||||
Serial = serial
|
||||
};
|
||||
resume.Tries.Add(currentTry);
|
||||
extents = new ExtentsULong();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -211,18 +211,17 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
dumpLog.WriteLine("Requesting page {0:X2}h.", page);
|
||||
sense = dev.ScsiInquiry(out cmdBuf, out senseBuf, page);
|
||||
if(!sense)
|
||||
if(sense) continue;
|
||||
|
||||
EVPDType evpd = new EVPDType
|
||||
{
|
||||
EVPDType evpd = new EVPDType
|
||||
{
|
||||
Image = string.Format("{0}.evpd_{1:X2}h.bin", outputPrefix, page),
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray(),
|
||||
Size = cmdBuf.Length
|
||||
};
|
||||
evpd.Checksums = Checksum.GetChecksums(cmdBuf).ToArray();
|
||||
DataFile.WriteTo("SCSI Dump", evpd.Image, cmdBuf);
|
||||
evpds.Add(evpd);
|
||||
}
|
||||
Image = string.Format("{0}.evpd_{1:X2}h.bin", outputPrefix, page),
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray(),
|
||||
Size = cmdBuf.Length
|
||||
};
|
||||
evpd.Checksums = Checksum.GetChecksums(cmdBuf).ToArray();
|
||||
DataFile.WriteTo("SCSI Dump", evpd.Image, cmdBuf);
|
||||
evpds.Add(evpd);
|
||||
}
|
||||
|
||||
if(evpds.Count > 0) sidecar.BlockMedia[0].SCSI.EVPD = evpds.ToArray();
|
||||
@@ -651,23 +650,22 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, partitions[i]))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
if(!plugin.Identify(imageFormat, partitions[i])) continue;
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
@@ -693,23 +691,22 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, wholePart))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
if(!plugin.Identify(imageFormat, wholePart)) continue;
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
|
||||
@@ -495,13 +495,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, partitions[i]))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
if(!plugin.Identify(imageFormat, partitions[i])) continue;
|
||||
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
@@ -527,13 +526,12 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, wholePart))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
if(!plugin.Identify(imageFormat, wholePart)) continue;
|
||||
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
|
||||
@@ -850,23 +850,22 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, partitions[i]))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
if(!plugin.Identify(imageFormat, partitions[i])) continue;
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
plugin.GetInformation(imageFormat, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
@@ -892,23 +891,22 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(imageFormat, wholePart))
|
||||
{
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
if(!plugin.Identify(imageFormat, wholePart)) continue;
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
plugin.GetInformation(imageFormat, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
|
||||
@@ -86,13 +86,14 @@ namespace DiscImageChef.Core.Devices
|
||||
blocks = (ulong)(cylinders * heads * sectors);
|
||||
}
|
||||
|
||||
if((ataId.CurrentCylinders == 0 || ataId.CurrentHeads == 0 || ataId.CurrentSectorsPerTrack == 0) && ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0)
|
||||
{
|
||||
cylinders = ataId.Cylinders;
|
||||
heads = (byte)ataId.Heads;
|
||||
sectors = (byte)ataId.SectorsPerTrack;
|
||||
blocks = (ulong)(cylinders * heads * sectors);
|
||||
}
|
||||
if((ataId.CurrentCylinders != 0 && ataId.CurrentHeads != 0 && ataId.CurrentSectorsPerTrack != 0) ||
|
||||
ataId.Cylinders <= 0 || ataId.Heads <= 0 ||
|
||||
ataId.SectorsPerTrack <= 0) return (cylinders, heads, sectors);
|
||||
|
||||
cylinders = ataId.Cylinders;
|
||||
heads = (byte)ataId.Heads;
|
||||
sectors = (byte)ataId.SectorsPerTrack;
|
||||
blocks = (ulong)(cylinders * heads * sectors);
|
||||
|
||||
return (cylinders, heads, sectors);
|
||||
}
|
||||
@@ -107,11 +108,10 @@ namespace DiscImageChef.Core.Devices
|
||||
lbaMode = true;
|
||||
}
|
||||
|
||||
if(ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48))
|
||||
{
|
||||
blocks = ataId.LBA48Sectors;
|
||||
lbaMode = true;
|
||||
}
|
||||
if(!ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) return blocks;
|
||||
|
||||
blocks = ataId.LBA48Sectors;
|
||||
lbaMode = true;
|
||||
|
||||
return blocks;
|
||||
}
|
||||
@@ -279,14 +279,11 @@ namespace DiscImageChef.Core.Devices
|
||||
if(!error || blocksToRead == 1) break;
|
||||
}
|
||||
|
||||
if(error && lbaMode)
|
||||
{
|
||||
blocksToRead = 1;
|
||||
errorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
||||
return true;
|
||||
}
|
||||
if(!error || !lbaMode) return false;
|
||||
|
||||
return false;
|
||||
blocksToRead = 1;
|
||||
errorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AtaReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
||||
|
||||
@@ -174,13 +174,12 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, testSize,
|
||||
timeout, out duration);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
longBlockSize = testSize;
|
||||
readRaw = true;
|
||||
break;
|
||||
}
|
||||
if(testSense || dev.Error) continue;
|
||||
|
||||
readLong10 = true;
|
||||
longBlockSize = testSize;
|
||||
readRaw = true;
|
||||
break;
|
||||
}
|
||||
else if(blockSize == 1024)
|
||||
foreach(ushort testSize in new[]
|
||||
@@ -203,13 +202,12 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
testSense = dev.ReadLong10(out readBuffer, out senseBuf, false, false, 0, testSize,
|
||||
timeout, out duration);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
longBlockSize = testSize;
|
||||
readRaw = true;
|
||||
break;
|
||||
}
|
||||
if(testSense || dev.Error) continue;
|
||||
|
||||
readLong10 = true;
|
||||
longBlockSize = testSize;
|
||||
readRaw = true;
|
||||
break;
|
||||
}
|
||||
else if(blockSize == 2048)
|
||||
{
|
||||
@@ -468,14 +466,11 @@ namespace DiscImageChef.Core.Devices
|
||||
if(!dev.Error || blocksToRead == 1) break;
|
||||
}
|
||||
|
||||
if(dev.Error)
|
||||
{
|
||||
blocksToRead = 1;
|
||||
errorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
||||
return true;
|
||||
}
|
||||
if(!dev.Error) return false;
|
||||
|
||||
return false;
|
||||
blocksToRead = 1;
|
||||
errorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScsiReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
||||
@@ -522,14 +517,11 @@ namespace DiscImageChef.Core.Devices
|
||||
else return true;
|
||||
}
|
||||
|
||||
if(sense || dev.Error)
|
||||
{
|
||||
DicConsole.DebugWriteLine("SCSI Reader", "READ error:\n{0}",
|
||||
Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||
return true;
|
||||
}
|
||||
if(!sense && !dev.Error) return false;
|
||||
|
||||
return false;
|
||||
DicConsole.DebugWriteLine("SCSI Reader", "READ error:\n{0}",
|
||||
Decoders.SCSI.Sense.PrettifySense(senseBuf));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScsiSeek(ulong block, out double duration)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,409 +51,408 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
Decoders.ATA.AtaErrorRegistersCHS errorRegs;
|
||||
dev.AtapiIdentify(out buffer, out errorRegs, timeout, out duration);
|
||||
|
||||
if(Decoders.ATA.Identify.Decode(buffer).HasValue)
|
||||
if(!Decoders.ATA.Identify.Decode(buffer).HasValue) return;
|
||||
|
||||
Decoders.ATA.Identify.IdentifyDevice atapiId = Decoders.ATA.Identify.Decode(buffer).Value;
|
||||
|
||||
report.ATAPI = new ataType();
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID))
|
||||
{
|
||||
Decoders.ATA.Identify.IdentifyDevice atapiId = Decoders.ATA.Identify.Decode(buffer).Value;
|
||||
|
||||
report.ATAPI = new ataType();
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID))
|
||||
{
|
||||
report.ATAPI.AdditionalPID = atapiId.AdditionalPID;
|
||||
report.ATAPI.AdditionalPIDSpecified = true;
|
||||
}
|
||||
if(atapiId.APIOSupported != 0)
|
||||
{
|
||||
report.ATAPI.APIOSupported = atapiId.APIOSupported;
|
||||
report.ATAPI.APIOSupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.ATAPIByteCount != 0)
|
||||
{
|
||||
report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount;
|
||||
report.ATAPI.ATAPIByteCountSpecified = true;
|
||||
}
|
||||
if(atapiId.BufferType != 0)
|
||||
{
|
||||
report.ATAPI.BufferType = atapiId.BufferType;
|
||||
report.ATAPI.BufferTypeSpecified = true;
|
||||
}
|
||||
if(atapiId.BufferSize != 0)
|
||||
{
|
||||
report.ATAPI.BufferSize = atapiId.BufferSize;
|
||||
report.ATAPI.BufferSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.Capabilities != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities = atapiId.Capabilities;
|
||||
report.ATAPI.CapabilitiesSpecified = true;
|
||||
}
|
||||
if(atapiId.Capabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities2 = atapiId.Capabilities2;
|
||||
report.ATAPI.Capabilities2Specified = true;
|
||||
}
|
||||
if(atapiId.Capabilities3 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities3 = atapiId.Capabilities3;
|
||||
report.ATAPI.Capabilities3Specified = true;
|
||||
}
|
||||
if(atapiId.CFAPowerMode != 0)
|
||||
{
|
||||
report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode;
|
||||
report.ATAPI.CFAPowerModeSpecified = true;
|
||||
}
|
||||
if(atapiId.CommandSet != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet = atapiId.CommandSet;
|
||||
report.ATAPI.CommandSetSpecified = true;
|
||||
}
|
||||
if(atapiId.CommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet2 = atapiId.CommandSet2;
|
||||
report.ATAPI.CommandSet2Specified = true;
|
||||
}
|
||||
if(atapiId.CommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet3 = atapiId.CommandSet3;
|
||||
report.ATAPI.CommandSet3Specified = true;
|
||||
}
|
||||
if(atapiId.CommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet4 = atapiId.CommandSet4;
|
||||
report.ATAPI.CommandSet4Specified = true;
|
||||
}
|
||||
if(atapiId.CommandSet5 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet5 = atapiId.CommandSet5;
|
||||
report.ATAPI.CommandSet5Specified = true;
|
||||
}
|
||||
if(atapiId.CurrentAAM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAAM = atapiId.CurrentAAM;
|
||||
report.ATAPI.CurrentAAMSpecified = true;
|
||||
}
|
||||
if(atapiId.CurrentAPM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAPM = atapiId.CurrentAPM;
|
||||
report.ATAPI.CurrentAPMSpecified = true;
|
||||
}
|
||||
if(atapiId.DataSetMgmt != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt;
|
||||
report.ATAPI.DataSetMgmtSpecified = true;
|
||||
}
|
||||
if(atapiId.DataSetMgmtSize != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize;
|
||||
report.ATAPI.DataSetMgmtSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.DeviceFormFactor != 0)
|
||||
{
|
||||
report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor;
|
||||
report.ATAPI.DeviceFormFactorSpecified = true;
|
||||
}
|
||||
if(atapiId.DMAActive != 0)
|
||||
{
|
||||
report.ATAPI.DMAActive = atapiId.DMAActive;
|
||||
report.ATAPI.DMAActiveSpecified = true;
|
||||
}
|
||||
if(atapiId.DMASupported != 0)
|
||||
{
|
||||
report.ATAPI.DMASupported = atapiId.DMASupported;
|
||||
report.ATAPI.DMASupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.DMATransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode;
|
||||
report.ATAPI.DMATransferTimingModeSpecified = true;
|
||||
}
|
||||
if(atapiId.EnhancedSecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime;
|
||||
report.ATAPI.EnhancedSecurityEraseTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet;
|
||||
report.ATAPI.EnabledCommandSetSpecified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2;
|
||||
report.ATAPI.EnabledCommandSet2Specified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3;
|
||||
report.ATAPI.EnabledCommandSet3Specified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4;
|
||||
report.ATAPI.EnabledCommandSet4Specified = true;
|
||||
}
|
||||
if(atapiId.EnabledSATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures;
|
||||
report.ATAPI.EnabledSATAFeaturesSpecified = true;
|
||||
}
|
||||
if(atapiId.ExtendedUserSectors != 0)
|
||||
{
|
||||
report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors;
|
||||
report.ATAPI.ExtendedUserSectorsSpecified = true;
|
||||
}
|
||||
if(atapiId.FreeFallSensitivity != 0)
|
||||
{
|
||||
report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity;
|
||||
report.ATAPI.FreeFallSensitivitySpecified = true;
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision))
|
||||
{
|
||||
report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision;
|
||||
report.ATAPI.FirmwareRevisionSpecified = true;
|
||||
}
|
||||
if(atapiId.GeneralConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration;
|
||||
report.ATAPI.GeneralConfigurationSpecified = true;
|
||||
}
|
||||
if(atapiId.HardwareResetResult != 0)
|
||||
{
|
||||
report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult;
|
||||
report.ATAPI.HardwareResetResultSpecified = true;
|
||||
}
|
||||
if(atapiId.InterseekDelay != 0)
|
||||
{
|
||||
report.ATAPI.InterseekDelay = atapiId.InterseekDelay;
|
||||
report.ATAPI.InterseekDelaySpecified = true;
|
||||
}
|
||||
if(atapiId.MajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MajorVersion = atapiId.MajorVersion;
|
||||
report.ATAPI.MajorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.MasterPasswordRevisionCode != 0)
|
||||
{
|
||||
report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode;
|
||||
report.ATAPI.MasterPasswordRevisionCodeSpecified = true;
|
||||
}
|
||||
if(atapiId.MaxDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3;
|
||||
report.ATAPI.MaxDownloadMicroMode3Specified = true;
|
||||
}
|
||||
if(atapiId.MaxQueueDepth != 0)
|
||||
{
|
||||
report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth;
|
||||
report.ATAPI.MaxQueueDepthSpecified = true;
|
||||
}
|
||||
if(atapiId.MDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.MDMAActive = atapiId.MDMAActive;
|
||||
report.ATAPI.MDMAActiveSpecified = true;
|
||||
}
|
||||
if(atapiId.MDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.MDMASupported = atapiId.MDMASupported;
|
||||
report.ATAPI.MDMASupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.MinDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3;
|
||||
report.ATAPI.MinDownloadMicroMode3Specified = true;
|
||||
}
|
||||
if(atapiId.MinMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime;
|
||||
report.ATAPI.MinMDMACycleTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.MinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MinorVersion = atapiId.MinorVersion;
|
||||
report.ATAPI.MinorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.MinPIOCycleTimeNoFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow;
|
||||
report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true;
|
||||
}
|
||||
if(atapiId.MinPIOCycleTimeFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow;
|
||||
report.ATAPI.MinPIOCycleTimeFlowSpecified = true;
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.Model))
|
||||
{
|
||||
report.ATAPI.Model = atapiId.Model;
|
||||
report.ATAPI.ModelSpecified = true;
|
||||
}
|
||||
if(atapiId.MultipleMaxSectors != 0)
|
||||
{
|
||||
report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors;
|
||||
report.ATAPI.MultipleMaxSectorsSpecified = true;
|
||||
}
|
||||
if(atapiId.MultipleSectorNumber != 0)
|
||||
{
|
||||
report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber;
|
||||
report.ATAPI.MultipleSectorNumberSpecified = true;
|
||||
}
|
||||
if(atapiId.NVCacheCaps != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps;
|
||||
report.ATAPI.NVCacheCapsSpecified = true;
|
||||
}
|
||||
if(atapiId.NVCacheSize != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheSize = atapiId.NVCacheSize;
|
||||
report.ATAPI.NVCacheSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.NVCacheWriteSpeed != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed;
|
||||
report.ATAPI.NVCacheWriteSpeedSpecified = true;
|
||||
}
|
||||
if(atapiId.NVEstimatedSpinUp != 0)
|
||||
{
|
||||
report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp;
|
||||
report.ATAPI.NVEstimatedSpinUpSpecified = true;
|
||||
}
|
||||
if(atapiId.PacketBusRelease != 0)
|
||||
{
|
||||
report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease;
|
||||
report.ATAPI.PacketBusReleaseSpecified = true;
|
||||
}
|
||||
if(atapiId.PIOTransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode;
|
||||
report.ATAPI.PIOTransferTimingModeSpecified = true;
|
||||
}
|
||||
if(atapiId.RecommendedAAM != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM;
|
||||
report.ATAPI.RecommendedAAMSpecified = true;
|
||||
}
|
||||
if(atapiId.RecMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime;
|
||||
report.ATAPI.RecommendedMDMACycleTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.RemovableStatusSet != 0)
|
||||
{
|
||||
report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet;
|
||||
report.ATAPI.RemovableStatusSetSpecified = true;
|
||||
}
|
||||
if(atapiId.SATACapabilities != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities = atapiId.SATACapabilities;
|
||||
report.ATAPI.SATACapabilitiesSpecified = true;
|
||||
}
|
||||
if(atapiId.SATACapabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2;
|
||||
report.ATAPI.SATACapabilities2Specified = true;
|
||||
}
|
||||
if(atapiId.SATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.SATAFeatures = atapiId.SATAFeatures;
|
||||
report.ATAPI.SATAFeaturesSpecified = true;
|
||||
}
|
||||
if(atapiId.SCTCommandTransport != 0)
|
||||
{
|
||||
report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport;
|
||||
report.ATAPI.SCTCommandTransportSpecified = true;
|
||||
}
|
||||
if(atapiId.SectorsPerCard != 0)
|
||||
{
|
||||
report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard;
|
||||
report.ATAPI.SectorsPerCardSpecified = true;
|
||||
}
|
||||
if(atapiId.SecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime;
|
||||
report.ATAPI.SecurityEraseTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.SecurityStatus != 0)
|
||||
{
|
||||
report.ATAPI.SecurityStatus = atapiId.SecurityStatus;
|
||||
report.ATAPI.SecurityStatusSpecified = true;
|
||||
}
|
||||
if(atapiId.ServiceBusyClear != 0)
|
||||
{
|
||||
report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear;
|
||||
report.ATAPI.ServiceBusyClearSpecified = true;
|
||||
}
|
||||
if(atapiId.SpecificConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration;
|
||||
report.ATAPI.SpecificConfigurationSpecified = true;
|
||||
}
|
||||
if(atapiId.StreamAccessLatency != 0)
|
||||
{
|
||||
report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency;
|
||||
report.ATAPI.StreamAccessLatencySpecified = true;
|
||||
}
|
||||
if(atapiId.StreamMinReqSize != 0)
|
||||
{
|
||||
report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize;
|
||||
report.ATAPI.StreamMinReqSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.StreamPerformanceGranularity != 0)
|
||||
{
|
||||
report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity;
|
||||
report.ATAPI.StreamPerformanceGranularitySpecified = true;
|
||||
}
|
||||
if(atapiId.StreamTransferTimeDMA != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA;
|
||||
report.ATAPI.StreamTransferTimeDMASpecified = true;
|
||||
}
|
||||
if(atapiId.StreamTransferTimePIO != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO;
|
||||
report.ATAPI.StreamTransferTimePIOSpecified = true;
|
||||
}
|
||||
if(atapiId.TransportMajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion;
|
||||
report.ATAPI.TransportMajorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.TransportMinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion;
|
||||
report.ATAPI.TransportMinorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.TrustedComputing != 0)
|
||||
{
|
||||
report.ATAPI.TrustedComputing = atapiId.TrustedComputing;
|
||||
report.ATAPI.TrustedComputingSpecified = true;
|
||||
}
|
||||
if(atapiId.UDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.UDMAActive = atapiId.UDMAActive;
|
||||
report.ATAPI.UDMAActiveSpecified = true;
|
||||
}
|
||||
if(atapiId.UDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.UDMASupported = atapiId.UDMASupported;
|
||||
report.ATAPI.UDMASupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.WRVMode != 0)
|
||||
{
|
||||
report.ATAPI.WRVMode = atapiId.WRVMode;
|
||||
report.ATAPI.WRVModeSpecified = true;
|
||||
}
|
||||
if(atapiId.WRVSectorCountMode3 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3;
|
||||
report.ATAPI.WRVSectorCountMode3Specified = true;
|
||||
}
|
||||
if(atapiId.WRVSectorCountMode2 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
||||
report.ATAPI.WRVSectorCountMode2Specified = true;
|
||||
}
|
||||
if(debug) report.ATAPI.Identify = buffer;
|
||||
report.ATAPI.AdditionalPID = atapiId.AdditionalPID;
|
||||
report.ATAPI.AdditionalPIDSpecified = true;
|
||||
}
|
||||
if(atapiId.APIOSupported != 0)
|
||||
{
|
||||
report.ATAPI.APIOSupported = atapiId.APIOSupported;
|
||||
report.ATAPI.APIOSupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.ATAPIByteCount != 0)
|
||||
{
|
||||
report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount;
|
||||
report.ATAPI.ATAPIByteCountSpecified = true;
|
||||
}
|
||||
if(atapiId.BufferType != 0)
|
||||
{
|
||||
report.ATAPI.BufferType = atapiId.BufferType;
|
||||
report.ATAPI.BufferTypeSpecified = true;
|
||||
}
|
||||
if(atapiId.BufferSize != 0)
|
||||
{
|
||||
report.ATAPI.BufferSize = atapiId.BufferSize;
|
||||
report.ATAPI.BufferSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.Capabilities != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities = atapiId.Capabilities;
|
||||
report.ATAPI.CapabilitiesSpecified = true;
|
||||
}
|
||||
if(atapiId.Capabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities2 = atapiId.Capabilities2;
|
||||
report.ATAPI.Capabilities2Specified = true;
|
||||
}
|
||||
if(atapiId.Capabilities3 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities3 = atapiId.Capabilities3;
|
||||
report.ATAPI.Capabilities3Specified = true;
|
||||
}
|
||||
if(atapiId.CFAPowerMode != 0)
|
||||
{
|
||||
report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode;
|
||||
report.ATAPI.CFAPowerModeSpecified = true;
|
||||
}
|
||||
if(atapiId.CommandSet != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet = atapiId.CommandSet;
|
||||
report.ATAPI.CommandSetSpecified = true;
|
||||
}
|
||||
if(atapiId.CommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet2 = atapiId.CommandSet2;
|
||||
report.ATAPI.CommandSet2Specified = true;
|
||||
}
|
||||
if(atapiId.CommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet3 = atapiId.CommandSet3;
|
||||
report.ATAPI.CommandSet3Specified = true;
|
||||
}
|
||||
if(atapiId.CommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet4 = atapiId.CommandSet4;
|
||||
report.ATAPI.CommandSet4Specified = true;
|
||||
}
|
||||
if(atapiId.CommandSet5 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet5 = atapiId.CommandSet5;
|
||||
report.ATAPI.CommandSet5Specified = true;
|
||||
}
|
||||
if(atapiId.CurrentAAM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAAM = atapiId.CurrentAAM;
|
||||
report.ATAPI.CurrentAAMSpecified = true;
|
||||
}
|
||||
if(atapiId.CurrentAPM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAPM = atapiId.CurrentAPM;
|
||||
report.ATAPI.CurrentAPMSpecified = true;
|
||||
}
|
||||
if(atapiId.DataSetMgmt != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt;
|
||||
report.ATAPI.DataSetMgmtSpecified = true;
|
||||
}
|
||||
if(atapiId.DataSetMgmtSize != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize;
|
||||
report.ATAPI.DataSetMgmtSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.DeviceFormFactor != 0)
|
||||
{
|
||||
report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor;
|
||||
report.ATAPI.DeviceFormFactorSpecified = true;
|
||||
}
|
||||
if(atapiId.DMAActive != 0)
|
||||
{
|
||||
report.ATAPI.DMAActive = atapiId.DMAActive;
|
||||
report.ATAPI.DMAActiveSpecified = true;
|
||||
}
|
||||
if(atapiId.DMASupported != 0)
|
||||
{
|
||||
report.ATAPI.DMASupported = atapiId.DMASupported;
|
||||
report.ATAPI.DMASupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.DMATransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode;
|
||||
report.ATAPI.DMATransferTimingModeSpecified = true;
|
||||
}
|
||||
if(atapiId.EnhancedSecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime;
|
||||
report.ATAPI.EnhancedSecurityEraseTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet;
|
||||
report.ATAPI.EnabledCommandSetSpecified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2;
|
||||
report.ATAPI.EnabledCommandSet2Specified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3;
|
||||
report.ATAPI.EnabledCommandSet3Specified = true;
|
||||
}
|
||||
if(atapiId.EnabledCommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4;
|
||||
report.ATAPI.EnabledCommandSet4Specified = true;
|
||||
}
|
||||
if(atapiId.EnabledSATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures;
|
||||
report.ATAPI.EnabledSATAFeaturesSpecified = true;
|
||||
}
|
||||
if(atapiId.ExtendedUserSectors != 0)
|
||||
{
|
||||
report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors;
|
||||
report.ATAPI.ExtendedUserSectorsSpecified = true;
|
||||
}
|
||||
if(atapiId.FreeFallSensitivity != 0)
|
||||
{
|
||||
report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity;
|
||||
report.ATAPI.FreeFallSensitivitySpecified = true;
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision))
|
||||
{
|
||||
report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision;
|
||||
report.ATAPI.FirmwareRevisionSpecified = true;
|
||||
}
|
||||
if(atapiId.GeneralConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration;
|
||||
report.ATAPI.GeneralConfigurationSpecified = true;
|
||||
}
|
||||
if(atapiId.HardwareResetResult != 0)
|
||||
{
|
||||
report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult;
|
||||
report.ATAPI.HardwareResetResultSpecified = true;
|
||||
}
|
||||
if(atapiId.InterseekDelay != 0)
|
||||
{
|
||||
report.ATAPI.InterseekDelay = atapiId.InterseekDelay;
|
||||
report.ATAPI.InterseekDelaySpecified = true;
|
||||
}
|
||||
if(atapiId.MajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MajorVersion = atapiId.MajorVersion;
|
||||
report.ATAPI.MajorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.MasterPasswordRevisionCode != 0)
|
||||
{
|
||||
report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode;
|
||||
report.ATAPI.MasterPasswordRevisionCodeSpecified = true;
|
||||
}
|
||||
if(atapiId.MaxDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3;
|
||||
report.ATAPI.MaxDownloadMicroMode3Specified = true;
|
||||
}
|
||||
if(atapiId.MaxQueueDepth != 0)
|
||||
{
|
||||
report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth;
|
||||
report.ATAPI.MaxQueueDepthSpecified = true;
|
||||
}
|
||||
if(atapiId.MDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.MDMAActive = atapiId.MDMAActive;
|
||||
report.ATAPI.MDMAActiveSpecified = true;
|
||||
}
|
||||
if(atapiId.MDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.MDMASupported = atapiId.MDMASupported;
|
||||
report.ATAPI.MDMASupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.MinDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3;
|
||||
report.ATAPI.MinDownloadMicroMode3Specified = true;
|
||||
}
|
||||
if(atapiId.MinMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime;
|
||||
report.ATAPI.MinMDMACycleTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.MinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MinorVersion = atapiId.MinorVersion;
|
||||
report.ATAPI.MinorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.MinPIOCycleTimeNoFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow;
|
||||
report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true;
|
||||
}
|
||||
if(atapiId.MinPIOCycleTimeFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow;
|
||||
report.ATAPI.MinPIOCycleTimeFlowSpecified = true;
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.Model))
|
||||
{
|
||||
report.ATAPI.Model = atapiId.Model;
|
||||
report.ATAPI.ModelSpecified = true;
|
||||
}
|
||||
if(atapiId.MultipleMaxSectors != 0)
|
||||
{
|
||||
report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors;
|
||||
report.ATAPI.MultipleMaxSectorsSpecified = true;
|
||||
}
|
||||
if(atapiId.MultipleSectorNumber != 0)
|
||||
{
|
||||
report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber;
|
||||
report.ATAPI.MultipleSectorNumberSpecified = true;
|
||||
}
|
||||
if(atapiId.NVCacheCaps != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps;
|
||||
report.ATAPI.NVCacheCapsSpecified = true;
|
||||
}
|
||||
if(atapiId.NVCacheSize != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheSize = atapiId.NVCacheSize;
|
||||
report.ATAPI.NVCacheSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.NVCacheWriteSpeed != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed;
|
||||
report.ATAPI.NVCacheWriteSpeedSpecified = true;
|
||||
}
|
||||
if(atapiId.NVEstimatedSpinUp != 0)
|
||||
{
|
||||
report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp;
|
||||
report.ATAPI.NVEstimatedSpinUpSpecified = true;
|
||||
}
|
||||
if(atapiId.PacketBusRelease != 0)
|
||||
{
|
||||
report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease;
|
||||
report.ATAPI.PacketBusReleaseSpecified = true;
|
||||
}
|
||||
if(atapiId.PIOTransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode;
|
||||
report.ATAPI.PIOTransferTimingModeSpecified = true;
|
||||
}
|
||||
if(atapiId.RecommendedAAM != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM;
|
||||
report.ATAPI.RecommendedAAMSpecified = true;
|
||||
}
|
||||
if(atapiId.RecMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime;
|
||||
report.ATAPI.RecommendedMDMACycleTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.RemovableStatusSet != 0)
|
||||
{
|
||||
report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet;
|
||||
report.ATAPI.RemovableStatusSetSpecified = true;
|
||||
}
|
||||
if(atapiId.SATACapabilities != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities = atapiId.SATACapabilities;
|
||||
report.ATAPI.SATACapabilitiesSpecified = true;
|
||||
}
|
||||
if(atapiId.SATACapabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2;
|
||||
report.ATAPI.SATACapabilities2Specified = true;
|
||||
}
|
||||
if(atapiId.SATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.SATAFeatures = atapiId.SATAFeatures;
|
||||
report.ATAPI.SATAFeaturesSpecified = true;
|
||||
}
|
||||
if(atapiId.SCTCommandTransport != 0)
|
||||
{
|
||||
report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport;
|
||||
report.ATAPI.SCTCommandTransportSpecified = true;
|
||||
}
|
||||
if(atapiId.SectorsPerCard != 0)
|
||||
{
|
||||
report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard;
|
||||
report.ATAPI.SectorsPerCardSpecified = true;
|
||||
}
|
||||
if(atapiId.SecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime;
|
||||
report.ATAPI.SecurityEraseTimeSpecified = true;
|
||||
}
|
||||
if(atapiId.SecurityStatus != 0)
|
||||
{
|
||||
report.ATAPI.SecurityStatus = atapiId.SecurityStatus;
|
||||
report.ATAPI.SecurityStatusSpecified = true;
|
||||
}
|
||||
if(atapiId.ServiceBusyClear != 0)
|
||||
{
|
||||
report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear;
|
||||
report.ATAPI.ServiceBusyClearSpecified = true;
|
||||
}
|
||||
if(atapiId.SpecificConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration;
|
||||
report.ATAPI.SpecificConfigurationSpecified = true;
|
||||
}
|
||||
if(atapiId.StreamAccessLatency != 0)
|
||||
{
|
||||
report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency;
|
||||
report.ATAPI.StreamAccessLatencySpecified = true;
|
||||
}
|
||||
if(atapiId.StreamMinReqSize != 0)
|
||||
{
|
||||
report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize;
|
||||
report.ATAPI.StreamMinReqSizeSpecified = true;
|
||||
}
|
||||
if(atapiId.StreamPerformanceGranularity != 0)
|
||||
{
|
||||
report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity;
|
||||
report.ATAPI.StreamPerformanceGranularitySpecified = true;
|
||||
}
|
||||
if(atapiId.StreamTransferTimeDMA != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA;
|
||||
report.ATAPI.StreamTransferTimeDMASpecified = true;
|
||||
}
|
||||
if(atapiId.StreamTransferTimePIO != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO;
|
||||
report.ATAPI.StreamTransferTimePIOSpecified = true;
|
||||
}
|
||||
if(atapiId.TransportMajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion;
|
||||
report.ATAPI.TransportMajorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.TransportMinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion;
|
||||
report.ATAPI.TransportMinorVersionSpecified = true;
|
||||
}
|
||||
if(atapiId.TrustedComputing != 0)
|
||||
{
|
||||
report.ATAPI.TrustedComputing = atapiId.TrustedComputing;
|
||||
report.ATAPI.TrustedComputingSpecified = true;
|
||||
}
|
||||
if(atapiId.UDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.UDMAActive = atapiId.UDMAActive;
|
||||
report.ATAPI.UDMAActiveSpecified = true;
|
||||
}
|
||||
if(atapiId.UDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.UDMASupported = atapiId.UDMASupported;
|
||||
report.ATAPI.UDMASupportedSpecified = true;
|
||||
}
|
||||
if(atapiId.WRVMode != 0)
|
||||
{
|
||||
report.ATAPI.WRVMode = atapiId.WRVMode;
|
||||
report.ATAPI.WRVModeSpecified = true;
|
||||
}
|
||||
if(atapiId.WRVSectorCountMode3 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3;
|
||||
report.ATAPI.WRVSectorCountMode3Specified = true;
|
||||
}
|
||||
if(atapiId.WRVSectorCountMode2 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
||||
report.ATAPI.WRVSectorCountMode2Specified = true;
|
||||
}
|
||||
if(debug) report.ATAPI.Identify = buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,25 +51,24 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) return;
|
||||
|
||||
report.FireWire = new firewireType();
|
||||
report.FireWire.Manufacturer = dev.FireWireVendorName;
|
||||
report.FireWire.Product = dev.FireWireModelName;
|
||||
report.FireWire.ProductID = dev.FireWireModel;
|
||||
report.FireWire.VendorID = dev.FireWireVendor;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
report.FireWire = new firewireType();
|
||||
report.FireWire.Manufacturer = dev.FireWireVendorName;
|
||||
report.FireWire.Product = dev.FireWireModelName;
|
||||
report.FireWire.ProductID = dev.FireWireModel;
|
||||
report.FireWire.VendorID = dev.FireWireVendor;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,32 +43,33 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.PCMCIA = new pcmciaType();
|
||||
report.PCMCIA.CIS = dev.Cis;
|
||||
Tuple[] tuples = CIS.GetTuples(dev.Cis);
|
||||
if(tuples != null)
|
||||
foreach(Tuple tuple in tuples)
|
||||
switch(tuple.Code) {
|
||||
case TupleCodes.CISTPL_MANFID:
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
if(tuples == null) return;
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
foreach(Tuple tuple in tuples)
|
||||
switch(tuple.Code) {
|
||||
case TupleCodes.CISTPL_MANFID:
|
||||
ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion);
|
||||
report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(manfid != null)
|
||||
{
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion);
|
||||
report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,13 +189,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
DicConsole.WriteLine("Querying SCSI EVPD {0:X2}h...", page);
|
||||
sense = dev.ScsiInquiry(out buffer, out senseBuffer, page);
|
||||
if(!sense)
|
||||
{
|
||||
pageType evpd = new pageType();
|
||||
evpd.page = page;
|
||||
evpd.value = buffer;
|
||||
evpds.Add(evpd);
|
||||
}
|
||||
if(sense) continue;
|
||||
|
||||
pageType evpd = new pageType();
|
||||
evpd.page = page;
|
||||
evpd.value = buffer;
|
||||
evpds.Add(evpd);
|
||||
}
|
||||
|
||||
if(evpds.Count > 0) report.SCSI.EVPDPages = evpds.ToArray();
|
||||
@@ -330,324 +329,321 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) continue;
|
||||
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
|
||||
testedMediaType mediaTest = new testedMediaType();
|
||||
DicConsole.Write("Please write a description of the media type and press enter: ");
|
||||
mediaTest.MediumTypeName = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media manufacturer and press enter: ");
|
||||
mediaTest.Manufacturer = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media model and press enter: ");
|
||||
mediaTest.Model = System.Console.ReadLine();
|
||||
|
||||
mediaTest.ManufacturerSpecified = true;
|
||||
mediaTest.ModelSpecified = true;
|
||||
mediaTest.MediaIsRecognized = true;
|
||||
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
testedMediaType mediaTest = new testedMediaType();
|
||||
DicConsole.Write("Please write a description of the media type and press enter: ");
|
||||
mediaTest.MediumTypeName = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media manufacturer and press enter: ");
|
||||
mediaTest.Manufacturer = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media model and press enter: ");
|
||||
mediaTest.Model = System.Console.ReadLine();
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
mediaTest.ManufacturerSpecified = true;
|
||||
mediaTest.ModelSpecified = true;
|
||||
mediaTest.MediaIsRecognized = true;
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
sense = dev.ReadCapacity(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity = true;
|
||||
mediaTest.Blocks =
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) +
|
||||
buffer[3]) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)...");
|
||||
sense = dev.ReadCapacity16(out buffer, out buffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity16 = true;
|
||||
byte[] temp = new byte[8];
|
||||
Array.Copy(buffer, 0, temp, 0, 8);
|
||||
Array.Reverse(temp);
|
||||
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) +
|
||||
buffer[11]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue)
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
mediaTest.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize,
|
||||
timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read6",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (10)...");
|
||||
mediaTest.SupportsRead10 =
|
||||
!dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0,
|
||||
mediaTest.BlockSize, 0, 1, timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (12)...");
|
||||
mediaTest.SupportsRead12 =
|
||||
!dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0,
|
||||
mediaTest.BlockSize, 0, 1, false, timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read12",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (16)...");
|
||||
mediaTest.SupportsRead16 =
|
||||
!dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0,
|
||||
mediaTest.BlockSize, 0, 1, false, timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read16",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
mediaTest.LongBlockSize = mediaTest.BlockSize;
|
||||
DicConsole.WriteLine("Trying SCSI READ LONG (10)...");
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout,
|
||||
out duration);
|
||||
if(sense && !dev.Error)
|
||||
{
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
mediaTest.LongBlockSize =
|
||||
0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
mediaTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
else mediaTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
if(mediaTest.BlockSize == 512)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
514,
|
||||
// Long sector sizes for SuperDisk
|
||||
536, 558,
|
||||
// Long sector sizes for 512-byte magneto-opticals
|
||||
600, 610, 630
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(mediaTest.BlockSize == 1024)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
1026,
|
||||
// Long sector sizes for 1024-byte magneto-opticals
|
||||
1200
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(mediaTest.BlockSize == 2048)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 4096)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 8192)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
sense = dev.ReadCapacity(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity = true;
|
||||
mediaTest.Blocks =
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) +
|
||||
buffer[3]) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)...");
|
||||
sense = dev.ReadCapacity16(out buffer, out buffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
{
|
||||
mediaTest.SupportsReadCapacity16 = true;
|
||||
byte[] temp = new byte[8];
|
||||
Array.Copy(buffer, 0, temp, 0, 8);
|
||||
Array.Reverse(temp);
|
||||
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) +
|
||||
buffer[11]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue)
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
for(ushort i = (ushort)mediaTest.BlockSize; i <= ushort.MaxValue; i++)
|
||||
{
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
mediaTest.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize,
|
||||
timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read6",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (10)...");
|
||||
mediaTest.SupportsRead10 =
|
||||
!dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0,
|
||||
mediaTest.BlockSize, 0, 1, timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (12)...");
|
||||
mediaTest.SupportsRead12 =
|
||||
!dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0,
|
||||
mediaTest.BlockSize, 0, 1, false, timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read12",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (16)...");
|
||||
mediaTest.SupportsRead16 =
|
||||
!dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0,
|
||||
mediaTest.BlockSize, 0, 1, false, timeout, out duration);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16);
|
||||
if(debug)
|
||||
DataFile.WriteTo("SCSI Report", "read16",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
|
||||
mediaTest.LongBlockSize = mediaTest.BlockSize;
|
||||
DicConsole.WriteLine("Trying SCSI READ LONG (10)...");
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout,
|
||||
out duration);
|
||||
if(sense && !dev.Error)
|
||||
{
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == Decoders.SCSI.SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
{
|
||||
mediaTest.LongBlockSize =
|
||||
0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
if(mediaTest.BlockSize == 512)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
514,
|
||||
// Long sector sizes for SuperDisk
|
||||
536, 558,
|
||||
// Long sector sizes for 512-byte magneto-opticals
|
||||
600, 610, 630
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 1024)
|
||||
foreach(ushort testSize in new[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
1026,
|
||||
// Long sector sizes for 1024-byte magneto-opticals
|
||||
1200
|
||||
})
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
testSize, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 2048)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380,
|
||||
DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 4096)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
else if(mediaTest.BlockSize == 8192)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424,
|
||||
timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
{
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
{
|
||||
for(ushort i = (ushort)mediaTest.BlockSize; i <= ushort.MaxValue; i++)
|
||||
{
|
||||
DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i);
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i,
|
||||
timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(i == ushort.MaxValue) break;
|
||||
break;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine();
|
||||
if(i == ushort.MaxValue) break;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified &&
|
||||
mediaTest.LongBlockSize != mediaTest.BlockSize)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
(ushort)mediaTest.LongBlockSize, timeout, out duration);
|
||||
if(!sense)
|
||||
DataFile.WriteTo("SCSI Report", "readlong10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
}
|
||||
|
||||
mediaTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
mediaTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
}
|
||||
|
||||
mediaTests.Add(mediaTest);
|
||||
if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified &&
|
||||
mediaTest.LongBlockSize != mediaTest.BlockSize)
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
|
||||
(ushort)mediaTest.LongBlockSize, timeout, out duration);
|
||||
if(!sense)
|
||||
DataFile.WriteTo("SCSI Report", "readlong10",
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results",
|
||||
buffer);
|
||||
}
|
||||
|
||||
mediaTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
mediaTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
}
|
||||
|
||||
mediaTests.Add(mediaTest);
|
||||
}
|
||||
|
||||
report.SCSI.RemovableMedias = mediaTests.ToArray();
|
||||
@@ -807,13 +803,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(report.SCSI.ReadCapabilities.BlockSize == 1024)
|
||||
foreach(ushort testSize in new[]
|
||||
@@ -826,13 +821,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout,
|
||||
out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
else if(report.SCSI.ReadCapabilities.BlockSize == 2048)
|
||||
{
|
||||
|
||||
@@ -1333,11 +1333,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DataFile.WriteTo("SCSI Report", "leadin",
|
||||
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.CanReadLeadIn = true;
|
||||
break;
|
||||
}
|
||||
if(sense) continue;
|
||||
|
||||
mediaTest.CanReadLeadIn = true;
|
||||
break;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Trying to read CD Lead-Out...");
|
||||
|
||||
@@ -133,14 +133,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].Organization =
|
||||
mtsh.Value.descriptors[i].organization;
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes != null)
|
||||
{
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
if(mtsh.Value.descriptors[i].densityCodes == null) continue;
|
||||
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,159 +157,157 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) continue;
|
||||
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
|
||||
SequentialMedia seqTest = new SequentialMedia();
|
||||
DicConsole.Write("Please write a description of the media type and press enter: ");
|
||||
seqTest.MediumTypeName = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media manufacturer and press enter: ");
|
||||
seqTest.Manufacturer = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media model and press enter: ");
|
||||
seqTest.Model = System.Console.ReadLine();
|
||||
|
||||
seqTest.MediaIsRecognized = true;
|
||||
|
||||
sense = dev.Load(out senseBuffer, timeout, out duration);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
|
||||
System.Console.ReadKey(true);
|
||||
|
||||
SequentialMedia seqTest = new SequentialMedia();
|
||||
DicConsole.Write("Please write a description of the media type and press enter: ");
|
||||
seqTest.MediumTypeName = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media manufacturer and press enter: ");
|
||||
seqTest.Manufacturer = System.Console.ReadLine();
|
||||
DicConsole.Write("Please write the media model and press enter: ");
|
||||
seqTest.Model = System.Console.ReadLine();
|
||||
|
||||
seqTest.MediaIsRecognized = true;
|
||||
|
||||
sense = dev.Load(out senseBuffer, timeout, out duration);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.ASC == 0x3A)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
leftRetries--;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
int leftRetries = 20;
|
||||
while(leftRetries > 0)
|
||||
{
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
DicConsole.Write("\rWaiting for drive to become ready");
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
|
||||
if(!sense) break;
|
||||
|
||||
leftRetries--;
|
||||
}
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
leftRetries--;
|
||||
}
|
||||
else seqTest.MediaIsRecognized = false;
|
||||
|
||||
seqTest.MediaIsRecognized &= !sense;
|
||||
}
|
||||
else seqTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(seqTest.MediaIsRecognized)
|
||||
{
|
||||
decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer);
|
||||
if(dsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for medium types for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer);
|
||||
if(mtsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < mtsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes != null)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
seqTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
seqTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
seqTests.Add(seqTest);
|
||||
else seqTest.MediaIsRecognized = false;
|
||||
}
|
||||
|
||||
if(seqTest.MediaIsRecognized)
|
||||
{
|
||||
decMode = null;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE (10)...");
|
||||
sense = dev.ModeSense10(out buffer, out senseBuffer, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer);
|
||||
if(dsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for medium types for current media...");
|
||||
sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, true, timeout, out duration);
|
||||
if(!sense)
|
||||
{
|
||||
Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh =
|
||||
Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer);
|
||||
if(mtsh.HasValue)
|
||||
{
|
||||
seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < mtsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes == null) continue;
|
||||
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes =
|
||||
new int[mtsh.Value.descriptors[i].densityCodes.Length];
|
||||
for(int j = 0; j < mtsh.Value.descriptors.Length; j++)
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes[j] =
|
||||
mtsh.Value.descriptors[i].densityCodes[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
seqTest.CanReadMediaSerialSpecified = true;
|
||||
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
|
||||
seqTest.CanReadMediaSerial =
|
||||
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, timeout, out duration);
|
||||
seqTests.Add(seqTest);
|
||||
}
|
||||
|
||||
report.SCSI.SequentialDevice.TestedMedia = seqTests.ToArray();
|
||||
|
||||
@@ -51,26 +51,25 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
if(pressedKey.Key == ConsoleKey.Y)
|
||||
if(pressedKey.Key != ConsoleKey.Y) return;
|
||||
|
||||
report.USB = new usbType();
|
||||
report.USB.Manufacturer = dev.UsbManufacturerString;
|
||||
report.USB.Product = dev.UsbProductString;
|
||||
report.USB.ProductID = dev.UsbProductId;
|
||||
report.USB.VendorID = dev.UsbVendorId;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
report.USB = new usbType();
|
||||
report.USB.Manufacturer = dev.UsbManufacturerString;
|
||||
report.USB.Product = dev.UsbProductString;
|
||||
report.USB.ProductID = dev.UsbProductId;
|
||||
report.USB.VendorID = dev.UsbVendorId;
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.USB.RemovableMedia;
|
||||
if(debug) report.USB.Descriptors = dev.UsbDescriptors;
|
||||
DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
|
||||
report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.USB.RemovableMedia;
|
||||
if(debug) report.USB.Descriptors = dev.UsbDescriptors;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,11 +56,10 @@ namespace DiscImageChef.Core
|
||||
try
|
||||
{
|
||||
DicConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name);
|
||||
if(imageplugin.IdentifyImage(imageFilter))
|
||||
{
|
||||
imageFormat = imageplugin;
|
||||
break;
|
||||
}
|
||||
if(!imageplugin.IdentifyImage(imageFilter)) continue;
|
||||
|
||||
imageFormat = imageplugin;
|
||||
break;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch { }
|
||||
@@ -75,11 +74,10 @@ namespace DiscImageChef.Core
|
||||
try
|
||||
{
|
||||
DicConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name);
|
||||
if(imageplugin.IdentifyImage(imageFilter))
|
||||
{
|
||||
imageFormat = imageplugin;
|
||||
break;
|
||||
}
|
||||
if(!imageplugin.IdentifyImage(imageFilter)) continue;
|
||||
|
||||
imageFormat = imageplugin;
|
||||
break;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch { }
|
||||
|
||||
@@ -43,93 +43,90 @@ namespace DiscImageChef.Core.Logging
|
||||
|
||||
public DumpLog(string outputFile, Device dev)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(outputFile))
|
||||
if(string.IsNullOrEmpty(outputFile)) return;
|
||||
|
||||
logSw = new StreamWriter(outputFile, true);
|
||||
|
||||
logSw.WriteLine("Start logging at {0}", DateTime.Now);
|
||||
|
||||
Interop.PlatformID platId = Interop.DetectOS.GetRealPlatformID();
|
||||
string platVer = Interop.DetectOS.GetVersion();
|
||||
Type monoRunType = Type.GetType("Mono.Runtime");
|
||||
|
||||
logSw.WriteLine("################# System information #################");
|
||||
logSw.WriteLine("{0} {1} ({2}-bit)", Interop.DetectOS.GetPlatformName(platId, platVer), platVer,
|
||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||
if(monoRunType != null)
|
||||
{
|
||||
logSw = new StreamWriter(outputFile, true);
|
||||
|
||||
logSw.WriteLine("Start logging at {0}", DateTime.Now);
|
||||
|
||||
Interop.PlatformID platId = Interop.DetectOS.GetRealPlatformID();
|
||||
string platVer = Interop.DetectOS.GetVersion();
|
||||
Type monoRunType = Type.GetType("Mono.Runtime");
|
||||
|
||||
logSw.WriteLine("################# System information #################");
|
||||
logSw.WriteLine("{0} {1} ({2}-bit)", Interop.DetectOS.GetPlatformName(platId, platVer), platVer,
|
||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||
if(monoRunType != null)
|
||||
{
|
||||
string monoVer = "unknown version";
|
||||
MethodInfo monoDisplayName =
|
||||
monoRunType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if(monoDisplayName != null) monoVer = (string)monoDisplayName.Invoke(null, null);
|
||||
logSw.WriteLine("Mono {0}", monoVer);
|
||||
}
|
||||
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
|
||||
logSw.WriteLine();
|
||||
|
||||
logSw.WriteLine("################# Program information ################");
|
||||
logSw.WriteLine("DiscImageChef {0} running in {1}-bit", Version.GetVersion(),
|
||||
Environment.Is64BitProcess ? 64 : 32);
|
||||
#if DEBUG
|
||||
logSw.WriteLine("DEBUG version");
|
||||
#endif
|
||||
logSw.WriteLine("Command line: {0}", Environment.CommandLine);
|
||||
logSw.WriteLine();
|
||||
|
||||
logSw.WriteLine("################# Device information #################");
|
||||
logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer);
|
||||
logSw.WriteLine("Model: {0}", dev.Model);
|
||||
logSw.WriteLine("Firmware revision: {0}", dev.Revision);
|
||||
logSw.WriteLine("Serial number: {0}", dev.Serial);
|
||||
logSw.WriteLine("Removable device: {0}", dev.IsRemovable);
|
||||
logSw.WriteLine("Device type: {0}", dev.Type);
|
||||
logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash);
|
||||
logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia);
|
||||
logSw.WriteLine("USB device: {0}", dev.IsUsb);
|
||||
if(dev.IsUsb)
|
||||
{
|
||||
logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString);
|
||||
logSw.WriteLine("USB product: {0}", dev.UsbProductString);
|
||||
logSw.WriteLine("USB serial: {0}", dev.UsbSerialString);
|
||||
logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
|
||||
logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId);
|
||||
}
|
||||
logSw.WriteLine("FireWire device: {0}", dev.IsFireWire);
|
||||
if(dev.IsFireWire)
|
||||
{
|
||||
logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName);
|
||||
logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName);
|
||||
logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid);
|
||||
logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
|
||||
logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel);
|
||||
}
|
||||
logSw.WriteLine();
|
||||
logSw.WriteLine("######################################################");
|
||||
|
||||
logSw.WriteLine();
|
||||
logSw.WriteLine("################ Dumping progress log ################");
|
||||
logSw.Flush();
|
||||
string monoVer = "unknown version";
|
||||
MethodInfo monoDisplayName =
|
||||
monoRunType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
if(monoDisplayName != null) monoVer = (string)monoDisplayName.Invoke(null, null);
|
||||
logSw.WriteLine("Mono {0}", monoVer);
|
||||
}
|
||||
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
|
||||
logSw.WriteLine();
|
||||
|
||||
logSw.WriteLine("################# Program information ################");
|
||||
logSw.WriteLine("DiscImageChef {0} running in {1}-bit", Version.GetVersion(),
|
||||
Environment.Is64BitProcess ? 64 : 32);
|
||||
#if DEBUG
|
||||
logSw.WriteLine("DEBUG version");
|
||||
#endif
|
||||
logSw.WriteLine("Command line: {0}", Environment.CommandLine);
|
||||
logSw.WriteLine();
|
||||
|
||||
logSw.WriteLine("################# Device information #################");
|
||||
logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer);
|
||||
logSw.WriteLine("Model: {0}", dev.Model);
|
||||
logSw.WriteLine("Firmware revision: {0}", dev.Revision);
|
||||
logSw.WriteLine("Serial number: {0}", dev.Serial);
|
||||
logSw.WriteLine("Removable device: {0}", dev.IsRemovable);
|
||||
logSw.WriteLine("Device type: {0}", dev.Type);
|
||||
logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash);
|
||||
logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia);
|
||||
logSw.WriteLine("USB device: {0}", dev.IsUsb);
|
||||
if(dev.IsUsb)
|
||||
{
|
||||
logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString);
|
||||
logSw.WriteLine("USB product: {0}", dev.UsbProductString);
|
||||
logSw.WriteLine("USB serial: {0}", dev.UsbSerialString);
|
||||
logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
|
||||
logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId);
|
||||
}
|
||||
logSw.WriteLine("FireWire device: {0}", dev.IsFireWire);
|
||||
if(dev.IsFireWire)
|
||||
{
|
||||
logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName);
|
||||
logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName);
|
||||
logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid);
|
||||
logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
|
||||
logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel);
|
||||
}
|
||||
logSw.WriteLine();
|
||||
logSw.WriteLine("######################################################");
|
||||
|
||||
logSw.WriteLine();
|
||||
logSw.WriteLine("################ Dumping progress log ################");
|
||||
logSw.Flush();
|
||||
}
|
||||
|
||||
public void WriteLine(string format, params object[] args)
|
||||
{
|
||||
if(logSw != null)
|
||||
{
|
||||
string text = string.Format(format, args);
|
||||
logSw.WriteLine("{0:s} {1}", DateTime.Now, text);
|
||||
logSw.Flush();
|
||||
}
|
||||
if(logSw == null) return;
|
||||
|
||||
string text = string.Format(format, args);
|
||||
logSw.WriteLine("{0:s} {1}", DateTime.Now, text);
|
||||
logSw.Flush();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if(logSw != null)
|
||||
{
|
||||
logSw.WriteLine("######################################################");
|
||||
logSw.WriteLine("End logging at {0}", DateTime.Now);
|
||||
logSw.Close();
|
||||
}
|
||||
if(logSw == null) return;
|
||||
|
||||
logSw.WriteLine("######################################################");
|
||||
logSw.WriteLine("End logging at {0}", DateTime.Now);
|
||||
logSw.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,237 +56,233 @@ namespace DiscImageChef.Core.Logging
|
||||
|
||||
internal IbgLog(string outputFile, ushort currentProfile)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(outputFile))
|
||||
{
|
||||
ibgFs = new FileStream(outputFile, FileMode.Create);
|
||||
ibgSb = new StringBuilder();
|
||||
ibgDatePoint = DateTime.Now;
|
||||
ibgCulture = new CultureInfo("en-US");
|
||||
ibgStartSet = false;
|
||||
ibgMaxSpeed = 0;
|
||||
ibgIntSpeed = 0;
|
||||
ibgSnaps = 0;
|
||||
ibgIntSector = 0;
|
||||
if(string.IsNullOrEmpty(outputFile)) return;
|
||||
|
||||
switch(currentProfile)
|
||||
{
|
||||
case 0x0001:
|
||||
ibgMediaType = "HDD";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0005:
|
||||
ibgMediaType = "CD-MO";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0008:
|
||||
ibgMediaType = "CD-ROM";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0009:
|
||||
ibgMediaType = "CD-R";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x000A:
|
||||
ibgMediaType = "CD-RW";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0010:
|
||||
ibgMediaType = "DVD-ROM";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0011:
|
||||
ibgMediaType = "DVD-R";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0012:
|
||||
ibgMediaType = "DVD-RAM";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0013:
|
||||
case 0x0014:
|
||||
ibgMediaType = "DVD-RW";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0015:
|
||||
case 0x0016:
|
||||
ibgMediaType = "DVD-R DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0017:
|
||||
ibgMediaType = "DVD-RW DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0018:
|
||||
ibgMediaType = "DVD-Download";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x001A:
|
||||
ibgMediaType = "DVD+RW";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x001B:
|
||||
ibgMediaType = "DVD+R";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0020:
|
||||
ibgMediaType = "DDCD-ROM";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0021:
|
||||
ibgMediaType = "DDCD-R";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0022:
|
||||
ibgMediaType = "DDCD-RW";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x002A:
|
||||
ibgMediaType = "DVD+RW DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x002B:
|
||||
ibgMediaType = "DVD+R DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0040:
|
||||
ibgMediaType = "BD-ROM";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0041:
|
||||
case 0x0042:
|
||||
ibgMediaType = "BD-R";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0043:
|
||||
ibgMediaType = "BD-RE";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0050:
|
||||
ibgMediaType = "HD DVD-ROM";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0051:
|
||||
ibgMediaType = "HD DVD-R";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0052:
|
||||
ibgMediaType = "HD DVD-RAM";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0053:
|
||||
ibgMediaType = "HD DVD-RW";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0058:
|
||||
ibgMediaType = "HD DVD-R DL";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x005A:
|
||||
ibgMediaType = "HD DVD-RW DL";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
default:
|
||||
ibgMediaType = "Unknown";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
}
|
||||
ibgFs = new FileStream(outputFile, FileMode.Create);
|
||||
ibgSb = new StringBuilder();
|
||||
ibgDatePoint = DateTime.Now;
|
||||
ibgCulture = new CultureInfo("en-US");
|
||||
ibgStartSet = false;
|
||||
ibgMaxSpeed = 0;
|
||||
ibgIntSpeed = 0;
|
||||
ibgSnaps = 0;
|
||||
ibgIntSector = 0;
|
||||
|
||||
switch(currentProfile)
|
||||
{
|
||||
case 0x0001:
|
||||
ibgMediaType = "HDD";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0005:
|
||||
ibgMediaType = "CD-MO";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0008:
|
||||
ibgMediaType = "CD-ROM";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0009:
|
||||
ibgMediaType = "CD-R";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x000A:
|
||||
ibgMediaType = "CD-RW";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0010:
|
||||
ibgMediaType = "DVD-ROM";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0011:
|
||||
ibgMediaType = "DVD-R";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0012:
|
||||
ibgMediaType = "DVD-RAM";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0013:
|
||||
case 0x0014:
|
||||
ibgMediaType = "DVD-RW";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0015:
|
||||
case 0x0016:
|
||||
ibgMediaType = "DVD-R DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0017:
|
||||
ibgMediaType = "DVD-RW DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0018:
|
||||
ibgMediaType = "DVD-Download";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x001A:
|
||||
ibgMediaType = "DVD+RW";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x001B:
|
||||
ibgMediaType = "DVD+R";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0020:
|
||||
ibgMediaType = "DDCD-ROM";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0021:
|
||||
ibgMediaType = "DDCD-R";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0022:
|
||||
ibgMediaType = "DDCD-RW";
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x002A:
|
||||
ibgMediaType = "DVD+RW DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x002B:
|
||||
ibgMediaType = "DVD+R DL";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0040:
|
||||
ibgMediaType = "BD-ROM";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0041:
|
||||
case 0x0042:
|
||||
ibgMediaType = "BD-R";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0043:
|
||||
ibgMediaType = "BD-RE";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0050:
|
||||
ibgMediaType = "HD DVD-ROM";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0051:
|
||||
ibgMediaType = "HD DVD-R";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0052:
|
||||
ibgMediaType = "HD DVD-RAM";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0053:
|
||||
ibgMediaType = "HD DVD-RW";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0058:
|
||||
ibgMediaType = "HD DVD-R DL";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x005A:
|
||||
ibgMediaType = "HD DVD-RW DL";
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
default:
|
||||
ibgMediaType = "Unknown";
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Write(ulong sector, double currentSpeed)
|
||||
{
|
||||
if(ibgFs != null)
|
||||
if(ibgFs == null) return;
|
||||
|
||||
ibgIntSpeed += currentSpeed;
|
||||
ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds);
|
||||
ibgSnaps++;
|
||||
|
||||
if(ibgSampleRate < 100) return;
|
||||
|
||||
if(ibgIntSpeed > 0 && !ibgStartSet)
|
||||
{
|
||||
ibgIntSpeed += currentSpeed;
|
||||
ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds);
|
||||
ibgSnaps++;
|
||||
|
||||
if(ibgSampleRate >= 100)
|
||||
{
|
||||
if(ibgIntSpeed > 0 && !ibgStartSet)
|
||||
{
|
||||
ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider;
|
||||
ibgStartSet = true;
|
||||
}
|
||||
|
||||
ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector,
|
||||
ibgSampleRate).AppendLine();
|
||||
if(ibgIntSpeed / ibgSnaps / ibgDivider > ibgMaxSpeed) ibgMaxSpeed = ibgIntSpeed / ibgDivider;
|
||||
|
||||
ibgDatePoint = DateTime.Now;
|
||||
ibgIntSpeed = 0;
|
||||
ibgSampleRate = 0;
|
||||
ibgSnaps = 0;
|
||||
ibgIntSector = sector;
|
||||
}
|
||||
ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider;
|
||||
ibgStartSet = true;
|
||||
}
|
||||
|
||||
ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector,
|
||||
ibgSampleRate).AppendLine();
|
||||
if(ibgIntSpeed / ibgSnaps / ibgDivider > ibgMaxSpeed) ibgMaxSpeed = ibgIntSpeed / ibgDivider;
|
||||
|
||||
ibgDatePoint = DateTime.Now;
|
||||
ibgIntSpeed = 0;
|
||||
ibgSampleRate = 0;
|
||||
ibgSnaps = 0;
|
||||
ibgIntSector = sector;
|
||||
}
|
||||
|
||||
internal void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed,
|
||||
double averageSpeed, string devicePath)
|
||||
{
|
||||
if(ibgFs != null)
|
||||
{
|
||||
StringBuilder ibgHeader = new StringBuilder();
|
||||
string ibgBusType;
|
||||
if(ibgFs == null) return;
|
||||
|
||||
if(dev.IsUsb) ibgBusType = "USB";
|
||||
else if(dev.IsFireWire) ibgBusType = "FireWire";
|
||||
else ibgBusType = dev.Type.ToString();
|
||||
StringBuilder ibgHeader = new StringBuilder();
|
||||
string ibgBusType;
|
||||
|
||||
ibgHeader.AppendLine("IBGD");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("[START_CONFIGURATION]");
|
||||
ibgHeader.AppendLine("IBGD_VERSION=2");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat("DATE={0}", DateTime.Now).AppendLine();
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat("SAMPLE_RATE={0}", 100).AppendLine();
|
||||
if(dev.IsUsb) ibgBusType = "USB";
|
||||
else if(dev.IsFireWire) ibgBusType = "FireWire";
|
||||
else ibgBusType = dev.Type.ToString();
|
||||
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE=[0:0:0] {0} {1} ({2}) ({3})", dev.Manufacturer, dev.Model, devicePath,
|
||||
ibgBusType).AppendLine();
|
||||
ibgHeader.AppendLine("DEVICE_ADDRESS=0:0:0");
|
||||
ibgHeader.AppendFormat("DEVICE_MAKEMODEL={0} {1}", dev.Manufacturer, dev.Model).AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE_FIRMWAREVERSION={0}", dev.Revision).AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE_DRIVELETTER={0}", devicePath).AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE_BUSTYPE={0}", ibgBusType).AppendLine();
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("IBGD");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("[START_CONFIGURATION]");
|
||||
ibgHeader.AppendLine("IBGD_VERSION=2");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat("DATE={0}", DateTime.Now).AppendLine();
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat("SAMPLE_RATE={0}", 100).AppendLine();
|
||||
|
||||
ibgHeader.AppendFormat("MEDIA_TYPE={0}", ibgMediaType).AppendLine();
|
||||
ibgHeader.AppendLine("MEDIA_BOOKTYPE=Unknown");
|
||||
ibgHeader.AppendLine("MEDIA_ID=N/A");
|
||||
ibgHeader.AppendLine("MEDIA_TRACKPATH=PTP");
|
||||
ibgHeader.AppendLine("MEDIA_SPEEDS=N/A");
|
||||
ibgHeader.AppendFormat("MEDIA_CAPACITY={0}", blocks).AppendLine();
|
||||
ibgHeader.AppendLine("MEDIA_LAYER_BREAK=0");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("DATA_IMAGEFILE=/dev/null");
|
||||
ibgHeader.AppendFormat("DATA_SECTORS={0}", blocks).AppendLine();
|
||||
ibgHeader.AppendFormat("DATA_TYPE=MODE1/{0}", blockSize).AppendLine();
|
||||
ibgHeader.AppendLine("DATA_VOLUMEIDENTIFIER=");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_START={0:0.00}", ibgStartSpeed).AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_END={0:0.00}", currentSpeed / ibgDivider).AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_AVERAGE={0:0.00}", averageSpeed / ibgDivider)
|
||||
.AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_MAX={0:0.00}", ibgMaxSpeed).AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_TIME_TAKEN={0:0}", Math.Floor(totalSeconds)).AppendLine();
|
||||
ibgHeader.AppendLine("[END_CONFIGURATION]");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("HRPC=True");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("[START_VERIFY_GRAPH_VALUES]");
|
||||
ibgHeader.Append(ibgSb.ToString());
|
||||
ibgHeader.AppendLine("[END_VERIFY_GRAPH_VALUES]");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE=[0:0:0] {0} {1} ({2}) ({3})", dev.Manufacturer, dev.Model, devicePath,
|
||||
ibgBusType).AppendLine();
|
||||
ibgHeader.AppendLine("DEVICE_ADDRESS=0:0:0");
|
||||
ibgHeader.AppendFormat("DEVICE_MAKEMODEL={0} {1}", dev.Manufacturer, dev.Model).AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE_FIRMWAREVERSION={0}", dev.Revision).AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE_DRIVELETTER={0}", devicePath).AppendLine();
|
||||
ibgHeader.AppendFormat("DEVICE_BUSTYPE={0}", ibgBusType).AppendLine();
|
||||
ibgHeader.AppendLine();
|
||||
|
||||
StreamWriter sr = new StreamWriter(ibgFs);
|
||||
sr.Write(ibgHeader);
|
||||
sr.Close();
|
||||
ibgFs.Close();
|
||||
}
|
||||
ibgHeader.AppendFormat("MEDIA_TYPE={0}", ibgMediaType).AppendLine();
|
||||
ibgHeader.AppendLine("MEDIA_BOOKTYPE=Unknown");
|
||||
ibgHeader.AppendLine("MEDIA_ID=N/A");
|
||||
ibgHeader.AppendLine("MEDIA_TRACKPATH=PTP");
|
||||
ibgHeader.AppendLine("MEDIA_SPEEDS=N/A");
|
||||
ibgHeader.AppendFormat("MEDIA_CAPACITY={0}", blocks).AppendLine();
|
||||
ibgHeader.AppendLine("MEDIA_LAYER_BREAK=0");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("DATA_IMAGEFILE=/dev/null");
|
||||
ibgHeader.AppendFormat("DATA_SECTORS={0}", blocks).AppendLine();
|
||||
ibgHeader.AppendFormat("DATA_TYPE=MODE1/{0}", blockSize).AppendLine();
|
||||
ibgHeader.AppendLine("DATA_VOLUMEIDENTIFIER=");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_START={0:0.00}", ibgStartSpeed).AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_END={0:0.00}", currentSpeed / ibgDivider).AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_AVERAGE={0:0.00}", averageSpeed / ibgDivider)
|
||||
.AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_MAX={0:0.00}", ibgMaxSpeed).AppendLine();
|
||||
ibgHeader.AppendFormat(ibgCulture, "VERIFY_TIME_TAKEN={0:0}", Math.Floor(totalSeconds)).AppendLine();
|
||||
ibgHeader.AppendLine("[END_CONFIGURATION]");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("HRPC=True");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.AppendLine("[START_VERIFY_GRAPH_VALUES]");
|
||||
ibgHeader.Append(ibgSb.ToString());
|
||||
ibgHeader.AppendLine("[END_VERIFY_GRAPH_VALUES]");
|
||||
ibgHeader.AppendLine();
|
||||
ibgHeader.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
|
||||
|
||||
StreamWriter sr = new StreamWriter(ibgFs);
|
||||
sr.Write(ibgHeader);
|
||||
sr.Close();
|
||||
ibgFs.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,101 +43,99 @@ namespace DiscImageChef.Core.Logging
|
||||
|
||||
internal MhddLog(string outputFile, Device dev, ulong blocks, ulong blockSize, ulong blocksToRead)
|
||||
{
|
||||
if(dev != null && !string.IsNullOrEmpty(outputFile))
|
||||
if(dev == null || string.IsNullOrEmpty(outputFile)) return;
|
||||
|
||||
mhddFs = new FileStream(outputFile, FileMode.Create);
|
||||
|
||||
string device;
|
||||
string mode;
|
||||
string fw;
|
||||
string sn;
|
||||
string sectors;
|
||||
string sectorsize;
|
||||
string scanblocksize;
|
||||
string ver;
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
mhddFs = new FileStream(outputFile, FileMode.Create);
|
||||
|
||||
string device;
|
||||
string mode;
|
||||
string fw;
|
||||
string sn;
|
||||
string sectors;
|
||||
string sectorsize;
|
||||
string scanblocksize;
|
||||
string ver;
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.ATA:
|
||||
case DeviceType.ATAPI:
|
||||
mode = "MODE: IDE";
|
||||
break;
|
||||
case DeviceType.SCSI:
|
||||
mode = "MODE: SCSI";
|
||||
break;
|
||||
case DeviceType.MMC:
|
||||
mode = "MODE: MMC";
|
||||
break;
|
||||
case DeviceType.NVMe:
|
||||
mode = "MODE: NVMe";
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
mode = "MODE: SD";
|
||||
break;
|
||||
default:
|
||||
mode = "MODE: IDE";
|
||||
break;
|
||||
}
|
||||
|
||||
device = string.Format("DEVICE: {0} {1}", dev.Manufacturer, dev.Model);
|
||||
fw = string.Format("F/W: {0}", dev.Revision);
|
||||
sn = string.Format("S/N: {0}", dev.Serial);
|
||||
sectors = string.Format(new System.Globalization.CultureInfo("en-US"), "SECTORS: {0:n0}", blocks);
|
||||
sectorsize = string.Format(new System.Globalization.CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes",
|
||||
blockSize);
|
||||
scanblocksize = string.Format(new System.Globalization.CultureInfo("en-US"),
|
||||
"SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead);
|
||||
ver = "VER:2 ";
|
||||
|
||||
byte[] deviceBytes = Encoding.ASCII.GetBytes(device);
|
||||
byte[] modeBytes = Encoding.ASCII.GetBytes(mode);
|
||||
byte[] fwBytes = Encoding.ASCII.GetBytes(fw);
|
||||
byte[] snBytes = Encoding.ASCII.GetBytes(sn);
|
||||
byte[] sectorsBytes = Encoding.ASCII.GetBytes(sectors);
|
||||
byte[] sectorsizeBytes = Encoding.ASCII.GetBytes(sectorsize);
|
||||
byte[] scanblocksizeBytes = Encoding.ASCII.GetBytes(scanblocksize);
|
||||
byte[] verBytes = Encoding.ASCII.GetBytes(ver);
|
||||
|
||||
uint pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length +
|
||||
sectorsBytes.Length + sectorsizeBytes.Length + scanblocksizeBytes.Length +
|
||||
verBytes.Length + 2 * 9 + // New lines
|
||||
4); // Pointer
|
||||
|
||||
byte[] newLine = new byte[2];
|
||||
newLine[0] = 0x0D;
|
||||
newLine[1] = 0x0A;
|
||||
|
||||
mhddFs.Write(BitConverter.GetBytes(pointer), 0, 4);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(verBytes, 0, verBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(modeBytes, 0, modeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(deviceBytes, 0, deviceBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(fwBytes, 0, fwBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(snBytes, 0, snBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
case DeviceType.ATA:
|
||||
case DeviceType.ATAPI:
|
||||
mode = "MODE: IDE";
|
||||
break;
|
||||
case DeviceType.SCSI:
|
||||
mode = "MODE: SCSI";
|
||||
break;
|
||||
case DeviceType.MMC:
|
||||
mode = "MODE: MMC";
|
||||
break;
|
||||
case DeviceType.NVMe:
|
||||
mode = "MODE: NVMe";
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
mode = "MODE: SD";
|
||||
break;
|
||||
default:
|
||||
mode = "MODE: IDE";
|
||||
break;
|
||||
}
|
||||
|
||||
device = string.Format("DEVICE: {0} {1}", dev.Manufacturer, dev.Model);
|
||||
fw = string.Format("F/W: {0}", dev.Revision);
|
||||
sn = string.Format("S/N: {0}", dev.Serial);
|
||||
sectors = string.Format(new System.Globalization.CultureInfo("en-US"), "SECTORS: {0:n0}", blocks);
|
||||
sectorsize = string.Format(new System.Globalization.CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes",
|
||||
blockSize);
|
||||
scanblocksize = string.Format(new System.Globalization.CultureInfo("en-US"),
|
||||
"SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead);
|
||||
ver = "VER:2 ";
|
||||
|
||||
byte[] deviceBytes = Encoding.ASCII.GetBytes(device);
|
||||
byte[] modeBytes = Encoding.ASCII.GetBytes(mode);
|
||||
byte[] fwBytes = Encoding.ASCII.GetBytes(fw);
|
||||
byte[] snBytes = Encoding.ASCII.GetBytes(sn);
|
||||
byte[] sectorsBytes = Encoding.ASCII.GetBytes(sectors);
|
||||
byte[] sectorsizeBytes = Encoding.ASCII.GetBytes(sectorsize);
|
||||
byte[] scanblocksizeBytes = Encoding.ASCII.GetBytes(scanblocksize);
|
||||
byte[] verBytes = Encoding.ASCII.GetBytes(ver);
|
||||
|
||||
uint pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length +
|
||||
sectorsBytes.Length + sectorsizeBytes.Length + scanblocksizeBytes.Length +
|
||||
verBytes.Length + 2 * 9 + // New lines
|
||||
4); // Pointer
|
||||
|
||||
byte[] newLine = new byte[2];
|
||||
newLine[0] = 0x0D;
|
||||
newLine[1] = 0x0A;
|
||||
|
||||
mhddFs.Write(BitConverter.GetBytes(pointer), 0, 4);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(verBytes, 0, verBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(modeBytes, 0, modeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(deviceBytes, 0, deviceBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(fwBytes, 0, fwBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(snBytes, 0, snBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
}
|
||||
|
||||
internal void Write(ulong sector, double duration)
|
||||
{
|
||||
if(mhddFs != null)
|
||||
{
|
||||
byte[] sectorBytes = BitConverter.GetBytes(sector);
|
||||
byte[] durationBytes = BitConverter.GetBytes((ulong)(duration * 1000));
|
||||
if(mhddFs == null) return;
|
||||
|
||||
mhddFs.Write(sectorBytes, 0, 8);
|
||||
mhddFs.Write(durationBytes, 0, 8);
|
||||
}
|
||||
byte[] sectorBytes = BitConverter.GetBytes(sector);
|
||||
byte[] durationBytes = BitConverter.GetBytes((ulong)(duration * 1000));
|
||||
|
||||
mhddFs.Write(sectorBytes, 0, 8);
|
||||
mhddFs.Write(durationBytes, 0, 8);
|
||||
}
|
||||
|
||||
internal void Close()
|
||||
|
||||
@@ -90,12 +90,12 @@ namespace DiscImageChef.Core
|
||||
foreach(PartitionPlugin _partplugin in plugins.PartPluginsList.Values)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Partitions", "Trying {0} @ {1}", _partplugin.Name, partitions[0].Start);
|
||||
if(_partplugin.GetInformation(image, out List<Partition> _partitions, partitions[0].Start))
|
||||
{
|
||||
DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", _partplugin.Name,
|
||||
partitions[0].Start);
|
||||
childs.AddRange(_partitions);
|
||||
}
|
||||
if(!_partplugin.GetInformation(image, out List<Partition> _partitions, partitions[0].Start))
|
||||
continue;
|
||||
|
||||
DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", _partplugin.Name,
|
||||
partitions[0].Start);
|
||||
childs.AddRange(_partitions);
|
||||
}
|
||||
|
||||
checkedLocations.Add(partitions[0].Start);
|
||||
|
||||
@@ -63,11 +63,10 @@ namespace DiscImageChef.Core
|
||||
foreach(Type type in assembly.GetTypes())
|
||||
try
|
||||
{
|
||||
if(type.IsSubclassOf(typeof(ImagePlugin)))
|
||||
{
|
||||
ImagePlugin plugin = (ImagePlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
||||
RegisterImagePlugin(plugin);
|
||||
}
|
||||
if(!type.IsSubclassOf(typeof(ImagePlugin))) continue;
|
||||
|
||||
ImagePlugin plugin = (ImagePlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
||||
RegisterImagePlugin(plugin);
|
||||
}
|
||||
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
||||
|
||||
@@ -76,11 +75,10 @@ namespace DiscImageChef.Core
|
||||
foreach(Type type in assembly.GetTypes())
|
||||
try
|
||||
{
|
||||
if(type.IsSubclassOf(typeof(PartitionPlugin)))
|
||||
{
|
||||
PartitionPlugin plugin = (PartitionPlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
||||
RegisterPartPlugin(plugin);
|
||||
}
|
||||
if(!type.IsSubclassOf(typeof(PartitionPlugin))) continue;
|
||||
|
||||
PartitionPlugin plugin = (PartitionPlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
||||
RegisterPartPlugin(plugin);
|
||||
}
|
||||
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
||||
|
||||
@@ -89,15 +87,14 @@ namespace DiscImageChef.Core
|
||||
foreach(Type type in assembly.GetTypes())
|
||||
try
|
||||
{
|
||||
if(type.IsSubclassOf(typeof(Filesystem)))
|
||||
{
|
||||
Filesystem plugin;
|
||||
if(encoding != null)
|
||||
plugin = (Filesystem)type.GetConstructor(new Type[] {encoding.GetType()})
|
||||
.Invoke(new object[] {encoding});
|
||||
else plugin = (Filesystem)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
||||
RegisterPlugin(plugin);
|
||||
}
|
||||
if(!type.IsSubclassOf(typeof(Filesystem))) continue;
|
||||
|
||||
Filesystem plugin;
|
||||
if(encoding != null)
|
||||
plugin = (Filesystem)type.GetConstructor(new Type[] {encoding.GetType()})
|
||||
.Invoke(new object[] {encoding});
|
||||
else plugin = (Filesystem)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
||||
RegisterPlugin(plugin);
|
||||
}
|
||||
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
||||
}
|
||||
|
||||
@@ -308,12 +308,11 @@ namespace DiscImageChef.Core
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(image, partitions[i]))
|
||||
{
|
||||
plugin.GetInformation(image, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
}
|
||||
if(!plugin.Identify(image, partitions[i])) continue;
|
||||
|
||||
plugin.GetInformation(image, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
@@ -342,12 +341,11 @@ namespace DiscImageChef.Core
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(image, wholePart))
|
||||
{
|
||||
plugin.GetInformation(image, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
}
|
||||
if(!plugin.Identify(image, wholePart)) continue;
|
||||
|
||||
plugin.GetInformation(image, wholePart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
@@ -676,70 +674,68 @@ namespace DiscImageChef.Core
|
||||
string dfiFilePath = Path.Combine(Path.GetDirectoryName(imagePath),
|
||||
Path.GetFileNameWithoutExtension(imagePath) + ".dfi");
|
||||
|
||||
if(File.Exists(dfiFilePath))
|
||||
{
|
||||
DiscImages.DiscFerret dfiImage = new DiscFerret();
|
||||
Filters.ZZZNoFilter dfiFilter = new ZZZNoFilter();
|
||||
dfiFilter.Open(dfiFilePath);
|
||||
if(!File.Exists(dfiFilePath)) return;
|
||||
|
||||
if(dfiImage.IdentifyImage(dfiFilter))
|
||||
DiscImages.DiscFerret dfiImage = new DiscFerret();
|
||||
Filters.ZZZNoFilter dfiFilter = new ZZZNoFilter();
|
||||
dfiFilter.Open(dfiFilePath);
|
||||
|
||||
if(!dfiImage.IdentifyImage(dfiFilter)) return;
|
||||
|
||||
try { dfiImage.OpenImage(dfiFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
|
||||
if(image.ImageInfo.Heads == dfiImage.ImageInfo.Heads)
|
||||
if(dfiImage.ImageInfo.Cylinders >= image.ImageInfo.Cylinders)
|
||||
{
|
||||
try { dfiImage.OpenImage(dfiFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
List<BlockTrackType> dfiBlockTrackTypes = new List<BlockTrackType>();
|
||||
long currentSector = 0;
|
||||
Stream dfiStream = dfiFilter.GetDataForkStream();
|
||||
|
||||
if(image.ImageInfo.Heads == dfiImage.ImageInfo.Heads)
|
||||
if(dfiImage.ImageInfo.Cylinders >= image.ImageInfo.Cylinders)
|
||||
foreach(int t in dfiImage.TrackOffsets.Keys)
|
||||
{
|
||||
BlockTrackType dfiBlockTrackType = new BlockTrackType();
|
||||
dfiBlockTrackType.Cylinder = t / image.ImageInfo.Heads;
|
||||
dfiBlockTrackType.Head = t % image.ImageInfo.Heads;
|
||||
dfiBlockTrackType.Image = new ImageType();
|
||||
dfiBlockTrackType.Image.format = dfiImage.GetImageFormat();
|
||||
dfiBlockTrackType.Image.Value = Path.GetFileName(dfiFilePath);
|
||||
|
||||
if(dfiBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> dfiBlockTrackTypes = new List<BlockTrackType>();
|
||||
long currentSector = 0;
|
||||
Stream dfiStream = dfiFilter.GetDataForkStream();
|
||||
|
||||
foreach(int t in dfiImage.TrackOffsets.Keys)
|
||||
{
|
||||
BlockTrackType dfiBlockTrackType = new BlockTrackType();
|
||||
dfiBlockTrackType.Cylinder = t / image.ImageInfo.Heads;
|
||||
dfiBlockTrackType.Head = t % image.ImageInfo.Heads;
|
||||
dfiBlockTrackType.Image = new ImageType();
|
||||
dfiBlockTrackType.Image.format = dfiImage.GetImageFormat();
|
||||
dfiBlockTrackType.Image.Value = Path.GetFileName(dfiFilePath);
|
||||
|
||||
if(dfiBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
|
||||
{
|
||||
dfiBlockTrackType.StartSector = currentSector;
|
||||
currentSector += image.ImageInfo.SectorsPerTrack;
|
||||
dfiBlockTrackType.EndSector = currentSector - 1;
|
||||
dfiBlockTrackType.Sectors = image.ImageInfo.SectorsPerTrack;
|
||||
dfiBlockTrackType.BytesPerSector = (int)image.ImageInfo.SectorSize;
|
||||
dfiBlockTrackType.Format = trkFormat;
|
||||
}
|
||||
|
||||
if(dfiImage.TrackOffsets.TryGetValue(t, out long offset) &&
|
||||
dfiImage.TrackLengths.TryGetValue(t, out long length))
|
||||
{
|
||||
dfiBlockTrackType.Image.offset = offset;
|
||||
byte[] trackContents = new byte[length];
|
||||
dfiStream.Position = offset;
|
||||
dfiStream.Read(trackContents, 0, trackContents.Length);
|
||||
dfiBlockTrackType.Size = trackContents.Length;
|
||||
dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray();
|
||||
}
|
||||
|
||||
dfiBlockTrackTypes.Add(dfiBlockTrackType);
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Track =
|
||||
dfiBlockTrackTypes.OrderBy(t => t.Cylinder).ThenBy(t => t.Head).ToArray();
|
||||
dfiBlockTrackType.StartSector = currentSector;
|
||||
currentSector += image.ImageInfo.SectorsPerTrack;
|
||||
dfiBlockTrackType.EndSector = currentSector - 1;
|
||||
dfiBlockTrackType.Sectors = image.ImageInfo.SectorsPerTrack;
|
||||
dfiBlockTrackType.BytesPerSector = (int)image.ImageInfo.SectorSize;
|
||||
dfiBlockTrackType.Format = trkFormat;
|
||||
}
|
||||
else
|
||||
DicConsole
|
||||
.ErrorWriteLine("DiscFerret image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...",
|
||||
dfiImage.ImageInfo.Cylinders, image.ImageInfo.Cylinders);
|
||||
else
|
||||
DicConsole
|
||||
.ErrorWriteLine("DiscFerret image do not contain same number of heads ({0}) than disk image ({1}), ignoring...",
|
||||
dfiImage.ImageInfo.Heads, image.ImageInfo.Heads);
|
||||
|
||||
if(dfiImage.TrackOffsets.TryGetValue(t, out long offset) &&
|
||||
dfiImage.TrackLengths.TryGetValue(t, out long length))
|
||||
{
|
||||
dfiBlockTrackType.Image.offset = offset;
|
||||
byte[] trackContents = new byte[length];
|
||||
dfiStream.Position = offset;
|
||||
dfiStream.Read(trackContents, 0, trackContents.Length);
|
||||
dfiBlockTrackType.Size = trackContents.Length;
|
||||
dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray();
|
||||
}
|
||||
|
||||
dfiBlockTrackTypes.Add(dfiBlockTrackType);
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Track =
|
||||
dfiBlockTrackTypes.OrderBy(t => t.Cylinder).ThenBy(t => t.Head).ToArray();
|
||||
}
|
||||
}
|
||||
else
|
||||
DicConsole
|
||||
.ErrorWriteLine("DiscFerret image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...",
|
||||
dfiImage.ImageInfo.Cylinders, image.ImageInfo.Cylinders);
|
||||
else
|
||||
DicConsole
|
||||
.ErrorWriteLine("DiscFerret image do not contain same number of heads ({0}) than disk image ({1}), ignoring...",
|
||||
dfiImage.ImageInfo.Heads, image.ImageInfo.Heads);
|
||||
#endregion
|
||||
|
||||
// TODO: Implement support for getting CHS from SCSI mode pages
|
||||
|
||||
@@ -465,22 +465,21 @@ namespace DiscImageChef.Core
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(image, partitions[i]))
|
||||
{
|
||||
plugin.GetInformation(image, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
if(!plugin.Identify(image, partitions[i])) continue;
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
plugin.GetInformation(image, partitions[i], out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
@@ -513,22 +512,21 @@ namespace DiscImageChef.Core
|
||||
foreach(Filesystem plugin in plugins.PluginsList.Values)
|
||||
try
|
||||
{
|
||||
if(plugin.Identify(image, xmlPart))
|
||||
{
|
||||
plugin.GetInformation(image, xmlPart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
if(!plugin.Identify(image, xmlPart)) continue;
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
plugin.GetInformation(image, xmlPart, out string foo);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
|
||||
switch(plugin.XmlFSType.Type) {
|
||||
case "Opera": dskType = MediaType.ThreeDO;
|
||||
break;
|
||||
case "PC Engine filesystem": dskType = MediaType.SuperCDROM2;
|
||||
break;
|
||||
case "Nintendo Wii filesystem": dskType = MediaType.WOD;
|
||||
break;
|
||||
case "Nintendo Gamecube filesystem": dskType = MediaType.GOD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user