mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use Aaru Metadata instead of CICM Metadata.
This commit is contained in:
@@ -34,8 +34,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -44,7 +46,6 @@ using Aaru.Core.Graphics;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.ATA;
|
||||
using Aaru.Decoders.PCMCIA;
|
||||
using Schemas;
|
||||
using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify;
|
||||
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
@@ -175,8 +176,8 @@ public partial class Dump
|
||||
bool removable = !_dev.IsCompactFlash &&
|
||||
ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable);
|
||||
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(ataReader.IsLba, removable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
@@ -595,7 +596,7 @@ public partial class Dump
|
||||
|
||||
if(!error || recoveredError)
|
||||
{
|
||||
mhddLog.Write(currentBlock, duration, 1);
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
|
||||
@@ -612,7 +613,7 @@ public partial class Dump
|
||||
else
|
||||
{
|
||||
_resume.BadBlocks.Add(currentBlock);
|
||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration, 1);
|
||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
@@ -679,12 +680,12 @@ public partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputFormat.SetMetadata(metadata))
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputFormat.SetCicmMetadata(_preSidecar);
|
||||
outputFormat.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
@@ -745,14 +746,14 @@ public partial class Dump
|
||||
_sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
CICMMetadataType sidecar = _sidecarClass.Create();
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
|
||||
if(!_aborted)
|
||||
{
|
||||
if(_preSidecar != null)
|
||||
{
|
||||
_preSidecar.BlockMedia = sidecar.BlockMedia;
|
||||
sidecar = _preSidecar;
|
||||
_preSidecar.BlockMedias = sidecar.BlockMedias;
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
if(_dev.IsUsb &&
|
||||
@@ -761,15 +762,15 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_USB_descriptors);
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_USB_descriptors);
|
||||
|
||||
sidecar.BlockMedia[0].USB = new USBType
|
||||
sidecar.BlockMedias[0].Usb = new Usb
|
||||
{
|
||||
ProductID = _dev.UsbProductId,
|
||||
VendorID = _dev.UsbVendorId,
|
||||
Descriptors = new DumpType
|
||||
Descriptors = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)_dev.UsbDescriptors.Length,
|
||||
Checksums = Checksum.GetChecksums(_dev.UsbDescriptors).ToArray()
|
||||
Checksums = Checksum.GetChecksums(_dev.UsbDescriptors)
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -780,13 +781,13 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_PCMCIA_CIS);
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_PCMCIA_CIS);
|
||||
|
||||
sidecar.BlockMedia[0].PCMCIA = new PCMCIAType
|
||||
sidecar.BlockMedias[0].Pcmcia = new Pcmcia
|
||||
{
|
||||
CIS = new DumpType
|
||||
Cis = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)_dev.Cis.Length,
|
||||
Checksums = Checksum.GetChecksums(_dev.Cis).ToArray()
|
||||
Checksums = Checksum.GetChecksums(_dev.Cis)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -804,12 +805,10 @@ public partial class Dump
|
||||
|
||||
if(manufacturerId != null)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCode =
|
||||
sidecar.BlockMedias[0].Pcmcia.ManufacturerCode =
|
||||
manufacturerId.ManufacturerID;
|
||||
|
||||
sidecar.BlockMedia[0].PCMCIA.CardCode = manufacturerId.CardID;
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true;
|
||||
sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true;
|
||||
sidecar.BlockMedias[0].Pcmcia.CardCode = manufacturerId.CardID;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -818,14 +817,14 @@ public partial class Dump
|
||||
|
||||
if(version != null)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.Manufacturer = version.Manufacturer;
|
||||
sidecar.BlockMedia[0].PCMCIA.ProductName = version.Product;
|
||||
sidecar.BlockMedias[0].Pcmcia.Manufacturer = version.Manufacturer;
|
||||
sidecar.BlockMedias[0].Pcmcia.ProductName = version.Product;
|
||||
|
||||
sidecar.BlockMedia[0].PCMCIA.Compliance =
|
||||
sidecar.BlockMedias[0].Pcmcia.Compliance =
|
||||
$"{version.MajorVersion}.{version.MinorVersion}";
|
||||
|
||||
sidecar.BlockMedia[0].PCMCIA.AdditionalInformation =
|
||||
version.AdditionalInformation;
|
||||
sidecar.BlockMedias[0].Pcmcia.AdditionalInformation =
|
||||
new List<string>(version.AdditionalInformation);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -835,13 +834,13 @@ public partial class Dump
|
||||
if(_private)
|
||||
DeviceReport.ClearIdentify(ataIdentify);
|
||||
|
||||
sidecar.BlockMedia[0].ATA = new ATAType
|
||||
sidecar.BlockMedias[0].ATA = new ATA
|
||||
{
|
||||
Identify = new DumpType
|
||||
Identify = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)cmdBuf.Length,
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray()
|
||||
Checksums = Checksum.GetChecksums(cmdBuf)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -864,8 +863,8 @@ public partial class Dump
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
|
||||
if(sidecar.BlockMedia[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation
|
||||
where partition.FileSystems != null
|
||||
from fileSystem in partition.FileSystems
|
||||
select (partition.StartSector, fileSystem.Type));
|
||||
@@ -886,39 +885,40 @@ public partial class Dump
|
||||
|
||||
(string type, string subType) = CommonTypes.Metadata.MediaType.MediaTypeToString(mediaType);
|
||||
|
||||
sidecar.BlockMedia[0].DiskType = type;
|
||||
sidecar.BlockMedia[0].DiskSubType = subType;
|
||||
sidecar.BlockMedia[0].Interface = "ATA";
|
||||
sidecar.BlockMedia[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedia[0].PhysicalBlockSize = physicalSectorSize;
|
||||
sidecar.BlockMedia[0].LogicalBlockSize = blockSize;
|
||||
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].Model = _dev.Model;
|
||||
sidecar.BlockMedias[0].MediaType = type;
|
||||
sidecar.BlockMedias[0].MediaSubType = subType;
|
||||
sidecar.BlockMedias[0].Interface = "ATA";
|
||||
sidecar.BlockMedias[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedias[0].PhysicalBlockSize = physicalSectorSize;
|
||||
sidecar.BlockMedias[0].LogicalBlockSize = blockSize;
|
||||
sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedias[0].Model = _dev.Model;
|
||||
|
||||
if(!_private)
|
||||
sidecar.BlockMedia[0].Serial = _dev.Serial;
|
||||
sidecar.BlockMedias[0].Serial = _dev.Serial;
|
||||
|
||||
sidecar.BlockMedia[0].Size = blocks * blockSize;
|
||||
sidecar.BlockMedias[0].Size = blocks * blockSize;
|
||||
|
||||
if(cylinders > 0 &&
|
||||
heads > 0 &&
|
||||
sectors > 0)
|
||||
{
|
||||
sidecar.BlockMedia[0].Cylinders = cylinders;
|
||||
sidecar.BlockMedia[0].CylindersSpecified = true;
|
||||
sidecar.BlockMedia[0].Heads = heads;
|
||||
sidecar.BlockMedia[0].HeadsSpecified = true;
|
||||
sidecar.BlockMedia[0].SectorsPerTrack = sectors;
|
||||
sidecar.BlockMedia[0].SectorsPerTrackSpecified = true;
|
||||
sidecar.BlockMedias[0].Cylinders = cylinders;
|
||||
sidecar.BlockMedias[0].Heads = heads;
|
||||
sidecar.BlockMedias[0].SectorsPerTrack = sectors;
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar);
|
||||
|
||||
var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create);
|
||||
var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create);
|
||||
|
||||
var xmlSer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
xmlSer.Serialize(xmlFs, sidecar);
|
||||
xmlFs.Close();
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
|
||||
@@ -146,7 +146,7 @@ partial class Dump
|
||||
/// <param name="mcn">Disc media catalogue number</param>
|
||||
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
|
||||
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
|
||||
void ReadCdiReady(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents,
|
||||
void ReadCdiReady(uint blockSize, ref double currentSpeed, DumpHardware currentTry, ExtentsULong extents,
|
||||
IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed,
|
||||
MhddLog mhddLog, ref double minSpeed, uint subSize, MmcSubchannel supportedSubchannel,
|
||||
ref double totalDuration, Track[] tracks, SubchannelLog subLog, MmcSubchannel desiredSubchannel,
|
||||
@@ -242,7 +242,7 @@ partial class Dump
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i + r, cmdDuration, 1);
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
extents.Add(i + r, 1, true);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
@@ -324,7 +324,7 @@ partial class Dump
|
||||
FixOffsetData(offsetBytes, sectorSize, sectorsForOffset, supportedSubchannel, ref blocksToRead,
|
||||
subSize, ref cmdBuf, blockSize, false);
|
||||
|
||||
mhddLog.Write(i, cmdDuration, 1);
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
extents.Add(i, blocksToRead, true);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
|
||||
@@ -38,16 +38,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
@@ -89,7 +89,7 @@ partial class Dump
|
||||
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
|
||||
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
|
||||
void ReadCdData(ExtentsULong audioExtents, ulong blocks, uint blockSize, ref double currentSpeed,
|
||||
DumpHardwareType currentTry, ExtentsULong extents, IbgLog ibgLog, ref double imageWriteDuration,
|
||||
DumpHardware currentTry, ExtentsULong extents, IbgLog ibgLog, ref double imageWriteDuration,
|
||||
long lastSector, ExtentsULong leadOutExtents, ref double maxSpeed, MhddLog mhddLog,
|
||||
ref double minSpeed, out bool newTrim, bool nextData, int offsetBytes, bool read6, bool read10,
|
||||
bool read12, bool read16, bool readcd, int sectorsForOffset, uint subSize,
|
||||
@@ -476,7 +476,7 @@ partial class Dump
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i + r, cmdDuration, 1);
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
extents.Add(i + r, 1, true);
|
||||
DateTime writeStart = DateTime.Now;
|
||||
@@ -596,7 +596,7 @@ partial class Dump
|
||||
AaruConsole.DebugWriteLine("Dump-Media", Localization.Core.READ_error_0,
|
||||
Sense.PrettifySense(senseBuf));
|
||||
|
||||
mhddLog.Write(i + r, cmdDuration < 500 ? 65535 : cmdDuration, 1);
|
||||
mhddLog.Write(i + r, cmdDuration < 500 ? 65535 : cmdDuration);
|
||||
|
||||
ibgLog.Write(i + r, 0);
|
||||
_dumpLog.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, 1, i + r);
|
||||
|
||||
@@ -39,10 +39,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Graphics;
|
||||
using Aaru.Core.Logging;
|
||||
@@ -50,7 +50,7 @@ using Aaru.Core.Media.Detection;
|
||||
using Aaru.Database.Models;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
@@ -69,7 +69,7 @@ sealed partial class Dump
|
||||
uint blockSize; // Size of the read sector in bytes
|
||||
CdOffset cdOffset; // Read offset from database
|
||||
byte[] cmdBuf; // Data buffer
|
||||
DumpHardwareType currentTry = null; // Current dump hardware try
|
||||
DumpHardware currentTry = null; // Current dump hardware try
|
||||
double currentSpeed = 0; // Current read speed
|
||||
int? discOffset = null; // Disc write offset
|
||||
DateTime dumpStart = DateTime.UtcNow; // Time of dump start
|
||||
@@ -1380,14 +1380,14 @@ sealed partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputOptical.SetMetadata(metadata))
|
||||
if(!outputOptical.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputOptical.ErrorMessage);
|
||||
|
||||
outputOptical.SetDumpHardware(_resume.Tries);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputOptical.SetCicmMetadata(_preSidecar);
|
||||
outputOptical.SetMetadata(_preSidecar);
|
||||
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
{
|
||||
|
||||
@@ -37,16 +37,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
@@ -72,7 +72,7 @@ partial class Dump
|
||||
/// <param name="mcn">Disc media catalogue number</param>
|
||||
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
|
||||
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
|
||||
void RetryCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardwareType currentTry, ExtentsULong extents,
|
||||
void RetryCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents,
|
||||
int offsetBytes, bool readcd, int sectorsForOffset, uint subSize,
|
||||
MmcSubchannel supportedSubchannel, ref double totalDuration, SubchannelLog subLog,
|
||||
MmcSubchannel desiredSubchannel, Track[] tracks, Dictionary<byte, string> isrcs,
|
||||
|
||||
@@ -38,13 +38,13 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
|
||||
@@ -79,7 +79,7 @@ partial class Dump
|
||||
|
||||
// TODO: Use it
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
void DumpCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents,
|
||||
void DumpCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardware currentTry, ExtentsULong extents,
|
||||
IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed,
|
||||
MhddLog mhddLog, ref double minSpeed, bool read6, bool read10, bool read12, bool read16,
|
||||
bool readcd, MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration,
|
||||
@@ -145,7 +145,7 @@ partial class Dump
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, 1);
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
extents.Add(i, _maximumReadable, true);
|
||||
leadOutExtents.Remove(i);
|
||||
@@ -252,7 +252,7 @@ partial class Dump
|
||||
|
||||
// TODO: Use it
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
void RetryCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents,
|
||||
void RetryCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardware currentTry, ExtentsULong extents,
|
||||
IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed,
|
||||
MhddLog mhddLog, ref double minSpeed, bool read6, bool read10, bool read12, bool read16,
|
||||
bool readcd, MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration,
|
||||
@@ -380,7 +380,7 @@ partial class Dump
|
||||
|
||||
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
|
||||
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, 1);
|
||||
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration);
|
||||
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
|
||||
@@ -74,7 +74,7 @@ partial class Dump
|
||||
/// <param name="mcn">Disc media catalogue number</param>
|
||||
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
|
||||
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
|
||||
void TrimCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardwareType currentTry, ExtentsULong extents,
|
||||
void TrimCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents,
|
||||
bool newTrim, int offsetBytes, bool read6, bool read10, bool read12, bool read16, bool readcd,
|
||||
int sectorsForOffset, uint subSize, MmcSubchannel supportedSubchannel, bool supportsLongSectors,
|
||||
ref double totalDuration, SubchannelLog subLog, MmcSubchannel desiredSubchannel, Track[] tracks,
|
||||
|
||||
@@ -39,13 +39,14 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Database;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using File = System.IO.File;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
|
||||
@@ -88,7 +89,7 @@ public partial class Dump
|
||||
readonly IBaseWritableImage _outputPlugin;
|
||||
readonly string _outputPrefix;
|
||||
readonly bool _persistent;
|
||||
readonly CICMMetadataType _preSidecar;
|
||||
readonly Metadata _preSidecar;
|
||||
readonly bool _private;
|
||||
readonly ushort _retryPasses;
|
||||
readonly bool _retrySubchannel;
|
||||
@@ -157,12 +158,11 @@ public partial class Dump
|
||||
public Dump(bool doResume, Device dev, string devicePath, IBaseWritableImage 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 metadata, bool trim, bool dumpFirstTrackPregap,
|
||||
bool fixOffset, bool debug, DumpSubchannel subchannel, int speed, bool @private,
|
||||
bool fixSubchannelPosition, bool retrySubchannel, bool fixSubchannel, bool fixSubchannelCrc,
|
||||
bool skipCdireadyHole, ErrorLog errorLog, bool generateSubchannels, uint maximumReadable,
|
||||
bool useBufferedReads, bool storeEncrypted, bool titleKeys, uint ignoreCdrRunOuts, bool createGraph,
|
||||
uint dimensions)
|
||||
Metadata preSidecar, uint skip, bool metadata, bool trim, bool dumpFirstTrackPregap, bool fixOffset,
|
||||
bool debug, DumpSubchannel subchannel, int speed, bool @private, bool fixSubchannelPosition,
|
||||
bool retrySubchannel, bool fixSubchannel, bool fixSubchannelCrc, bool skipCdireadyHole,
|
||||
ErrorLog errorLog, bool generateSubchannels, uint maximumReadable, bool useBufferedReads,
|
||||
bool storeEncrypted, bool titleKeys, uint ignoreCdrRunOuts, bool createGraph, uint dimensions)
|
||||
{
|
||||
_doResume = doResume;
|
||||
_dev = dev;
|
||||
|
||||
@@ -423,7 +423,7 @@ public partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputBai.SetMetadata(metadata))
|
||||
if(!outputBai.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputBai.ErrorMessage);
|
||||
|
||||
@@ -431,7 +431,7 @@ public partial class Dump
|
||||
//outputBAI.SetDumpHardware();
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputBai.SetCicmMetadata(_preSidecar);
|
||||
outputBai.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Decoders.Bluray;
|
||||
@@ -43,7 +44,6 @@ using Aaru.Decoders.SCSI.MMC;
|
||||
using Aaru.Decryption;
|
||||
using Aaru.Decryption.DVD;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using DDS = Aaru.Decoders.DVD.DDS;
|
||||
using DMI = Aaru.Decoders.Xbox.DMI;
|
||||
using DVDDecryption = Aaru.Decryption.DVD.Dump;
|
||||
@@ -802,36 +802,35 @@ partial class Dump
|
||||
}
|
||||
|
||||
// TODO: Move somewhere else
|
||||
internal static void AddMediaTagToSidecar(string outputPath, MediaTagType tagType, byte[] tag,
|
||||
ref CICMMetadataType sidecar)
|
||||
internal static void AddMediaTagToSidecar(string outputPath, MediaTagType tagType, byte[] tag, ref Metadata sidecar)
|
||||
{
|
||||
switch(tagType)
|
||||
{
|
||||
case MediaTagType.DVD_PFI:
|
||||
sidecar.OpticalDisc[0].PFI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Pfi = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DVD_DMI:
|
||||
sidecar.OpticalDisc[0].DMI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Dmi = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DVD_CMI:
|
||||
case MediaTagType.HDDVD_CPI:
|
||||
sidecar.OpticalDisc[0].CMI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Cmi = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
byte[] tmp = new byte[tag.Length + 4];
|
||||
@@ -843,190 +842,190 @@ partial class Dump
|
||||
|
||||
if(cpy.HasValue &&
|
||||
cpy.Value.CopyrightType != CopyrightType.NoProtection)
|
||||
sidecar.OpticalDisc[0].CopyProtection = cpy.Value.CopyrightType.ToString();
|
||||
sidecar.OpticalDiscs[0].CopyProtection = cpy.Value.CopyrightType.ToString();
|
||||
|
||||
break;
|
||||
case MediaTagType.DVD_BCA:
|
||||
case MediaTagType.BD_BCA:
|
||||
sidecar.OpticalDisc[0].BCA = new DumpType
|
||||
sidecar.OpticalDiscs[0].Bca = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.BD_DDS:
|
||||
case MediaTagType.DVDRAM_DDS:
|
||||
sidecar.OpticalDisc[0].DDS = new DumpType
|
||||
sidecar.OpticalDiscs[0].Dds = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DVDRAM_SpareArea:
|
||||
case MediaTagType.BD_SpareArea:
|
||||
sidecar.OpticalDisc[0].SAI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Sai = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DVDR_PreRecordedInfo:
|
||||
sidecar.OpticalDisc[0].PRI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Pri = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DVD_MediaIdentifier:
|
||||
sidecar.OpticalDisc[0].MediaID = new DumpType
|
||||
sidecar.OpticalDiscs[0].MediaID = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DVDR_PFI:
|
||||
sidecar.OpticalDisc[0].PFIR = new DumpType
|
||||
sidecar.OpticalDiscs[0].Pfir = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DVD_ADIP:
|
||||
sidecar.OpticalDisc[0].ADIP = new DumpType
|
||||
sidecar.OpticalDiscs[0].Adip = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.DCB:
|
||||
sidecar.OpticalDisc[0].DCB = new DumpType
|
||||
sidecar.OpticalDiscs[0].Dcb = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.BD_DI:
|
||||
sidecar.OpticalDisc[0].DI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Di = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.Xbox_SecuritySector:
|
||||
sidecar.OpticalDisc[0].Xbox ??= new XboxType();
|
||||
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
|
||||
|
||||
sidecar.OpticalDisc[0].Xbox.SecuritySectors = new[]
|
||||
sidecar.OpticalDiscs[0].Xbox.SecuritySectors = new List<XboxSecuritySector>
|
||||
{
|
||||
new XboxSecuritySectorsType
|
||||
new()
|
||||
{
|
||||
RequestNumber = 0,
|
||||
RequestVersion = 1,
|
||||
SecuritySectors = new DumpType
|
||||
SecuritySectors = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.Xbox_PFI:
|
||||
sidecar.OpticalDisc[0].Xbox ??= new XboxType();
|
||||
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
|
||||
|
||||
sidecar.OpticalDisc[0].Xbox.PFI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Xbox.Pfi = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.Xbox_DMI:
|
||||
sidecar.OpticalDisc[0].Xbox ??= new XboxType();
|
||||
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
|
||||
|
||||
sidecar.OpticalDisc[0].Xbox.DMI = new DumpType
|
||||
sidecar.OpticalDiscs[0].Xbox.Dmi = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_FullTOC:
|
||||
sidecar.OpticalDisc[0].TOC = new DumpType
|
||||
sidecar.OpticalDiscs[0].Toc = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_ATIP:
|
||||
sidecar.OpticalDisc[0].ATIP = new DumpType
|
||||
sidecar.OpticalDiscs[0].Atip = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_PMA:
|
||||
sidecar.OpticalDisc[0].PMA = new DumpType
|
||||
sidecar.OpticalDiscs[0].Pma = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_TEXT:
|
||||
sidecar.OpticalDisc[0].LeadInCdText = new DumpType
|
||||
sidecar.OpticalDiscs[0].LeadInCdText = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_FirstTrackPregap:
|
||||
sidecar.OpticalDisc[0].FirstTrackPregrap = new[]
|
||||
sidecar.OpticalDiscs[0].FirstTrackPregrap = new List<Border>
|
||||
{
|
||||
new BorderType
|
||||
new()
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
}
|
||||
};
|
||||
|
||||
break;
|
||||
case MediaTagType.CD_LeadIn:
|
||||
sidecar.OpticalDisc[0].LeadIn = new[]
|
||||
sidecar.OpticalDiscs[0].LeadIn = new List<Border>
|
||||
{
|
||||
new BorderType
|
||||
new()
|
||||
{
|
||||
Image = outputPath,
|
||||
Size = (ulong)tag.Length,
|
||||
Checksums = Checksum.GetChecksums(tag).ToArray()
|
||||
Checksums = Checksum.GetChecksums(tag)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -34,12 +34,13 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Schemas;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
@@ -55,7 +56,7 @@ partial class Dump
|
||||
/// <param name="sessions">Disc sessions</param>
|
||||
/// <param name="totalChkDuration">Total time spent doing checksums</param>
|
||||
/// <param name="discOffset">Disc write offset</param>
|
||||
void WriteOpticalSidecar(uint blockSize, ulong blocks, MediaType mediaType, LayersType layers,
|
||||
void WriteOpticalSidecar(uint blockSize, ulong blocks, MediaType mediaType, Layers layers,
|
||||
Dictionary<MediaTagType, byte[]> mediaTags, int sessions, out double totalChkDuration,
|
||||
int? discOffset)
|
||||
{
|
||||
@@ -91,8 +92,8 @@ partial class Dump
|
||||
_sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
CICMMetadataType sidecar = _sidecarClass.Create();
|
||||
DateTime end = DateTime.UtcNow;
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
DateTime end = DateTime.UtcNow;
|
||||
|
||||
if(_aborted)
|
||||
return;
|
||||
@@ -105,14 +106,14 @@ partial class Dump
|
||||
|
||||
if(_preSidecar != null)
|
||||
{
|
||||
_preSidecar.OpticalDisc = sidecar.OpticalDisc;
|
||||
sidecar = _preSidecar;
|
||||
_preSidecar.OpticalDiscs = sidecar.OpticalDiscs;
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
|
||||
if(sidecar.OpticalDisc[0].Track != null)
|
||||
filesystems.AddRange(from xmlTrack in sidecar.OpticalDisc[0].Track
|
||||
if(sidecar.OpticalDiscs[0].Track != null)
|
||||
filesystems.AddRange(from xmlTrack in sidecar.OpticalDiscs[0].Track
|
||||
where xmlTrack.FileSystemInformation != null
|
||||
from partition in xmlTrack.FileSystemInformation where partition.FileSystems != null
|
||||
from fileSystem in partition.FileSystems
|
||||
@@ -126,19 +127,16 @@ partial class Dump
|
||||
}).Distinct())
|
||||
_dumpLog.WriteLine(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start);
|
||||
|
||||
sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(mediaType);
|
||||
sidecar.OpticalDiscs[0].Dimensions = Dimensions.DimensionsFromMediaType(mediaType);
|
||||
(string type, string subType) discType = CommonTypes.Metadata.MediaType.MediaTypeToString(mediaType);
|
||||
sidecar.OpticalDisc[0].DiscType = discType.type;
|
||||
sidecar.OpticalDisc[0].DiscSubType = discType.subType;
|
||||
sidecar.OpticalDisc[0].DumpHardwareArray = _resume.Tries.ToArray();
|
||||
sidecar.OpticalDisc[0].Sessions = (uint)sessions;
|
||||
sidecar.OpticalDisc[0].Layers = layers;
|
||||
sidecar.OpticalDiscs[0].DiscType = discType.type;
|
||||
sidecar.OpticalDiscs[0].DiscSubType = discType.subType;
|
||||
sidecar.OpticalDiscs[0].DumpHardware = _resume.Tries;
|
||||
sidecar.OpticalDiscs[0].Sessions = (uint)sessions;
|
||||
sidecar.OpticalDiscs[0].Layers = layers;
|
||||
|
||||
if(discOffset.HasValue)
|
||||
{
|
||||
sidecar.OpticalDisc[0].Offset = (int)(discOffset / 4);
|
||||
sidecar.OpticalDisc[0].OffsetSpecified = true;
|
||||
}
|
||||
sidecar.OpticalDiscs[0].Offset = (int)(discOffset / 4);
|
||||
|
||||
if(mediaTags != null)
|
||||
foreach(KeyValuePair<MediaTagType, byte[]> tag in mediaTags.Where(tag => _outputPlugin.SupportedMediaTags.
|
||||
@@ -147,10 +145,14 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar);
|
||||
|
||||
var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create);
|
||||
var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create);
|
||||
|
||||
var xmlSer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
xmlSer.Serialize(xmlFs, sidecar);
|
||||
xmlFs.Close();
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -47,7 +49,6 @@ using Aaru.Core.Graphics;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
@@ -263,8 +264,10 @@ partial class Dump
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead);
|
||||
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions);
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private,
|
||||
_dimensions);
|
||||
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
|
||||
ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
|
||||
|
||||
// Cannot create image
|
||||
@@ -342,8 +345,8 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
@@ -740,12 +743,12 @@ partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputFormat.SetMetadata(metadata))
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputFormat.SetCicmMetadata(_preSidecar);
|
||||
outputFormat.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
@@ -793,7 +796,7 @@ partial class Dump
|
||||
_sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
CICMMetadataType sidecar = _sidecarClass.Create();
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
|
||||
if(!_aborted)
|
||||
@@ -814,14 +817,14 @@ partial class Dump
|
||||
|
||||
if(_preSidecar != null)
|
||||
{
|
||||
_preSidecar.BlockMedia = sidecar.BlockMedia;
|
||||
sidecar = _preSidecar;
|
||||
_preSidecar.BlockMedias = sidecar.BlockMedias;
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
|
||||
if(sidecar.BlockMedia[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation
|
||||
where partition.FileSystems != null from fileSystem in partition.FileSystems
|
||||
select (partition.StartSector, fileSystem.Type));
|
||||
|
||||
@@ -839,43 +842,47 @@ partial class Dump
|
||||
filesystem.start);
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
(string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType);
|
||||
sidecar.BlockMedia[0].DiskType = xmlType.type;
|
||||
sidecar.BlockMedia[0].DiskSubType = xmlType.subType;
|
||||
sidecar.BlockMedias[0].MediaType = xmlType.type;
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(_dev.Type == DeviceType.ATAPI)
|
||||
sidecar.BlockMedia[0].Interface = "ATAPI";
|
||||
sidecar.BlockMedias[0].Interface = "ATAPI";
|
||||
else if(_dev.IsUsb)
|
||||
sidecar.BlockMedia[0].Interface = "USB";
|
||||
sidecar.BlockMedias[0].Interface = "USB";
|
||||
else if(_dev.IsFireWire)
|
||||
sidecar.BlockMedia[0].Interface = "FireWire";
|
||||
sidecar.BlockMedias[0].Interface = "FireWire";
|
||||
else
|
||||
sidecar.BlockMedia[0].Interface = "SCSI";
|
||||
sidecar.BlockMedias[0].Interface = "SCSI";
|
||||
|
||||
sidecar.BlockMedia[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize;
|
||||
sidecar.BlockMedia[0].LogicalBlockSize = blockSize;
|
||||
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].Model = _dev.Model;
|
||||
sidecar.BlockMedias[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedias[0].PhysicalBlockSize = physicalBlockSize;
|
||||
sidecar.BlockMedias[0].LogicalBlockSize = blockSize;
|
||||
sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedias[0].Model = _dev.Model;
|
||||
|
||||
if(!_private)
|
||||
sidecar.BlockMedia[0].Serial = _dev.Serial;
|
||||
sidecar.BlockMedias[0].Serial = _dev.Serial;
|
||||
|
||||
sidecar.BlockMedia[0].Size = blocks * blockSize;
|
||||
sidecar.BlockMedias[0].Size = blocks * blockSize;
|
||||
|
||||
if(_dev.IsRemovable)
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray();
|
||||
sidecar.BlockMedias[0].DumpHardware = _resume.Tries;
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar);
|
||||
|
||||
var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create);
|
||||
var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create);
|
||||
|
||||
var xmlSer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
xmlSer.Serialize(xmlFs, sidecar);
|
||||
xmlFs.Close();
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,10 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -47,7 +49,6 @@ using Aaru.Core.Graphics;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
@@ -158,8 +159,10 @@ public partial class Dump
|
||||
|
||||
bool ret;
|
||||
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions);
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private,
|
||||
_dimensions);
|
||||
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
|
||||
ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
|
||||
|
||||
// Cannot create image
|
||||
@@ -177,8 +180,8 @@ public partial class Dump
|
||||
start = DateTime.UtcNow;
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
@@ -591,14 +594,14 @@ public partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputFormat.SetMetadata(metadata))
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
outputFormat.SetDumpHardware(_resume.Tries);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputFormat.SetCicmMetadata(_preSidecar);
|
||||
outputFormat.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
@@ -646,7 +649,7 @@ public partial class Dump
|
||||
_sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
CICMMetadataType sidecar = _sidecarClass.Create();
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
|
||||
if(!_aborted)
|
||||
@@ -667,14 +670,14 @@ public partial class Dump
|
||||
|
||||
if(_preSidecar != null)
|
||||
{
|
||||
_preSidecar.BlockMedia = sidecar.BlockMedia;
|
||||
sidecar = _preSidecar;
|
||||
_preSidecar.BlockMedias = sidecar.BlockMedias;
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
|
||||
if(sidecar.BlockMedia[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation
|
||||
where partition.FileSystems != null from fileSystem in partition.FileSystems
|
||||
select (partition.StartSector, fileSystem.Type));
|
||||
|
||||
@@ -692,32 +695,36 @@ public partial class Dump
|
||||
filesystem.start);
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
(string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType);
|
||||
sidecar.BlockMedia[0].DiskType = xmlType.type;
|
||||
sidecar.BlockMedia[0].DiskSubType = xmlType.subType;
|
||||
sidecar.BlockMedia[0].Interface = "USB";
|
||||
sidecar.BlockMedia[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedia[0].PhysicalBlockSize = (int)blockSize;
|
||||
sidecar.BlockMedia[0].LogicalBlockSize = (int)blockSize;
|
||||
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].Model = _dev.Model;
|
||||
sidecar.BlockMedias[0].MediaType = xmlType.type;
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
sidecar.BlockMedias[0].Interface = "USB";
|
||||
sidecar.BlockMedias[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedias[0].PhysicalBlockSize = (int)blockSize;
|
||||
sidecar.BlockMedias[0].LogicalBlockSize = (int)blockSize;
|
||||
sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedias[0].Model = _dev.Model;
|
||||
|
||||
if(!_private)
|
||||
sidecar.BlockMedia[0].Serial = _dev.Serial;
|
||||
sidecar.BlockMedias[0].Serial = _dev.Serial;
|
||||
|
||||
sidecar.BlockMedia[0].Size = blocks * blockSize;
|
||||
sidecar.BlockMedias[0].Size = blocks * blockSize;
|
||||
|
||||
if(_dev.IsRemovable)
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray();
|
||||
sidecar.BlockMedias[0].DumpHardware = _resume.Tries;
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar);
|
||||
|
||||
var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create);
|
||||
var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create);
|
||||
|
||||
var xmlSer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
xmlSer.Serialize(xmlFs, sidecar);
|
||||
xmlFs.Close();
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,16 +36,16 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Graphics;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
@@ -158,8 +158,10 @@ public partial class Dump
|
||||
|
||||
bool ret;
|
||||
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions);
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010);
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private,
|
||||
_dimensions);
|
||||
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010);
|
||||
ret = outputOptical.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
|
||||
|
||||
// Cannot create image
|
||||
@@ -191,8 +193,8 @@ public partial class Dump
|
||||
}
|
||||
});
|
||||
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
@@ -589,14 +591,14 @@ public partial class Dump
|
||||
MediaPartNumber = mediaPartNumber
|
||||
};
|
||||
|
||||
if(!outputOptical.SetMetadata(metadata))
|
||||
if(!outputOptical.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputOptical.ErrorMessage);
|
||||
|
||||
outputOptical.SetDumpHardware(_resume.Tries);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputOptical.SetCicmMetadata(_preSidecar);
|
||||
outputOptical.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Schemas;
|
||||
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
@@ -64,7 +64,7 @@ static class ResumeSupport
|
||||
/// progress dump
|
||||
/// </exception>
|
||||
internal static void Process(bool isLba, bool removable, ulong blocks, string manufacturer, string model,
|
||||
string serial, PlatformID platform, ref Resume resume, ref DumpHardwareType currentTry,
|
||||
string serial, PlatformID platform, ref Resume resume, ref DumpHardware currentTry,
|
||||
ref ExtentsULong extents, string firmware, bool @private, bool force,
|
||||
bool isTape = false)
|
||||
{
|
||||
@@ -102,7 +102,7 @@ static class ResumeSupport
|
||||
InvalidOperationException(string.Format(Localization.Core.Resume_file_different_number_of_blocks_not_continuing,
|
||||
resume.LastBlock + 1, blocks));
|
||||
|
||||
foreach(DumpHardwareType oldTry in resume.Tries)
|
||||
foreach(DumpHardware oldTry in resume.Tries)
|
||||
{
|
||||
if(!removable &&
|
||||
!force)
|
||||
@@ -153,9 +153,9 @@ static class ResumeSupport
|
||||
if(currentTry != null)
|
||||
return;
|
||||
|
||||
currentTry = new DumpHardwareType
|
||||
currentTry = new DumpHardware
|
||||
{
|
||||
Software = CommonTypes.Metadata.Version.GetSoftwareType(),
|
||||
Software = CommonTypes.Metadata.Version.GetSoftware(),
|
||||
Manufacturer = manufacturer,
|
||||
Model = model,
|
||||
Serial = serial,
|
||||
@@ -169,16 +169,16 @@ static class ResumeSupport
|
||||
{
|
||||
resume = new Resume
|
||||
{
|
||||
Tries = new List<DumpHardwareType>(),
|
||||
Tries = new List<DumpHardware>(),
|
||||
CreationDate = DateTime.UtcNow,
|
||||
BadBlocks = new List<ulong>(),
|
||||
LastBlock = isTape ? 0 : blocks - 1,
|
||||
Tape = isTape
|
||||
};
|
||||
|
||||
currentTry = new DumpHardwareType
|
||||
currentTry = new DumpHardware
|
||||
{
|
||||
Software = CommonTypes.Metadata.Version.GetSoftwareType(),
|
||||
Software = CommonTypes.Metadata.Version.GetSoftware(),
|
||||
Manufacturer = manufacturer,
|
||||
Model = model,
|
||||
Serial = serial,
|
||||
|
||||
@@ -36,21 +36,23 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.SCSI.SSC;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Helpers;
|
||||
using Schemas;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
using TapeFile = Aaru.CommonTypes.Structs.TapeFile;
|
||||
using TapePartition = Aaru.CommonTypes.Structs.TapePartition;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
@@ -498,8 +500,8 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
@@ -1306,12 +1308,12 @@ partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputTape.SetMetadata(metadata))
|
||||
if(!outputTape.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputTape.ErrorMessage);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputTape.SetCicmMetadata(_preSidecar);
|
||||
outputTape.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
@@ -1367,7 +1369,7 @@ partial class Dump
|
||||
_sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
CICMMetadataType sidecar = _sidecarClass.Create();
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
|
||||
if(!_aborted)
|
||||
@@ -1388,14 +1390,14 @@ partial class Dump
|
||||
|
||||
if(_preSidecar != null)
|
||||
{
|
||||
_preSidecar.BlockMedia = sidecar.BlockMedia;
|
||||
sidecar = _preSidecar;
|
||||
_preSidecar.BlockMedias = sidecar.BlockMedias;
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
|
||||
if(sidecar.BlockMedia[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation
|
||||
where partition.FileSystems != null from fileSystem in partition.FileSystems
|
||||
select (partition.StartSector, fileSystem.Type));
|
||||
|
||||
@@ -1413,44 +1415,48 @@ partial class Dump
|
||||
filesystem.start);
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
|
||||
(string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType);
|
||||
|
||||
sidecar.BlockMedia[0].DiskType = xmlType.type;
|
||||
sidecar.BlockMedia[0].DiskSubType = xmlType.subType;
|
||||
sidecar.BlockMedias[0].MediaType = xmlType.type;
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
|
||||
// TODO: Implement device firmware revision
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(_dev.Type == DeviceType.ATAPI)
|
||||
sidecar.BlockMedia[0].Interface = "ATAPI";
|
||||
sidecar.BlockMedias[0].Interface = "ATAPI";
|
||||
else if(_dev.IsUsb)
|
||||
sidecar.BlockMedia[0].Interface = "USB";
|
||||
sidecar.BlockMedias[0].Interface = "USB";
|
||||
else if(_dev.IsFireWire)
|
||||
sidecar.BlockMedia[0].Interface = "FireWire";
|
||||
sidecar.BlockMedias[0].Interface = "FireWire";
|
||||
else
|
||||
sidecar.BlockMedia[0].Interface = "SCSI";
|
||||
sidecar.BlockMedias[0].Interface = "SCSI";
|
||||
|
||||
sidecar.BlockMedia[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].Model = _dev.Model;
|
||||
sidecar.BlockMedias[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedias[0].Model = _dev.Model;
|
||||
|
||||
if(!_private)
|
||||
sidecar.BlockMedia[0].Serial = _dev.Serial;
|
||||
sidecar.BlockMedias[0].Serial = _dev.Serial;
|
||||
|
||||
sidecar.BlockMedia[0].Size = blocks * blockSize;
|
||||
sidecar.BlockMedias[0].Size = blocks * blockSize;
|
||||
|
||||
if(_dev.IsRemovable)
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray();
|
||||
sidecar.BlockMedias[0].DumpHardware = _resume.Tries;
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar);
|
||||
|
||||
var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create);
|
||||
var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create);
|
||||
|
||||
var xmlSer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
xmlSer.Serialize(xmlFs, sidecar);
|
||||
xmlFs.Close();
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -34,7 +35,6 @@ using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.DVD;
|
||||
using Aaru.Decryption;
|
||||
using Aaru.Decryption.DVD;
|
||||
using Schemas;
|
||||
using DVDDecryption = Aaru.Decryption.DVD.Dump;
|
||||
|
||||
// ReSharper disable JoinDeclarationAndInitializer
|
||||
@@ -62,7 +62,7 @@ partial class Dump
|
||||
/// <param name="newTrim">Set if we need to start a trim</param>
|
||||
/// <param name="dvdDecrypt">DVD CSS decryption module</param>
|
||||
/// <param name="discKey">The DVD disc key</param>
|
||||
void ReadSbcData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardwareType currentTry,
|
||||
void ReadSbcData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardware currentTry,
|
||||
ExtentsULong extents, ref double currentSpeed, ref double minSpeed, ref double maxSpeed,
|
||||
ref double totalDuration, Reader scsiReader, MhddLog mhddLog, IbgLog ibgLog,
|
||||
ref double imageWriteDuration, ref bool newTrim, ref DVDDecryption dvdDecrypt, byte[] discKey)
|
||||
|
||||
@@ -35,13 +35,14 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Graphics;
|
||||
@@ -52,11 +53,12 @@ using Aaru.Decoders.DVD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.SCSI.MMC;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using DeviceReport = Aaru.Core.Devices.Report.DeviceReport;
|
||||
using DVDDecryption = Aaru.Decryption.DVD.Dump;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
using Usb = Aaru.CommonTypes.AaruMetadata.Usb;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
// ReSharper disable JoinDeclarationAndInitializer
|
||||
@@ -369,8 +371,10 @@ partial class Dump
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead);
|
||||
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions);
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private,
|
||||
_dimensions);
|
||||
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
|
||||
bool imageCreated = false;
|
||||
|
||||
if(!opticalDisc)
|
||||
@@ -697,8 +701,8 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial,
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
@@ -1023,12 +1027,12 @@ partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputFormat.SetMetadata(metadata))
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputFormat.SetCicmMetadata(_preSidecar);
|
||||
outputFormat.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
@@ -1082,7 +1086,7 @@ partial class Dump
|
||||
_sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
CICMMetadataType sidecar = _sidecarClass.Create();
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
end = DateTime.UtcNow;
|
||||
|
||||
if(!_aborted)
|
||||
@@ -1103,8 +1107,8 @@ partial class Dump
|
||||
|
||||
if(_preSidecar != null)
|
||||
{
|
||||
_preSidecar.BlockMedia = sidecar.BlockMedia;
|
||||
sidecar = _preSidecar;
|
||||
_preSidecar.BlockMedias = sidecar.BlockMedias;
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
// All USB flash drives report as removable, even if the media is not removable
|
||||
@@ -1114,15 +1118,15 @@ partial class Dump
|
||||
if(_dev.IsUsb &&
|
||||
_dev.UsbDescriptors != null)
|
||||
if(outputFormat.SupportedMediaTags.Contains(MediaTagType.USB_Descriptors))
|
||||
sidecar.BlockMedia[0].USB = new USBType
|
||||
sidecar.BlockMedias[0].Usb = new Usb
|
||||
{
|
||||
ProductID = _dev.UsbProductId,
|
||||
VendorID = _dev.UsbVendorId,
|
||||
Descriptors = new DumpType
|
||||
Descriptors = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)_dev.UsbDescriptors.Length,
|
||||
Checksums = Checksum.GetChecksums(_dev.UsbDescriptors).ToArray()
|
||||
Checksums = Checksum.GetChecksums(_dev.UsbDescriptors)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1134,13 +1138,13 @@ partial class Dump
|
||||
|
||||
if(!sense)
|
||||
if(outputFormat.SupportedMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY))
|
||||
sidecar.BlockMedia[0].ATA = new ATAType
|
||||
sidecar.BlockMedias[0].ATA = new ATA
|
||||
{
|
||||
Identify = new DumpType
|
||||
Identify = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)cmdBuf.Length,
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray()
|
||||
Checksums = Checksum.GetChecksums(cmdBuf)
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1150,13 +1154,13 @@ partial class Dump
|
||||
if(!sense)
|
||||
{
|
||||
if(outputFormat.SupportedMediaTags.Contains(MediaTagType.SCSI_INQUIRY))
|
||||
sidecar.BlockMedia[0].SCSI = new SCSIType
|
||||
sidecar.BlockMedias[0].SCSI = new SCSI
|
||||
{
|
||||
Inquiry = new DumpType
|
||||
Inquiry = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)cmdBuf.Length,
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray()
|
||||
Checksums = Checksum.GetChecksums(cmdBuf)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1171,25 +1175,25 @@ partial class Dump
|
||||
|
||||
if(pages != null)
|
||||
{
|
||||
List<EVPDType> evpds = new List<EVPDType>();
|
||||
List<Evpd> evpds = new();
|
||||
foreach(byte page in pages)
|
||||
{
|
||||
dumpLog.WriteLine("Requesting page {0:X2}h.", page);
|
||||
sense = dev.ScsiInquiry(out cmdBuf, out _, page);
|
||||
if(sense) continue;
|
||||
|
||||
EVPDType evpd = new EVPDType
|
||||
Evpd evpd = new()
|
||||
{
|
||||
Image = $"{outputPrefix}.evpd_{page:X2}h.bin",
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray(),
|
||||
Checksums = Checksum.GetChecksums(cmdBuf),
|
||||
Size = cmdBuf.Length
|
||||
};
|
||||
evpd.Checksums = Checksum.GetChecksums(cmdBuf).ToArray();
|
||||
evpd.Checksums = Checksum.GetChecksums(cmdBuf);
|
||||
DataFile.WriteTo("SCSI Dump", evpd.Image, cmdBuf);
|
||||
evpds.Add(evpd);
|
||||
}
|
||||
|
||||
if(evpds.Count > 0) sidecar.BlockMedia[0].SCSI.EVPD = evpds.ToArray();
|
||||
if(evpds.Count > 0) sidecar.BlockMedias[0].SCSI.Evpds = evpds;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1209,11 +1213,11 @@ partial class Dump
|
||||
!_dev.Error)
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
if(outputFormat.SupportedMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10))
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
|
||||
sidecar.BlockMedias[0].SCSI.ModeSense10 = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)cmdBuf.Length,
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray()
|
||||
Checksums = Checksum.GetChecksums(cmdBuf)
|
||||
};
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6);
|
||||
@@ -1233,19 +1237,19 @@ partial class Dump
|
||||
!_dev.Error)
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
if(outputFormat.SupportedMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6))
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
|
||||
sidecar.BlockMedias[0].SCSI.ModeSense = new CommonTypes.AaruMetadata.Dump
|
||||
{
|
||||
Image = _outputPath,
|
||||
Size = (ulong)cmdBuf.Length,
|
||||
Checksums = Checksum.GetChecksums(cmdBuf).ToArray()
|
||||
Checksums = Checksum.GetChecksums(cmdBuf)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
|
||||
if(sidecar.BlockMedia[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation
|
||||
if(sidecar.BlockMedias[0].FileSystemInformation != null)
|
||||
filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation
|
||||
where partition.FileSystems != null
|
||||
from fileSystem in partition.FileSystems
|
||||
select (partition.StartSector, fileSystem.Type));
|
||||
@@ -1264,46 +1268,50 @@ partial class Dump
|
||||
filesystem.start);
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
|
||||
|
||||
(string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType);
|
||||
|
||||
sidecar.BlockMedia[0].DiskType = xmlType.type;
|
||||
sidecar.BlockMedia[0].DiskSubType = xmlType.subType;
|
||||
sidecar.BlockMedias[0].MediaType = xmlType.type;
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
|
||||
// TODO: Implement device firmware revision
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(_dev.Type == DeviceType.ATAPI)
|
||||
sidecar.BlockMedia[0].Interface = "ATAPI";
|
||||
sidecar.BlockMedias[0].Interface = "ATAPI";
|
||||
else if(_dev.IsUsb)
|
||||
sidecar.BlockMedia[0].Interface = "USB";
|
||||
sidecar.BlockMedias[0].Interface = "USB";
|
||||
else if(_dev.IsFireWire)
|
||||
sidecar.BlockMedia[0].Interface = "FireWire";
|
||||
sidecar.BlockMedias[0].Interface = "FireWire";
|
||||
else
|
||||
sidecar.BlockMedia[0].Interface = "SCSI";
|
||||
sidecar.BlockMedias[0].Interface = "SCSI";
|
||||
|
||||
sidecar.BlockMedia[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize;
|
||||
sidecar.BlockMedia[0].LogicalBlockSize = logicalBlockSize;
|
||||
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].Model = _dev.Model;
|
||||
sidecar.BlockMedias[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedias[0].PhysicalBlockSize = physicalBlockSize;
|
||||
sidecar.BlockMedias[0].LogicalBlockSize = logicalBlockSize;
|
||||
sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedias[0].Model = _dev.Model;
|
||||
|
||||
if(!_private)
|
||||
sidecar.BlockMedia[0].Serial = _dev.Serial;
|
||||
sidecar.BlockMedias[0].Serial = _dev.Serial;
|
||||
|
||||
sidecar.BlockMedia[0].Size = blocks * blockSize;
|
||||
sidecar.BlockMedias[0].Size = blocks * blockSize;
|
||||
|
||||
if(_dev.IsRemovable)
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray();
|
||||
sidecar.BlockMedias[0].DumpHardware = _resume.Tries;
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar);
|
||||
|
||||
var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create);
|
||||
var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create);
|
||||
|
||||
var xmlSer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
xmlSer.Serialize(xmlFs, sidecar);
|
||||
xmlFs.Close();
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -36,7 +37,6 @@ using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decryption;
|
||||
using Aaru.Decryption.DVD;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using DVDDecryption = Aaru.Decryption.DVD.Dump;
|
||||
|
||||
// ReSharper disable JoinDeclarationAndInitializer
|
||||
@@ -53,7 +53,7 @@ partial class Dump
|
||||
/// <param name="totalDuration">Total time spent in commands</param>
|
||||
/// <param name="scsiReader">SCSI reader</param>
|
||||
/// <param name="blankExtents">Blank extents</param>
|
||||
void RetrySbcData(Reader scsiReader, DumpHardwareType currentTry, ExtentsULong extents, ref double totalDuration,
|
||||
void RetrySbcData(Reader scsiReader, DumpHardware currentTry, ExtentsULong extents, ref double totalDuration,
|
||||
ExtentsULong blankExtents)
|
||||
{
|
||||
int pass = 1;
|
||||
@@ -326,7 +326,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
if(newBlank)
|
||||
_resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents);
|
||||
_resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents).ToArray();
|
||||
|
||||
EndProgress?.Invoke();
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Helpers;
|
||||
using Schemas;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
|
||||
@@ -35,7 +35,7 @@ partial class Dump
|
||||
/// <param name="imageWriteDuration">Total time spent writing to image</param>
|
||||
/// <param name="newTrim">Set if we need to start a trim</param>
|
||||
/// <param name="blankExtents">Blank extents</param>
|
||||
void ReadOpticalData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardwareType currentTry,
|
||||
void ReadOpticalData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardware currentTry,
|
||||
ExtentsULong extents, ref double currentSpeed, ref double minSpeed, ref double maxSpeed,
|
||||
ref double totalDuration, Reader scsiReader, MhddLog mhddLog, IbgLog ibgLog,
|
||||
ref double imageWriteDuration, ref bool newTrim, ref ExtentsULong blankExtents)
|
||||
@@ -148,7 +148,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
if(_resume != null && canMediumScan)
|
||||
_resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents);
|
||||
_resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents).ToArray();
|
||||
|
||||
EndProgress?.Invoke();
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
// ReSharper disable InlineOutVariableDeclaration
|
||||
// ReSharper disable TooWideLocalVariableScope
|
||||
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Schemas;
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping;
|
||||
|
||||
@@ -41,7 +41,7 @@ partial class Dump
|
||||
/// <param name="extents">Correctly dump extents</param>
|
||||
/// <param name="currentTry">Resume information</param>
|
||||
/// <param name="blankExtents">Blank extents</param>
|
||||
void TrimSbcData(Reader scsiReader, ExtentsULong extents, DumpHardwareType currentTry, ExtentsULong blankExtents)
|
||||
void TrimSbcData(Reader scsiReader, ExtentsULong extents, DumpHardware currentTry, ExtentsULong blankExtents)
|
||||
{
|
||||
ulong[] tmpArray = _resume.BadBlocks.ToArray();
|
||||
bool sense;
|
||||
@@ -95,6 +95,6 @@ partial class Dump
|
||||
}
|
||||
|
||||
if(newBlank)
|
||||
_resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents);
|
||||
_resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents).ToArray();
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
@@ -46,7 +48,6 @@ using Aaru.Core.Graphics;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.MMC;
|
||||
using Aaru.Decoders.SecureDigital;
|
||||
using Schemas;
|
||||
using CSD = Aaru.Decoders.MMC.CSD;
|
||||
using DeviceType = Aaru.CommonTypes.Enums.DeviceType;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
@@ -418,8 +419,8 @@ public partial class Dump
|
||||
if(_skip < blocksToRead)
|
||||
_skip = blocksToRead;
|
||||
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(true, false, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force);
|
||||
@@ -457,8 +458,10 @@ public partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions);
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sdProfile);
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private,
|
||||
_dimensions);
|
||||
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sdProfile);
|
||||
|
||||
ret = outputFormat.Create(_outputPath,
|
||||
_dev.Type == DeviceType.SecureDigital ? MediaType.SecureDigital : MediaType.MMC,
|
||||
@@ -867,12 +870,12 @@ public partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputFormat.SetMetadata(metadata))
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputFormat.SetCicmMetadata(_preSidecar);
|
||||
outputFormat.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
@@ -916,14 +919,14 @@ public partial class Dump
|
||||
_sidecarClass.UpdateProgressEvent2 += UpdateProgress2;
|
||||
_sidecarClass.EndProgressEvent2 += EndProgress2;
|
||||
_sidecarClass.UpdateStatusEvent += UpdateStatus;
|
||||
CICMMetadataType sidecar = _sidecarClass.Create();
|
||||
Metadata sidecar = _sidecarClass.Create();
|
||||
|
||||
if(!_aborted)
|
||||
{
|
||||
if(_preSidecar != null)
|
||||
{
|
||||
_preSidecar.BlockMedia = sidecar.BlockMedia;
|
||||
sidecar = _preSidecar;
|
||||
_preSidecar.BlockMedias = sidecar.BlockMedias;
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
end = DateTime.UtcNow;
|
||||
@@ -949,39 +952,43 @@ public partial class Dump
|
||||
case DeviceType.MMC:
|
||||
xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(MediaType.MMC);
|
||||
|
||||
sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.MMC);
|
||||
sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.MMC);
|
||||
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
CommonTypes.Metadata.MediaType.MediaTypeToString(MediaType.SecureDigital);
|
||||
|
||||
sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.SecureDigital);
|
||||
sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.SecureDigital);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].DiskType = xmlType.type;
|
||||
sidecar.BlockMedia[0].DiskSubType = xmlType.subType;
|
||||
sidecar.BlockMedias[0].MediaType = xmlType.type;
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
|
||||
// TODO: Implement device firmware revision
|
||||
sidecar.BlockMedia[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize > 0 ? physicalBlockSize : blockSize;
|
||||
sidecar.BlockMedia[0].LogicalBlockSize = blockSize;
|
||||
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].Model = _dev.Model;
|
||||
sidecar.BlockMedias[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedias[0].PhysicalBlockSize = physicalBlockSize > 0 ? physicalBlockSize : blockSize;
|
||||
sidecar.BlockMedias[0].LogicalBlockSize = blockSize;
|
||||
sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedias[0].Model = _dev.Model;
|
||||
|
||||
if(!_private)
|
||||
sidecar.BlockMedia[0].Serial = _dev.Serial;
|
||||
sidecar.BlockMedias[0].Serial = _dev.Serial;
|
||||
|
||||
sidecar.BlockMedia[0].Size = blocks * blockSize;
|
||||
sidecar.BlockMedias[0].Size = blocks * blockSize;
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar);
|
||||
|
||||
var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create);
|
||||
var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create);
|
||||
|
||||
var xmlSer = new XmlSerializer(typeof(CICMMetadataType));
|
||||
xmlSer.Serialize(xmlFs, sidecar);
|
||||
xmlFs.Close();
|
||||
JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
WriteIndented = true
|
||||
});
|
||||
|
||||
jsonFs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Interop;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Graphics;
|
||||
@@ -49,9 +49,10 @@ using Aaru.Decoders.DVD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.Xbox;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
using Device = Aaru.Devices.Remote.Device;
|
||||
using Layers = Aaru.CommonTypes.AaruMetadata.Layers;
|
||||
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
|
||||
using Track = Aaru.CommonTypes.Structs.Track;
|
||||
using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
@@ -498,8 +499,10 @@ partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead);
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
|
||||
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions);
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010);
|
||||
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private,
|
||||
_dimensions);
|
||||
|
||||
var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010);
|
||||
ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
|
||||
|
||||
// Cannot create image
|
||||
@@ -517,10 +520,10 @@ partial class Dump
|
||||
start = DateTime.UtcNow;
|
||||
double imageWriteDuration = 0;
|
||||
|
||||
double cmdDuration = 0;
|
||||
uint saveBlocksToRead = blocksToRead;
|
||||
DumpHardwareType currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
double cmdDuration = 0;
|
||||
uint saveBlocksToRead = blocksToRead;
|
||||
DumpHardware currentTry = null;
|
||||
ExtentsULong extents = null;
|
||||
|
||||
ResumeSupport.Process(true, true, totalSize, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force);
|
||||
@@ -1262,12 +1265,12 @@ partial class Dump
|
||||
ApplicationVersion = Version.GetVersion()
|
||||
};
|
||||
|
||||
if(!outputFormat.SetMetadata(metadata))
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
if(_preSidecar != null)
|
||||
outputFormat.SetCicmMetadata(_preSidecar);
|
||||
outputFormat.SetMetadata(_preSidecar);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Closing_output_file);
|
||||
UpdateStatus?.Invoke(Localization.Core.Closing_output_file);
|
||||
@@ -1292,16 +1295,16 @@ partial class Dump
|
||||
|
||||
if(_metadata)
|
||||
{
|
||||
var layers = new LayersType
|
||||
var layers = new Layers
|
||||
{
|
||||
type = LayersTypeType.OTP,
|
||||
typeSpecified = true,
|
||||
Sectors = new SectorsType[1]
|
||||
};
|
||||
|
||||
layers.Sectors[0] = new SectorsType
|
||||
{
|
||||
Value = layerBreak
|
||||
Type = LayerType.OTP,
|
||||
Sectors = new List<Sectors>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Value = layerBreak
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WriteOpticalSidecar(blockSize, blocks, dskType, layers, mediaTags, 1, out totalChkDuration, null);
|
||||
|
||||
Reference in New Issue
Block a user