mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
🎨🎨🎨 Removed methods in images that only returned what's already in the ImageInfo structure.
This commit is contained in:
@@ -65,8 +65,8 @@ namespace DiscImageChef.Partitions
|
||||
// RISC OS always checks for the partition on 0. Afaik no emulator chains it.
|
||||
if(sectorOffset != 0) return false;
|
||||
|
||||
if(imagePlugin.GetSectorSize() > ADFS_SB_POS) sbSector = 0;
|
||||
else sbSector = ADFS_SB_POS / imagePlugin.GetSectorSize();
|
||||
if(imagePlugin.ImageInfo.SectorSize > ADFS_SB_POS) sbSector = 0;
|
||||
else sbSector = ADFS_SB_POS / imagePlugin.ImageInfo.SectorSize;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(sbSector);
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace DiscImageChef.Partitions
|
||||
int secCyl = bootBlock.discRecord.spt * heads;
|
||||
int mapSector = bootBlock.startCylinder * secCyl;
|
||||
|
||||
if((ulong)mapSector >= imagePlugin.GetSectors()) return false;
|
||||
if((ulong)mapSector >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] map = imagePlugin.ReadSector((ulong)mapSector);
|
||||
|
||||
|
||||
@@ -63,12 +63,12 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
uint sectorSize;
|
||||
|
||||
if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sectorSize = 2048;
|
||||
else sectorSize = imagePlugin.GetSectorSize();
|
||||
if(imagePlugin.ImageInfo.SectorSize == 2352 || imagePlugin.ImageInfo.SectorSize == 2448) sectorSize = 2048;
|
||||
else sectorSize = imagePlugin.ImageInfo.SectorSize;
|
||||
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false;
|
||||
if(sectorOffset + 2 >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] ddmSector = imagePlugin.ReadSector(sectorOffset);
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace DiscImageChef.Partitions
|
||||
Marshal.FreeHGlobal(lblPtr);
|
||||
|
||||
// Not much to check but...
|
||||
ulong deviceSectors = imagePlugin.GetSectors();
|
||||
ulong deviceSectors = imagePlugin.ImageInfo.Sectors;
|
||||
ulong deviceSizeAccordingToLabel = label.cylinders * label.heads * label.spt;
|
||||
if(label.operatingSystem > 4 || label.bootType > 5 || label.partitionCount > 8 ||
|
||||
deviceSizeAccordingToLabel > deviceSectors || label.firstDataBlock > deviceSectors) return false;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(imagePlugin.GetSectorSize() < 512) return false;
|
||||
if(imagePlugin.ImageInfo.SectorSize < 512) return false;
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
@@ -159,13 +159,13 @@ namespace DiscImageChef.Partitions
|
||||
case TypeMinix2:
|
||||
validTable = true;
|
||||
|
||||
if(table.entries[i].start <= imagePlugin.GetSectors())
|
||||
if(table.entries[i].start <= imagePlugin.ImageInfo.Sectors)
|
||||
{
|
||||
if(table.entries[i].start + table.entries[i].length > imagePlugin.GetSectors())
|
||||
if(table.entries[i].start + table.entries[i].length > imagePlugin.ImageInfo.Sectors)
|
||||
DicConsole.DebugWriteLine("Atari partition plugin",
|
||||
"WARNING: End of partition goes beyond device size");
|
||||
|
||||
ulong sectorSize = imagePlugin.GetSectorSize();
|
||||
ulong sectorSize = imagePlugin.ImageInfo.SectorSize;
|
||||
if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048;
|
||||
|
||||
byte[] partType = new byte[3];
|
||||
@@ -253,14 +253,14 @@ namespace DiscImageChef.Partitions
|
||||
extendedType != TypeMinix2) continue;
|
||||
|
||||
validTable = true;
|
||||
if(extendedTable.entries[j].start > imagePlugin.GetSectors()) continue;
|
||||
if(extendedTable.entries[j].start > imagePlugin.ImageInfo.Sectors) continue;
|
||||
|
||||
if(extendedTable.entries[j].start + extendedTable.entries[j].length >
|
||||
imagePlugin.GetSectors())
|
||||
imagePlugin.ImageInfo.Sectors)
|
||||
DicConsole.DebugWriteLine("Atari partition plugin",
|
||||
"WARNING: End of partition goes beyond device size");
|
||||
|
||||
ulong sectorSize = imagePlugin.GetSectorSize();
|
||||
ulong sectorSize = imagePlugin.ImageInfo.SectorSize;
|
||||
if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048;
|
||||
|
||||
byte[] partType = new byte[3];
|
||||
@@ -335,13 +335,13 @@ namespace DiscImageChef.Partitions
|
||||
type != TypeRAW && type != TypeNetBSD && type != TypeNetBSDSwap && type != TypeSysV &&
|
||||
type != TypeMac && type != TypeMinix && type != TypeMinix2) continue;
|
||||
|
||||
if(table.icdEntries[i].start > imagePlugin.GetSectors()) continue;
|
||||
if(table.icdEntries[i].start > imagePlugin.ImageInfo.Sectors) continue;
|
||||
|
||||
if(table.icdEntries[i].start + table.icdEntries[i].length > imagePlugin.GetSectors())
|
||||
if(table.icdEntries[i].start + table.icdEntries[i].length > imagePlugin.ImageInfo.Sectors)
|
||||
DicConsole.DebugWriteLine("Atari partition plugin",
|
||||
"WARNING: End of partition goes beyond device size");
|
||||
|
||||
ulong sectorSize = imagePlugin.GetSectorSize();
|
||||
ulong sectorSize = imagePlugin.ImageInfo.SectorSize;
|
||||
if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048;
|
||||
|
||||
byte[] partType = new byte[3];
|
||||
|
||||
@@ -60,15 +60,15 @@ namespace DiscImageChef.Partitions
|
||||
public override bool GetInformation(ImagePlugin imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
uint run = (MAX_LABEL_SIZE + labelOffsets.Last()) / imagePlugin.GetSectorSize();
|
||||
if((MAX_LABEL_SIZE + labelOffsets.Last()) % imagePlugin.GetSectorSize() > 0) run++;
|
||||
uint run = (MAX_LABEL_SIZE + labelOffsets.Last()) / imagePlugin.ImageInfo.SectorSize;
|
||||
if((MAX_LABEL_SIZE + labelOffsets.Last()) % imagePlugin.ImageInfo.SectorSize > 0) run++;
|
||||
|
||||
DiskLabel dl = new DiskLabel();
|
||||
bool found = false;
|
||||
|
||||
foreach(ulong location in labelLocations)
|
||||
{
|
||||
if(location + run + sectorOffset >= imagePlugin.GetSectors()) return false;
|
||||
if(location + run + sectorOffset >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] tmp = imagePlugin.ReadSectors(location + sectorOffset, run);
|
||||
foreach(uint offset in labelOffsets)
|
||||
@@ -141,9 +141,9 @@ namespace DiscImageChef.Partitions
|
||||
dl.d_partitions[i].p_fstype, fsTypeToString(dl.d_partitions[i].p_fstype));
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = dl.d_partitions[i].p_offset * dl.d_secsize / imagePlugin.GetSectorSize(),
|
||||
Start = dl.d_partitions[i].p_offset * dl.d_secsize / imagePlugin.ImageInfo.SectorSize,
|
||||
Offset = dl.d_partitions[i].p_offset * dl.d_secsize,
|
||||
Length = dl.d_partitions[i].p_size * dl.d_secsize / imagePlugin.GetSectorSize(),
|
||||
Length = dl.d_partitions[i].p_size * dl.d_secsize / imagePlugin.ImageInfo.SectorSize,
|
||||
Size = dl.d_partitions[i].p_size * dl.d_secsize,
|
||||
Type = fsTypeToString(dl.d_partitions[i].p_fstype),
|
||||
Sequence = counter,
|
||||
@@ -156,7 +156,7 @@ namespace DiscImageChef.Partitions
|
||||
if(addSectorOffset)
|
||||
{
|
||||
part.Start += sectorOffset;
|
||||
part.Offset += sectorOffset * imagePlugin.GetSectorSize();
|
||||
part.Offset += sectorOffset * imagePlugin.ImageInfo.SectorSize;
|
||||
}
|
||||
DicConsole.DebugWriteLine("BSD plugin", "part.start = {0}", part.Start);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "Adding it...");
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(31 + sectorOffset >= imagePlugin.GetSectors()) return false;
|
||||
if(31 + sectorOffset >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(31 + sectorOffset);
|
||||
if(sector.Length < 512) return false;
|
||||
|
||||
@@ -51,10 +51,10 @@ namespace DiscImageChef.Partitions
|
||||
public override bool GetInformation(ImagePlugin imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
uint nSectors = 2048 / imagePlugin.GetSectorSize();
|
||||
if(2048 % imagePlugin.GetSectorSize() > 0) nSectors++;
|
||||
uint nSectors = 2048 / imagePlugin.ImageInfo.SectorSize;
|
||||
if(2048 % imagePlugin.ImageInfo.SectorSize > 0) nSectors++;
|
||||
|
||||
if(sectorOffset + nSectors >= imagePlugin.GetSectors()) return false;
|
||||
if(sectorOffset + nSectors >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] sectors = imagePlugin.ReadSectors(sectorOffset, nSectors);
|
||||
if(sectors.Length < 2048) return false;
|
||||
@@ -72,10 +72,10 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = entry.p_boffset / imagePlugin.GetSectorSize() + sectorOffset,
|
||||
Offset = entry.p_boffset + sectorOffset * imagePlugin.GetSectorSize(),
|
||||
Start = entry.p_boffset / imagePlugin.ImageInfo.SectorSize + sectorOffset,
|
||||
Offset = entry.p_boffset + sectorOffset * imagePlugin.ImageInfo.SectorSize,
|
||||
Size = entry.p_bsize,
|
||||
Length = entry.p_bsize / imagePlugin.GetSectorSize(),
|
||||
Length = entry.p_bsize / imagePlugin.ImageInfo.SectorSize,
|
||||
Name = entry.p_stor_uuid.ToString(),
|
||||
Sequence = counter,
|
||||
Scheme = Name,
|
||||
@@ -84,7 +84,7 @@ namespace DiscImageChef.Partitions
|
||||
: BSD.fsTypeToString((BSD.fsType)entry.p_fstype)
|
||||
};
|
||||
|
||||
if(entry.p_bsize % imagePlugin.GetSectorSize() > 0) part.Length++;
|
||||
if(entry.p_bsize % imagePlugin.ImageInfo.SectorSize > 0) part.Length++;
|
||||
|
||||
if(entry.p_bsize <= 0 || entry.p_boffset <= 0) continue;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false;
|
||||
if(sectorOffset + 2 >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] hdrBytes = imagePlugin.ReadSector(1 + sectorOffset);
|
||||
GptHeader hdr;
|
||||
@@ -121,11 +121,11 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
divisor = 1;
|
||||
modulo = 0;
|
||||
sectorSize = imagePlugin.GetSectorSize();
|
||||
sectorSize = imagePlugin.ImageInfo.SectorSize;
|
||||
}
|
||||
|
||||
uint totalEntriesSectors = hdr.entries * hdr.entriesSize / imagePlugin.GetSectorSize();
|
||||
if(hdr.entries * hdr.entriesSize % imagePlugin.GetSectorSize() > 0) totalEntriesSectors++;
|
||||
uint totalEntriesSectors = hdr.entries * hdr.entriesSize / imagePlugin.ImageInfo.SectorSize;
|
||||
if(hdr.entries * hdr.entriesSize % imagePlugin.ImageInfo.SectorSize > 0) totalEntriesSectors++;
|
||||
|
||||
byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo);
|
||||
byte[] entriesBytes = new byte[temp.Length - modulo * 512];
|
||||
@@ -165,8 +165,8 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("GPT Plugin", "entry.attributes = 0x{0:X16}", entry.attributes);
|
||||
DicConsole.DebugWriteLine("GPT Plugin", "entry.name = {0}", entry.name);
|
||||
|
||||
if(entry.startLBA / divisor > imagePlugin.GetSectors() ||
|
||||
entry.endLBA / divisor > imagePlugin.GetSectors()) return false;
|
||||
if(entry.startLBA / divisor > imagePlugin.ImageInfo.Sectors ||
|
||||
entry.endLBA / divisor > imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
Partition part = new Partition
|
||||
{
|
||||
|
||||
@@ -57,11 +57,11 @@ namespace DiscImageChef.Partitions
|
||||
byte[] sector;
|
||||
ulong sectsPerUnit;
|
||||
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "sectorSize = {0}", imagePlugin.GetSectorSize());
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "sectorSize = {0}", imagePlugin.ImageInfo.SectorSize);
|
||||
|
||||
if(sectorOffset + 4 >= imagePlugin.GetSectors()) return false;
|
||||
if(sectorOffset + 4 >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
switch(imagePlugin.GetSectorSize())
|
||||
switch(imagePlugin.ImageInfo.SectorSize)
|
||||
{
|
||||
case 256:
|
||||
sector = imagePlugin.ReadSector(4 + sectorOffset);
|
||||
@@ -100,7 +100,7 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "entry.stateStart = {0}", entry.stateStart);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "entry.length = {0}", entry.length);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "sectsPerUnit = {0} {1}", sectsPerUnit,
|
||||
imagePlugin.GetSectorSize());
|
||||
imagePlugin.ImageInfo.SectorSize);
|
||||
|
||||
Partition part = new Partition
|
||||
{
|
||||
|
||||
@@ -196,9 +196,9 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(imagePlugin.GetSectorSize() < 512) return false;
|
||||
if(imagePlugin.ImageInfo.SectorSize < 512) return false;
|
||||
|
||||
uint sectorSize = imagePlugin.GetSectorSize();
|
||||
uint sectorSize = imagePlugin.ImageInfo.SectorSize;
|
||||
// Divider of sector size in MBR between real sector size
|
||||
ulong divider = 1;
|
||||
|
||||
@@ -300,14 +300,15 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
if(minix && lbaStart == sectorOffset) minix = false;
|
||||
|
||||
if(lbaStart > imagePlugin.GetSectors())
|
||||
if(lbaStart > imagePlugin.ImageInfo.Sectors)
|
||||
{
|
||||
valid = false;
|
||||
extended = false;
|
||||
}
|
||||
|
||||
// Some buggy implementations do some rounding errors getting a few sectors beyond device size
|
||||
if(lbaStart + lbaSectors > imagePlugin.GetSectors()) lbaSectors = imagePlugin.GetSectors() - lbaStart;
|
||||
if(lbaStart + lbaSectors > imagePlugin.ImageInfo.Sectors)
|
||||
lbaSectors = imagePlugin.ImageInfo.Sectors - lbaStart;
|
||||
|
||||
DicConsole.DebugWriteLine("MBR plugin", "entry.status {0}", entry.status);
|
||||
DicConsole.DebugWriteLine("MBR plugin", "entry.type {0}", entry.type);
|
||||
@@ -436,11 +437,11 @@ namespace DiscImageChef.Partitions
|
||||
}
|
||||
|
||||
extStart += lbaStart;
|
||||
extValid &= extStart <= imagePlugin.GetSectors();
|
||||
extValid &= extStart <= imagePlugin.ImageInfo.Sectors;
|
||||
|
||||
// Some buggy implementations do some rounding errors getting a few sectors beyond device size
|
||||
if(extStart + extSectors > imagePlugin.GetSectors())
|
||||
extSectors = imagePlugin.GetSectors() - extStart;
|
||||
if(extStart + extSectors > imagePlugin.ImageInfo.Sectors)
|
||||
extSectors = imagePlugin.ImageInfo.Sectors - extStart;
|
||||
|
||||
if(extValid && extMinix) // Let's mix the fun
|
||||
if(GetMinix(imagePlugin, lbaStart, divider, sectorOffset, sectorSize,
|
||||
@@ -473,7 +474,7 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
DicConsole.DebugWriteLine("MBR plugin", "next_start {0}", nextStart);
|
||||
processingExtended &= nextStart != 0;
|
||||
processingExtended &= nextStart <= imagePlugin.GetSectors();
|
||||
processingExtended &= nextStart <= imagePlugin.ImageInfo.Sectors;
|
||||
lbaStart = nextStart;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
uint sectorSize;
|
||||
|
||||
if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sectorSize = 2048;
|
||||
else sectorSize = imagePlugin.GetSectorSize();
|
||||
if(imagePlugin.ImageInfo.SectorSize == 2352 || imagePlugin.ImageInfo.SectorSize == 2448) sectorSize = 2048;
|
||||
else sectorSize = imagePlugin.ImageInfo.SectorSize;
|
||||
|
||||
partitions = new List<Partition>();
|
||||
|
||||
@@ -77,7 +77,8 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
ulong labelPosition = 0;
|
||||
|
||||
foreach(ulong i in new ulong[] {0, 4, 15, 16}.TakeWhile(i => i + sectorOffset < imagePlugin.GetSectors()))
|
||||
foreach(ulong i in
|
||||
new ulong[] {0, 4, 15, 16}.TakeWhile(i => i + sectorOffset < imagePlugin.ImageInfo.Sectors))
|
||||
{
|
||||
labelSector = imagePlugin.ReadSector(i + sectorOffset);
|
||||
uint magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00);
|
||||
|
||||
@@ -100,11 +100,11 @@ namespace DiscImageChef.Partitions
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
};
|
||||
part.Offset = part.Start * imagePlugin.GetSectorSize();
|
||||
part.Offset = part.Start * imagePlugin.ImageInfo.SectorSize;
|
||||
part.Length = CHS.ToLBA(entry.dp_ecyl, entry.dp_ehd, (uint)(entry.dp_esect + 1),
|
||||
imagePlugin.ImageInfo.Heads, imagePlugin.ImageInfo.SectorsPerTrack) -
|
||||
part.Start;
|
||||
part.Size = part.Length * imagePlugin.GetSectorSize();
|
||||
part.Size = part.Length * imagePlugin.ImageInfo.SectorSize;
|
||||
|
||||
DicConsole.DebugWriteLine("PC98 plugin", "part.Start = {0}", part.Start);
|
||||
DicConsole.DebugWriteLine("PC98 plugin", "part.Type = {0}", part.Type);
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false;
|
||||
if(sectorOffset + 2 >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(sectorOffset + 1);
|
||||
// While all of Plan9 is supposedly UTF-8, it uses ASCII strcmp for reading its partition table
|
||||
@@ -69,10 +69,10 @@ namespace DiscImageChef.Partitions
|
||||
Partition part = new Partition
|
||||
{
|
||||
Length = end - start + 1,
|
||||
Offset = (start + sectorOffset) * imagePlugin.GetSectorSize(),
|
||||
Offset = (start + sectorOffset) * imagePlugin.ImageInfo.SectorSize,
|
||||
Scheme = Name,
|
||||
Sequence = (ulong)partitions.Count,
|
||||
Size = (end - start + 1) * imagePlugin.GetSectorSize(),
|
||||
Size = (end - start + 1) * imagePlugin.ImageInfo.SectorSize,
|
||||
Start = start + sectorOffset,
|
||||
Type = tokens[1]
|
||||
};
|
||||
|
||||
@@ -290,9 +290,9 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
while(rdbBlock < 16)
|
||||
{
|
||||
if(imagePlugin.GetSectors() <= rdbBlock) return false;
|
||||
if(imagePlugin.ImageInfo.Sectors <= rdbBlock) return false;
|
||||
|
||||
if(rdbBlock + sectorOffset >= imagePlugin.GetSectors()) break;
|
||||
if(rdbBlock + sectorOffset >= imagePlugin.ImageInfo.Sectors) break;
|
||||
|
||||
byte[] tmpSector = imagePlugin.ReadSector(rdbBlock + sectorOffset);
|
||||
uint magic = BigEndianBitConverter.ToUInt32(tmpSector, 0);
|
||||
|
||||
@@ -121,9 +121,12 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = dvh.partitions[i].first_block * dvh.device_params.dp_secbytes / imagePlugin.GetSectorSize(),
|
||||
Start =
|
||||
dvh.partitions[i].first_block * dvh.device_params.dp_secbytes /
|
||||
imagePlugin.ImageInfo.SectorSize,
|
||||
Offset = dvh.partitions[i].first_block * dvh.device_params.dp_secbytes,
|
||||
Length = dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes / imagePlugin.GetSectorSize(),
|
||||
Length =
|
||||
dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes / imagePlugin.ImageInfo.SectorSize,
|
||||
Size = dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes,
|
||||
Type = TypeToString(dvh.partitions[i].type),
|
||||
Sequence = counter,
|
||||
|
||||
@@ -80,9 +80,9 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(imagePlugin.GetSectorSize() < 512) return false;
|
||||
if(imagePlugin.ImageInfo.SectorSize < 512) return false;
|
||||
|
||||
if(sectorOffset + 2 >= imagePlugin.GetSectors()) return false;
|
||||
if(sectorOffset + 2 >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
bool useDkl = false, useDkl8 = false, useDkl16 = false;
|
||||
|
||||
@@ -161,16 +161,17 @@ namespace DiscImageChef.Partitions
|
||||
Partition part = new Partition
|
||||
{
|
||||
Size = (ulong)dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length = (ulong)(dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.GetSectorSize()),
|
||||
Length =
|
||||
(ulong)(dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.ImageInfo.SectorSize),
|
||||
Sequence = (ulong)i,
|
||||
Offset =
|
||||
((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE,
|
||||
Start = ((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
|
||||
DK_LABEL_SIZE / imagePlugin.GetSectorSize(),
|
||||
DK_LABEL_SIZE / imagePlugin.ImageInfo.SectorSize,
|
||||
Type = "SunOS partition",
|
||||
Scheme = Name
|
||||
};
|
||||
if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors())
|
||||
if(part.Start < imagePlugin.ImageInfo.Sectors && part.End <= imagePlugin.ImageInfo.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
@@ -227,12 +228,13 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
Description = SunFlagsToString(dkl8.dkl_vtoc.v_part[i].p_flag),
|
||||
Size = (ulong)dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length = (ulong)(dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.GetSectorSize()),
|
||||
Length =
|
||||
(ulong)(dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.ImageInfo.SectorSize),
|
||||
Sequence = (ulong)i,
|
||||
Offset =
|
||||
((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE,
|
||||
Start = ((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
|
||||
DK_LABEL_SIZE / imagePlugin.GetSectorSize(),
|
||||
DK_LABEL_SIZE / imagePlugin.ImageInfo.SectorSize,
|
||||
Type = SunIdToString(dkl8.dkl_vtoc.v_part[i].p_tag),
|
||||
Scheme = Name
|
||||
};
|
||||
@@ -240,7 +242,7 @@ namespace DiscImageChef.Partitions
|
||||
part.Description +=
|
||||
$"\nPartition timestamped on {DateHandlers.UnixToDateTime(dkl8.dkl_vtoc.v_timestamp[i])}";
|
||||
|
||||
if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors())
|
||||
if(part.Start < imagePlugin.ImageInfo.Sectors && part.End <= imagePlugin.ImageInfo.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
@@ -295,19 +297,19 @@ namespace DiscImageChef.Partitions
|
||||
Size = (ulong)dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz,
|
||||
Length =
|
||||
(ulong)(dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz /
|
||||
imagePlugin.GetSectorSize()),
|
||||
imagePlugin.ImageInfo.SectorSize),
|
||||
Sequence = (ulong)i,
|
||||
Offset =
|
||||
((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz,
|
||||
Start = ((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) *
|
||||
dkl16.dkl_vtoc.v_sectorsz / imagePlugin.GetSectorSize(),
|
||||
dkl16.dkl_vtoc.v_sectorsz / imagePlugin.ImageInfo.SectorSize,
|
||||
Type = SunIdToString(dkl16.dkl_vtoc.v_part[i].p_tag),
|
||||
Scheme = Name
|
||||
};
|
||||
if(dkl16.dkl_vtoc.v_timestamp[i] != 0)
|
||||
part.Description +=
|
||||
$"\nPartition timestamped on {DateHandlers.UnixToDateTime(dkl16.dkl_vtoc.v_timestamp[i])}";
|
||||
if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors())
|
||||
if(part.Start < imagePlugin.ImageInfo.Sectors && part.End <= imagePlugin.ImageInfo.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ namespace DiscImageChef.Partitions
|
||||
bool magicFound = false;
|
||||
bool absolute = false;
|
||||
|
||||
foreach(ulong i in new ulong[] {0, 1, 8, 29}.TakeWhile(i => i + sectorOffset < imagePlugin.GetSectors()))
|
||||
foreach(ulong i in
|
||||
new ulong[] {0, 1, 8, 29}.TakeWhile(i => i + sectorOffset < imagePlugin.ImageInfo.Sectors))
|
||||
{
|
||||
pdsector = imagePlugin.ReadSector(i + sectorOffset);
|
||||
magic = BitConverter.ToUInt32(pdsector, 4);
|
||||
@@ -204,14 +205,14 @@ namespace DiscImageChef.Partitions
|
||||
if(!magicFound)
|
||||
{
|
||||
DicConsole.DebugWriteLine("VTOC plugin", "Searching for VTOC on relative byte {0}", pd.vtoc_ptr);
|
||||
ulong relSecPtr = pd.vtoc_ptr / imagePlugin.GetSectorSize();
|
||||
uint relSecOff = pd.vtoc_ptr % imagePlugin.GetSectorSize();
|
||||
uint secCount = (relSecOff + pd.vtoc_len) / imagePlugin.GetSectorSize();
|
||||
if((relSecOff + pd.vtoc_len) % imagePlugin.GetSectorSize() > 0) secCount++;
|
||||
ulong relSecPtr = pd.vtoc_ptr / imagePlugin.ImageInfo.SectorSize;
|
||||
uint relSecOff = pd.vtoc_ptr % imagePlugin.ImageInfo.SectorSize;
|
||||
uint secCount = (relSecOff + pd.vtoc_len) / imagePlugin.ImageInfo.SectorSize;
|
||||
if((relSecOff + pd.vtoc_len) % imagePlugin.ImageInfo.SectorSize > 0) secCount++;
|
||||
DicConsole.DebugWriteLine("VTOC plugin",
|
||||
"Going to read {0} sectors from sector {1}, getting VTOC from byte {2}",
|
||||
secCount, relSecPtr + sectorOffset, relSecOff);
|
||||
if(relSecPtr + sectorOffset + secCount >= imagePlugin.GetSectors())
|
||||
if(relSecPtr + sectorOffset + secCount >= imagePlugin.ImageInfo.Sectors)
|
||||
{
|
||||
DicConsole.DebugWriteLine("VTOC plugin", "Going to read past device size, aborting...");
|
||||
return false;
|
||||
@@ -330,8 +331,8 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = (ulong)(parts[i].p_start * bps) / imagePlugin.GetSectorSize(),
|
||||
Length = (ulong)(parts[i].p_size * bps) / imagePlugin.GetSectorSize(),
|
||||
Start = (ulong)(parts[i].p_start * bps) / imagePlugin.ImageInfo.SectorSize,
|
||||
Length = (ulong)(parts[i].p_size * bps) / imagePlugin.ImageInfo.SectorSize,
|
||||
Offset = (ulong)(parts[i].p_start * bps),
|
||||
Size = (ulong)(parts[i].p_size * bps),
|
||||
Sequence = (ulong)i,
|
||||
@@ -344,7 +345,7 @@ namespace DiscImageChef.Partitions
|
||||
if(!useOld && !absolute)
|
||||
{
|
||||
part.Start += sectorOffset;
|
||||
part.Offset += sectorOffset * imagePlugin.GetSectorSize();
|
||||
part.Offset += sectorOffset * imagePlugin.ImageInfo.SectorSize;
|
||||
}
|
||||
|
||||
if(parts[i].p_flag.HasFlag(pFlag.V_VALID)) info += " (valid)";
|
||||
@@ -356,7 +357,7 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
part.Description = "UNIX slice" + info + ".";
|
||||
|
||||
if(part.End < imagePlugin.GetSectors()) partitions.Add(part);
|
||||
if(part.End < imagePlugin.ImageInfo.Sectors) partitions.Add(part);
|
||||
}
|
||||
|
||||
return partitions.Count > 0;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(42 + sectorOffset >= imagePlugin.GetSectors()) return false;
|
||||
if(42 + sectorOffset >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
|
||||
byte[] tblsector = imagePlugin.ReadSector(42 + sectorOffset);
|
||||
|
||||
@@ -80,19 +80,19 @@ namespace DiscImageChef.Partitions
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start =
|
||||
(ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) / imagePlugin.GetSectorSize() +
|
||||
(ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) / imagePlugin.ImageInfo.SectorSize +
|
||||
sectorOffset,
|
||||
Length = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE) / imagePlugin.GetSectorSize(),
|
||||
Length = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE) / imagePlugin.ImageInfo.SectorSize,
|
||||
Offset =
|
||||
(ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) +
|
||||
imagePlugin.GetSectorSize() * sectorOffset,
|
||||
imagePlugin.ImageInfo.SectorSize * sectorOffset,
|
||||
Size = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE),
|
||||
Sequence = (ulong)i,
|
||||
Type = "XENIX",
|
||||
Scheme = Name
|
||||
};
|
||||
|
||||
if(part.End < imagePlugin.GetSectors()) partitions.Add(part);
|
||||
if(part.End < imagePlugin.ImageInfo.Sectors) partitions.Add(part);
|
||||
}
|
||||
|
||||
return partitions.Count > 0;
|
||||
|
||||
Reference in New Issue
Block a user