mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
* CICMMetadata:
Updated metadata. * DiscImageChef.Core/Sidecar.cs: On block media, calculate checksum of contents not only of disk image.
This commit is contained in:
Submodule CICMMetadata updated: 18665665e4...8efa10e1e4
@@ -340,7 +340,6 @@ namespace DiscImageChef.Core
|
|||||||
InitProgress();
|
InitProgress();
|
||||||
foreach(Track trk in tracks)
|
foreach(Track trk in tracks)
|
||||||
{
|
{
|
||||||
UpdateProgress("Track {0} of {1}", trk.TrackSequence, tracks.Count);
|
|
||||||
Schemas.TrackType xmlTrk = new Schemas.TrackType();
|
Schemas.TrackType xmlTrk = new Schemas.TrackType();
|
||||||
switch(trk.TrackType)
|
switch(trk.TrackType)
|
||||||
{
|
{
|
||||||
@@ -422,12 +421,14 @@ namespace DiscImageChef.Core
|
|||||||
ulong doneSectors = 0;
|
ulong doneSectors = 0;
|
||||||
|
|
||||||
// If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum.
|
// If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum.
|
||||||
if(tracks.Count == 1 && xmlTrk.Image.Value == sidecar.OpticalDisc[0].Image.Value)
|
if(image.PluginUUID == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
|
||||||
{
|
{
|
||||||
xmlTrk.Checksums = sidecar.OpticalDisc[0].Checksums;
|
xmlTrk.Checksums = sidecar.OpticalDisc[0].Checksums;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
UpdateProgress("Track {0} of {1}", trk.TrackSequence, tracks.Count);
|
||||||
|
|
||||||
// For fast debugging, skip checksum
|
// For fast debugging, skip checksum
|
||||||
//goto skipChecksum;
|
//goto skipChecksum;
|
||||||
|
|
||||||
@@ -784,6 +785,47 @@ namespace DiscImageChef.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum.
|
||||||
|
if(image.PluginUUID == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
|
||||||
|
{
|
||||||
|
sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Checksum contentChkWorker = new Checksum();
|
||||||
|
|
||||||
|
uint sectorsToRead = 512;
|
||||||
|
ulong sectors = image.GetSectors();
|
||||||
|
ulong doneSectors = 0;
|
||||||
|
|
||||||
|
InitProgress2();
|
||||||
|
while(doneSectors < sectors)
|
||||||
|
{
|
||||||
|
byte[] sector;
|
||||||
|
|
||||||
|
if((sectors - doneSectors) >= sectorsToRead)
|
||||||
|
{
|
||||||
|
sector = image.ReadSectors(doneSectors, sectorsToRead);
|
||||||
|
UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, (long)sectors);
|
||||||
|
doneSectors += sectorsToRead;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sector = image.ReadSectors(doneSectors, (uint)(sectors - doneSectors));
|
||||||
|
UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, (long)sectors);
|
||||||
|
doneSectors += (sectors - doneSectors);
|
||||||
|
}
|
||||||
|
|
||||||
|
contentChkWorker.Update(sector);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ChecksumType> cntChecksums = contentChkWorker.End();
|
||||||
|
|
||||||
|
sidecar.BlockMedia[0].ContentChecksums = cntChecksums.ToArray();
|
||||||
|
|
||||||
|
EndProgress2();
|
||||||
|
}
|
||||||
|
|
||||||
string dskType, dskSubType;
|
string dskType, dskSubType;
|
||||||
Metadata.MediaType.MediaTypeToString(image.ImageInfo.mediaType, out dskType, out dskSubType);
|
Metadata.MediaType.MediaTypeToString(image.ImageInfo.mediaType, out dskType, out dskSubType);
|
||||||
sidecar.BlockMedia[0].DiskType = dskType;
|
sidecar.BlockMedia[0].DiskType = dskType;
|
||||||
|
|||||||
Reference in New Issue
Block a user