Create dump class.

This commit is contained in:
2019-04-19 17:00:46 +01:00
parent 01165a7753
commit b0426c4335
3 changed files with 21 additions and 20 deletions

View File

@@ -55,7 +55,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <summary> /// <summary>
/// Implements dumping ATA devices /// Implements dumping ATA devices
/// </summary> /// </summary>
public static class Ata public partial class Dump
{ {
/// <summary> /// <summary>
/// Dumps an ATA device /// Dumps an ATA device
@@ -75,15 +75,14 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <param name="outputPath">Path to output file</param> /// <param name="outputPath">Path to output file</param>
/// <param name="formatOptions">Formats to pass to output file plugin</param> /// <param name="formatOptions">Formats to pass to output file plugin</param>
/// <exception cref="InvalidOperationException">If the resume file is invalid</exception> /// <exception cref="InvalidOperationException">If the resume file is invalid</exception>
public static void Dump(Device dev, string devicePath, public void Ata(Device dev, string devicePath,
IWritableImage outputPlugin, ushort retryPasses, IWritableImage outputPlugin, ushort retryPasses, bool force,
bool force, bool dumpRaw, bool dumpRaw, bool persistent,
bool persistent, bool stopOnError, ref Resume resume, bool stopOnError, ref Resume resume, ref DumpLog dumpLog,
ref DumpLog dumpLog, Encoding encoding, Encoding encoding, string outputPrefix,
string outputPrefix, string outputPath, string outputPath,
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar, Dictionary<string, string> formatOptions, CICMMetadataType preSidecar, uint skip,
uint skip, bool nometadata, bool notrim)
bool nometadata, bool notrim)
{ {
bool aborted; bool aborted;

View File

@@ -50,7 +50,6 @@ using DiscImageChef.Devices;
using Eto.Forms; using Eto.Forms;
using Eto.Serialization.Xaml; using Eto.Serialization.Xaml;
using Schemas; using Schemas;
using Ata = DiscImageChef.Core.Devices.Dumping.Ata;
using DeviceInfo = DiscImageChef.Core.Devices.Info.DeviceInfo; using DeviceInfo = DiscImageChef.Core.Devices.Info.DeviceInfo;
using MediaType = DiscImageChef.CommonTypes.MediaType; using MediaType = DiscImageChef.CommonTypes.MediaType;
using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi; using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi;
@@ -447,14 +446,16 @@ namespace DiscImageChef.Gui.Forms
parsedOptions.Add(key, value); parsedOptions.Add(key, value);
} }
Dump dumper = new Dump();
switch(dev.Type) switch(dev.Type)
{ {
case DeviceType.ATA: case DeviceType.ATA:
Ata.Dump(dev, devicePath, outputFormat, (ushort)stpRetries.Value, chkForce.Checked == true, dumper.Ata(dev, devicePath, outputFormat, (ushort)stpRetries.Value, chkForce.Checked == true,
false, /*options.Raw,*/ false, /*options.Raw,*/
chkPersistent.Checked == true, chkStopOnError.Checked == true, ref resume, ref dumpLog, chkPersistent.Checked == true, chkStopOnError.Checked == true, ref resume, ref dumpLog,
encoding, outputPrefix, txtDestination.Text, parsedOptions, sidecar, encoding, outputPrefix, txtDestination.Text, parsedOptions, sidecar,
(uint)stpSkipped.Value, chkExistingMetadata.Checked == false, chkTrim.Checked == false); (uint)stpSkipped.Value, chkExistingMetadata.Checked == false, chkTrim.Checked == false);
break; break;
case DeviceType.MMC: case DeviceType.MMC:
case DeviceType.SecureDigital: case DeviceType.SecureDigital:

View File

@@ -48,7 +48,6 @@ using DiscImageChef.Core.Logging;
using DiscImageChef.Devices; using DiscImageChef.Devices;
using Mono.Options; using Mono.Options;
using Schemas; using Schemas;
using Ata = DiscImageChef.Core.Devices.Dumping.Ata;
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID; using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi; using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi;
@@ -296,6 +295,8 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Output image format: {0}.", outputFormat.Name); DicConsole.WriteLine("Output image format: {0}.", outputFormat.Name);
} }
Dump dumper = new Dump();
if(dev.IsUsb && dev.UsbVendorId == 0x054C && if(dev.IsUsb && dev.UsbVendorId == 0x054C &&
(dev.UsbProductId == 0x01C8 || dev.UsbProductId == 0x01C9 || dev.UsbProductId == 0x02D2)) (dev.UsbProductId == 0x01C8 || dev.UsbProductId == 0x01C9 || dev.UsbProductId == 0x02D2))
PlayStationPortable.Dump(dev, devicePath, outputFormat, retryPasses, force, persistent, stopOnError, PlayStationPortable.Dump(dev, devicePath, outputFormat, retryPasses, force, persistent, stopOnError,
@@ -305,9 +306,9 @@ namespace DiscImageChef.Commands
switch(dev.Type) switch(dev.Type)
{ {
case DeviceType.ATA: case DeviceType.ATA:
Ata.Dump(dev, devicePath, outputFormat, retryPasses, force, false, /*raw,*/ dumper.Ata(dev, devicePath, outputFormat, retryPasses, force, false, /*raw,*/
persistent, stopOnError, ref resume, ref dumpLog, encoding, outputPrefix, outputFile, persistent, stopOnError, ref resume, ref dumpLog, encoding, outputPrefix, outputFile,
parsedOptions, sidecar, (uint)skip, noMetadata, noTrim); parsedOptions, sidecar, (uint)skip, noMetadata, noTrim);
break; break;
case DeviceType.MMC: case DeviceType.MMC:
case DeviceType.SecureDigital: case DeviceType.SecureDigital: