mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Code cleanup.
This commit is contained in:
@@ -52,7 +52,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void AudioMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
static void AudioMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.AudioMedia = new[]
|
||||
@@ -62,12 +63,12 @@ namespace DiscImageChef.Core
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
offsetSpecified = true,
|
||||
Value = Path.GetFileName(imagePath)
|
||||
Value = Path.GetFileName(imagePath)
|
||||
},
|
||||
Size = fi.Length,
|
||||
Size = fi.Length,
|
||||
Sequence = new SequenceType {MediaTitle = image.Info.MediaTitle}
|
||||
}
|
||||
};
|
||||
@@ -75,12 +76,12 @@ namespace DiscImageChef.Core
|
||||
if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0)
|
||||
{
|
||||
sidecar.AudioMedia[0].Sequence.MediaSequence = image.Info.MediaSequence;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence;
|
||||
}
|
||||
else
|
||||
{
|
||||
sidecar.AudioMedia[0].Sequence.MediaSequence = 1;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = 1;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void BlockMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
static void BlockMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.BlockMedia = new[]
|
||||
@@ -70,7 +70,7 @@ namespace DiscImageChef.Core
|
||||
new BlockMediaType
|
||||
{
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
@@ -119,7 +119,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.PCMCIA_CIS:
|
||||
byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS);
|
||||
byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS);
|
||||
sidecar.BlockMedia[0].PCMCIA = new PCMCIAType
|
||||
{
|
||||
CIS = new DumpType {Checksums = Checksum.GetChecksums(cis).ToArray(), Size = cis.Length}
|
||||
@@ -150,7 +150,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product;
|
||||
sidecar.BlockMedia[0].PCMCIA.Compliance =
|
||||
sidecar.BlockMedia[0].PCMCIA.Compliance =
|
||||
$"{vers.MajorVersion}.{vers.MinorVersion}";
|
||||
sidecar.BlockMedia[0].PCMCIA.AdditionalInformation =
|
||||
vers.AdditionalInformation;
|
||||
@@ -236,7 +236,7 @@ namespace DiscImageChef.Core
|
||||
break;
|
||||
case MediaTagType.MMC_ExtendedCSD:
|
||||
if(sidecar.BlockMedia[0].MultiMediaCard == null)
|
||||
sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType();
|
||||
sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType();
|
||||
sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -245,8 +245,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.USB_Descriptors:
|
||||
if(sidecar.BlockMedia[0].USB == null)
|
||||
sidecar.BlockMedia[0].USB = new USBType();
|
||||
if(sidecar.BlockMedia[0].USB == null) sidecar.BlockMedia[0].USB = new USBType();
|
||||
sidecar.BlockMedia[0].USB.Descriptors = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -255,8 +254,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.SCSI_MODESENSE_6:
|
||||
if(sidecar.BlockMedia[0].SCSI == null)
|
||||
sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
if(sidecar.BlockMedia[0].SCSI == null) sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -265,8 +263,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.SCSI_MODESENSE_10:
|
||||
if(sidecar.BlockMedia[0].SCSI == null)
|
||||
sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
if(sidecar.BlockMedia[0].SCSI == null) sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -378,7 +375,7 @@ namespace DiscImageChef.Core
|
||||
else
|
||||
{
|
||||
sidecar.BlockMedia[0].FileSystemInformation[0] =
|
||||
new PartitionType {StartSector = 0, EndSector = (int)(image.Info.Sectors - 1)};
|
||||
new PartitionType {StartSector = 0, EndSector = (int)(image.Info.Sectors - 1)};
|
||||
|
||||
Partition wholePart = new Partition
|
||||
{
|
||||
@@ -575,8 +572,8 @@ namespace DiscImageChef.Core
|
||||
try { scpImage.Open(scpFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
|
||||
if(image.Info.Heads == 2 && scpImage.Header.heads == 0 || image.Info.Heads == 1 &&
|
||||
(scpImage.Header.heads == 1 || scpImage.Header.heads == 2))
|
||||
if(image.Info.Heads == 2 && scpImage.Header.heads == 0 || image.Info.Heads == 1 &&
|
||||
(scpImage.Header.heads == 1 || scpImage.Header.heads == 2))
|
||||
if(scpImage.Header.end + 1 >= image.Info.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> scpBlockTrackTypes = new List<BlockTrackType>();
|
||||
@@ -589,7 +586,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
Cylinder = t / image.Info.Heads,
|
||||
Head = t % image.Info.Heads,
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = scpImage.Format,
|
||||
Value = Path.GetFileName(scpFilePath),
|
||||
@@ -610,7 +607,7 @@ namespace DiscImageChef.Core
|
||||
if(scpImage.ScpTracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack))
|
||||
{
|
||||
byte[] trackContents =
|
||||
new byte[scpTrack.Entries.Last().dataOffset +
|
||||
new byte[scpTrack.Entries.Last().dataOffset +
|
||||
scpTrack.Entries.Last().trackLength - scpImage.Header.offsets[t] + 1];
|
||||
scpStream.Position = scpImage.Header.offsets[t];
|
||||
scpStream.Read(trackContents, 0, trackContents.Length);
|
||||
@@ -637,7 +634,7 @@ namespace DiscImageChef.Core
|
||||
#endregion
|
||||
|
||||
#region KryoFlux
|
||||
string kfFile = null;
|
||||
string kfFile = null;
|
||||
string basename = Path.Combine(Path.GetDirectoryName(imagePath),
|
||||
Path.GetFileNameWithoutExtension(imagePath));
|
||||
bool kfDir = false;
|
||||
@@ -651,10 +648,8 @@ namespace DiscImageChef.Core
|
||||
kfDir = true;
|
||||
}
|
||||
}
|
||||
else if(File.Exists(basename + "00.0.raw"))
|
||||
kfFile = basename + "00.0.raw";
|
||||
else if(File.Exists(basename + "00.1.raw"))
|
||||
kfFile = basename + "00.1.raw";
|
||||
else if(File.Exists(basename + "00.0.raw")) kfFile = basename + "00.0.raw";
|
||||
else if(File.Exists(basename + "00.1.raw")) kfFile = basename + "00.1.raw";
|
||||
|
||||
if(kfFile != null)
|
||||
{
|
||||
@@ -666,7 +661,7 @@ namespace DiscImageChef.Core
|
||||
try { kfImage.Open(kfFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
|
||||
if(kfImage.Info.Heads == image.Info.Heads)
|
||||
if(kfImage.Info.Heads == image.Info.Heads)
|
||||
if(kfImage.Info.Cylinders >= image.Info.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> kfBlockTrackTypes = new List<BlockTrackType>();
|
||||
@@ -679,14 +674,14 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
Cylinder = kvp.Key / image.Info.Heads,
|
||||
Head = kvp.Key % image.Info.Heads,
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = kfImage.Format,
|
||||
Value = kfDir
|
||||
? Path
|
||||
.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())),
|
||||
kvp.Value.GetFilename())
|
||||
: kvp.Value.GetFilename(),
|
||||
Value = kfDir
|
||||
? Path
|
||||
.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())),
|
||||
kvp.Value.GetFilename())
|
||||
: kvp.Value.GetFilename(),
|
||||
offset = 0
|
||||
}
|
||||
};
|
||||
@@ -703,7 +698,7 @@ namespace DiscImageChef.Core
|
||||
|
||||
Stream kfStream = kvp.Value.GetDataForkStream();
|
||||
byte[] trackContents = new byte[kfStream.Length];
|
||||
kfStream.Position = 0;
|
||||
kfStream.Position = 0;
|
||||
kfStream.Read(trackContents, 0, trackContents.Length);
|
||||
kfBlockTrackType.Size = trackContents.Length;
|
||||
kfBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray();
|
||||
@@ -741,7 +736,7 @@ namespace DiscImageChef.Core
|
||||
try { dfiImage.Open(dfiFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
|
||||
if(image.Info.Heads == dfiImage.Info.Heads)
|
||||
if(image.Info.Heads == dfiImage.Info.Heads)
|
||||
if(dfiImage.Info.Cylinders >= image.Info.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> dfiBlockTrackTypes = new List<BlockTrackType>();
|
||||
@@ -771,8 +766,8 @@ namespace DiscImageChef.Core
|
||||
dfiImage.TrackLengths.TryGetValue(t, out long length))
|
||||
{
|
||||
dfiBlockTrackType.Image.offset = offset;
|
||||
byte[] trackContents = new byte[length];
|
||||
dfiStream.Position = offset;
|
||||
byte[] trackContents = new byte[length];
|
||||
dfiStream.Position = offset;
|
||||
dfiStream.Read(trackContents, 0, trackContents.Length);
|
||||
dfiBlockTrackType.Size = trackContents.Length;
|
||||
dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray();
|
||||
|
||||
@@ -52,19 +52,25 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
new BlockMediaType
|
||||
{
|
||||
Image = new ImageType {format = "Directory", offsetSpecified = false, Value = folderName},
|
||||
Sequence = new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1},
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Directory",
|
||||
offsetSpecified = false,
|
||||
Value = folderName
|
||||
},
|
||||
Sequence =
|
||||
new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1},
|
||||
PhysicalBlockSize = blockSize,
|
||||
LogicalBlockSize = blockSize,
|
||||
LogicalBlockSize = blockSize,
|
||||
TapeInformation = new[]
|
||||
{
|
||||
new TapePartitionType
|
||||
{
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Directory",
|
||||
format = "Directory",
|
||||
offsetSpecified = false,
|
||||
Value = folderName
|
||||
Value = folderName
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,32 +78,32 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
};
|
||||
|
||||
long currentBlock = 0;
|
||||
long totalSize = 0;
|
||||
Checksum tapeWorker = new Checksum();
|
||||
List<TapeFileType> tapeFiles = new List<TapeFileType>();
|
||||
long currentBlock = 0;
|
||||
long totalSize = 0;
|
||||
Checksum tapeWorker = new Checksum();
|
||||
List<TapeFileType> tapeFiles = new List<TapeFileType>();
|
||||
|
||||
for(int i = 0; i < files.Count; i++)
|
||||
{
|
||||
FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read);
|
||||
Checksum fileWorker = new Checksum();
|
||||
FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read);
|
||||
Checksum fileWorker = new Checksum();
|
||||
TapeFileType tapeFile = new TapeFileType
|
||||
{
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Raw disk image (sector by sector copy)",
|
||||
offset = 0,
|
||||
Value = Path.GetFileName(files[i])
|
||||
Value = Path.GetFileName(files[i])
|
||||
},
|
||||
Size = fs.Length,
|
||||
BlockSize = blockSize,
|
||||
Size = fs.Length,
|
||||
BlockSize = blockSize,
|
||||
StartBlock = currentBlock,
|
||||
Sequence = i
|
||||
Sequence = i
|
||||
};
|
||||
|
||||
const uint SECTORS_TO_READ = 512;
|
||||
long sectors = fs.Length / blockSize;
|
||||
long doneSectors = 0;
|
||||
long sectors = fs.Length / blockSize;
|
||||
long doneSectors = 0;
|
||||
|
||||
InitProgress2();
|
||||
while(doneSectors < sectors)
|
||||
@@ -125,51 +131,51 @@ namespace DiscImageChef.Core
|
||||
tapeWorker.Update(sector);
|
||||
}
|
||||
|
||||
tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1;
|
||||
currentBlock += sectors;
|
||||
totalSize += fs.Length;
|
||||
tapeFile.Checksums = fileWorker.End().ToArray();
|
||||
tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1;
|
||||
currentBlock += sectors;
|
||||
totalSize += fs.Length;
|
||||
tapeFile.Checksums = fileWorker.End().ToArray();
|
||||
tapeFiles.Add(tapeFile);
|
||||
|
||||
EndProgress2();
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray();
|
||||
sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums;
|
||||
sidecar.BlockMedia[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].LogicalBlocks = currentBlock;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray();
|
||||
sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums;
|
||||
sidecar.BlockMedia[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].LogicalBlocks = currentBlock;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].Checksums = sidecar.BlockMedia[0].Checksums;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray();
|
||||
sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray();
|
||||
|
||||
// This is purely for convenience, as typically these kind of data represents QIC tapes
|
||||
if(blockSize == 512)
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Quarter-inch cartridge";
|
||||
|
||||
if(totalSize <= 20 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-11";
|
||||
else if(totalSize <= 40 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-40";
|
||||
else if(totalSize <= 60 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-24";
|
||||
else if(totalSize <= 80 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-80";
|
||||
else if(totalSize <= 120 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-120";
|
||||
else if(totalSize <= 150 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-150";
|
||||
else if(totalSize <= 320 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-320";
|
||||
else if(totalSize <= 340 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
|
||||
else if(totalSize <= 525 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-525";
|
||||
else if(totalSize <= 670 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
|
||||
else if(totalSize <= 1200 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
|
||||
else if(totalSize <= 1350 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
|
||||
if(totalSize <= 20 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-11";
|
||||
else if(totalSize <= 40 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-40";
|
||||
else if(totalSize <= 60 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-24";
|
||||
else if(totalSize <= 80 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-80";
|
||||
else if(totalSize <= 120 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-120";
|
||||
else if(totalSize <= 150 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-150";
|
||||
else if(totalSize <= 320 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-320";
|
||||
else if(totalSize <= 340 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
|
||||
else if(totalSize <= 525 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-525";
|
||||
else if(totalSize <= 670 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
|
||||
else if(totalSize <= 1200 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
|
||||
else if(totalSize <= 1350 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
|
||||
else if(totalSize <= (long)4000 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3095";
|
||||
else
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
public static partial class Sidecar
|
||||
{
|
||||
public static event InitProgressHandler InitProgressEvent;
|
||||
public static event UpdateProgressHandler UpdateProgressEvent;
|
||||
public static event EndProgressHandler EndProgressEvent;
|
||||
public static event InitProgressHandler2 InitProgressEvent2;
|
||||
public static event InitProgressHandler InitProgressEvent;
|
||||
public static event UpdateProgressHandler UpdateProgressEvent;
|
||||
public static event EndProgressHandler EndProgressEvent;
|
||||
public static event InitProgressHandler2 InitProgressEvent2;
|
||||
public static event UpdateProgressHandler2 UpdateProgressEvent2;
|
||||
public static event EndProgressHandler2 EndProgressEvent2;
|
||||
public static event UpdateStatusHandler UpdateStatusEvent;
|
||||
public static event EndProgressHandler2 EndProgressEvent2;
|
||||
public static event UpdateStatusHandler UpdateStatusEvent;
|
||||
|
||||
public static void InitProgress()
|
||||
{
|
||||
|
||||
@@ -44,19 +44,19 @@ namespace DiscImageChef.Core
|
||||
long m, s, f;
|
||||
if(lba >= -150)
|
||||
{
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
}
|
||||
else
|
||||
{
|
||||
m = (lba + 450150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150;
|
||||
m = (lba + 450150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150;
|
||||
}
|
||||
|
||||
return $"{m}:{s:D2}:{f:D2}";
|
||||
@@ -72,23 +72,23 @@ namespace DiscImageChef.Core
|
||||
long h, m, s, f;
|
||||
if(lba >= -150)
|
||||
{
|
||||
h = (lba + 150) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
h = (lba + 150) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = (lba + 450150 * 2) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 450150 * 2) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150 * 2) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150 * 2;
|
||||
h = (lba + 450150 * 2) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 450150 * 2) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150 * 2) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150 * 2;
|
||||
}
|
||||
|
||||
return string.Format("{3}:{0:D2}:{1:D2}:{2:D2}", m, s, f, h);
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void LinearMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
static void LinearMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.LinearMedia = new[]
|
||||
@@ -62,10 +63,10 @@ namespace DiscImageChef.Core
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
offsetSpecified = true,
|
||||
Value = Path.GetFileName(imagePath)
|
||||
Value = Path.GetFileName(imagePath)
|
||||
},
|
||||
Size = fi.Length
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void OpticalDisc(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
static void OpticalDisc(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.OpticalDisc = new[]
|
||||
@@ -70,7 +70,7 @@ namespace DiscImageChef.Core
|
||||
new OpticalDiscType
|
||||
{
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
@@ -228,7 +228,7 @@ namespace DiscImageChef.Core
|
||||
break;
|
||||
}
|
||||
|
||||
if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) dskType = MediaType.DVDRDL;
|
||||
if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) dskType = MediaType.DVDRDL;
|
||||
if(dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3)
|
||||
dskType = MediaType.DVDRWDL;
|
||||
if(dskType == MediaType.GOD && pfi.Value.DiscSize == DVDSize.OneTwenty)
|
||||
@@ -294,11 +294,11 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
new XboxSecuritySectorsType
|
||||
{
|
||||
RequestNumber = 0,
|
||||
RequestVersion = 1,
|
||||
RequestNumber = 0,
|
||||
RequestVersion = 1,
|
||||
SecuritySectors = new DumpType
|
||||
{
|
||||
Image = Path.GetFileName(imagePath),
|
||||
Image = Path.GetFileName(imagePath),
|
||||
Checksums =
|
||||
Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.Xbox_SecuritySector))
|
||||
.ToArray(),
|
||||
@@ -332,7 +332,7 @@ namespace DiscImageChef.Core
|
||||
|
||||
try
|
||||
{
|
||||
List<Session> sessions = image.Sessions;
|
||||
List<Session> sessions = image.Sessions;
|
||||
sidecar.OpticalDisc[0].Sessions = sessions?.Count ?? 1;
|
||||
}
|
||||
catch { sidecar.OpticalDisc[0].Sessions = 1; }
|
||||
@@ -350,7 +350,7 @@ namespace DiscImageChef.Core
|
||||
sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType);
|
||||
|
||||
InitProgress();
|
||||
|
||||
|
||||
UpdateStatus("Checking filesystems");
|
||||
List<Partition> partitions = Partitions.GetAll(image);
|
||||
Partitions.AddSchemesToStats(partitions);
|
||||
@@ -398,10 +398,10 @@ namespace DiscImageChef.Core
|
||||
break;
|
||||
}
|
||||
|
||||
xmlTrk.Sequence =
|
||||
xmlTrk.Sequence =
|
||||
new TrackSequenceType {Session = trk.TrackSession, TrackNumber = (int)trk.TrackSequence};
|
||||
xmlTrk.StartSector = (long)trk.TrackStartSector;
|
||||
xmlTrk.EndSector = (long)trk.TrackEndSector;
|
||||
xmlTrk.StartSector = (long)trk.TrackStartSector;
|
||||
xmlTrk.EndSector = (long)trk.TrackEndSector;
|
||||
|
||||
if(trk.Indexes != null && trk.Indexes.ContainsKey(0))
|
||||
if(trk.Indexes.TryGetValue(0, out ulong idx0))
|
||||
@@ -470,7 +470,7 @@ namespace DiscImageChef.Core
|
||||
(uint)xmlTrk.Sequence.TrackNumber);
|
||||
UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
doneSectors += sectors - doneSectors;
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
trkChkWorker.Update(sector);
|
||||
@@ -539,7 +539,7 @@ namespace DiscImageChef.Core
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
doneSectors += sectors - doneSectors;
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
subChkWorker.Update(sector);
|
||||
@@ -555,9 +555,10 @@ namespace DiscImageChef.Core
|
||||
// For fast debugging, skip checksum
|
||||
//skipChecksum:
|
||||
|
||||
List<Partition> trkPartitions =
|
||||
partitions.Where(p => p.Start >= trk.TrackStartSector && p.End <= trk.TrackEndSector).ToList();
|
||||
|
||||
List<Partition> trkPartitions = partitions
|
||||
.Where(p => p.Start >= trk.TrackStartSector &&
|
||||
p.End <= trk.TrackEndSector).ToList();
|
||||
|
||||
xmlTrk.FileSystemInformation = new PartitionType[1];
|
||||
if(trkPartitions.Count > 0)
|
||||
{
|
||||
@@ -672,7 +673,7 @@ namespace DiscImageChef.Core
|
||||
// All XGD3 all have the same number of blocks
|
||||
if(dskType == MediaType.XGD2 && sidecar.OpticalDisc[0].Track.Length == 1)
|
||||
{
|
||||
ulong blocks = (ulong)(sidecar.OpticalDisc[0].Track[0].EndSector -
|
||||
ulong blocks = (ulong)(sidecar.OpticalDisc[0].Track[0].EndSector -
|
||||
sidecar.OpticalDisc[0].Track[0].StartSector + 1);
|
||||
if(blocks == 25063 || // Locked (or non compatible drive)
|
||||
blocks == 4229664 || // Xtreme unlock
|
||||
@@ -699,7 +700,7 @@ namespace DiscImageChef.Core
|
||||
Model = image.Info.DriveModel,
|
||||
Firmware = image.Info.DriveFirmwareRevision,
|
||||
Serial = image.Info.DriveSerialNumber,
|
||||
Software = new SoftwareType
|
||||
Software = new SoftwareType
|
||||
{
|
||||
Name = image.Info.Application,
|
||||
Version = image.Info.ApplicationVersion
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace DiscImageChef.Core
|
||||
position += 1048576;
|
||||
}
|
||||
|
||||
data = new byte[fi.Length - position];
|
||||
data = new byte[fi.Length - position];
|
||||
fs.Read(data, 0, (int)(fi.Length - position));
|
||||
|
||||
UpdateProgress("Hashing image file byte {0} of {1}", position, fi.Length);
|
||||
|
||||
Reference in New Issue
Block a user