mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Draw a speed chart on media scan in GUI.
This commit is contained in:
@@ -103,7 +103,7 @@ namespace DiscImageChef.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void ErrorMessageHandler(string text);
|
public delegate void ErrorMessageHandler(string text);
|
||||||
|
|
||||||
public delegate void InitBlockMapHandler(ulong blocks, ulong blockSize, ulong blocksToRead);
|
public delegate void InitBlockMapHandler(ulong blocks, ulong blockSize, ulong blocksToRead, ushort currentProfile);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates lists of time taken on scanning from the specified sector
|
/// Updates lists of time taken on scanning from the specified sector
|
||||||
@@ -115,4 +115,6 @@ namespace DiscImageChef.Core
|
|||||||
/// Specified a number of blocks could not be read on scan
|
/// Specified a number of blocks could not be read on scan
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void ScanUnreadableHandler(ulong sector);
|
public delegate void ScanUnreadableHandler(ulong sector);
|
||||||
|
|
||||||
|
public delegate void ScanSpeedHandler(ulong sector, double currentSpeed);
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
{
|
{
|
||||||
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
||||||
|
|
||||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead);
|
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, ATA_PROFILE);
|
||||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||||
|
|
||||||
@@ -151,12 +151,14 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
else results.A += blocksToRead;
|
else results.A += blocksToRead;
|
||||||
|
|
||||||
ScanTime?.Invoke(i, duration);
|
ScanTime?.Invoke(i, duration);
|
||||||
|
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||||
mhddLog.Write(i, duration);
|
mhddLog.Write(i, duration);
|
||||||
ibgLog.Write(i, currentSpeed * 1024);
|
ibgLog.Write(i, currentSpeed * 1024);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScanUnreadable?.Invoke(i);
|
ScanUnreadable?.Invoke(i);
|
||||||
|
ScanSpeed?.Invoke(i, 0);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||||
|
|
||||||
@@ -208,7 +210,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead);
|
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, ATA_PROFILE);
|
||||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||||
|
|
||||||
@@ -248,12 +250,14 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
else results.A += blocksToRead;
|
else results.A += blocksToRead;
|
||||||
|
|
||||||
ScanTime?.Invoke(currentBlock, duration);
|
ScanTime?.Invoke(currentBlock, duration);
|
||||||
|
ScanSpeed?.Invoke(currentBlock, currentSpeed * 1024);
|
||||||
mhddLog.Write(currentBlock, duration);
|
mhddLog.Write(currentBlock, duration);
|
||||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScanUnreadable?.Invoke(currentBlock);
|
ScanUnreadable?.Invoke(currentBlock);
|
||||||
|
ScanSpeed?.Invoke(currentBlock, 0);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
results.UnreadableSectors.Add(currentBlock);
|
results.UnreadableSectors.Add(currentBlock);
|
||||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||||
|
|||||||
@@ -71,5 +71,6 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
public event ScanTimeHandler ScanTime;
|
public event ScanTimeHandler ScanTime;
|
||||||
public event ScanUnreadableHandler ScanUnreadable;
|
public event ScanUnreadableHandler ScanUnreadable;
|
||||||
public event InitBlockMapHandler InitBlockMap;
|
public event InitBlockMapHandler InitBlockMap;
|
||||||
|
public event ScanSpeedHandler ScanSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
|
|
||||||
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
||||||
|
|
||||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead);
|
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, currentProfile);
|
||||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||||
@@ -319,6 +319,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
else results.A += blocksToRead;
|
else results.A += blocksToRead;
|
||||||
|
|
||||||
ScanTime?.Invoke(i, cmdDuration);
|
ScanTime?.Invoke(i, cmdDuration);
|
||||||
|
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||||
mhddLog.Write(i, cmdDuration);
|
mhddLog.Write(i, cmdDuration);
|
||||||
ibgLog.Write(i, currentSpeed * 1024);
|
ibgLog.Write(i, currentSpeed * 1024);
|
||||||
}
|
}
|
||||||
@@ -347,6 +348,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScanUnreadable?.Invoke(i);
|
ScanUnreadable?.Invoke(i);
|
||||||
|
ScanSpeed?.Invoke(i, 0);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||||
|
|
||||||
@@ -380,7 +382,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
|
|
||||||
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
||||||
|
|
||||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead);
|
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, currentProfile);
|
||||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||||
@@ -414,6 +416,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
else results.A += blocksToRead;
|
else results.A += blocksToRead;
|
||||||
|
|
||||||
ScanTime?.Invoke(i, cmdDuration);
|
ScanTime?.Invoke(i, cmdDuration);
|
||||||
|
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||||
mhddLog.Write(i, cmdDuration);
|
mhddLog.Write(i, cmdDuration);
|
||||||
ibgLog.Write(i, currentSpeed * 1024);
|
ibgLog.Write(i, currentSpeed * 1024);
|
||||||
}
|
}
|
||||||
@@ -421,6 +424,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScanUnreadable?.Invoke(i);
|
ScanUnreadable?.Invoke(i);
|
||||||
|
ScanSpeed?.Invoke(i, 0);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
|
|
||||||
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
||||||
|
|
||||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead);
|
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, SD_PROFILE);
|
||||||
MhddLog mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
MhddLog mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||||
IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
||||||
|
|
||||||
@@ -182,12 +182,14 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
else results.A += blocksToRead;
|
else results.A += blocksToRead;
|
||||||
|
|
||||||
ScanTime?.Invoke(i, duration);
|
ScanTime?.Invoke(i, duration);
|
||||||
|
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||||
mhddLog.Write(i, duration);
|
mhddLog.Write(i, duration);
|
||||||
ibgLog.Write(i, currentSpeed * 1024);
|
ibgLog.Write(i, currentSpeed * 1024);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScanUnreadable?.Invoke(i);
|
ScanUnreadable?.Invoke(i);
|
||||||
|
ScanSpeed?.Invoke(i, 0);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,9 @@
|
|||||||
<TabPage Text="Graph">
|
<TabPage Text="Graph">
|
||||||
<local:BlockMap ID="blockMap"/>
|
<local:BlockMap ID="blockMap"/>
|
||||||
</TabPage>
|
</TabPage>
|
||||||
|
<TabPage Text="Chart">
|
||||||
|
<local:LineChart ID="lineChart"/>
|
||||||
|
</TabPage>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
ID="stkProgress" Visible="False">
|
ID="stkProgress" Visible="False">
|
||||||
|
|||||||
@@ -66,6 +66,16 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
|
|
||||||
this.devicePath = devicePath;
|
this.devicePath = devicePath;
|
||||||
btnStop.Visible = false;
|
btnStop.Visible = false;
|
||||||
|
|
||||||
|
lineChart.AbsoluteMargins = true;
|
||||||
|
lineChart.MarginX = 5;
|
||||||
|
lineChart.MarginY = 5;
|
||||||
|
lineChart.DrawAxes = true;
|
||||||
|
lineChart.AxesColor = Colors.Black;
|
||||||
|
lineChart.ColorX = Colors.Gray;
|
||||||
|
lineChart.ColorY = Colors.Gray;
|
||||||
|
lineChart.BackgroundColor = Color.FromRgb(0x2974c1);
|
||||||
|
lineChart.LineColor = Colors.Yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnBtnCancelClick(object sender, EventArgs e)
|
void OnBtnCancelClick(object sender, EventArgs e)
|
||||||
@@ -120,6 +130,7 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
scanner.UpdateProgress += UpdateProgress;
|
scanner.UpdateProgress += UpdateProgress;
|
||||||
scanner.EndProgress += EndProgress;
|
scanner.EndProgress += EndProgress;
|
||||||
scanner.InitBlockMap += InitBlockMap;
|
scanner.InitBlockMap += InitBlockMap;
|
||||||
|
scanner.ScanSpeed += ScanSpeed;
|
||||||
|
|
||||||
ScanResults results = scanner.Scan();
|
ScanResults results = scanner.Scan();
|
||||||
|
|
||||||
@@ -161,13 +172,99 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
WorkFinished();
|
WorkFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitBlockMap(ulong blocks, ulong blocksize, ulong blockstoread)
|
void ScanSpeed(ulong sector, double currentspeed)
|
||||||
|
{
|
||||||
|
Application.Instance.Invoke(() =>
|
||||||
|
{
|
||||||
|
System.Console.WriteLine(lineChart.MaxY);
|
||||||
|
if(currentspeed > lineChart.MaxY) lineChart.MaxY = (float)(currentspeed + currentspeed / 10);
|
||||||
|
|
||||||
|
lineChart.Values.Add(new PointF(sector, (float)currentspeed));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitBlockMap(ulong blocks, ulong blocksize, ulong blockstoread, ushort currentProfile)
|
||||||
{
|
{
|
||||||
Application.Instance.Invoke(() =>
|
Application.Instance.Invoke(() =>
|
||||||
{
|
{
|
||||||
blockMap.Sectors = blocks;
|
blockMap.Sectors = blocks;
|
||||||
blockMap.SectorsToRead = (uint)blockstoread;
|
blockMap.SectorsToRead = (uint)blockstoread;
|
||||||
blocksToRead = blockstoread;
|
blocksToRead = blockstoread;
|
||||||
|
lineChart.MinX = 0;
|
||||||
|
lineChart.MinY = 0;
|
||||||
|
switch(currentProfile)
|
||||||
|
{
|
||||||
|
case 0x0005: // CD and DDCD
|
||||||
|
case 0x0008:
|
||||||
|
case 0x0009:
|
||||||
|
case 0x000A:
|
||||||
|
case 0x0020:
|
||||||
|
case 0x0021:
|
||||||
|
case 0x0022:
|
||||||
|
if(blocks <= 360000) lineChart.MaxX = 360000;
|
||||||
|
else if(blocks <= 405000) lineChart.MaxX = 405000;
|
||||||
|
else if(blocks <= 445500) lineChart.MaxX = 445500;
|
||||||
|
else lineChart.MaxX = blocks;
|
||||||
|
lineChart.StepsX = lineChart.MaxX / 10f;
|
||||||
|
lineChart.StepsY = 150 * 4;
|
||||||
|
lineChart.MaxY = lineChart.StepsY * 13.5f;
|
||||||
|
break;
|
||||||
|
case 0x0010: // DVD SL
|
||||||
|
case 0x0011:
|
||||||
|
case 0x0012:
|
||||||
|
case 0x0013:
|
||||||
|
case 0x0014:
|
||||||
|
case 0x0018:
|
||||||
|
case 0x001A:
|
||||||
|
case 0x001B:
|
||||||
|
lineChart.MaxX = 2298496;
|
||||||
|
lineChart.StepsX = lineChart.MaxX / 10f;
|
||||||
|
lineChart.StepsY = 1352.5f;
|
||||||
|
lineChart.MaxY = lineChart.StepsY * 30;
|
||||||
|
break;
|
||||||
|
case 0x0015: // DVD DL
|
||||||
|
case 0x0016:
|
||||||
|
case 0x0017:
|
||||||
|
case 0x002A:
|
||||||
|
case 0x002B:
|
||||||
|
lineChart.MaxX = 4173824;
|
||||||
|
lineChart.StepsX = lineChart.MaxX / 10f;
|
||||||
|
lineChart.StepsY = 1352.5f;
|
||||||
|
lineChart.MaxY = lineChart.StepsY * 30;
|
||||||
|
break;
|
||||||
|
case 0x0041:
|
||||||
|
case 0x0042:
|
||||||
|
case 0x0043:
|
||||||
|
case 0x0040: // BD
|
||||||
|
if(blocks <= 12219392) lineChart.MaxX = 12219392;
|
||||||
|
else if(blocks <= 24438784) lineChart.MaxX = 24438784;
|
||||||
|
else if(blocks <= 48878592) lineChart.MaxX = 48878592;
|
||||||
|
else if(blocks <= 62500864) lineChart.MaxX = 62500864;
|
||||||
|
else lineChart.MaxX = blocks;
|
||||||
|
lineChart.StepsX = lineChart.MaxX / 10f;
|
||||||
|
lineChart.StepsY = 4394.5f;
|
||||||
|
lineChart.MaxY = lineChart.StepsY * 20;
|
||||||
|
break;
|
||||||
|
case 0x0050: // HD DVD
|
||||||
|
case 0x0051:
|
||||||
|
case 0x0052:
|
||||||
|
case 0x0053:
|
||||||
|
case 0x0058:
|
||||||
|
case 0x005A:
|
||||||
|
if(blocks <= 7361599) lineChart.MaxX = 7361599;
|
||||||
|
else if(blocks <= 16305407) lineChart.MaxX = 16305407;
|
||||||
|
else lineChart.MaxX = blocks;
|
||||||
|
lineChart.StepsX = lineChart.MaxX / 10f;
|
||||||
|
lineChart.StepsY = 4394.5f;
|
||||||
|
lineChart.MaxY = lineChart.StepsY * 20;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
lineChart.MaxX = blocks;
|
||||||
|
lineChart.StepsX = lineChart.MaxX / 10f;
|
||||||
|
lineChart.StepsY = 625f;
|
||||||
|
lineChart.MaxY = lineChart.StepsY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,6 +415,7 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
ProgressBar prgProgress2;
|
ProgressBar prgProgress2;
|
||||||
TabControl tabResults;
|
TabControl tabResults;
|
||||||
BlockMap blockMap;
|
BlockMap blockMap;
|
||||||
|
LineChart lineChart;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user