mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added resume parameter passing.
This commit is contained in:
@@ -53,7 +53,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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;
|
||||
MHDDLog mhddLog;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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;
|
||||
IBGLog ibgLog;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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[] senseBuf = null;
|
||||
@@ -163,7 +163,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -579,11 +579,11 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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;
|
||||
IBGLog ibgLog;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
public class SCSI
|
||||
{
|
||||
// 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;
|
||||
bool sense = false;
|
||||
@@ -135,7 +135,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(dumpRaw)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
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");
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
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");
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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;
|
||||
string strSense;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
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;
|
||||
IBGLog ibgLog;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
* Commands/DumpMedia.cs:
|
||||
Added resume parameter passing.
|
||||
|
||||
* Options.cs:
|
||||
* Commands/DumpMedia.cs:
|
||||
Added support for dumping subchannel in a separate file.
|
||||
|
||||
@@ -45,6 +45,8 @@ using DiscImageChef.Filters;
|
||||
using DiscImageChef.ImagePlugins;
|
||||
using DiscImageChef.PartPlugins;
|
||||
using Schemas;
|
||||
using DiscImageChef.Metadata;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
{
|
||||
@@ -87,26 +89,54 @@ namespace DiscImageChef.Commands
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
case DeviceType.MMC:
|
||||
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;
|
||||
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;
|
||||
case DeviceType.ATAPI:
|
||||
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;
|
||||
default:
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user