mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Possible 'System.InvalidOperationException'.
This commit is contained in:
@@ -83,7 +83,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
sense = dev.AtaIdentify(out byte[] cmdBuf, out AtaErrorRegistersCHS errorChs);
|
sense = dev.AtaIdentify(out byte[] cmdBuf, out AtaErrorRegistersCHS errorChs);
|
||||||
if(!sense && Identify.Decode(cmdBuf).HasValue)
|
if(!sense && Identify.Decode(cmdBuf).HasValue)
|
||||||
{
|
{
|
||||||
Identify.IdentifyDevice ataId = Identify.Decode(cmdBuf).Value;
|
Identify.IdentifyDevice? ataIdNullable = Identify.Decode(cmdBuf);
|
||||||
|
if(ataIdNullable != null) {
|
||||||
|
Identify.IdentifyDevice ataId = ataIdNullable.Value;
|
||||||
|
|
||||||
CICMMetadataType sidecar =
|
CICMMetadataType sidecar =
|
||||||
new CICMMetadataType {BlockMedia = new[] {new BlockMediaType()}};
|
new CICMMetadataType {BlockMedia = new[] {new BlockMediaType()}};
|
||||||
@@ -609,6 +611,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
xmlSer.Serialize(xmlFs, sidecar);
|
xmlSer.Serialize(xmlFs, sidecar);
|
||||||
xmlFs.Close();
|
xmlFs.Close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Statistics.AddMedia(CommonTypes.MediaType.GENERIC_HDD, true);
|
Statistics.AddMedia(CommonTypes.MediaType.GENERIC_HDD, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ namespace DiscImageChef.Core.Devices
|
|||||||
switch(dev.Type)
|
switch(dev.Type)
|
||||||
{
|
{
|
||||||
case DeviceType.ATA:
|
case DeviceType.ATA:
|
||||||
if(Identify.Decode(identification).HasValue) ataId = Identify.Decode(identification).Value;
|
Identify.IdentifyDevice? ataIdNullable = Identify.Decode(identification);
|
||||||
|
if(ataIdNullable.HasValue) ataId = ataIdNullable.Value;
|
||||||
break;
|
break;
|
||||||
case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported.");
|
case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ namespace DiscImageChef.Core.Devices.Report
|
|||||||
|
|
||||||
if(!Identify.Decode(buffer).HasValue) return;
|
if(!Identify.Decode(buffer).HasValue) return;
|
||||||
|
|
||||||
Identify.IdentifyDevice ataId = Identify.Decode(buffer).Value;
|
Identify.IdentifyDevice? ataIdNullable = Identify.Decode(buffer);
|
||||||
|
if(ataIdNullable != null) {
|
||||||
|
Identify.IdentifyDevice ataId = ataIdNullable.Value;
|
||||||
|
|
||||||
if((ushort)ataId.GeneralConfiguration == 0x848A)
|
if((ushort)ataId.GeneralConfiguration == 0x848A)
|
||||||
{
|
{
|
||||||
@@ -1229,3 +1231,4 @@ namespace DiscImageChef.Core.Devices.Report
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -54,7 +54,9 @@ namespace DiscImageChef.Core.Devices.Report
|
|||||||
|
|
||||||
if(!Identify.Decode(buffer).HasValue) return;
|
if(!Identify.Decode(buffer).HasValue) return;
|
||||||
|
|
||||||
Identify.IdentifyDevice atapiId = Identify.Decode(buffer).Value;
|
Identify.IdentifyDevice? atapiIdNullable = Identify.Decode(buffer);
|
||||||
|
if(atapiIdNullable != null) {
|
||||||
|
Identify.IdentifyDevice atapiId = atapiIdNullable.Value;
|
||||||
|
|
||||||
report.ATAPI = new ataType();
|
report.ATAPI = new ataType();
|
||||||
|
|
||||||
@@ -453,6 +455,7 @@ namespace DiscImageChef.Core.Devices.Report
|
|||||||
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
||||||
report.ATAPI.WRVSectorCountMode2Specified = true;
|
report.ATAPI.WRVSectorCountMode2Specified = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(debug) report.ATAPI.Identify = buffer;
|
if(debug) report.ATAPI.Identify = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
sense = dev.AtaIdentify(out cmdBuf, out errorChs);
|
sense = dev.AtaIdentify(out cmdBuf, out errorChs);
|
||||||
if(!sense && Identify.Decode(cmdBuf).HasValue)
|
if(!sense && Identify.Decode(cmdBuf).HasValue)
|
||||||
{
|
{
|
||||||
Identify.IdentifyDevice ataId = Identify.Decode(cmdBuf).Value;
|
|
||||||
|
|
||||||
// Initializate reader
|
// Initializate reader
|
||||||
Reader ataReader = new Reader(dev, timeout, cmdBuf);
|
Reader ataReader = new Reader(dev, timeout, cmdBuf);
|
||||||
// Fill reader blocks
|
// Fill reader blocks
|
||||||
|
|||||||
Reference in New Issue
Block a user