mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Invert if to reduce nesting.
This commit is contained in:
@@ -206,13 +206,12 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
@@ -341,16 +340,13 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors *
|
||||
blockSize /
|
||||
(1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
ScanSpeed?.Invoke(currentBlock, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
|
||||
ScanSpeed?.Invoke(currentBlock, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,13 +508,12 @@ public sealed partial class MediaScan
|
||||
}
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_scanStopwatch.Stop();
|
||||
@@ -624,13 +623,11 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_scanStopwatch.Stop();
|
||||
|
||||
@@ -343,13 +343,12 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_scanStopwatch.Stop();
|
||||
|
||||
Reference in New Issue
Block a user