Files
Aaru/Aaru.Core/Devices/Scanning/MediaScan.cs

61 lines
2.5 KiB
C#
Raw Normal View History

2019-04-21 00:11:27 +01:00
using System;
2020-02-27 00:33:26 +00:00
using Aaru.CommonTypes.Enums;
using Aaru.Devices;
2019-04-21 00:11:27 +01:00
2020-02-27 00:33:26 +00:00
namespace Aaru.Core.Devices.Scanning
2019-04-21 00:11:27 +01:00
{
public partial class MediaScan
{
readonly Device dev;
readonly string devicePath;
readonly string ibgLogPath;
readonly string mhddLogPath;
2019-04-21 00:59:01 +01:00
bool aborted;
2019-04-21 00:11:27 +01:00
/// <param name="mhddLogPath">Path to a MHDD log file</param>
/// <param name="ibgLogPath">Path to a IMGBurn log file</param>
/// <param name="devicePath">Device path</param>
/// <param name="dev">Device</param>
public MediaScan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
{
this.mhddLogPath = mhddLogPath;
this.ibgLogPath = ibgLogPath;
this.devicePath = devicePath;
this.dev = dev;
2019-04-21 00:59:01 +01:00
aborted = false;
2019-04-21 00:11:27 +01:00
}
public ScanResults Scan()
{
switch(dev.Type)
{
case DeviceType.ATA: return Ata();
case DeviceType.MMC:
case DeviceType.SecureDigital: return SecureDigital();
case DeviceType.NVMe: return Nvme();
case DeviceType.ATAPI:
case DeviceType.SCSI: return Scsi();
default: throw new NotSupportedException("Unknown device type.");
}
}
2020-02-29 18:03:35 +00:00
public void Abort() => aborted = true;
2019-04-21 00:59:01 +01:00
2020-02-29 18:03:35 +00:00
/// <summary>Event raised when the progress bar is not longer needed</summary>
public event EndProgressHandler EndProgress;
2020-02-29 18:03:35 +00:00
/// <summary>Event raised when a progress bar is needed</summary>
public event InitProgressHandler InitProgress;
2020-02-29 18:03:35 +00:00
/// <summary>Event raised to report status updates</summary>
public event UpdateStatusHandler UpdateStatus;
2020-02-29 18:03:35 +00:00
/// <summary>Event raised to report a fatal error that stops the dumping operation and should call user's attention</summary>
public event ErrorMessageHandler StoppingErrorMessage;
2020-02-29 18:03:35 +00:00
/// <summary>Event raised to update the values of a determinate progress bar</summary>
public event UpdateProgressHandler UpdateProgress;
2020-02-29 18:03:35 +00:00
/// <summary>Event raised to update the status of an undeterminate progress bar</summary>
public event PulseProgressHandler PulseProgress;
public event ScanTimeHandler ScanTime;
public event ScanUnreadableHandler ScanUnreadable;
public event InitBlockMapHandler InitBlockMap;
public event ScanSpeedHandler ScanSpeed;
2019-04-21 00:11:27 +01:00
}
}