mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General code refactor and reformat.
This commit is contained in:
@@ -174,10 +174,8 @@ namespace DiscImageChef.DiscImages
|
||||
WriteEcc(address, data, 52, 43, 86, 88, ref ecc, addressOffset, dataOffset, eccOffset + 0xAC); // Q
|
||||
}
|
||||
|
||||
static (byte minute, byte second, byte frame) LbaToMsf(long pos)
|
||||
{
|
||||
return ((byte)((pos + 150) / 75 / 60), (byte)((pos + 150) / 75 % 60), (byte)((pos + 150) % 75));
|
||||
}
|
||||
static (byte minute, byte second, byte frame) LbaToMsf(long pos) =>
|
||||
((byte)((pos + 150) / 75 / 60), (byte)((pos + 150) / 75 % 60), (byte)((pos + 150) % 75));
|
||||
|
||||
void ReconstructPrefix(ref byte[] sector, // must point to a full 2352-byte sector
|
||||
TrackType type, long lba)
|
||||
|
||||
@@ -130,7 +130,8 @@ namespace DiscImageChef.DiscImages
|
||||
Md5Context md5Provider;
|
||||
/// <summary>Cache of media tags.</summary>
|
||||
Dictionary<MediaTagType, byte[]> mediaTags;
|
||||
bool nocompress;
|
||||
byte[] mode2Subheaders;
|
||||
bool nocompress;
|
||||
/// <summary>If DDT is on-disk, this is the image stream offset at which it starts.</summary>
|
||||
long outMemoryDdtPosition;
|
||||
bool rewinded;
|
||||
@@ -161,7 +162,6 @@ namespace DiscImageChef.DiscImages
|
||||
ulong[] userDataDdt;
|
||||
bool writingLong;
|
||||
ulong writtenSectors;
|
||||
byte[] mode2Subheaders;
|
||||
|
||||
public DiscImageChef()
|
||||
{
|
||||
|
||||
@@ -61,20 +61,20 @@ namespace DiscImageChef.DiscImages
|
||||
new[]
|
||||
{
|
||||
("sectors_per_block", typeof(uint),
|
||||
"How many sectors to store per block (will be rounded to next power of two)", 4096U),
|
||||
"How many sectors to store per block (will be rounded to next power of two)", 4096U),
|
||||
("dictionary", typeof(uint), "Size, in bytes, of the LZMA dictionary", (uint)(1 << 25)),
|
||||
("max_ddt_size", typeof(uint),
|
||||
"Maximum size, in mebibytes, for in-memory DDT. If image needs a bigger one, it will be on-disk",
|
||||
256U),
|
||||
"Maximum size, in mebibytes, for in-memory DDT. If image needs a bigger one, it will be on-disk",
|
||||
256U),
|
||||
("md5", typeof(bool), "Calculate and store MD5 of image's user data", (object)false),
|
||||
("sha1", typeof(bool), "Calculate and store SHA1 of image's user data", (object)false),
|
||||
("sha256", typeof(bool), "Calculate and store SHA256 of image's user data", (object)false),
|
||||
("spamsum", typeof(bool), "Calculate and store SpamSum of image's user data", (object)false),
|
||||
("deduplicate", typeof(bool),
|
||||
"Store only unique sectors. This consumes more memory and is slower, but it's enabled by default",
|
||||
(object)true),
|
||||
"Store only unique sectors. This consumes more memory and is slower, but it's enabled by default",
|
||||
(object)true),
|
||||
("nocompress", typeof(bool),
|
||||
"Don't compress user data blocks. Other blocks will still be compressed", (object)false)
|
||||
"Don't compress user data blocks. Other blocks will still be compressed", (object)false)
|
||||
};
|
||||
public IEnumerable<string> KnownExtensions => new[] {".dicf"};
|
||||
public bool IsWriting { get; private set; }
|
||||
|
||||
@@ -732,8 +732,7 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
DumpHardwareType dump = new DumpHardwareType
|
||||
{
|
||||
Software = new SoftwareType(),
|
||||
Extents = new ExtentType[dumpEntry.extents]
|
||||
Software = new SoftwareType(), Extents = new ExtentType[dumpEntry.extents]
|
||||
};
|
||||
|
||||
byte[] tmp;
|
||||
@@ -808,8 +807,7 @@ namespace DiscImageChef.DiscImages
|
||||
imageStream.Read(tmp, 0, tmp.Length);
|
||||
dump.Extents[j] = new ExtentType
|
||||
{
|
||||
Start = BitConverter.ToUInt64(tmp, 0),
|
||||
End = BitConverter.ToUInt64(tmp, 8)
|
||||
Start = BitConverter.ToUInt64(tmp, 0), End = BitConverter.ToUInt64(tmp, 8)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -879,8 +877,9 @@ namespace DiscImageChef.DiscImages
|
||||
SessionSequence = (ushort)i,
|
||||
StartTrack = Tracks.Where(t => t.TrackSession == i).Min(t => t.TrackSequence),
|
||||
EndTrack = Tracks.Where(t => t.TrackSession == i).Max(t => t.TrackSequence),
|
||||
StartSector = Tracks.Where(t => t.TrackSession == i).Min(t => t.TrackStartSector),
|
||||
EndSector = Tracks.Where(t => t.TrackSession == i).Max(t => t.TrackEndSector)
|
||||
StartSector =
|
||||
Tracks.Where(t => t.TrackSession == i).Min(t => t.TrackStartSector),
|
||||
EndSector = Tracks.Where(t => t.TrackSession == i).Max(t => t.TrackEndSector)
|
||||
});
|
||||
|
||||
ulong currentTrackOffset = 0;
|
||||
@@ -895,7 +894,7 @@ namespace DiscImageChef.DiscImages
|
||||
Offset = currentTrackOffset,
|
||||
Start = track.TrackStartSector,
|
||||
Size = (track.TrackEndSector - track.TrackStartSector + 1) *
|
||||
(ulong)track.TrackBytesPerSector,
|
||||
(ulong)track.TrackBytesPerSector,
|
||||
Length = track.TrackEndSector - track.TrackStartSector + 1,
|
||||
Scheme = "Optical disc track"
|
||||
});
|
||||
@@ -1033,10 +1032,7 @@ namespace DiscImageChef.DiscImages
|
||||
return sector;
|
||||
}
|
||||
|
||||
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag)
|
||||
{
|
||||
return ReadSectorsTag(sectorAddress, 1, tag);
|
||||
}
|
||||
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => ReadSectorsTag(sectorAddress, 1, tag);
|
||||
|
||||
public byte[] ReadSector(ulong sectorAddress, uint track)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user