* CICMMetadata:

Updated metadata.

	* DiscImageChef.Core/Sidecar.cs:
	  On block media, calculate checksum of contents not only of
	disk image.
This commit is contained in:
2017-06-20 06:13:38 +01:00
parent 92d34eef55
commit c25cc90c46
2 changed files with 45 additions and 3 deletions

View File

@@ -340,7 +340,6 @@ namespace DiscImageChef.Core
InitProgress();
foreach(Track trk in tracks)
{
UpdateProgress("Track {0} of {1}", trk.TrackSequence, tracks.Count);
Schemas.TrackType xmlTrk = new Schemas.TrackType();
switch(trk.TrackType)
{
@@ -422,12 +421,14 @@ namespace DiscImageChef.Core
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(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;
}
else
{
UpdateProgress("Track {0} of {1}", trk.TrackSequence, tracks.Count);
// For fast debugging, skip checksum
//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;
Metadata.MediaType.MediaTypeToString(image.ImageInfo.mediaType, out dskType, out dskSubType);
sidecar.BlockMedia[0].DiskType = dskType;