Move optical disc exclusive methods to new interfaces.

This commit is contained in:
2019-01-20 20:11:10 +00:00
parent 287d761dff
commit 640c57b87a
144 changed files with 869 additions and 2708 deletions

View File

@@ -85,7 +85,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <exception cref="InvalidOperationException">If the resume file is invalid</exception>
/// <exception cref="ArgumentOutOfRangeException">If the track type is unknown (never)</exception>
internal static void Dump(Device dev, string devicePath,
IWritableImage outputPlugin, ushort retryPasses,
IWritableOpticalImage outputPlugin, ushort retryPasses,
bool force, bool dumpRaw,
bool persistent, bool stopOnError,
ref MediaType dskType,

View File

@@ -77,7 +77,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <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>
internal static void Dump(Device dev, string devicePath,
IWritableImage outputPlugin, ushort retryPasses,
IWritableOpticalImage outputPlugin, ushort retryPasses,
bool force, bool dumpRaw,
bool persistent, bool stopOnError, ref MediaType dskType,
ref Resume resume, ref DumpLog dumpLog,

View File

@@ -208,16 +208,20 @@ namespace DiscImageChef.Core.Devices.Dumping
return;
}
DumpUmd(dev, devicePath, outputPlugin, retryPasses, force, persistent, stopOnError,
ref resume, ref dumpLog,
encoding, outputPrefix, outputPath, formatOptions, preSidecar, skip, nometadata, notrim);
if(outputPlugin is IWritableOpticalImage opticalPlugin)
DumpUmd(dev, devicePath, opticalPlugin, retryPasses, force, persistent, stopOnError,
ref resume,
ref dumpLog, encoding, outputPrefix, outputPath, formatOptions, preSidecar, skip,
nometadata,
notrim);
else DicConsole.ErrorWriteLine("The specified plugin does not support storing optical disc images.");
}
static void DumpUmd(Device dev, string devicePath,
IWritableImage outputPlugin, ushort retryPasses, bool force,
bool persistent, bool stopOnError,
ref Resume resume, ref DumpLog dumpLog,
Encoding encoding, string outputPrefix,
static void DumpUmd(Device dev, string devicePath,
IWritableOpticalImage 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,

View File

@@ -283,19 +283,28 @@ namespace DiscImageChef.Core.Devices.Dumping
double imageWriteDuration = 0;
if(opticalDisc)
outputPlugin.SetTracks(new List<Track>
{
new Track
{
if(outputPlugin is IWritableOpticalImage opticalPlugin)
opticalPlugin.SetTracks(new List<Track>
{
TrackBytesPerSector = (int)blockSize,
TrackEndSector = blocks - 1,
TrackSequence = 1,
TrackRawBytesPerSector = (int)blockSize,
TrackSubchannelType = TrackSubchannelType.None,
TrackSession = 1,
TrackType = TrackType.Data
}
});
new Track
{
TrackBytesPerSector = (int)blockSize,
TrackEndSector = blocks - 1,
TrackSequence = 1,
TrackRawBytesPerSector = (int)blockSize,
TrackSubchannelType = TrackSubchannelType.None,
TrackSession = 1,
TrackType = TrackType.Data
}
});
else
{
dumpLog.WriteLine("The specified plugin does not support storing optical disc images..");
DicConsole.ErrorWriteLine("The specified plugin does not support storing optical disc images.");
return;
}
}
else if(decMode.HasValue)
{
bool setGeometry = false;

View File

@@ -209,9 +209,12 @@ namespace DiscImageChef.Core.Devices.Dumping
Ssc.Dump(dev, outputPrefix, devicePath, ref resume, ref dumpLog, preSidecar);
return;
case PeripheralDeviceTypes.MultiMediaDevice:
Mmc.Dump(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent, stopOnError,
ref dskType, ref resume, ref dumpLog, dumpFirstTrackPregap, encoding, outputPrefix,
outputPath, formatOptions, preSidecar, skip, nometadata, notrim);
if(outputPlugin is IWritableOpticalImage opticalPlugin)
Mmc.Dump(dev, devicePath, opticalPlugin, retryPasses, force, dumpRaw, persistent, stopOnError,
ref dskType, ref resume, ref dumpLog, dumpFirstTrackPregap, encoding, outputPrefix,
outputPath, formatOptions, preSidecar, skip, nometadata, notrim);
else
DicConsole.ErrorWriteLine("The specified plugin does not support storing optical disc images.");
return;
default:
Sbc.Dump(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent, stopOnError, null,

View File

@@ -83,7 +83,7 @@ namespace DiscImageChef.Core.Devices.Dumping
/// dump
/// </exception>
internal static void Dump(Device dev, string devicePath,
IWritableImage outputPlugin, ushort retryPasses,
IWritableOpticalImage outputPlugin, ushort retryPasses,
bool force, bool dumpRaw,
bool persistent, bool stopOnError,
Dictionary<MediaTagType, byte[]> mediaTags, ref MediaType dskType,