Refactor.

This commit is contained in:
2019-12-14 22:55:26 +00:00
parent 3a16603b93
commit d4d3542d4f
2 changed files with 279 additions and 238 deletions

View File

@@ -46,30 +46,27 @@ using Spare = DiscImageChef.Decoders.DVD.Spare;
namespace DiscImageChef.Core.Devices.Dumping
{
/// <summary>
/// Implement dumping optical discs from MultiMedia devices
/// </summary>
/// <summary>Implement dumping optical discs from MultiMedia devices</summary>
partial class Dump
{
/// <summary>
/// Dumps an optical disc
/// </summary>
internal void Mmc(ref MediaType dskType)
/// <summary>Dumps an optical disc</summary>
void Mmc(ref MediaType dskType)
{
bool sense;
bool sense;
byte[] tmpBuf;
var compactDisc = true;
var isXbox = false;
bool compactDisc = true;
bool isXbox = false;
// TODO: Log not only what is it reading, but if it was read correctly or not.
sense = dev.GetConfiguration(out var cmdBuf, out _, 0, MmcGetConfigurationRt.Current, dev.Timeout,
out _);
if (!sense)
sense = dev.GetConfiguration(out byte[] cmdBuf, out _, 0, MmcGetConfigurationRt.Current, dev.Timeout,
out _);
if(!sense)
{
var ftr = Features.Separate(cmdBuf);
Features.SeparatedFeatures ftr = Features.Separate(cmdBuf);
dumpLog.WriteLine("Device reports current profile is 0x{0:X4}", ftr.CurrentProfile);
switch (ftr.CurrentProfile)
switch(ftr.CurrentProfile)
{
case 0x0001:
dskType = MediaType.GENERIC_HDD;
@@ -79,15 +76,19 @@ namespace DiscImageChef.Core.Devices.Dumping
goto default;
case 0x0005:
dskType = MediaType.CDMO;
break;
case 0x0008:
dskType = MediaType.CD;
break;
case 0x0009:
dskType = MediaType.CDR;
break;
case 0x000A:
dskType = MediaType.CDRW;
break;
case 0x0010:
dskType = MediaType.DVDROM;
@@ -163,57 +164,68 @@ namespace DiscImageChef.Core.Devices.Dumping
goto default;
default:
compactDisc = false;
break;
}
}
if (compactDisc)
if(compactDisc)
{
CompactDisc(ref dskType);
CompactDisc(out dskType);
return;
}
var scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw);
var blocks = scsiReader.GetDeviceBlocks();
var scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw);
ulong blocks = scsiReader.GetDeviceBlocks();
dumpLog.WriteLine("Device reports disc has {0} blocks", blocks);
var mediaTags = new Dictionary<MediaTagType, byte[]>();
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>();
if (dskType == MediaType.PD650)
switch (blocks + 1)
if(dskType == MediaType.PD650)
switch(blocks + 1)
{
case 1281856:
dskType = MediaType.PD650_WORM;
break;
case 58620544:
dskType = MediaType.REV120;
break;
case 17090880:
dskType = MediaType.REV35;
break;
// TODO: Unknown value
default:
dskType = MediaType.REV70;
break;
}
#region Nintendo
switch (dskType)
switch(dskType)
{
case MediaType.Unknown when blocks > 0:
dumpLog.WriteLine("Reading Physical Format Information");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
if(!sense)
{
var nintendoPfi = PFI.Decode(cmdBuf);
if (nintendoPfi != null)
if (nintendoPfi.Value.DiskCategory == DiskCategory.Nintendo &&
nintendoPfi.Value.PartVersion == 15)
PFI.PhysicalFormatInformation? nintendoPfi = PFI.Decode(cmdBuf);
if(nintendoPfi != null)
if(nintendoPfi.Value.DiskCategory == DiskCategory.Nintendo &&
nintendoPfi.Value.PartVersion == 15)
{
dumpLog.WriteLine("Dumping Nintendo GameCube or Wii discs is not yet implemented.");
StoppingErrorMessage
?.Invoke("Dumping Nintendo GameCube or Wii discs is not yet implemented.");
StoppingErrorMessage?.
Invoke("Dumping Nintendo GameCube or Wii discs is not yet implemented.");
return;
}
}
@@ -237,106 +249,128 @@ namespace DiscImageChef.Core.Devices.Dumping
case MediaType.HDDVDRW:
case MediaType.HDDVDRWDL:
dumpLog.WriteLine("Reading Physical Format Information");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
if (!sense)
if (PFI.Decode(cmdBuf).HasValue)
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
if(!sense)
if(PFI.Decode(cmdBuf).HasValue)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf);
var decPfi = PFI.Decode(cmdBuf).Value;
PFI.PhysicalFormatInformation decPfi = PFI.Decode(cmdBuf).Value;
UpdateStatus?.Invoke($"PFI:\n{PFI.Prettify(decPfi)}");
// False book types
if (dskType == MediaType.DVDROM)
switch (decPfi.DiskCategory)
if(dskType == MediaType.DVDROM)
switch(decPfi.DiskCategory)
{
case DiskCategory.DVDPR:
dskType = MediaType.DVDPR;
break;
case DiskCategory.DVDPRDL:
dskType = MediaType.DVDPRDL;
break;
case DiskCategory.DVDPRW:
dskType = MediaType.DVDPRW;
break;
case DiskCategory.DVDPRWDL:
dskType = MediaType.DVDPRWDL;
break;
case DiskCategory.DVDR:
dskType = decPfi.PartVersion == 6 ? MediaType.DVDRDL : MediaType.DVDR;
break;
case DiskCategory.DVDRAM:
dskType = MediaType.DVDRAM;
break;
default:
dskType = MediaType.DVDROM;
break;
case DiskCategory.DVDRW:
dskType = decPfi.PartVersion == 3 ? MediaType.DVDRWDL : MediaType.DVDRW;
break;
case DiskCategory.HDDVDR:
dskType = MediaType.HDDVDR;
break;
case DiskCategory.HDDVDRAM:
dskType = MediaType.HDDVDRAM;
break;
case DiskCategory.HDDVDROM:
dskType = MediaType.HDDVDROM;
break;
case DiskCategory.HDDVDRW:
dskType = MediaType.HDDVDRW;
break;
case DiskCategory.Nintendo:
dskType = decPfi.DiscSize == DVDSize.Eighty ? MediaType.GOD : MediaType.WOD;
break;
case DiskCategory.UMD:
dskType = MediaType.UMD;
break;
}
}
dumpLog.WriteLine("Reading Disc Manufacturing Information");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout,
out _);
if (!sense)
MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout,
out _);
if(!sense)
{
if (DMI.IsXbox(cmdBuf) || DMI.IsXbox360(cmdBuf))
if(DMI.IsXbox(cmdBuf) ||
DMI.IsXbox360(cmdBuf))
{
if (DMI.IsXbox(cmdBuf))
if(DMI.IsXbox(cmdBuf))
{
dskType = MediaType.XGD;
}
else if (DMI.IsXbox360(cmdBuf))
else if(DMI.IsXbox360(cmdBuf))
{
dskType = MediaType.XGD2;
// All XGD3 all have the same number of blocks
if (blocks == 25063 || // Locked (or non compatible drive)
blocks == 4229664 || // Xtreme unlock
blocks == 4246304) // Wxripper unlock
if(blocks == 25063 || // Locked (or non compatible drive)
blocks == 4229664 || // Xtreme unlock
blocks == 4246304) // Wxripper unlock
dskType = MediaType.XGD3;
}
sense = dev.ScsiInquiry(out var inqBuf, out _);
sense = dev.ScsiInquiry(out byte[] inqBuf, out _);
if (sense || !Inquiry.Decode(inqBuf).HasValue || Inquiry.Decode(inqBuf).HasValue &&
!Inquiry.Decode(inqBuf).Value.KreonPresent)
if(sense ||
!Inquiry.Decode(inqBuf).HasValue ||
(Inquiry.Decode(inqBuf).HasValue && !Inquiry.Decode(inqBuf).Value.KreonPresent))
{
dumpLog.WriteLine("Dumping Xbox Game Discs requires a drive with Kreon firmware.");
StoppingErrorMessage
?.Invoke("Dumping Xbox Game Discs requires a drive with Kreon firmware.");
StoppingErrorMessage?.
Invoke("Dumping Xbox Game Discs requires a drive with Kreon firmware.");
return;
}
if (dumpRaw && !force)
if(dumpRaw && !force)
{
StoppingErrorMessage
?.Invoke(
"Not continuing. If you want to continue reading cooked data when raw is not available use the force option.");
StoppingErrorMessage?.
Invoke("Not continuing. If you want to continue reading cooked data when raw is not available use the force option.");
// TODO: Exit more gracefully
return;
}
@@ -344,7 +378,7 @@ namespace DiscImageChef.Core.Devices.Dumping
isXbox = true;
}
if (cmdBuf.Length == 2052)
if(cmdBuf.Length == 2052)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -354,42 +388,42 @@ namespace DiscImageChef.Core.Devices.Dumping
break;
}
#endregion Nintendo
#region All DVD and HD DVD types
#endregion All DVD and HD DVD types
#region DVD-ROM
if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM)
if(dskType == MediaType.DVDDownload ||
dskType == MediaType.DVDROM)
{
dumpLog.WriteLine("Reading Lead-in Copyright Information.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out _);
if (!sense)
if (CSS_CPRM.DecodeLeadInCopyright(cmdBuf).HasValue)
MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out _);
if(!sense)
if(CSS_CPRM.DecodeLeadInCopyright(cmdBuf).HasValue)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
mediaTags.Add(MediaTagType.DVD_CMI, tmpBuf);
}
}
#endregion DVD-ROM
switch (dskType)
switch(dskType)
{
#region DVD-ROM and HD DVD-ROM
case MediaType.DVDDownload:
case MediaType.DVDROM:
case MediaType.HDDVDROM:
dumpLog.WriteLine("Reading Burst Cutting Area.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -397,18 +431,18 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion DVD-ROM and HD DVD-ROM
#region DVD-RAM and HD DVD-RAM
case MediaType.DVDRAM:
case MediaType.HDDVDRAM:
dumpLog.WriteLine("Reading Disc Description Structure.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdramDds, 0, dev.Timeout, out _);
if (!sense)
if (DDS.Decode(cmdBuf).HasValue)
MmcDiscStructureFormat.DvdramDds, 0, dev.Timeout, out _);
if(!sense)
if(DDS.Decode(cmdBuf).HasValue)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -416,11 +450,13 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Spare Area Information.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, dev.Timeout,
out _);
if (!sense)
if (Spare.Decode(cmdBuf).HasValue)
MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, dev.Timeout,
out _);
if(!sense)
if(Spare.Decode(cmdBuf).HasValue)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -428,17 +464,17 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion DVD-RAM and HD DVD-RAM
#region DVD-R and DVD-RW
case MediaType.DVDR:
case MediaType.DVDRW:
dumpLog.WriteLine("Reading Pre-Recorded Information.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -446,21 +482,21 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion DVD-R and DVD-RW
}
switch (dskType)
switch(dskType)
{
#region DVD-R, DVD-RW and HD DVD-R
case MediaType.DVDR:
case MediaType.DVDRW:
case MediaType.HDDVDR:
dumpLog.WriteLine("Reading Media Identifier.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdrMediaIdentifier, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.DvdrMediaIdentifier, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -468,10 +504,12 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Recordable Physical Information.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DvdrPhysicalInformation, 0, dev.Timeout,
out _);
if (!sense)
MmcDiscStructureFormat.DvdrPhysicalInformation, 0, dev.Timeout,
out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -479,19 +517,19 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion DVD-R, DVD-RW and HD DVD-R
#region All DVD+
case MediaType.DVDPR:
case MediaType.DVDPRDL:
case MediaType.DVDPRW:
case MediaType.DVDPRWDL:
dumpLog.WriteLine("Reading ADdress In Pregroove.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.Adip, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.Adip, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -499,9 +537,11 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Disc Control Blocks.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.Dcb, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.Dcb, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -509,17 +549,17 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion All DVD+
#region HD DVD-ROM
case MediaType.HDDVDROM:
dumpLog.WriteLine("Reading Lead-in Copyright Information.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.HddvdCopyrightInformation, 0, dev.Timeout,
out _);
if (!sense)
MmcDiscStructureFormat.HddvdCopyrightInformation, 0, dev.Timeout,
out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -527,21 +567,21 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion HD DVD-ROM
#region All Blu-ray
case MediaType.BDR:
case MediaType.BDRE:
case MediaType.BDROM:
case MediaType.BDRXL:
case MediaType.BDREXL:
dumpLog.WriteLine("Reading Disc Information.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out _);
if (!sense)
if (DI.Decode(cmdBuf).HasValue)
MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out _);
if(!sense)
if(DI.Decode(cmdBuf).HasValue)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -560,19 +600,19 @@ namespace DiscImageChef.Core.Devices.Dumping
mediaTags.Add(MediaTagType.PAC, tmpBuf);
}*/
break;
#endregion All Blu-ray
}
switch (dskType)
switch(dskType)
{
#region BD-ROM only
case MediaType.BDROM:
dumpLog.WriteLine("Reading Burst Cutting Area.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.BdBurstCuttingArea, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.BdBurstCuttingArea, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -580,19 +620,19 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion BD-ROM only
#region Writable Blu-ray only
case MediaType.BDR:
case MediaType.BDRE:
case MediaType.BDRXL:
case MediaType.BDREXL:
dumpLog.WriteLine("Reading Disc Definition Structure.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.BdDds, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.BdDds, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -600,9 +640,11 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Spare Area Information.");
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.BdSpareAreaInformation, 0, dev.Timeout, out _);
if (!sense)
MmcDiscStructureFormat.BdSpareAreaInformation, 0, dev.Timeout, out _);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
@@ -610,57 +652,57 @@ namespace DiscImageChef.Core.Devices.Dumping
}
break;
#endregion Writable Blu-ray only
}
if (isXbox)
if(isXbox)
{
Xgd(mediaTags, ref dskType);
return;
}
Sbc(mediaTags, ref dskType, true);
}
internal static void AddMediaTagToSidecar(string outputPath,
KeyValuePair<MediaTagType, byte[]> tag,
ref CICMMetadataType sidecar)
static void AddMediaTagToSidecar(string outputPath, KeyValuePair<MediaTagType, byte[]> tag,
ref CICMMetadataType sidecar)
{
switch (tag.Key)
switch(tag.Key)
{
case MediaTagType.DVD_PFI:
sidecar.OpticalDisc[0].PFI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DVD_DMI:
sidecar.OpticalDisc[0].DMI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DVD_CMI:
case MediaTagType.HDDVD_CPI:
sidecar.OpticalDisc[0].CMI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
var tmp = new byte[tag.Value.Length + 4];
byte[] tmp = new byte[tag.Value.Length + 4];
Array.Copy(tag.Value, 0, tmp, 4, tag.Value.Length);
tmp[0] = (byte) ((tag.Value.Length & 0xFF00) >> 8);
tmp[1] = (byte) (tag.Value.Length & 0xFF);
tmp[0] = (byte)((tag.Value.Length & 0xFF00) >> 8);
tmp[1] = (byte)(tag.Value.Length & 0xFF);
var cpy = CSS_CPRM.DecodeLeadInCopyright(tmp);
if (cpy.HasValue && cpy.Value.CopyrightType != CopyrightType.NoProtection)
CSS_CPRM.LeadInCopyright? cpy = CSS_CPRM.DecodeLeadInCopyright(tmp);
if(cpy.HasValue &&
cpy.Value.CopyrightType != CopyrightType.NoProtection)
sidecar.OpticalDisc[0].CopyProtection = cpy.Value.CopyrightType.ToString();
break;
@@ -668,90 +710,88 @@ namespace DiscImageChef.Core.Devices.Dumping
case MediaTagType.BD_BCA:
sidecar.OpticalDisc[0].BCA = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.BD_DDS:
case MediaTagType.DVDRAM_DDS:
sidecar.OpticalDisc[0].DDS = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DVDRAM_SpareArea:
case MediaTagType.BD_SpareArea:
sidecar.OpticalDisc[0].SAI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DVDR_PreRecordedInfo:
sidecar.OpticalDisc[0].PRI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DVD_MediaIdentifier:
sidecar.OpticalDisc[0].MediaID = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DVDR_PFI:
sidecar.OpticalDisc[0].PFIR = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DVD_ADIP:
sidecar.OpticalDisc[0].ADIP = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.DCB:
sidecar.OpticalDisc[0].DCB = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.BD_DI:
sidecar.OpticalDisc[0].DI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.Xbox_SecuritySector:
if (sidecar.OpticalDisc[0].Xbox == null) sidecar.OpticalDisc[0].Xbox = new XboxType();
if(sidecar.OpticalDisc[0].Xbox == null)
sidecar.OpticalDisc[0].Xbox = new XboxType();
sidecar.OpticalDisc[0].Xbox.SecuritySectors = new[]
{
new XboxSecuritySectorsType
{
RequestNumber = 0,
RequestVersion = 1,
SecuritySectors = new DumpType
RequestNumber = 0, RequestVersion = 1, SecuritySectors = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
}
}
@@ -759,78 +799,80 @@ namespace DiscImageChef.Core.Devices.Dumping
break;
case MediaTagType.Xbox_PFI:
if (sidecar.OpticalDisc[0].Xbox == null) sidecar.OpticalDisc[0].Xbox = new XboxType();
if(sidecar.OpticalDisc[0].Xbox == null)
sidecar.OpticalDisc[0].Xbox = new XboxType();
sidecar.OpticalDisc[0].Xbox.PFI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.Xbox_DMI:
if (sidecar.OpticalDisc[0].Xbox == null) sidecar.OpticalDisc[0].Xbox = new XboxType();
if(sidecar.OpticalDisc[0].Xbox == null)
sidecar.OpticalDisc[0].Xbox = new XboxType();
sidecar.OpticalDisc[0].Xbox.DMI = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.CD_FullTOC:
sidecar.OpticalDisc[0].TOC = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.CD_ATIP:
sidecar.OpticalDisc[0].ATIP = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.CD_PMA:
sidecar.OpticalDisc[0].PMA = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.CD_TEXT:
sidecar.OpticalDisc[0].LeadInCdText = new DumpType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
};
break;
case MediaTagType.CD_FirstTrackPregap:
sidecar.OpticalDisc[0].FirstTrackPregrap = new[]
{
new BorderType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
}
};
break;
case MediaTagType.CD_LeadIn:
sidecar.OpticalDisc[0].LeadIn = new[]
{
new BorderType
{
Image = outputPath,
Size = (ulong) tag.Value.Length,
Image = outputPath, Size = (ulong)tag.Value.Length,
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
}
};
break;
}
}