Added resume parameter passing.

This commit is contained in:
2017-06-08 20:21:50 +01:00
parent 82252f1135
commit b135a3f7d1
11 changed files with 52 additions and 19 deletions

View File

@@ -53,7 +53,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
public class ATA public class ATA
{ {
public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError) public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume)
{ {
bool aborted; bool aborted;
MHDDLog mhddLog; MHDDLog mhddLog;

View File

@@ -50,7 +50,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
internal class CompactDisc internal class CompactDisc
{ {
internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool separateSubchannel) internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool separateSubchannel, ref Metadata.Resume resume)
{ {
MHDDLog mhddLog; MHDDLog mhddLog;
IBGLog ibgLog; IBGLog ibgLog;

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
internal static class MMC internal static class MMC
{ {
internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool separateSubchannel) internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool separateSubchannel, ref Metadata.Resume resume)
{ {
byte[] cmdBuf = null; byte[] cmdBuf = null;
byte[] senseBuf = null; byte[] senseBuf = null;
@@ -163,7 +163,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(compactDisc) if(compactDisc)
{ {
CompactDisc.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, separateSubchannel); CompactDisc.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, separateSubchannel, ref resume);
return; return;
} }
@@ -579,11 +579,11 @@ namespace DiscImageChef.Core.Devices.Dumping
if(isXbox) if(isXbox)
{ {
XGD.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType); XGD.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, ref resume);
return; return;
} }
SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, true); SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, true, ref resume);
} }
} }
} }

View File

@@ -42,7 +42,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
public static class NVMe public static class NVMe
{ {
public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError) public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume)
{ {
throw new NotImplementedException("NVMe devices not yet supported."); throw new NotImplementedException("NVMe devices not yet supported.");
} }

View File

@@ -52,7 +52,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
internal static class SBC internal static class SBC
{ {
internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool opticalDisc) internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, bool opticalDisc, ref Metadata.Resume resume)
{ {
MHDDLog mhddLog; MHDDLog mhddLog;
IBGLog ibgLog; IBGLog ibgLog;

View File

@@ -47,7 +47,7 @@ namespace DiscImageChef.Core.Devices.Dumping
public class SCSI public class SCSI
{ {
// TODO: Get cartridge serial number from Certance vendor EVPD // TODO: Get cartridge serial number from Certance vendor EVPD
public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, bool separateSubchannel) public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, bool separateSubchannel, ref Metadata.Resume resume)
{ {
byte[] senseBuf = null; byte[] senseBuf = null;
bool sense = false; bool sense = false;
@@ -135,7 +135,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dumpRaw) if(dumpRaw)
throw new ArgumentException("Tapes cannot be dumped raw."); throw new ArgumentException("Tapes cannot be dumped raw.");
SSC.Dump(dev, outputPrefix, devicePath, ref sidecar); SSC.Dump(dev, outputPrefix, devicePath, ref sidecar, ref resume);
return; return;
} }
@@ -145,7 +145,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{ {
MMC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, separateSubchannel); MMC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, separateSubchannel, ref resume);
DicConsole.WriteLine("Writing metadata sidecar"); DicConsole.WriteLine("Writing metadata sidecar");
@@ -155,7 +155,7 @@ namespace DiscImageChef.Core.Devices.Dumping
return; return;
} }
SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, false); SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar, ref dskType, false, ref resume);
DicConsole.WriteLine("Writing metadata sidecar"); DicConsole.WriteLine("Writing metadata sidecar");

View File

@@ -48,7 +48,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
internal static class SSC internal static class SSC
{ {
internal static void Dump(Device dev, string outputPrefix, string devicePath, ref CICMMetadataType sidecar) internal static void Dump(Device dev, string outputPrefix, string devicePath, ref CICMMetadataType sidecar, ref Metadata.Resume resume)
{ {
Decoders.SCSI.FixedSense? fxSense; Decoders.SCSI.FixedSense? fxSense;
string strSense; string strSense;

View File

@@ -42,7 +42,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
public class SecureDigital public class SecureDigital
{ {
public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError) public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume)
{ {
throw new NotImplementedException("MMC/SD devices not yet supported."); throw new NotImplementedException("MMC/SD devices not yet supported.");
} }

View File

@@ -52,7 +52,7 @@ namespace DiscImageChef.Core.Devices.Dumping
{ {
internal static class XGD internal static class XGD
{ {
internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType) internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar, ref MediaType dskType, ref Metadata.Resume resume)
{ {
MHDDLog mhddLog; MHDDLog mhddLog;
IBGLog ibgLog; IBGLog ibgLog;

View File

@@ -1,3 +1,6 @@
* Commands/DumpMedia.cs:
Added resume parameter passing.
* Options.cs: * Options.cs:
* Commands/DumpMedia.cs: * Commands/DumpMedia.cs:
Added support for dumping subchannel in a separate file. Added support for dumping subchannel in a separate file.

View File

@@ -45,6 +45,8 @@ using DiscImageChef.Filters;
using DiscImageChef.ImagePlugins; using DiscImageChef.ImagePlugins;
using DiscImageChef.PartPlugins; using DiscImageChef.PartPlugins;
using Schemas; using Schemas;
using DiscImageChef.Metadata;
using System.Xml.Serialization;
namespace DiscImageChef.Commands namespace DiscImageChef.Commands
{ {
@@ -87,26 +89,54 @@ namespace DiscImageChef.Commands
Core.Statistics.AddDevice(dev); Core.Statistics.AddDevice(dev);
Resume resume = null;
XmlSerializer xs = new XmlSerializer(resume.GetType());
if(File.Exists(options.OutputPrefix + ".resume.xml"))
{
try
{
StreamReader sr = new StreamReader(options.OutputPrefix + ".resume.xml");
resume = (Resume)xs.Deserialize(sr);
sr.Close();
}
catch
{
DicConsole.ErrorWriteLine("Incorrect resume file, not continuing...");
return;
}
}
switch(dev.Type) switch(dev.Type)
{ {
case DeviceType.ATA: case DeviceType.ATA:
ATA.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError); ATA.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, ref resume);
break; break;
case DeviceType.MMC: case DeviceType.MMC:
case DeviceType.SecureDigital: case DeviceType.SecureDigital:
SecureDigital.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError); SecureDigital.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, ref resume);
break; break;
case DeviceType.NVMe: case DeviceType.NVMe:
NVMe.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError); NVMe.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, ref resume);
break; break;
case DeviceType.ATAPI: case DeviceType.ATAPI:
case DeviceType.SCSI: case DeviceType.SCSI:
SCSI.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, options.SeparateSubchannel); SCSI.Dump(dev, options.DevicePath, options.OutputPrefix, options.RetryPasses, options.Force, options.Raw, options.Persistent, options.StopOnError, options.SeparateSubchannel, ref resume);
break; break;
default: default:
throw new NotSupportedException("Unknown device type."); throw new NotSupportedException("Unknown device type.");
} }
if(resume != null)
{
if(File.Exists(options.OutputPrefix + ".resume.xml"))
File.Delete(options.OutputPrefix + ".resume.xml");
FileStream fs = new FileStream(options.OutputPrefix + ".resume.xml", FileMode.Create, FileAccess.ReadWrite);
xs = new XmlSerializer(resume.GetType());
xs.Serialize(fs, resume);
fs.Close();
}
Core.Statistics.AddCommand("dump-media"); Core.Statistics.AddCommand("dump-media");
} }
} }