From b0426c43357467a627b8acdf91bb9215961c843c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 19 Apr 2019 17:00:46 +0100 Subject: [PATCH] Create dump class. --- DiscImageChef.Core/Devices/Dumping/ATA.cs | 19 +++++++++---------- DiscImageChef.Gui/Forms/frmDump.xeto.cs | 13 +++++++------ DiscImageChef/Commands/DumpMedia.cs | 9 +++++---- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/DiscImageChef.Core/Devices/Dumping/ATA.cs b/DiscImageChef.Core/Devices/Dumping/ATA.cs index 3115a5c8d..1f0bb20b4 100644 --- a/DiscImageChef.Core/Devices/Dumping/ATA.cs +++ b/DiscImageChef.Core/Devices/Dumping/ATA.cs @@ -55,7 +55,7 @@ namespace DiscImageChef.Core.Devices.Dumping /// /// Implements dumping ATA devices /// - public static class Ata + public partial class Dump { /// /// Dumps an ATA device @@ -75,15 +75,14 @@ namespace DiscImageChef.Core.Devices.Dumping /// Path to output file /// Formats to pass to output file plugin /// If the resume file is invalid - public static void Dump(Device dev, string devicePath, - IWritableImage outputPlugin, ushort retryPasses, - bool force, bool dumpRaw, - bool persistent, bool stopOnError, ref Resume resume, - ref DumpLog dumpLog, Encoding encoding, - string outputPrefix, string outputPath, - Dictionary formatOptions, CICMMetadataType preSidecar, - uint skip, - bool nometadata, bool notrim) + public void Ata(Device dev, string devicePath, + IWritableImage outputPlugin, ushort retryPasses, bool force, + bool dumpRaw, bool persistent, + bool stopOnError, ref Resume resume, ref DumpLog dumpLog, + Encoding encoding, string outputPrefix, + string outputPath, + Dictionary formatOptions, CICMMetadataType preSidecar, uint skip, + bool nometadata, bool notrim) { bool aborted; diff --git a/DiscImageChef.Gui/Forms/frmDump.xeto.cs b/DiscImageChef.Gui/Forms/frmDump.xeto.cs index 15badeb3a..b4d1d7546 100644 --- a/DiscImageChef.Gui/Forms/frmDump.xeto.cs +++ b/DiscImageChef.Gui/Forms/frmDump.xeto.cs @@ -50,7 +50,6 @@ using DiscImageChef.Devices; using Eto.Forms; using Eto.Serialization.Xaml; using Schemas; -using Ata = DiscImageChef.Core.Devices.Dumping.Ata; using DeviceInfo = DiscImageChef.Core.Devices.Info.DeviceInfo; using MediaType = DiscImageChef.CommonTypes.MediaType; using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi; @@ -447,14 +446,16 @@ namespace DiscImageChef.Gui.Forms parsedOptions.Add(key, value); } + Dump dumper = new Dump(); + switch(dev.Type) { case DeviceType.ATA: - Ata.Dump(dev, devicePath, outputFormat, (ushort)stpRetries.Value, chkForce.Checked == true, - false, /*options.Raw,*/ - chkPersistent.Checked == true, chkStopOnError.Checked == true, ref resume, ref dumpLog, - encoding, outputPrefix, txtDestination.Text, parsedOptions, sidecar, - (uint)stpSkipped.Value, chkExistingMetadata.Checked == false, chkTrim.Checked == false); + dumper.Ata(dev, devicePath, outputFormat, (ushort)stpRetries.Value, chkForce.Checked == true, + false, /*options.Raw,*/ + chkPersistent.Checked == true, chkStopOnError.Checked == true, ref resume, ref dumpLog, + encoding, outputPrefix, txtDestination.Text, parsedOptions, sidecar, + (uint)stpSkipped.Value, chkExistingMetadata.Checked == false, chkTrim.Checked == false); break; case DeviceType.MMC: case DeviceType.SecureDigital: diff --git a/DiscImageChef/Commands/DumpMedia.cs b/DiscImageChef/Commands/DumpMedia.cs index 82a790e91..35aace857 100644 --- a/DiscImageChef/Commands/DumpMedia.cs +++ b/DiscImageChef/Commands/DumpMedia.cs @@ -48,7 +48,6 @@ using DiscImageChef.Core.Logging; using DiscImageChef.Devices; using Mono.Options; using Schemas; -using Ata = DiscImageChef.Core.Devices.Dumping.Ata; using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID; using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi; @@ -296,6 +295,8 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Output image format: {0}.", outputFormat.Name); } + Dump dumper = new Dump(); + if(dev.IsUsb && dev.UsbVendorId == 0x054C && (dev.UsbProductId == 0x01C8 || dev.UsbProductId == 0x01C9 || dev.UsbProductId == 0x02D2)) PlayStationPortable.Dump(dev, devicePath, outputFormat, retryPasses, force, persistent, stopOnError, @@ -305,9 +306,9 @@ namespace DiscImageChef.Commands switch(dev.Type) { case DeviceType.ATA: - Ata.Dump(dev, devicePath, outputFormat, retryPasses, force, false, /*raw,*/ - persistent, stopOnError, ref resume, ref dumpLog, encoding, outputPrefix, outputFile, - parsedOptions, sidecar, (uint)skip, noMetadata, noTrim); + dumper.Ata(dev, devicePath, outputFormat, retryPasses, force, false, /*raw,*/ + persistent, stopOnError, ref resume, ref dumpLog, encoding, outputPrefix, outputFile, + parsedOptions, sidecar, (uint)skip, noMetadata, noTrim); break; case DeviceType.MMC: case DeviceType.SecureDigital: