REFACTOR: Removed unneeded pragmas.

This commit is contained in:
2017-12-21 16:14:29 +00:00
parent bcbda18e4d
commit 7553983bd8
20 changed files with 0 additions and 104 deletions

View File

@@ -277,9 +277,7 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i); dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i);
} }
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
GC.Collect(); GC.Collect();
resume.NextBlock = i + blocksToRead; resume.NextBlock = i + blocksToRead;
} }
@@ -287,11 +285,9 @@ namespace DiscImageChef.Core.Devices.Dumping
end = DateTime.Now; end = DateTime.Now;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000),
devicePath); devicePath);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
@@ -399,9 +395,7 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpFile.Write(new byte[blockSize]); dumpFile.Write(new byte[blockSize]);
} }
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
currentSpeed = blockSize / (double)1048576 / (duration / 1000); currentSpeed = blockSize / (double)1048576 / (duration / 1000);
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
GC.Collect(); GC.Collect();
currentBlock++; currentBlock++;
@@ -412,11 +406,9 @@ namespace DiscImageChef.Core.Devices.Dumping
end = DateTime.Now; end = DateTime.Now;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000),
devicePath); devicePath);
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));

View File

@@ -437,9 +437,7 @@ namespace DiscImageChef.Core.Devices.Dumping
} }
} }
#pragma warning disable IDE0004 // Remove Unnecessary Cast
currentSpeed = blockSize / (double)1048576 / (cmdDuration / 1000); currentSpeed = blockSize / (double)1048576 / (cmdDuration / 1000);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
} }
dumpFile.Close(); dumpFile.Close();
@@ -629,9 +627,7 @@ namespace DiscImageChef.Core.Devices.Dumping
} }
} }
#pragma warning disable IDE0004 // Remove Unnecessary Cast
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
resume.NextBlock = i + blocksToRead; resume.NextBlock = i + blocksToRead;
} }
@@ -672,10 +668,8 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.WriteLine(); DicConsole.WriteLine();
end = DateTime.UtcNow; end = DateTime.UtcNow;
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Remove Unnecessary Cast
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath); blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
@@ -860,9 +854,7 @@ namespace DiscImageChef.Core.Devices.Dumping
double chkDuration = (chkEnd - chkStart).TotalMilliseconds; double chkDuration = (chkEnd - chkStart).TotalMilliseconds;
totalChkDuration += chkDuration; totalChkDuration += chkDuration;
#pragma warning disable IDE0004 // Remove Unnecessary Cast
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (chkDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (chkDuration / 1000);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
} }
tracks[t].Checksums = trkChk.End().ToArray(); tracks[t].Checksums = trkChk.End().ToArray();

View File

@@ -396,19 +396,15 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i); dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i);
} }
#pragma warning disable IDE0004 // Remove Unnecessary Cast
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
resume.NextBlock = i + blocksToRead; resume.NextBlock = i + blocksToRead;
} }
end = DateTime.UtcNow; end = DateTime.UtcNow;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Remove Unnecessary Cast
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath); blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
@@ -592,9 +588,7 @@ namespace DiscImageChef.Core.Devices.Dumping
double chkDuration = (chkEnd - chkStart).TotalMilliseconds; double chkDuration = (chkEnd - chkStart).TotalMilliseconds;
totalChkDuration += chkDuration; totalChkDuration += chkDuration;
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (chkDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (chkDuration / 1000);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
} }
DicConsole.WriteLine(); DicConsole.WriteLine();
@@ -831,10 +825,8 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).",
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000);
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000));
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed); DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed);
DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed); DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed);
DicConsole.WriteLine("{0} sectors could not be read.", resume.BadBlocks.Count); DicConsole.WriteLine("{0} sectors could not be read.", resume.BadBlocks.Count);

View File

@@ -632,10 +632,8 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).", DicConsole.WriteLine("Took a total of {0:F3} seconds ({1:F3} processing commands, {2:F3} checksumming).",
(end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000); (end - start).TotalSeconds, totalDuration / 1000, totalChkDuration / 1000);
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.", DicConsole.WriteLine("Avegare speed: {0:F3} MiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1048576 / (totalDuration / 1000));
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed); DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed);
DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed); DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed);

View File

@@ -344,9 +344,7 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i); dumpLog.WriteLine("Error reading {0} blocks from block {1}.", blocksToRead, i);
} }
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
GC.Collect(); GC.Collect();
resume.NextBlock = i + blocksToRead; resume.NextBlock = i + blocksToRead;
} }
@@ -354,10 +352,8 @@ namespace DiscImageChef.Core.Devices.Dumping
end = DateTime.Now; end = DateTime.Now;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath); blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));

View File

@@ -437,9 +437,7 @@ namespace DiscImageChef.Core.Devices.Dumping
foreach(string senseLine in senseLines) dumpLog.WriteLine(senseLine); foreach(string senseLine in senseLines) dumpLog.WriteLine(senseLine);
} }
#pragma warning disable IDE0004 // Remove Unnecessary Cast
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
blocksToRead = saveBlocksToRead; blocksToRead = saveBlocksToRead;
currentSector = i + 1; currentSector = i + 1;
resume.NextBlock = currentSector; resume.NextBlock = currentSector;
@@ -568,9 +566,7 @@ namespace DiscImageChef.Core.Devices.Dumping
foreach(string senseLine in senseLines) dumpLog.WriteLine(senseLine); foreach(string senseLine in senseLines) dumpLog.WriteLine(senseLine);
} }
#pragma warning disable IDE0004 // Remove Unnecessary Cast
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
currentSector += blocksToRead; currentSector += blocksToRead;
resume.NextBlock = currentSector; resume.NextBlock = currentSector;
} }
@@ -594,10 +590,8 @@ namespace DiscImageChef.Core.Devices.Dumping
end = DateTime.UtcNow; end = DateTime.UtcNow;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Remove Unnecessary Cast
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath); blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds); dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.", dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000)); (double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
@@ -792,9 +786,7 @@ namespace DiscImageChef.Core.Devices.Dumping
double chkDuration = (chkEnd - chkStart).TotalMilliseconds; double chkDuration = (chkEnd - chkStart).TotalMilliseconds;
totalChkDuration += chkDuration; totalChkDuration += chkDuration;
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (chkDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (chkDuration / 1000);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
} }
DicConsole.WriteLine(); DicConsole.WriteLine();

View File

@@ -191,9 +191,7 @@ namespace DiscImageChef.Core.Devices
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
{ {
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF); PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
} }
else PhysicalBlockSize = LogicalBlockSize; else PhysicalBlockSize = LogicalBlockSize;
} }

View File

@@ -93,15 +93,11 @@ namespace DiscImageChef.Core.Devices
return true; return true;
} }
#pragma warning disable IDE0004 // Remove Unnecessary Cast
if(!read16 && Blocks > 0xFFFFFFFF + (long)1) if(!read16 && Blocks > 0xFFFFFFFF + (long)1)
#pragma warning restore IDE0004 // Remove Unnecessary Cast
{ {
#pragma warning disable IDE0004 // Remove Unnecessary Cast
ErrorMessage = ErrorMessage =
string.Format("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)", string.Format("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)",
0xFFFFFFFF + (long)1, Blocks); 0xFFFFFFFF + (long)1, Blocks);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
return true; return true;
} }

View File

@@ -603,10 +603,8 @@ namespace DiscImageChef.Core.Devices.Report
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
{ {
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
physicalsectorsize = physicalsectorsize =
(uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF)); (uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF));
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
} }
else physicalsectorsize = logicalsectorsize; else physicalsectorsize = logicalsectorsize;
} }
@@ -973,10 +971,8 @@ namespace DiscImageChef.Core.Devices.Report
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
{ {
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
physicalsectorsize = logicalsectorsize * physicalsectorsize = logicalsectorsize *
(uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF); (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
} }
else physicalsectorsize = logicalsectorsize; else physicalsectorsize = logicalsectorsize;
} }

View File

@@ -167,20 +167,16 @@ namespace DiscImageChef.Core.Devices.Scanning
ibgLog.Write(i, 0); ibgLog.Write(i, 0);
} }
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
GC.Collect(); GC.Collect();
} }
end = DateTime.UtcNow; end = DateTime.UtcNow;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(results.Blocks + 1) / 1024 / blockSize * (double)(results.Blocks + 1) / 1024 /
(results.ProcessingTime / 1000), devicePath); (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
if(ataReader.CanSeekLba) if(ataReader.CanSeekLba)
for(int i = 0; i < SEEK_TIMES; i++) for(int i = 0; i < SEEK_TIMES; i++)
@@ -252,9 +248,7 @@ namespace DiscImageChef.Core.Devices.Scanning
ibgLog.Write(currentBlock, 0); ibgLog.Write(currentBlock, 0);
} }
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
currentSpeed = blockSize / (double)1048576 / (duration / 1000); currentSpeed = blockSize / (double)1048576 / (duration / 1000);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
GC.Collect(); GC.Collect();
currentBlock++; currentBlock++;
@@ -265,11 +259,9 @@ namespace DiscImageChef.Core.Devices.Scanning
end = DateTime.UtcNow; end = DateTime.UtcNow;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(results.Blocks + 1) / 1024 / blockSize * (double)(results.Blocks + 1) / 1024 /
(results.ProcessingTime / 1000), devicePath); (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
if(ataReader.CanSeek) if(ataReader.CanSeek)
for(int i = 0; i < SEEK_TIMES; i++) for(int i = 0; i < SEEK_TIMES; i++)
@@ -299,10 +291,8 @@ namespace DiscImageChef.Core.Devices.Scanning
results.ProcessingTime /= 1000; results.ProcessingTime /= 1000;
results.TotalTime = (end - start).TotalSeconds; results.TotalTime = (end - start).TotalSeconds;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 /
results.ProcessingTime; results.ProcessingTime;
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
results.SeekTimes = SEEK_TIMES; results.SeekTimes = SEEK_TIMES;
return results; return results;

View File

@@ -161,10 +161,8 @@ namespace DiscImageChef.Core.Devices.Scanning
if(results.Blocks != 0 && blockSize != 0) if(results.Blocks != 0 && blockSize != 0)
{ {
results.Blocks++; results.Blocks++;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)",
results.Blocks, blockSize, results.Blocks * (ulong)blockSize); results.Blocks, blockSize, results.Blocks * (ulong)blockSize);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
} }
break; break;
case PeripheralDeviceTypes.SequentialAccess: case PeripheralDeviceTypes.SequentialAccess:
@@ -353,20 +351,16 @@ namespace DiscImageChef.Core.Devices.Scanning
} }
} }
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
GC.Collect(); GC.Collect();
} }
end = DateTime.UtcNow; end = DateTime.UtcNow;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(results.Blocks + 1) / 1024 / blockSize * (double)(results.Blocks + 1) / 1024 /
(results.ProcessingTime / 1000), devicePath); (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
} }
else else
{ {
@@ -418,19 +412,15 @@ namespace DiscImageChef.Core.Devices.Scanning
ibgLog.Write(i, 0); ibgLog.Write(i, 0);
} }
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
} }
end = DateTime.UtcNow; end = DateTime.UtcNow;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(results.Blocks + 1) / 1024 / blockSize * (double)(results.Blocks + 1) / 1024 /
(results.ProcessingTime / 1000), devicePath); (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
} }
results.SeekMax = double.MinValue; results.SeekMax = double.MinValue;
@@ -468,9 +458,7 @@ namespace DiscImageChef.Core.Devices.Scanning
results.ProcessingTime /= 1000; results.ProcessingTime /= 1000;
results.TotalTime = (end - start).TotalSeconds; results.TotalTime = (end - start).TotalSeconds;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
results.SeekTimes = SEEK_TIMES; results.SeekTimes = SEEK_TIMES;
return results; return results;

View File

@@ -204,20 +204,16 @@ namespace DiscImageChef.Core.Devices.Scanning
ibgLog.Write(i, 0); ibgLog.Write(i, 0);
} }
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000); currentSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
GC.Collect(); GC.Collect();
} }
end = DateTime.UtcNow; end = DateTime.UtcNow;
DicConsole.WriteLine(); DicConsole.WriteLine();
mhddLog.Close(); mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
devicePath); devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
for(int i = 0; i < SEEK_TIMES; i++) for(int i = 0; i < SEEK_TIMES; i++)
{ {
@@ -243,9 +239,7 @@ namespace DiscImageChef.Core.Devices.Scanning
results.ProcessingTime /= 1000; results.ProcessingTime /= 1000;
results.TotalTime = (end - start).TotalSeconds; results.TotalTime = (end - start).TotalSeconds;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime; results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
results.SeekTimes = SEEK_TIMES; results.SeekTimes = SEEK_TIMES;
return results; return results;

View File

@@ -2378,10 +2378,8 @@ namespace DiscImageChef.Decoders.ATA
if((ATAID.PhysLogSectorSize & 0x2000) == 0x2000) if((ATAID.PhysLogSectorSize & 0x2000) == 0x2000)
{ {
#pragma warning disable IDE0004 // Remove Unnecessary Cast
physicalsectorsize = physicalsectorsize =
logicalsectorsize * (uint)Math.Pow(2, ATAID.PhysLogSectorSize & 0xF); logicalsectorsize * (uint)Math.Pow(2, ATAID.PhysLogSectorSize & 0xF);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
} }
else physicalsectorsize = logicalsectorsize; else physicalsectorsize = logicalsectorsize;
} }

View File

@@ -84,11 +84,9 @@ namespace DiscImageChef.Decoders.SCSI.SSC
sb.AppendFormat("Device's minimum block size is {0} bytes", decoded.Value.minBlockLen).AppendLine(); sb.AppendFormat("Device's minimum block size is {0} bytes", decoded.Value.minBlockLen).AppendLine();
if(decoded.Value.granularity > 0) if(decoded.Value.granularity > 0)
#pragma warning disable IDE0004 // Remove Unnecessary Cast
sb.AppendFormat("Device's needs a block size granularity of 2^{0} ({1}) bytes", sb.AppendFormat("Device's needs a block size granularity of 2^{0} ({1}) bytes",
decoded.Value.granularity, Math.Pow(2, decoded.Value.granularity)) decoded.Value.granularity, Math.Pow(2, decoded.Value.granularity))
.AppendLine(); .AppendLine();
#pragma warning restore IDE0004 // Remove Unnecessary Cast
} }
return sb.ToString(); return sb.ToString();

View File

@@ -160,10 +160,8 @@ namespace DiscImageChef.Decoders.SCSI.SSC
if(descriptor.duplicate) sb.AppendLine("\tThis descriptor is duplicated"); if(descriptor.duplicate) sb.AppendLine("\tThis descriptor is duplicated");
if(descriptor.defaultDensity) sb.AppendLine("\tThis is the default density on the drive"); if(descriptor.defaultDensity) sb.AppendLine("\tThis is the default density on the drive");
sb.AppendFormat("\tDensity has {0} bits per mm, with {1} tracks in a {2} mm width tape", sb.AppendFormat("\tDensity has {0} bits per mm, with {1} tracks in a {2} mm width tape",
#pragma warning disable IDE0004 // Remove Unnecessary Cast
descriptor.bpmm, descriptor.tracks, descriptor.width / (double)10) descriptor.bpmm, descriptor.tracks, descriptor.width / (double)10)
.AppendLine(); .AppendLine();
#pragma warning restore IDE0004 // Remove Unnecessary Cast
sb.AppendFormat("\tDensity maximum capacity is {0} megabytes", descriptor.capacity).AppendLine(); sb.AppendFormat("\tDensity maximum capacity is {0} megabytes", descriptor.capacity).AppendLine();
sb.AppendFormat("\tDensity description: {0}", descriptor.description).AppendLine(); sb.AppendFormat("\tDensity description: {0}", descriptor.description).AppendLine();
sb.AppendLine(); sb.AppendLine();
@@ -251,9 +249,7 @@ namespace DiscImageChef.Decoders.SCSI.SSC
} }
sb.AppendFormat("\tMedium has a nominal length of {0} m in a {1} mm width tape", sb.AppendFormat("\tMedium has a nominal length of {0} m in a {1} mm width tape",
#pragma warning disable IDE0004 // Remove Unnecessary Cast
descriptor.length, descriptor.width / (double)10).AppendLine(); descriptor.length, descriptor.width / (double)10).AppendLine();
#pragma warning restore IDE0004 // Remove Unnecessary Cast
sb.AppendFormat("\tMedium description: {0}", descriptor.description).AppendLine(); sb.AppendFormat("\tMedium description: {0}", descriptor.description).AppendLine();
sb.AppendLine(); sb.AppendLine();
} }

View File

@@ -99,9 +99,7 @@ namespace DiscImageChef.Devices
if(sense) return true; if(sense) return true;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
ushort confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4); ushort confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[confLength]; buffer = new byte[confLength];
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
cdb[8] = (byte)(buffer.Length & 0xFF); cdb[8] = (byte)(buffer.Length & 0xFF);
@@ -156,9 +154,7 @@ namespace DiscImageChef.Devices
if(sense) return true; if(sense) return true;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
ushort strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); ushort strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[strctLength]; buffer = new byte[strctLength];
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
cdb[9] = (byte)(buffer.Length & 0xFF); cdb[9] = (byte)(buffer.Length & 0xFF);
@@ -318,9 +314,7 @@ namespace DiscImageChef.Devices
out sense); out sense);
Error = LastError != 0; Error = LastError != 0;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[strctLength]; buffer = new byte[strctLength];
if(buffer.Length <= tmpBuffer.Length) if(buffer.Length <= tmpBuffer.Length)
@@ -381,9 +375,7 @@ namespace DiscImageChef.Devices
out sense); out sense);
Error = LastError != 0; Error = LastError != 0;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2); uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[strctLength]; buffer = new byte[strctLength];
Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length); Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length);

View File

@@ -80,10 +80,8 @@ namespace DiscImageChef.Devices
if(sense) return true; if(sense) return true;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] +
4); 4);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[attrLen]; buffer = new byte[attrLen];
cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24); cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24);
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);

View File

@@ -367,9 +367,7 @@ namespace DiscImageChef.Devices
if(sense) return true; if(sense) return true;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
ushort modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); ushort modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[modeLength]; buffer = new byte[modeLength];
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
cdb[8] = (byte)(buffer.Length & 0xFF); cdb[8] = (byte)(buffer.Length & 0xFF);
@@ -598,10 +596,8 @@ namespace DiscImageChef.Devices
if(sense) return true; if(sense) return true;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) +
buffer[3] + 4); buffer[3] + 4);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[strctLength]; buffer = new byte[strctLength];
cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24); cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24);
cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16); cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16);

View File

@@ -917,9 +917,7 @@ namespace DiscImageChef.Devices
if(sense) return true; if(sense) return true;
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
ushort availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2); ushort availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
buffer = new byte[availableLength]; buffer = new byte[availableLength];
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
cdb[8] = (byte)(buffer.Length & 0xFF); cdb[8] = (byte)(buffer.Length & 0xFF);

View File

@@ -113,12 +113,10 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Entropy for track {0} is {1:F4}.", currentTrack.TrackSequence, entropy); DicConsole.WriteLine("Entropy for track {0} is {1:F4}.", currentTrack.TrackSequence, entropy);
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
if(options.DuplicatedSectors) if(options.DuplicatedSectors)
DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})",
currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, currentTrack.TrackSequence, uniqueSectorsPerTrack.Count,
(double)uniqueSectorsPerTrack.Count / (double)sectors); (double)uniqueSectorsPerTrack.Count / (double)sectors);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
DicConsole.WriteLine(); DicConsole.WriteLine();
} }
@@ -165,10 +163,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Entropy for disk is {0:F4}.", entropy); DicConsole.WriteLine("Entropy for disk is {0:F4}.", entropy);
if(options.DuplicatedSectors) if(options.DuplicatedSectors)
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count,
(double)uniqueSectors.Count / (double)sectors); (double)uniqueSectors.Count / (double)sectors);
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
Core.Statistics.AddCommand("entropy"); Core.Statistics.AddCommand("entropy");
} }