mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move common dumper fields to Dump class.
This commit is contained in:
@@ -34,19 +34,15 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.CommonTypes.Enums;
|
using DiscImageChef.CommonTypes.Enums;
|
||||||
using DiscImageChef.CommonTypes.Extents;
|
using DiscImageChef.CommonTypes.Extents;
|
||||||
using DiscImageChef.CommonTypes.Interfaces;
|
using DiscImageChef.CommonTypes.Interfaces;
|
||||||
using DiscImageChef.CommonTypes.Metadata;
|
|
||||||
using DiscImageChef.Core.Logging;
|
using DiscImageChef.Core.Logging;
|
||||||
using DiscImageChef.Decoders.ATA;
|
using DiscImageChef.Decoders.ATA;
|
||||||
using DiscImageChef.Decoders.PCMCIA;
|
using DiscImageChef.Decoders.PCMCIA;
|
||||||
using DiscImageChef.Devices;
|
|
||||||
using Schemas;
|
using Schemas;
|
||||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
|
||||||
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
|
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
|
||||||
|
|
||||||
namespace DiscImageChef.Core.Devices.Dumping
|
namespace DiscImageChef.Core.Devices.Dumping
|
||||||
@@ -59,29 +55,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dumps an ATA device
|
/// Dumps an ATA device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dev">Device</param>
|
|
||||||
/// <param name="devicePath">Path to the device</param>
|
|
||||||
/// <param name="outputPrefix">Prefix for output log files</param>
|
|
||||||
/// <param name="outputPlugin">Plugin for output file</param>
|
|
||||||
/// <param name="retryPasses">How many times to retry</param>
|
|
||||||
/// <param name="force">Force to continue dump whenever possible</param>
|
|
||||||
/// <param name="dumpRaw">Dump long sectors</param>
|
|
||||||
/// <param name="persistent">Store whatever data the drive returned on error</param>
|
|
||||||
/// <param name="stopOnError">Stop dump on first error</param>
|
|
||||||
/// <param name="resume">Information for dump resuming</param>
|
|
||||||
/// <param name="dumpLog">Dump logger</param>
|
|
||||||
/// <param name="encoding">Encoding to use when analyzing dump</param>
|
|
||||||
/// <param name="outputPath">Path to output file</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 void Ata(Device dev, string devicePath,
|
public void Ata()
|
||||||
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<string, string> formatOptions, CICMMetadataType preSidecar, uint skip,
|
|
||||||
bool nometadata, bool notrim)
|
|
||||||
{
|
{
|
||||||
bool aborted;
|
bool aborted;
|
||||||
|
|
||||||
|
|||||||
@@ -66,36 +66,11 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dumps a compact disc
|
/// Dumps a compact disc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dev">Device</param>
|
|
||||||
/// <param name="devicePath">Path to the device</param>
|
|
||||||
/// <param name="outputPrefix">Prefix for output data files</param>
|
|
||||||
/// <param name="outputPlugin">Plugin for output file</param>
|
|
||||||
/// <param name="retryPasses">How many times to retry</param>
|
|
||||||
/// <param name="force">Force to continue dump whenever possible</param>
|
|
||||||
/// <param name="dumpRaw">Dump scrambled sectors</param>
|
|
||||||
/// <param name="persistent">Store whatever data the drive returned on error</param>
|
|
||||||
/// <param name="stopOnError">Stop dump on first error</param>
|
|
||||||
/// <param name="resume">Information for dump resuming</param>
|
|
||||||
/// <param name="dumpLog">Dump logger</param>
|
|
||||||
/// <param name="dskType">Disc type as detected in MMC layer</param>
|
/// <param name="dskType">Disc type as detected in MMC layer</param>
|
||||||
/// <param name="dumpFirstTrackPregap">Try to read and dump as much first track pregap as possible</param>
|
|
||||||
/// <param name="outputPath">Path to output file</param>
|
|
||||||
/// <param name="formatOptions">Formats to pass to output file plugin</param>
|
|
||||||
/// <param name="encoding">Encoding to use when analyzing dump</param>
|
|
||||||
/// <exception cref="NotImplementedException">If trying to dump scrambled sectors</exception>
|
/// <exception cref="NotImplementedException">If trying to dump scrambled sectors</exception>
|
||||||
/// <exception cref="InvalidOperationException">If the resume file is invalid</exception>
|
/// <exception cref="InvalidOperationException">If the resume file is invalid</exception>
|
||||||
/// <exception cref="ArgumentOutOfRangeException">If the track type is unknown (never)</exception>
|
/// <exception cref="ArgumentOutOfRangeException">If the track type is unknown (never)</exception>
|
||||||
internal void CompactDisc(Device dev, string devicePath,
|
internal void CompactDisc(ref MediaType dskType, bool dumpFirstTrackPregap)
|
||||||
IWritableOpticalImage outputPlugin, ushort retryPasses,
|
|
||||||
bool force, bool dumpRaw,
|
|
||||||
bool persistent, bool stopOnError,
|
|
||||||
ref MediaType dskType,
|
|
||||||
ref Resume resume, ref DumpLog dumpLog,
|
|
||||||
bool dumpFirstTrackPregap, Encoding encoding,
|
|
||||||
string outputPrefix, string outputPath,
|
|
||||||
Dictionary<string, string> formatOptions,
|
|
||||||
CICMMetadataType preSidecar, uint skip,
|
|
||||||
bool nometadata, bool notrim)
|
|
||||||
{
|
{
|
||||||
uint subSize;
|
uint subSize;
|
||||||
DateTime start;
|
DateTime start;
|
||||||
@@ -1002,7 +977,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send tracklist to output plugin. This may fail if subchannel is set but unsupported.
|
// Send tracklist to output plugin. This may fail if subchannel is set but unsupported.
|
||||||
ret = outputPlugin.SetTracks(tracks.ToList());
|
ret = (outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
if(!ret && supportedSubchannel == MmcSubchannel.None)
|
if(!ret && supportedSubchannel == MmcSubchannel.None)
|
||||||
{
|
{
|
||||||
dumpLog.WriteLine("Error sending tracks to output image, not continuing.");
|
dumpLog.WriteLine("Error sending tracks to output image, not continuing.");
|
||||||
@@ -1048,7 +1023,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
subSize = 0;
|
subSize = 0;
|
||||||
blockSize = SECTOR_SIZE + subSize;
|
blockSize = SECTOR_SIZE + subSize;
|
||||||
for(int t = 0; t < tracks.Length; t++) tracks[t].TrackSubchannelType = TrackSubchannelType.None;
|
for(int t = 0; t < tracks.Length; t++) tracks[t].TrackSubchannelType = TrackSubchannelType.None;
|
||||||
ret = outputPlugin.SetTracks(tracks.ToList());
|
ret = (outputPlugin as IWritableOpticalImage).SetTracks(tracks.ToList());
|
||||||
if(!ret)
|
if(!ret)
|
||||||
{
|
{
|
||||||
dumpLog.WriteLine("Error sending tracks to output image, not continuing.");
|
dumpLog.WriteLine("Error sending tracks to output image, not continuing.");
|
||||||
|
|||||||
@@ -1,7 +1,132 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using DiscImageChef.CommonTypes.Enums;
|
||||||
|
using DiscImageChef.CommonTypes.Interfaces;
|
||||||
|
using DiscImageChef.CommonTypes.Metadata;
|
||||||
|
using DiscImageChef.Core.Logging;
|
||||||
|
using DiscImageChef.Devices;
|
||||||
|
using Schemas;
|
||||||
|
|
||||||
namespace DiscImageChef.Core.Devices.Dumping
|
namespace DiscImageChef.Core.Devices.Dumping
|
||||||
{
|
{
|
||||||
public partial class Dump
|
public partial class Dump
|
||||||
{
|
{
|
||||||
|
readonly Device dev;
|
||||||
|
readonly string devicePath;
|
||||||
|
|
||||||
|
readonly bool doResume;
|
||||||
|
readonly bool dumpFirstTrackPregap;
|
||||||
|
readonly DumpLog dumpLog;
|
||||||
|
readonly bool dumpRaw;
|
||||||
|
readonly Encoding encoding;
|
||||||
|
readonly bool force;
|
||||||
|
readonly Dictionary<string, string> formatOptions;
|
||||||
|
readonly bool nometadata;
|
||||||
|
readonly bool notrim;
|
||||||
|
readonly string outputPath;
|
||||||
|
readonly IWritableImage outputPlugin;
|
||||||
|
readonly string outputPrefix;
|
||||||
|
readonly bool persistent;
|
||||||
|
readonly CICMMetadataType preSidecar;
|
||||||
|
readonly ushort retryPasses;
|
||||||
|
readonly bool stopOnError;
|
||||||
|
Resume resume;
|
||||||
|
uint skip;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dev">Device</param>
|
||||||
|
/// <param name="devicePath">Path to the device</param>
|
||||||
|
/// <param name="outputPrefix">Prefix for output log files</param>
|
||||||
|
/// <param name="outputPlugin">Plugin for output file</param>
|
||||||
|
/// <param name="retryPasses">How many times to retry</param>
|
||||||
|
/// <param name="force">Force to continue dump whenever possible</param>
|
||||||
|
/// <param name="dumpRaw">Dump long sectors</param>
|
||||||
|
/// <param name="persistent">Store whatever data the drive returned on error</param>
|
||||||
|
/// <param name="stopOnError">Stop dump on first error</param>
|
||||||
|
/// <param name="resume">Information for dump resuming</param>
|
||||||
|
/// <param name="dumpLog">Dump logger</param>
|
||||||
|
/// <param name="encoding">Encoding to use when analyzing dump</param>
|
||||||
|
/// <param name="outputPath">Path to output file</param>
|
||||||
|
/// <param name="formatOptions">Formats to pass to output file plugin</param>
|
||||||
|
/// <param name="dumpFirstTrackPregap">Try to read and dump as much first track pregap as possible</param>
|
||||||
|
public Dump(bool doResume, Device dev, string devicePath,
|
||||||
|
IWritableImage outputPlugin, ushort retryPasses,
|
||||||
|
bool force, bool dumpRaw, bool persistent,
|
||||||
|
bool stopOnError, Resume resume, DumpLog dumpLog,
|
||||||
|
Encoding encoding, string outputPrefix, string outputPath,
|
||||||
|
Dictionary<string, string> formatOptions,
|
||||||
|
CICMMetadataType preSidecar, uint skip, bool nometadata,
|
||||||
|
bool notrim, bool dumpFirstTrackPregap)
|
||||||
|
{
|
||||||
|
this.doResume = doResume;
|
||||||
|
this.dev = dev;
|
||||||
|
this.devicePath = devicePath;
|
||||||
|
this.outputPlugin = outputPlugin;
|
||||||
|
this.retryPasses = retryPasses;
|
||||||
|
this.force = force;
|
||||||
|
this.dumpRaw = dumpRaw;
|
||||||
|
this.persistent = persistent;
|
||||||
|
this.stopOnError = stopOnError;
|
||||||
|
this.resume = resume;
|
||||||
|
this.dumpLog = dumpLog;
|
||||||
|
this.encoding = encoding;
|
||||||
|
this.outputPrefix = outputPrefix;
|
||||||
|
this.outputPath = outputPath;
|
||||||
|
this.formatOptions = formatOptions;
|
||||||
|
this.preSidecar = preSidecar;
|
||||||
|
this.skip = skip;
|
||||||
|
this.nometadata = nometadata;
|
||||||
|
this.notrim = notrim;
|
||||||
|
this.dumpFirstTrackPregap = dumpFirstTrackPregap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
if(dev.IsUsb && dev.UsbVendorId == 0x054C &&
|
||||||
|
(dev.UsbProductId == 0x01C8 || dev.UsbProductId == 0x01C9 || dev.UsbProductId == 0x02D2))
|
||||||
|
PlayStationPortable();
|
||||||
|
else
|
||||||
|
switch(dev.Type)
|
||||||
|
{
|
||||||
|
case DeviceType.ATA:
|
||||||
|
Ata();
|
||||||
|
break;
|
||||||
|
case DeviceType.MMC:
|
||||||
|
case DeviceType.SecureDigital:
|
||||||
|
SecureDigital();
|
||||||
|
break;
|
||||||
|
case DeviceType.NVMe:
|
||||||
|
NVMe();
|
||||||
|
break;
|
||||||
|
case DeviceType.ATAPI:
|
||||||
|
case DeviceType.SCSI:
|
||||||
|
Scsi();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dumpLog.WriteLine("Unknown device type.");
|
||||||
|
dumpLog.Close();
|
||||||
|
throw new NotSupportedException("Unknown device type.");
|
||||||
|
}
|
||||||
|
|
||||||
|
dumpLog.Close();
|
||||||
|
|
||||||
|
if(resume == null || !doResume) return;
|
||||||
|
|
||||||
|
resume.LastWriteDate = DateTime.UtcNow;
|
||||||
|
resume.BadBlocks.Sort();
|
||||||
|
|
||||||
|
if(File.Exists(outputPrefix + ".resume.xml")) File.Delete(outputPrefix + ".resume.xml");
|
||||||
|
|
||||||
|
FileStream fs = new FileStream(outputPrefix + ".resume.xml", FileMode.Create, FileAccess.ReadWrite);
|
||||||
|
XmlSerializer xs = new XmlSerializer(resume.GetType());
|
||||||
|
xs.Serialize(fs, resume);
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
|
|
||||||
public event EndProgressHandler EndProgress;
|
public event EndProgressHandler EndProgress;
|
||||||
public event InitProgressHandler InitProgress;
|
public event InitProgressHandler InitProgress;
|
||||||
public event UpdateStatusHandler UpdateStatus;
|
public event UpdateStatusHandler UpdateStatus;
|
||||||
|
|||||||
@@ -32,12 +32,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.CommonTypes.Enums;
|
using DiscImageChef.CommonTypes.Enums;
|
||||||
using DiscImageChef.CommonTypes.Interfaces;
|
|
||||||
using DiscImageChef.CommonTypes.Metadata;
|
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
using DiscImageChef.Core.Logging;
|
|
||||||
using DiscImageChef.Decoders.Bluray;
|
using DiscImageChef.Decoders.Bluray;
|
||||||
using DiscImageChef.Decoders.DVD;
|
using DiscImageChef.Decoders.DVD;
|
||||||
using DiscImageChef.Decoders.SCSI;
|
using DiscImageChef.Decoders.SCSI;
|
||||||
@@ -46,7 +43,6 @@ using DiscImageChef.Devices;
|
|||||||
using Schemas;
|
using Schemas;
|
||||||
using DDS = DiscImageChef.Decoders.DVD.DDS;
|
using DDS = DiscImageChef.Decoders.DVD.DDS;
|
||||||
using DMI = DiscImageChef.Decoders.Xbox.DMI;
|
using DMI = DiscImageChef.Decoders.Xbox.DMI;
|
||||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
|
||||||
using Spare = DiscImageChef.Decoders.DVD.Spare;
|
using Spare = DiscImageChef.Decoders.DVD.Spare;
|
||||||
|
|
||||||
namespace DiscImageChef.Core.Devices.Dumping
|
namespace DiscImageChef.Core.Devices.Dumping
|
||||||
@@ -76,16 +72,7 @@ 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="NotImplementedException">If trying to dump GOD or WOD, or XGDs without a Kreon drive</exception>
|
/// <exception cref="NotImplementedException">If trying to dump GOD or WOD, or XGDs without a Kreon drive</exception>
|
||||||
internal void Mmc(Device dev, string devicePath,
|
internal void Mmc(ref MediaType dskType, bool dumpLeadIn)
|
||||||
IWritableOpticalImage outputPlugin, ushort retryPasses,
|
|
||||||
bool force, bool dumpRaw, bool persistent,
|
|
||||||
bool stopOnError, ref MediaType dskType,
|
|
||||||
ref Resume resume, ref DumpLog dumpLog, bool dumpLeadIn,
|
|
||||||
Encoding encoding,
|
|
||||||
string outputPrefix, string outputPath,
|
|
||||||
Dictionary<string, string> formatOptions,
|
|
||||||
CICMMetadataType preSidecar, uint skip, bool nometadata,
|
|
||||||
bool notrim)
|
|
||||||
{
|
{
|
||||||
bool sense;
|
bool sense;
|
||||||
byte[] tmpBuf;
|
byte[] tmpBuf;
|
||||||
@@ -197,10 +184,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
if(compactDisc)
|
if(compactDisc)
|
||||||
{
|
{
|
||||||
CompactDisc(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent,
|
CompactDisc(ref dskType, dumpLeadIn);
|
||||||
stopOnError,
|
|
||||||
ref dskType, ref resume, ref dumpLog, dumpLeadIn, encoding, outputPrefix, outputPath,
|
|
||||||
formatOptions, preSidecar, skip, nometadata, notrim);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,18 +584,11 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
if(isXbox)
|
if(isXbox)
|
||||||
{
|
{
|
||||||
Xgd(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent,
|
Xgd(mediaTags, ref dskType);
|
||||||
stopOnError, mediaTags,
|
|
||||||
ref dskType, ref resume, ref dumpLog, encoding, outputPrefix, outputPath, formatOptions,
|
|
||||||
preSidecar,
|
|
||||||
skip, nometadata, notrim);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sbc(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent, stopOnError,
|
Sbc(mediaTags, ref dskType, true);
|
||||||
mediaTags,
|
|
||||||
ref dskType, true, ref resume, ref dumpLog, encoding, outputPrefix, outputPath, formatOptions,
|
|
||||||
preSidecar, skip, nometadata, notrim);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void AddMediaTagToSidecar(string outputPath,
|
internal static void AddMediaTagToSidecar(string outputPath,
|
||||||
|
|||||||
@@ -31,13 +31,6 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using DiscImageChef.CommonTypes.Interfaces;
|
|
||||||
using DiscImageChef.CommonTypes.Metadata;
|
|
||||||
using DiscImageChef.Core.Logging;
|
|
||||||
using DiscImageChef.Devices;
|
|
||||||
using Schemas;
|
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
@@ -45,14 +38,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
{
|
{
|
||||||
public partial class Dump
|
public partial class Dump
|
||||||
{
|
{
|
||||||
public void NVMe(Device dev, string devicePath,
|
public void NVMe()
|
||||||
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<string, string> formatOptions, CICMMetadataType preSidecar, uint skip,
|
|
||||||
bool nometadata, bool notrim)
|
|
||||||
{
|
{
|
||||||
throw new NotImplementedException("NVMe devices not yet supported.");
|
throw new NotImplementedException("NVMe devices not yet supported.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,33 +29,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dumps a CFW PlayStation Portable UMD
|
/// Dumps a CFW PlayStation Portable UMD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dev">Device</param>
|
|
||||||
/// <param name="devicePath">Path to the device</param>
|
|
||||||
/// <param name="outputPrefix">Prefix for output data files</param>
|
|
||||||
/// <param name="outputPlugin">Plugin for output file</param>
|
|
||||||
/// <param name="retryPasses">How many times to retry</param>
|
|
||||||
/// <param name="force">Force to continue dump whenever possible</param>
|
|
||||||
/// <param name="persistent">Store whatever data the drive returned on error</param>
|
|
||||||
/// <param name="stopOnError">Stop dump on first error</param>
|
|
||||||
/// <param name="resume">Information for dump resuming</param>
|
|
||||||
/// <param name="dumpLog">Dump logger</param>
|
|
||||||
/// <param name="encoding">Encoding to use when analyzing dump</param>
|
|
||||||
/// <param name="outputPath">Path to output file</param>
|
|
||||||
/// <param name="formatOptions">Formats to pass to output file plugin</param>
|
|
||||||
/// <param name="preSidecar">Existing sidecar</param>
|
|
||||||
/// <param name="skip">How many sectors to skip on errors</param>
|
|
||||||
/// <param name="nometadata">Don't create metadata sidecar</param>
|
|
||||||
/// <param name="notrim">Don't trim errors</param>
|
|
||||||
/// <exception cref="ArgumentException">If you asked to dump long sectors from a SCSI Streaming device</exception>
|
/// <exception cref="ArgumentException">If you asked to dump long sectors from a SCSI Streaming device</exception>
|
||||||
public void PlayStationPortable(Device dev, string devicePath,
|
void PlayStationPortable()
|
||||||
IWritableImage outputPlugin, ushort retryPasses,
|
|
||||||
bool force, bool persistent,
|
|
||||||
bool stopOnError, ref Resume resume,
|
|
||||||
ref DumpLog dumpLog, Encoding encoding,
|
|
||||||
string outputPrefix, string outputPath,
|
|
||||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
|
||||||
uint skip, bool nometadata,
|
|
||||||
bool notrim)
|
|
||||||
{
|
{
|
||||||
if(!outputPlugin.SupportedMediaTypes.Contains(MediaType.MemoryStickDuo) &&
|
if(!outputPlugin.SupportedMediaTypes.Contains(MediaType.MemoryStickDuo) &&
|
||||||
!outputPlugin.SupportedMediaTypes.Contains(MediaType.MemoryStickProDuo) &&
|
!outputPlugin.SupportedMediaTypes.Contains(MediaType.MemoryStickProDuo) &&
|
||||||
@@ -92,11 +67,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
// UMDs are always write protected
|
// UMDs are always write protected
|
||||||
if(!decoded.Value.Header.WriteProtected)
|
if(!decoded.Value.Header.WriteProtected)
|
||||||
{
|
{
|
||||||
DumpMs(dev, devicePath, outputPlugin, retryPasses, force, persistent, stopOnError,
|
DumpMs();
|
||||||
ref resume,
|
|
||||||
ref dumpLog, encoding, outputPrefix, outputPath, formatOptions, preSidecar, skip,
|
|
||||||
nometadata,
|
|
||||||
notrim);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,11 +88,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
// UMDs are stored inside a FAT16 volume
|
// UMDs are stored inside a FAT16 volume
|
||||||
if(!tmp.SequenceEqual(FatSignature))
|
if(!tmp.SequenceEqual(FatSignature))
|
||||||
{
|
{
|
||||||
DumpMs(dev, devicePath, outputPlugin, retryPasses, force, persistent, stopOnError,
|
DumpMs();
|
||||||
ref resume,
|
|
||||||
ref dumpLog, encoding, outputPrefix, outputPath, formatOptions, preSidecar, skip,
|
|
||||||
nometadata,
|
|
||||||
notrim);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,11 +114,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
if(!tmp.SequenceEqual(IsoExtension))
|
if(!tmp.SequenceEqual(IsoExtension))
|
||||||
{
|
{
|
||||||
DumpMs(dev, devicePath, outputPlugin, retryPasses, force, persistent, stopOnError,
|
DumpMs();
|
||||||
ref resume,
|
|
||||||
ref dumpLog, encoding, outputPrefix, outputPath, formatOptions, preSidecar, skip,
|
|
||||||
nometadata,
|
|
||||||
notrim);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,30 +164,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
|
|
||||||
if(nextCluster == 0xFFFF) break;
|
if(nextCluster == 0xFFFF) break;
|
||||||
|
|
||||||
DumpMs(dev, devicePath, outputPlugin, retryPasses, force, persistent, stopOnError,
|
DumpMs();
|
||||||
ref resume,
|
|
||||||
ref dumpLog, encoding, outputPrefix, outputPath, formatOptions, preSidecar, skip,
|
|
||||||
nometadata,
|
|
||||||
notrim);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(outputPlugin is IWritableOpticalImage opticalPlugin)
|
if(outputPlugin is IWritableOpticalImage) DumpUmd();
|
||||||
DumpUmd(dev, devicePath, opticalPlugin, retryPasses, force, persistent, stopOnError,
|
|
||||||
ref resume,
|
|
||||||
ref dumpLog, encoding, outputPrefix, outputPath, formatOptions, preSidecar, skip,
|
|
||||||
nometadata,
|
|
||||||
notrim);
|
|
||||||
else StoppingErrorMessage?.Invoke("The specified plugin does not support storing optical disc images.");
|
else StoppingErrorMessage?.Invoke("The specified plugin does not support storing optical disc images.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpUmd(Device dev, string devicePath, IWritableOpticalImage outputPlugin,
|
void DumpUmd()
|
||||||
ushort retryPasses, bool force,
|
|
||||||
bool persistent, bool stopOnError, ref Resume resume,
|
|
||||||
ref DumpLog dumpLog, Encoding encoding,
|
|
||||||
string outputPrefix, string outputPath, Dictionary<string, string> formatOptions,
|
|
||||||
CICMMetadataType preSidecar, uint skip, bool nometadata,
|
|
||||||
bool notrim)
|
|
||||||
{
|
{
|
||||||
const uint BLOCK_SIZE = 2048;
|
const uint BLOCK_SIZE = 2048;
|
||||||
const MediaType DSK_TYPE = MediaType.UMD;
|
const MediaType DSK_TYPE = MediaType.UMD;
|
||||||
@@ -308,7 +256,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
start = DateTime.UtcNow;
|
start = DateTime.UtcNow;
|
||||||
double imageWriteDuration = 0;
|
double imageWriteDuration = 0;
|
||||||
|
|
||||||
outputPlugin.SetTracks(new List<Track>
|
(outputPlugin as IWritableOpticalImage).SetTracks(new List<Track>
|
||||||
{
|
{
|
||||||
new Track
|
new Track
|
||||||
{
|
{
|
||||||
@@ -316,9 +264,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
TrackEndSector = blocks - 1,
|
TrackEndSector = blocks - 1,
|
||||||
TrackSequence = 1,
|
TrackSequence = 1,
|
||||||
TrackRawBytesPerSector = (int)BLOCK_SIZE,
|
TrackRawBytesPerSector = (int)BLOCK_SIZE,
|
||||||
TrackSubchannelType = TrackSubchannelType.None,
|
TrackSubchannelType =
|
||||||
TrackSession = 1,
|
TrackSubchannelType.None,
|
||||||
TrackType = TrackType.Data
|
TrackSession = 1,
|
||||||
|
TrackType = TrackType.Data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -704,13 +653,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
Statistics.AddMedia(DSK_TYPE, true);
|
Statistics.AddMedia(DSK_TYPE, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpMs(Device dev, string devicePath, IWritableImage outputPlugin,
|
void DumpMs()
|
||||||
ushort retryPasses, bool force,
|
|
||||||
bool persistent, bool stopOnError, ref Resume resume,
|
|
||||||
ref DumpLog dumpLog, Encoding encoding,
|
|
||||||
string outputPrefix, string outputPath, Dictionary<string, string> formatOptions,
|
|
||||||
CICMMetadataType preSidecar, uint skip, bool nometadata,
|
|
||||||
bool notrim)
|
|
||||||
{
|
{
|
||||||
const ushort SBC_PROFILE = 0x0001;
|
const ushort SBC_PROFILE = 0x0001;
|
||||||
const uint BLOCK_SIZE = 512;
|
const uint BLOCK_SIZE = 512;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.CommonTypes.Enums;
|
using DiscImageChef.CommonTypes.Enums;
|
||||||
@@ -78,16 +77,7 @@ 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>
|
||||||
internal void Sbc(Device dev, string devicePath,
|
internal void Sbc(Dictionary<MediaTagType, byte[]> mediaTags, ref MediaType dskType, bool opticalDisc)
|
||||||
IWritableImage outputPlugin, ushort retryPasses, bool force,
|
|
||||||
bool dumpRaw, bool persistent,
|
|
||||||
bool stopOnError, Dictionary<MediaTagType, byte[]> mediaTags,
|
|
||||||
ref MediaType dskType, bool opticalDisc,
|
|
||||||
ref Resume resume, ref DumpLog dumpLog,
|
|
||||||
Encoding encoding, string outputPrefix,
|
|
||||||
string outputPath,
|
|
||||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar, uint skip,
|
|
||||||
bool nometadata, bool notrim)
|
|
||||||
{
|
{
|
||||||
bool sense;
|
bool sense;
|
||||||
byte scsiMediumType = 0;
|
byte scsiMediumType = 0;
|
||||||
|
|||||||
@@ -31,16 +31,10 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.CommonTypes.Interfaces;
|
using DiscImageChef.CommonTypes.Interfaces;
|
||||||
using DiscImageChef.CommonTypes.Metadata;
|
|
||||||
using DiscImageChef.Core.Logging;
|
|
||||||
using DiscImageChef.Decoders.SCSI;
|
using DiscImageChef.Decoders.SCSI;
|
||||||
using DiscImageChef.Devices;
|
|
||||||
using Schemas;
|
|
||||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
|
||||||
|
|
||||||
namespace DiscImageChef.Core.Devices.Dumping
|
namespace DiscImageChef.Core.Devices.Dumping
|
||||||
{
|
{
|
||||||
@@ -69,15 +63,7 @@ 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="ArgumentException">If you asked to dump long sectors from a SCSI Streaming device</exception>
|
/// <exception cref="ArgumentException">If you asked to dump long sectors from a SCSI Streaming device</exception>
|
||||||
public void Scsi(Device dev, string devicePath,
|
public void Scsi()
|
||||||
IWritableImage outputPlugin, ushort retryPasses, bool force,
|
|
||||||
bool dumpRaw, bool persistent,
|
|
||||||
bool stopOnError, ref Resume resume, ref DumpLog dumpLog,
|
|
||||||
bool dumpFirstTrackPregap, Encoding encoding,
|
|
||||||
string outputPrefix, string outputPath,
|
|
||||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
|
||||||
uint skip,
|
|
||||||
bool nometadata, bool notrim)
|
|
||||||
{
|
{
|
||||||
MediaType dskType = MediaType.Unknown;
|
MediaType dskType = MediaType.Unknown;
|
||||||
int resets = 0;
|
int resets = 0;
|
||||||
@@ -226,24 +212,16 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
case PeripheralDeviceTypes.SequentialAccess:
|
case PeripheralDeviceTypes.SequentialAccess:
|
||||||
if(dumpRaw) throw new ArgumentException("Tapes cannot be dumped raw.");
|
if(dumpRaw) throw new ArgumentException("Tapes cannot be dumped raw.");
|
||||||
|
|
||||||
Ssc(dev, outputPrefix, devicePath, ref resume, ref dumpLog, preSidecar);
|
Ssc();
|
||||||
return;
|
return;
|
||||||
case PeripheralDeviceTypes.MultiMediaDevice:
|
case PeripheralDeviceTypes.MultiMediaDevice:
|
||||||
if(outputPlugin is IWritableOpticalImage opticalPlugin)
|
if(outputPlugin is IWritableOpticalImage opticalPlugin) Mmc(ref dskType, dumpFirstTrackPregap);
|
||||||
Mmc(dev, devicePath, opticalPlugin, retryPasses, force, dumpRaw,
|
|
||||||
persistent, stopOnError,
|
|
||||||
ref dskType, ref resume, ref dumpLog, dumpFirstTrackPregap, encoding, outputPrefix,
|
|
||||||
outputPath, formatOptions, preSidecar, skip, nometadata, notrim);
|
|
||||||
else
|
else
|
||||||
StoppingErrorMessage
|
StoppingErrorMessage
|
||||||
?.Invoke("The specified plugin does not support storing optical disc images.");
|
?.Invoke("The specified plugin does not support storing optical disc images.");
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
Sbc(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent,
|
Sbc(null, ref dskType, false);
|
||||||
stopOnError, null,
|
|
||||||
ref dskType, false, ref resume, ref dumpLog, encoding, outputPrefix, outputPath,
|
|
||||||
formatOptions,
|
|
||||||
preSidecar, skip, nometadata, notrim);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// <param name="outputPrefix">Prefix for output data files</param>
|
/// <param name="outputPrefix">Prefix for output data files</param>
|
||||||
/// <param name="resume">Information for dump resuming</param>
|
/// <param name="resume">Information for dump resuming</param>
|
||||||
/// <param name="dumpLog">Dump logger</param>
|
/// <param name="dumpLog">Dump logger</param>
|
||||||
internal void Ssc(Device dev, string outputPrefix, string devicePath, ref Resume resume,
|
internal void Ssc()
|
||||||
ref DumpLog dumpLog,
|
|
||||||
CICMMetadataType preSidecar)
|
|
||||||
{
|
{
|
||||||
FixedSense? fxSense;
|
FixedSense? fxSense;
|
||||||
bool aborted;
|
bool aborted;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.CommonTypes.Enums;
|
using DiscImageChef.CommonTypes.Enums;
|
||||||
@@ -43,7 +42,6 @@ using DiscImageChef.CommonTypes.Interfaces;
|
|||||||
using DiscImageChef.CommonTypes.Metadata;
|
using DiscImageChef.CommonTypes.Metadata;
|
||||||
using DiscImageChef.Core.Logging;
|
using DiscImageChef.Core.Logging;
|
||||||
using DiscImageChef.Decoders.MMC;
|
using DiscImageChef.Decoders.MMC;
|
||||||
using DiscImageChef.Devices;
|
|
||||||
using Schemas;
|
using Schemas;
|
||||||
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
||||||
|
|
||||||
@@ -72,15 +70,7 @@ 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="ArgumentException">If you asked to dump long sectors from a SCSI Streaming device</exception>
|
/// <exception cref="ArgumentException">If you asked to dump long sectors from a SCSI Streaming device</exception>
|
||||||
public void SecureDigital(Device dev, string devicePath,
|
public void SecureDigital()
|
||||||
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<string, string> formatOptions, CICMMetadataType preSidecar,
|
|
||||||
uint skip,
|
|
||||||
bool nometadata, bool notrim)
|
|
||||||
{
|
{
|
||||||
bool aborted;
|
bool aborted;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.CommonTypes.Enums;
|
using DiscImageChef.CommonTypes.Enums;
|
||||||
@@ -82,17 +81,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
/// If the provided resume does not correspond with the current in progress
|
/// If the provided resume does not correspond with the current in progress
|
||||||
/// dump
|
/// dump
|
||||||
/// </exception>
|
/// </exception>
|
||||||
internal void Xgd(Device dev, string devicePath,
|
internal void Xgd(Dictionary<MediaTagType, byte[]> mediaTags, ref MediaType dskType)
|
||||||
IWritableOpticalImage outputPlugin, ushort retryPasses,
|
|
||||||
bool force, bool dumpRaw,
|
|
||||||
bool persistent, bool stopOnError,
|
|
||||||
Dictionary<MediaTagType, byte[]> mediaTags, ref MediaType dskType,
|
|
||||||
ref Resume resume,
|
|
||||||
ref DumpLog dumpLog, Encoding encoding,
|
|
||||||
string outputPrefix, string outputPath,
|
|
||||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
|
||||||
uint skip,
|
|
||||||
bool nometadata, bool notrim)
|
|
||||||
{
|
{
|
||||||
bool sense;
|
bool sense;
|
||||||
const uint BLOCK_SIZE = 2048;
|
const uint BLOCK_SIZE = 2048;
|
||||||
@@ -382,7 +371,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
if(currentTry == null || extents == null)
|
if(currentTry == null || extents == null)
|
||||||
throw new NotImplementedException("Could not process resume file, not continuing...");
|
throw new NotImplementedException("Could not process resume file, not continuing...");
|
||||||
|
|
||||||
outputPlugin.SetTracks(new List<Track>
|
(outputPlugin as IWritableOpticalImage).SetTracks(new List<Track>
|
||||||
{
|
{
|
||||||
new Track
|
new Track
|
||||||
{
|
{
|
||||||
@@ -390,9 +379,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
|||||||
TrackEndSector = blocks - 1,
|
TrackEndSector = blocks - 1,
|
||||||
TrackSequence = 1,
|
TrackSequence = 1,
|
||||||
TrackRawBytesPerSector = (int)BLOCK_SIZE,
|
TrackRawBytesPerSector = (int)BLOCK_SIZE,
|
||||||
TrackSubchannelType = TrackSubchannelType.None,
|
TrackSubchannelType =
|
||||||
TrackSession = 1,
|
TrackSubchannelType.None,
|
||||||
TrackType = TrackType.Data
|
TrackSession = 1,
|
||||||
|
TrackType = TrackType.Data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -398,6 +398,7 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
Statistics.AddDevice(dev);
|
Statistics.AddDevice(dev);
|
||||||
|
Statistics.AddCommand("dump-media");
|
||||||
|
|
||||||
if(!(cmbFormat.SelectedValue is IWritableImage outputFormat))
|
if(!(cmbFormat.SelectedValue is IWritableImage outputFormat))
|
||||||
{
|
{
|
||||||
@@ -445,67 +446,23 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
parsedOptions.Add(key, value);
|
parsedOptions.Add(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dump dumper = new Dump();
|
Dump dumper = new Dump(chkResume.Checked == true, dev, devicePath, outputFormat,
|
||||||
|
(ushort)stpRetries.Value,
|
||||||
|
chkForce.Checked == true, false, chkPersistent.Checked == true,
|
||||||
|
chkStopOnError.Checked == true, resume, dumpLog, encoding, outputPrefix,
|
||||||
|
txtDestination.Text, parsedOptions, sidecar, (uint)stpSkipped.Value,
|
||||||
|
chkExistingMetadata.Checked == false, chkTrim.Checked == false,
|
||||||
|
chkTrack1Pregap.Checked == true);
|
||||||
|
|
||||||
switch(dev.Type)
|
/*dumper.UpdateStatus += Progress.UpdateStatus;
|
||||||
{
|
dumper.ErrorMessage += Progress.ErrorMessage;
|
||||||
case DeviceType.ATA:
|
dumper.StoppingErrorMessage += Progress.ErrorMessage;
|
||||||
dumper.Ata(dev, devicePath, outputFormat, (ushort)stpRetries.Value, chkForce.Checked == true,
|
dumper.UpdateProgress += Progress.UpdateProgress;
|
||||||
false, /*options.Raw,*/
|
dumper.PulseProgress += Progress.PulseProgress;
|
||||||
chkPersistent.Checked == true, chkStopOnError.Checked == true, ref resume, ref dumpLog,
|
dumper.InitProgress += Progress.InitProgress;
|
||||||
encoding, outputPrefix, txtDestination.Text, parsedOptions, sidecar,
|
dumper.EndProgress += Progress.EndProgress;*/
|
||||||
(uint)stpSkipped.Value, chkExistingMetadata.Checked == false, chkTrim.Checked == false);
|
|
||||||
break;
|
|
||||||
case DeviceType.MMC:
|
|
||||||
case DeviceType.SecureDigital:
|
|
||||||
dumper.SecureDigital(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.NVMe:
|
|
||||||
dumper.NVMe(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.ATAPI:
|
|
||||||
case DeviceType.SCSI:
|
|
||||||
dumper.Scsi(dev, devicePath, outputFormat, (ushort)stpRetries.Value, chkForce.Checked == true,
|
|
||||||
false, /*options.Raw,*/
|
|
||||||
chkPersistent.Checked == true,
|
|
||||||
chkStopOnError.Checked == true, ref resume, ref dumpLog,
|
|
||||||
chkTrack1Pregap.Checked == true,
|
|
||||||
encoding, outputPrefix, txtDestination.Text,
|
|
||||||
parsedOptions, sidecar, (uint)stpSkipped.Value, chkExistingMetadata.Checked == false,
|
|
||||||
chkTrim.Checked == false);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dumpLog.WriteLine("Unknown device type.");
|
|
||||||
dumpLog.Close();
|
|
||||||
MessageBox.Show("Unknown device type.", MessageBoxType.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(resume != null && chkResume.Checked == true)
|
dumper.Start();
|
||||||
{
|
|
||||||
resume.LastWriteDate = DateTime.UtcNow;
|
|
||||||
resume.BadBlocks.Sort();
|
|
||||||
|
|
||||||
if(File.Exists(outputPrefix + ".resume.xml")) File.Delete(outputPrefix + ".resume.xml");
|
|
||||||
|
|
||||||
FileStream fs = new FileStream(outputPrefix + ".resume.xml", FileMode.Create, FileAccess.ReadWrite);
|
|
||||||
XmlSerializer xs = new XmlSerializer(resume.GetType());
|
|
||||||
xs.Serialize(fs, resume);
|
|
||||||
fs.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
dumpLog.Close();
|
|
||||||
|
|
||||||
Statistics.AddCommand("dump-media");
|
|
||||||
|
|
||||||
dev.Close();
|
dev.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,7 +294,9 @@ namespace DiscImageChef.Commands
|
|||||||
DicConsole.WriteLine("Output image format: {0}.", outputFormat.Name);
|
DicConsole.WriteLine("Output image format: {0}.", outputFormat.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dump dumper = new Dump();
|
Dump dumper = new Dump(doResume, dev, devicePath, outputFormat, retryPasses, force, false, persistent,
|
||||||
|
stopOnError, resume, dumpLog, encoding, outputPrefix, outputFile, parsedOptions,
|
||||||
|
sidecar, (uint)skip, noMetadata, noTrim, firstTrackPregap);
|
||||||
dumper.UpdateStatus += Progress.UpdateStatus;
|
dumper.UpdateStatus += Progress.UpdateStatus;
|
||||||
dumper.ErrorMessage += Progress.ErrorMessage;
|
dumper.ErrorMessage += Progress.ErrorMessage;
|
||||||
dumper.StoppingErrorMessage += Progress.ErrorMessage;
|
dumper.StoppingErrorMessage += Progress.ErrorMessage;
|
||||||
@@ -303,56 +305,8 @@ namespace DiscImageChef.Commands
|
|||||||
dumper.InitProgress += Progress.InitProgress;
|
dumper.InitProgress += Progress.InitProgress;
|
||||||
dumper.EndProgress += Progress.EndProgress;
|
dumper.EndProgress += Progress.EndProgress;
|
||||||
|
|
||||||
if(dev.IsUsb && dev.UsbVendorId == 0x054C &&
|
dumper.Start();
|
||||||
(dev.UsbProductId == 0x01C8 || dev.UsbProductId == 0x01C9 || dev.UsbProductId == 0x02D2))
|
|
||||||
dumper.PlayStationPortable(dev, devicePath, outputFormat, retryPasses, force, persistent, stopOnError,
|
|
||||||
ref resume, ref dumpLog, encoding, outputPrefix, outputFile, parsedOptions,
|
|
||||||
sidecar, (uint)skip, noMetadata, noTrim);
|
|
||||||
else
|
|
||||||
switch(dev.Type)
|
|
||||||
{
|
|
||||||
case DeviceType.ATA:
|
|
||||||
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:
|
|
||||||
dumper.SecureDigital(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.NVMe:
|
|
||||||
dumper.NVMe(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.ATAPI:
|
|
||||||
case DeviceType.SCSI:
|
|
||||||
dumper.Scsi(dev, devicePath, outputFormat, retryPasses, force, false, /*raw,*/
|
|
||||||
persistent, stopOnError, ref resume, ref dumpLog, firstTrackPregap, encoding,
|
|
||||||
outputPrefix, outputFile, parsedOptions, sidecar, (uint)skip, noMetadata, noTrim);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dumpLog.WriteLine("Unknown device type.");
|
|
||||||
dumpLog.Close();
|
|
||||||
throw new NotSupportedException("Unknown device type.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(resume != null && doResume)
|
|
||||||
{
|
|
||||||
resume.LastWriteDate = DateTime.UtcNow;
|
|
||||||
resume.BadBlocks.Sort();
|
|
||||||
|
|
||||||
if(File.Exists(outputPrefix + ".resume.xml")) File.Delete(outputPrefix + ".resume.xml");
|
|
||||||
|
|
||||||
FileStream fs = new FileStream(outputPrefix + ".resume.xml", FileMode.Create, FileAccess.ReadWrite);
|
|
||||||
xs = new XmlSerializer(resume.GetType());
|
|
||||||
xs.Serialize(fs, resume);
|
|
||||||
fs.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
dumpLog.Close();
|
|
||||||
dev.Close();
|
dev.Close();
|
||||||
return (int)ErrorNumber.NoError;
|
return (int)ErrorNumber.NoError;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user