mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Redo Reformat and cleanup.
Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted. This is now done with Rider-stable.
This commit is contained in:
@@ -99,8 +99,7 @@ public sealed class Acorn : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(sbSector, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return;
|
||||
|
||||
AcornBootBlock bootBlock = Marshal.ByteArrayToStructureLittleEndian<AcornBootBlock>(sector);
|
||||
@@ -165,8 +164,7 @@ public sealed class Acorn : IPartition
|
||||
|
||||
part.Offset = part.Start * (ulong)sector.Length;
|
||||
|
||||
if(entry.magic != LINUX_MAGIC &&
|
||||
entry.magic != SWAP_MAGIC)
|
||||
if(entry.magic != LINUX_MAGIC && entry.magic != SWAP_MAGIC)
|
||||
continue;
|
||||
|
||||
partitions.Add(part);
|
||||
@@ -218,8 +216,7 @@ public sealed class Acorn : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(0, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return;
|
||||
|
||||
uint icsSum = 0x50617274;
|
||||
@@ -273,11 +270,8 @@ public sealed class Acorn : IPartition
|
||||
Start = entry.start,
|
||||
Length = (ulong)(entry.size * -1),
|
||||
Size = (ulong)(entry.size * -1 * sector.Length),
|
||||
Type = sector[9] == 'N'
|
||||
? Localization.Linux
|
||||
: sector[9] == 'S'
|
||||
? Localization.Linux_swap
|
||||
: Localization.Unknown_partition_type,
|
||||
Type = sector[9] == 'N' ? Localization.Linux :
|
||||
sector[9] == 'S' ? Localization.Linux_swap : Localization.Unknown_partition_type,
|
||||
Sequence = counter,
|
||||
Scheme = "ICS"
|
||||
};
|
||||
|
||||
@@ -128,14 +128,11 @@ public sealed class AppleMap : IPartition
|
||||
Array.Copy(ddmSector, 18 + i * 8, tmp, 0, 8);
|
||||
ddm.sbMap[i] = Marshal.ByteArrayToStructureBigEndian<AppleDriverEntry>(tmp);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "ddm.sbMap[{1}].ddBlock = {0}", ddm.sbMap[i].ddBlock,
|
||||
i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "ddm.sbMap[{1}].ddBlock = {0}", ddm.sbMap[i].ddBlock, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "ddm.sbMap[{1}].ddSize = {0}", ddm.sbMap[i].ddSize,
|
||||
i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "ddm.sbMap[{1}].ddSize = {0}", ddm.sbMap[i].ddSize, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "ddm.sbMap[{1}].ddType = {0}", ddm.sbMap[i].ddType,
|
||||
i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "ddm.sbMap[{1}].ddType = {0}", ddm.sbMap[i].ddType, i);
|
||||
|
||||
if(ddm.sbMap[i].ddSize == 0)
|
||||
continue;
|
||||
@@ -304,14 +301,12 @@ public sealed class AppleMap : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].type = \"{1}\"", i,
|
||||
StringHandlers.CToString(entry.type));
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].first_data_block = {1}", i,
|
||||
entry.first_data_block);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].first_data_block = {1}", i, entry.first_data_block);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].data_sectors = {1}", i, entry.data_sectors);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].flags = {1}", i, (AppleMapFlags)entry.flags);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].first_boot_block = {1}", i,
|
||||
entry.first_boot_block);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].first_boot_block = {1}", i, entry.first_boot_block);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dpme[{0}].boot_size = {1}", i, entry.boot_size);
|
||||
|
||||
@@ -332,8 +327,7 @@ public sealed class AppleMap : IPartition
|
||||
|
||||
// BeOS doesn't mark its partitions as valid
|
||||
//if(flags.HasFlag(AppleMapFlags.Valid) &&
|
||||
if(StringHandlers.CToString(entry.type) == "Apple_partition_map" ||
|
||||
entry.sectors <= 0)
|
||||
if(StringHandlers.CToString(entry.type) == "Apple_partition_map" || entry.sectors <= 0)
|
||||
continue;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
@@ -387,8 +381,7 @@ public sealed class AppleMap : IPartition
|
||||
|
||||
partition.Description = sb.ToString();
|
||||
|
||||
if(partition.Start < imagePlugin.Info.Sectors &&
|
||||
partition.End < imagePlugin.Info.Sectors)
|
||||
if(partition.Start < imagePlugin.Info.Sectors && partition.End < imagePlugin.Info.Sectors)
|
||||
{
|
||||
partitions.Add(partition);
|
||||
sequence++;
|
||||
|
||||
@@ -46,8 +46,11 @@ namespace Aaru.Partitions;
|
||||
/// <summary>Implements decoding of Apricot partitions</summary>
|
||||
public sealed class Apricot : IPartition
|
||||
{
|
||||
const string MODULE_NAME = "Apricot partitions plugin";
|
||||
readonly int[] _baudRates = { 50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200 };
|
||||
const string MODULE_NAME = "Apricot partitions plugin";
|
||||
readonly int[] _baudRates =
|
||||
{
|
||||
50, 75, 110, 134, 150, 300, 600, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200
|
||||
};
|
||||
readonly string[] _bootTypeCodes =
|
||||
{
|
||||
Localization.Non_bootable, Localization.Apricot_XI_RAM_BIOS, Localization.Generic_ROM_BIOS,
|
||||
@@ -57,8 +60,14 @@ public sealed class Apricot : IPartition
|
||||
{
|
||||
Localization.MF1DD_70_track, "MF1DD", "MF2DD", "Winchester 5M", "Winchester 10M", "Winchester 20M"
|
||||
};
|
||||
readonly int[] _lineModes = { 256, 200 };
|
||||
readonly int[] _lineWidths = { 80, 40 };
|
||||
readonly int[] _lineModes =
|
||||
{
|
||||
256, 200
|
||||
};
|
||||
readonly int[] _lineWidths =
|
||||
{
|
||||
80, 40
|
||||
};
|
||||
readonly string[] _operatingSystemCodes =
|
||||
{
|
||||
Localization.Invalid_operating_system, "MS-DOS", "UCSD Pascal", Localization.CPM, "Concurrent CP/M"
|
||||
@@ -68,8 +77,14 @@ public sealed class Apricot : IPartition
|
||||
Localization.None_parity, Localization.Odd_parity, Localization.Even_parity, Localization.Mark_parity,
|
||||
Localization.Space_parity
|
||||
};
|
||||
readonly string[] _printDevices = { Localization.Parallel_print_device, Localization.Serial_print_device };
|
||||
readonly double[] _stopBits = { 1, 1.5, 2 };
|
||||
readonly string[] _printDevices =
|
||||
{
|
||||
Localization.Parallel_print_device, Localization.Serial_print_device
|
||||
};
|
||||
readonly double[] _stopBits =
|
||||
{
|
||||
1, 1.5, 2
|
||||
};
|
||||
|
||||
#region IPartition Members
|
||||
|
||||
@@ -93,8 +108,7 @@ public sealed class Apricot : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(0, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return false;
|
||||
|
||||
Label label = Marshal.ByteArrayToStructureLittleEndian<Label>(sector);
|
||||
@@ -110,8 +124,7 @@ public sealed class Apricot : IPartition
|
||||
label.firstDataBlock > deviceSectors)
|
||||
return false;
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.version = \"{0}\"",
|
||||
StringHandlers.CToString(label.version));
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.version = \"{0}\"", StringHandlers.CToString(label.version));
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.operatingSystem = {0} ({1})", label.operatingSystem,
|
||||
label.operatingSystem < _operatingSystemCodes.Length
|
||||
@@ -138,8 +151,8 @@ public sealed class Apricot : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.bootSize = {0}", label.bootSize);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.bootAddress = 0x{0:X8}", label.bootAddress);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.bootOffset:label.bootSegment = {0:X4}:{1:X4}",
|
||||
label.bootOffset, label.bootSegment);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.bootOffset:label.bootSegment = {0:X4}:{1:X4}", label.bootOffset,
|
||||
label.bootSegment);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.firstDataBlock = {0}", label.firstDataBlock);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.generation = {0}", label.generation);
|
||||
@@ -152,8 +165,7 @@ public sealed class Apricot : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partNumber = \"{0}\"",
|
||||
StringHandlers.CToString(label.partNumber));
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.copyright = \"{0}\"",
|
||||
StringHandlers.CToString(label.copyright));
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.copyright = \"{0}\"", StringHandlers.CToString(label.copyright));
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.mainBPB.bps = {0}", label.mainBPB.bps);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.mainBPB.spc = {0}", label.mainBPB.spc);
|
||||
@@ -171,8 +183,7 @@ public sealed class Apricot : IPartition
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.mainBPB.startSector = {0}", label.mainBPB.startSector);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.fontName = \"{0}\"",
|
||||
StringHandlers.CToString(label.fontName));
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.fontName = \"{0}\"", StringHandlers.CToString(label.fontName));
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.keyboardName = \"{0}\"",
|
||||
StringHandlers.CToString(label.keyboardName));
|
||||
@@ -247,8 +258,7 @@ public sealed class Apricot : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.nullsAfterFF = {0}", label.nullsAfterFF);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.lfAfterCRSerial = {0}", label.lfAfterCRSerial);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.biosErrorReportSerial = {0}",
|
||||
label.biosErrorReportSerial);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.biosErrorReportSerial = {0}", label.biosErrorReportSerial);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.spareSerial is null? = {0}",
|
||||
ArrayHelpers.ArrayIsNullOrEmpty(label.spareSerial));
|
||||
@@ -258,8 +268,7 @@ public sealed class Apricot : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.paperEmpty = {0}", label.paperEmpty);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.faultLine = {0}", label.faultLine);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.biosErrorReportParallel = {0}",
|
||||
label.biosErrorReportParallel);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.biosErrorReportParallel = {0}", label.biosErrorReportParallel);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.spareParallel is null? = {0}",
|
||||
ArrayHelpers.ArrayIsNullOrEmpty(label.spareParallel));
|
||||
@@ -278,29 +287,25 @@ public sealed class Apricot : IPartition
|
||||
|
||||
for(var i = 0; i < 8; i++)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].bps = {0}", label.partitions[i].bps,
|
||||
i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].bps = {0}", label.partitions[i].bps, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].spc = {0}", label.partitions[i].spc,
|
||||
i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].spc = {0}", label.partitions[i].spc, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].rsectors = {0}",
|
||||
label.partitions[i].rsectors, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].fats_no = {0}",
|
||||
label.partitions[i].fats_no, i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].fats_no = {0}", label.partitions[i].fats_no,
|
||||
i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].root_ent = {0}",
|
||||
label.partitions[i].root_ent, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].sectors = {0}",
|
||||
label.partitions[i].sectors, i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].sectors = {0}", label.partitions[i].sectors,
|
||||
i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].media = {0}",
|
||||
label.partitions[i].media, i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].media = {0}", label.partitions[i].media, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].spfat = {0}",
|
||||
label.partitions[i].spfat, i);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].spfat = {0}", label.partitions[i].spfat, i);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].diskType = {0} ({2})",
|
||||
label.partitions[i].diskType, i,
|
||||
@@ -334,8 +339,7 @@ public sealed class Apricot : IPartition
|
||||
Offset = (ulong)(label.partitions[i].startSector * label.sectorSize)
|
||||
};
|
||||
|
||||
if(part.Start < deviceSectors &&
|
||||
part.End < deviceSectors)
|
||||
if(part.Start < deviceSectors && part.End < deviceSectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,7 @@ public sealed class AtariPartitions : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(sectorOffset, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return false;
|
||||
|
||||
var table = new AtariTable
|
||||
@@ -121,11 +120,11 @@ public sealed class AtariPartitions : IPartition
|
||||
|
||||
for(var i = 0; i < 8; i++)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Markup.Escape("table.icdEntries[{0}].flag = 0x{1:X2}"),
|
||||
i, (table.IcdEntries[i].Type & 0xFF000000) >> 24);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Markup.Escape("table.icdEntries[{0}].flag = 0x{1:X2}"), i,
|
||||
(table.IcdEntries[i].Type & 0xFF000000) >> 24);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Markup.Escape("table.icdEntries[{0}].type = 0x{1:X6}"),
|
||||
i, table.IcdEntries[i].Type & 0x00FFFFFF);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Markup.Escape("table.icdEntries[{0}].type = 0x{1:X6}"), i,
|
||||
table.IcdEntries[i].Type & 0x00FFFFFF);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Markup.Escape("table.icdEntries[{0}].start = {1}"), i,
|
||||
table.IcdEntries[i].Start);
|
||||
@@ -416,8 +415,7 @@ public sealed class AtariPartitions : IPartition
|
||||
|
||||
if(table.IcdEntries[i].Start + table.IcdEntries[i].Length > imagePlugin.Info.Sectors)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.WARNING_End_of_partition_goes_beyond_device_size);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.WARNING_End_of_partition_goes_beyond_device_size);
|
||||
}
|
||||
|
||||
ulong sectorSize = imagePlugin.Info.SectorSize;
|
||||
|
||||
@@ -55,9 +55,15 @@ public sealed class BSD : IPartition
|
||||
const uint MAX_LABEL_SIZE = 500;
|
||||
const string MODULE_NAME = "BSD disklabel plugin";
|
||||
/// <summary>Known sector locations for BSD disklabel</summary>
|
||||
readonly ulong[] _labelLocations = { 0, 1, 2, 9 };
|
||||
readonly ulong[] _labelLocations =
|
||||
{
|
||||
0, 1, 2, 9
|
||||
};
|
||||
/// <summary>Known byte offsets for BSD disklabel</summary>
|
||||
readonly uint[] _labelOffsets = { 0, 9, 64, 128, 516 };
|
||||
readonly uint[] _labelOffsets =
|
||||
{
|
||||
0, 9, 64, 128, 516
|
||||
};
|
||||
|
||||
#region IPartition Members
|
||||
|
||||
@@ -189,8 +195,7 @@ public sealed class BSD : IPartition
|
||||
continue;
|
||||
|
||||
// Crude and dirty way to know if the disklabel is relative to its parent partition...
|
||||
if(dl.d_partitions[i].p_offset < sectorOffset &&
|
||||
!addSectorOffset)
|
||||
if(dl.d_partitions[i].p_offset < sectorOffset && !addSectorOffset)
|
||||
addSectorOffset = true;
|
||||
|
||||
if(addSectorOffset)
|
||||
|
||||
@@ -68,27 +68,26 @@ public sealed class DEC : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(31 + sectorOffset, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return false;
|
||||
|
||||
Label table = Marshal.ByteArrayToStructureLittleEndian<Label>(sector);
|
||||
|
||||
if(table.pt_magic != PT_MAGIC ||
|
||||
table.pt_valid != PT_VALID)
|
||||
if(table.pt_magic != PT_MAGIC || table.pt_valid != PT_VALID)
|
||||
return false;
|
||||
|
||||
ulong counter = 0;
|
||||
|
||||
foreach(CommonTypes.Partition part in table.pt_part.Select(entry => new CommonTypes.Partition
|
||||
{
|
||||
Start = entry.pi_blkoff,
|
||||
Offset = (ulong)(entry.pi_blkoff * sector.Length),
|
||||
Size = (ulong)entry.pi_nblocks,
|
||||
Length = (ulong)(entry.pi_nblocks * sector.Length),
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
}).Where(part => part.Size > 0))
|
||||
{
|
||||
Start = entry.pi_blkoff,
|
||||
Offset = (ulong)(entry.pi_blkoff * sector.Length),
|
||||
Size = (ulong)entry.pi_nblocks,
|
||||
Length = (ulong)(entry.pi_nblocks * sector.Length),
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
}).
|
||||
Where(part => part.Size > 0))
|
||||
{
|
||||
partitions.Add(part);
|
||||
counter++;
|
||||
|
||||
@@ -73,8 +73,7 @@ public sealed class DragonFlyBSD : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSectors(sectorOffset, nSectors, out byte[] sectors);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sectors.Length < 2048)
|
||||
if(errno != ErrorNumber.NoError || sectors.Length < 2048)
|
||||
return false;
|
||||
|
||||
Disklabel64 disklabel = Marshal.ByteArrayToStructureLittleEndian<Disklabel64>(sectors);
|
||||
@@ -103,8 +102,7 @@ public sealed class DragonFlyBSD : IPartition
|
||||
if(entry.p_bsize % imagePlugin.Info.SectorSize > 0)
|
||||
part.Length++;
|
||||
|
||||
if(entry.p_bsize <= 0 ||
|
||||
entry.p_boffset <= 0)
|
||||
if(entry.p_bsize <= 0 || entry.p_boffset <= 0)
|
||||
continue;
|
||||
|
||||
partitions.Add(part);
|
||||
|
||||
@@ -199,8 +199,7 @@ public sealed class GuidPartitionTable : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.attributes = 0x{0:X16}", entry.attributes);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "entry.name = {0}", entry.name);
|
||||
|
||||
if(entry.startLBA / divisor > imagePlugin.Info.Sectors ||
|
||||
entry.endLBA / divisor > imagePlugin.Info.Sectors)
|
||||
if(entry.startLBA / divisor > imagePlugin.Info.Sectors || entry.endLBA / divisor > imagePlugin.Info.Sectors)
|
||||
return false;
|
||||
|
||||
var part = new Partition
|
||||
|
||||
@@ -409,8 +409,7 @@ public sealed class MBR : IPartition
|
||||
var extended = false;
|
||||
var minix = false;
|
||||
|
||||
if(entry.status != 0x00 &&
|
||||
entry.status != 0x80)
|
||||
if(entry.status != 0x00 && entry.status != 0x80)
|
||||
return false; // Maybe a FAT filesystem
|
||||
|
||||
valid &= entry.type != 0x00;
|
||||
@@ -423,9 +422,14 @@ public sealed class MBR : IPartition
|
||||
|
||||
minix |= entry.type is 0x81 or 0x80; // MINIX partition
|
||||
|
||||
valid &= entry.lba_start != 0 || entry.lba_sectors != 0 || entry.start_cylinder != 0 ||
|
||||
entry.start_head != 0 || entry.start_sector != 0 || entry.end_cylinder != 0 ||
|
||||
entry.end_head != 0 || entry.end_sector != 0;
|
||||
valid &= entry.lba_start != 0 ||
|
||||
entry.lba_sectors != 0 ||
|
||||
entry.start_cylinder != 0 ||
|
||||
entry.start_head != 0 ||
|
||||
entry.start_sector != 0 ||
|
||||
entry.end_cylinder != 0 ||
|
||||
entry.end_head != 0 ||
|
||||
entry.end_sector != 0;
|
||||
|
||||
if(entry is { lba_start: 0, lba_sectors: 0 } && valid)
|
||||
{
|
||||
@@ -433,7 +437,8 @@ public sealed class MBR : IPartition
|
||||
imagePlugin.Info.SectorsPerTrack);
|
||||
|
||||
lbaSectors = CHS.ToLBA(endCylinder, entry.end_head, entry.end_sector, imagePlugin.Info.Heads,
|
||||
imagePlugin.Info.SectorsPerTrack) - lbaStart;
|
||||
imagePlugin.Info.SectorsPerTrack) -
|
||||
lbaStart;
|
||||
}
|
||||
|
||||
// For optical media
|
||||
@@ -556,9 +561,14 @@ public sealed class MBR : IPartition
|
||||
extValid &= ebrEntry.status is 0x00 or 0x80;
|
||||
extValid &= ebrEntry.type != 0x00;
|
||||
|
||||
extValid &= ebrEntry.lba_start != 0 || ebrEntry.lba_sectors != 0 || ebrEntry.start_cylinder != 0 ||
|
||||
ebrEntry.start_head != 0 || ebrEntry.start_sector != 0 || ebrEntry.end_cylinder != 0 ||
|
||||
ebrEntry.end_head != 0 || ebrEntry.end_sector != 0;
|
||||
extValid &= ebrEntry.lba_start != 0 ||
|
||||
ebrEntry.lba_sectors != 0 ||
|
||||
ebrEntry.start_cylinder != 0 ||
|
||||
ebrEntry.start_head != 0 ||
|
||||
ebrEntry.start_sector != 0 ||
|
||||
ebrEntry.end_cylinder != 0 ||
|
||||
ebrEntry.end_head != 0 ||
|
||||
ebrEntry.end_sector != 0;
|
||||
|
||||
if(ebrEntry is { lba_start: 0, lba_sectors: 0 } && extValid)
|
||||
{
|
||||
@@ -566,7 +576,8 @@ public sealed class MBR : IPartition
|
||||
imagePlugin.Info.SectorsPerTrack);
|
||||
|
||||
extSectors = CHS.ToLBA(endCylinder, ebrEntry.end_head, ebrEntry.end_sector,
|
||||
imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack) - extStart;
|
||||
imagePlugin.Info.Heads, imagePlugin.Info.SectorsPerTrack) -
|
||||
extStart;
|
||||
}
|
||||
|
||||
extMinix |= ebrEntry.type is 0x81 or 0x80;
|
||||
@@ -605,8 +616,7 @@ public sealed class MBR : IPartition
|
||||
|
||||
var part = new Partition();
|
||||
|
||||
if(extStart > 0 &&
|
||||
extSectors > 0)
|
||||
if(extStart > 0 && extSectors > 0)
|
||||
{
|
||||
part.Start = extStart + sectorOffset;
|
||||
part.Length = extSectors;
|
||||
@@ -685,9 +695,14 @@ public sealed class MBR : IPartition
|
||||
mnxValid &= mnxEntry.status is 0x00 or 0x80;
|
||||
mnxValid &= mnxEntry.type is 0x81 or 0x80;
|
||||
|
||||
mnxValid &= mnxEntry.lba_start != 0 || mnxEntry.lba_sectors != 0 || mnxEntry.start_cylinder != 0 ||
|
||||
mnxEntry.start_head != 0 || mnxEntry.start_sector != 0 || mnxEntry.end_cylinder != 0 ||
|
||||
mnxEntry.end_head != 0 || mnxEntry.end_sector != 0;
|
||||
mnxValid &= mnxEntry.lba_start != 0 ||
|
||||
mnxEntry.lba_sectors != 0 ||
|
||||
mnxEntry.start_cylinder != 0 ||
|
||||
mnxEntry.start_head != 0 ||
|
||||
mnxEntry.start_sector != 0 ||
|
||||
mnxEntry.end_cylinder != 0 ||
|
||||
mnxEntry.end_head != 0 ||
|
||||
mnxEntry.end_sector != 0;
|
||||
|
||||
if(mnxEntry is { lba_start: 0, lba_sectors: 0 } && mnxValid)
|
||||
{
|
||||
@@ -695,7 +710,8 @@ public sealed class MBR : IPartition
|
||||
imagePlugin.Info.SectorsPerTrack);
|
||||
|
||||
mnxSectors = CHS.ToLBA(endCylinder, mnxEntry.end_head, mnxEntry.end_sector, imagePlugin.Info.Heads,
|
||||
imagePlugin.Info.SectorsPerTrack) - mnxStart;
|
||||
imagePlugin.Info.SectorsPerTrack) -
|
||||
mnxStart;
|
||||
}
|
||||
|
||||
// For optical media
|
||||
@@ -710,8 +726,7 @@ public sealed class MBR : IPartition
|
||||
|
||||
var part = new Partition();
|
||||
|
||||
if(mnxStart > 0 &&
|
||||
mnxSectors > 0)
|
||||
if(mnxStart > 0 && mnxSectors > 0)
|
||||
{
|
||||
part.Start = mnxStart + sectorOffset;
|
||||
part.Length = mnxSectors;
|
||||
|
||||
@@ -89,7 +89,10 @@ public sealed class NeXTDisklabel : IPartition
|
||||
ulong labelPosition = 0;
|
||||
ErrorNumber errno;
|
||||
|
||||
foreach(ulong i in new ulong[] { 0, 4, 15, 16 }.TakeWhile(i => i + sectorOffset < imagePlugin.Info.Sectors))
|
||||
foreach(ulong i in new ulong[]
|
||||
{
|
||||
0, 4, 15, 16
|
||||
}.TakeWhile(i => i + sectorOffset < imagePlugin.Info.Sectors))
|
||||
{
|
||||
errno = imagePlugin.ReadSector(i + sectorOffset, out labelSector);
|
||||
|
||||
@@ -98,9 +101,7 @@ public sealed class NeXTDisklabel : IPartition
|
||||
|
||||
var magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00);
|
||||
|
||||
if(magic != NEXT_MAGIC1 &&
|
||||
magic != NEXT_MAGIC2 &&
|
||||
magic != NEXT_MAGIC3)
|
||||
if(magic != NEXT_MAGIC1 && magic != NEXT_MAGIC2 && magic != NEXT_MAGIC3)
|
||||
continue;
|
||||
|
||||
magicFound = true;
|
||||
@@ -225,7 +226,8 @@ public sealed class NeXTDisklabel : IPartition
|
||||
Sequence = (ulong)i,
|
||||
Name = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt),
|
||||
Length = (ulong)(label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize / sectorSize),
|
||||
Start = (ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize /
|
||||
Start = (ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) *
|
||||
label.dl_dt.d_secsize /
|
||||
sectorSize),
|
||||
Scheme = Name
|
||||
};
|
||||
|
||||
@@ -69,9 +69,7 @@ public sealed class PC98 : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(0, out byte[] bootSector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
bootSector[^2] != 0x55 ||
|
||||
bootSector[^1] != 0xAA)
|
||||
if(errno != ErrorNumber.NoError || bootSector[^2] != 0x55 || bootSector[^1] != 0xAA)
|
||||
return false;
|
||||
|
||||
errno = imagePlugin.ReadSector(1, out byte[] sector);
|
||||
@@ -129,7 +127,8 @@ public sealed class PC98 : IPartition
|
||||
part.Offset = part.Start * imagePlugin.Info.SectorSize;
|
||||
|
||||
part.Length = CHS.ToLBA(entry.dp_ecyl, entry.dp_ehd, (uint)(entry.dp_esect + 1), imagePlugin.Info.Heads,
|
||||
imagePlugin.Info.SectorsPerTrack) - part.Start;
|
||||
imagePlugin.Info.SectorsPerTrack) -
|
||||
part.Start;
|
||||
|
||||
part.Size = part.Length * imagePlugin.Info.SectorSize;
|
||||
|
||||
|
||||
@@ -77,10 +77,10 @@ public sealed class Plan9 : IPartition
|
||||
string[] really = StringHandlers.CToString(sector).Split('\n');
|
||||
|
||||
foreach(string[] tokens in really.TakeWhile(part => part.Length >= 5 && part[..5] == "part ").
|
||||
Select(part => part.Split(' ')).TakeWhile(tokens => tokens.Length == 4))
|
||||
Select(part => part.Split(' ')).
|
||||
TakeWhile(tokens => tokens.Length == 4))
|
||||
{
|
||||
if(!ulong.TryParse(tokens[2], out ulong start) ||
|
||||
!ulong.TryParse(tokens[3], out ulong end))
|
||||
if(!ulong.TryParse(tokens[2], out ulong start) || !ulong.TryParse(tokens[3], out ulong end))
|
||||
break;
|
||||
|
||||
var part = new Partition
|
||||
|
||||
@@ -216,8 +216,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
|
||||
var magic = BigEndianBitConverter.ToUInt32(tmpSector, 0);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Possible_magic_at_block_0_is_1_X8, rdbBlock,
|
||||
magic);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Possible_magic_at_block_0_is_1_X8, rdbBlock, magic);
|
||||
|
||||
if(magic == RIGID_DISK_BLOCK_MAGIC)
|
||||
{
|
||||
@@ -421,8 +420,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
|
||||
chainEntry.BlockPairs[i].GoodBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4));
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.Bad_block_at_0_replaced_with_good_block_at_1,
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Bad_block_at_0_replaced_with_good_block_at_1,
|
||||
chainEntry.BlockPairs[i].BadBlock, chainEntry.BlockPairs[i].GoodBlock);
|
||||
}
|
||||
|
||||
@@ -436,8 +434,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
|
||||
while(nextBlock != 0xFFFFFFFF)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.Going_to_block_0_in_search_of_a_PartitionEntry_block,
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Going_to_block_0_in_search_of_a_PartitionEntry_block,
|
||||
nextBlock + sectorOffset);
|
||||
|
||||
errno = imagePlugin.ReadSector(nextBlock + sectorOffset, out sector);
|
||||
@@ -547,8 +544,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.sec_org = 0x{0:X8}",
|
||||
partEntry.DosEnvVec.SecOrg);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.surfaces = {0}",
|
||||
partEntry.DosEnvVec.Surfaces);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.surfaces = {0}", partEntry.DosEnvVec.Surfaces);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.spb = {0}", partEntry.DosEnvVec.Spb);
|
||||
|
||||
@@ -557,8 +553,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.reservedblocks = {0}",
|
||||
partEntry.DosEnvVec.Reservedblocks);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.prealloc = {0}",
|
||||
partEntry.DosEnvVec.Prealloc);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.prealloc = {0}", partEntry.DosEnvVec.Prealloc);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.interleave = {0}",
|
||||
partEntry.DosEnvVec.Interleave);
|
||||
@@ -578,8 +573,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.maxTransfer = {0}",
|
||||
partEntry.DosEnvVec.MaxTransfer);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.Mask = 0x{0:X8}",
|
||||
partEntry.DosEnvVec.Mask);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.Mask = 0x{0:X8}", partEntry.DosEnvVec.Mask);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "partEntry.dosEnvVec.bootPriority = {0}",
|
||||
partEntry.DosEnvVec.BootPriority);
|
||||
@@ -606,8 +600,8 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
|
||||
while(nextBlock != 0xFFFFFFFF)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.Going_to_block_0_in_search_of_a_FileSystemHeader_block, nextBlock);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Going_to_block_0_in_search_of_a_FileSystemHeader_block,
|
||||
nextBlock);
|
||||
|
||||
errno = imagePlugin.ReadSector(nextBlock, out sector);
|
||||
|
||||
@@ -650,8 +644,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "FSHD.magic = 0x{0:X8}", fshd.Magic);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "FSHD.size = {0} longs, {1} bytes", fshd.Size,
|
||||
fshd.Size * 4);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "FSHD.size = {0} longs, {1} bytes", fshd.Size, fshd.Size * 4);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "FSHD.checksum = 0x{0:X8}", fshd.Checksum);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "FSHD.targetID = {0}", fshd.TargetId);
|
||||
@@ -684,8 +677,8 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
|
||||
while(nextBlock != 0xFFFFFFFF)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.Going_to_block_0_in_search_of_a_LoadSegment_block, nextBlock);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Going_to_block_0_in_search_of_a_LoadSegment_block,
|
||||
nextBlock);
|
||||
|
||||
errno = imagePlugin.ReadSector(nextBlock, out sector);
|
||||
|
||||
@@ -741,21 +734,25 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
ulong sequence = 0;
|
||||
|
||||
foreach(Partition entry in partitionEntries.Select(rdbEntry => new Partition
|
||||
{
|
||||
Description = AmigaDosTypeToDescriptionString(rdbEntry.DosEnvVec.DosType),
|
||||
Name = rdbEntry.DriveName,
|
||||
Sequence = sequence,
|
||||
Length = (rdbEntry.DosEnvVec.HighCylinder + 1 - rdbEntry.DosEnvVec.LowCylinder) *
|
||||
rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt,
|
||||
Start = rdbEntry.DosEnvVec.LowCylinder * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt +
|
||||
sectorOffset,
|
||||
Type = AmigaDosTypeToString(rdbEntry.DosEnvVec.DosType),
|
||||
Scheme = Name,
|
||||
Offset = (rdbEntry.DosEnvVec.LowCylinder * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt +
|
||||
sectorOffset) * rdb.BlockSize,
|
||||
Size = (rdbEntry.DosEnvVec.HighCylinder + 1 - rdbEntry.DosEnvVec.LowCylinder) *
|
||||
rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt * rdb.BlockSize
|
||||
}))
|
||||
{
|
||||
Description = AmigaDosTypeToDescriptionString(rdbEntry.DosEnvVec.DosType),
|
||||
Name = rdbEntry.DriveName,
|
||||
Sequence = sequence,
|
||||
Length = (rdbEntry.DosEnvVec.HighCylinder + 1 - rdbEntry.DosEnvVec.LowCylinder) *
|
||||
rdbEntry.DosEnvVec.Surfaces *
|
||||
rdbEntry.DosEnvVec.Bpt,
|
||||
Start = rdbEntry.DosEnvVec.LowCylinder * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt +
|
||||
sectorOffset,
|
||||
Type = AmigaDosTypeToString(rdbEntry.DosEnvVec.DosType),
|
||||
Scheme = Name,
|
||||
Offset = (rdbEntry.DosEnvVec.LowCylinder * rdbEntry.DosEnvVec.Surfaces * rdbEntry.DosEnvVec.Bpt +
|
||||
sectorOffset) *
|
||||
rdb.BlockSize,
|
||||
Size = (rdbEntry.DosEnvVec.HighCylinder + 1 - rdbEntry.DosEnvVec.LowCylinder) *
|
||||
rdbEntry.DosEnvVec.Surfaces *
|
||||
rdbEntry.DosEnvVec.Bpt *
|
||||
rdb.BlockSize
|
||||
}))
|
||||
{
|
||||
partitions.Add(entry);
|
||||
sequence++;
|
||||
@@ -867,8 +864,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
|
||||
AmigaDosTypeToString(amigaDosType));
|
||||
}
|
||||
|
||||
if((amigaDosType & 0x50465300) == 0x50465300 ||
|
||||
(amigaDosType & 0x41465300) == 0x41465300)
|
||||
if((amigaDosType & 0x50465300) == 0x50465300 || (amigaDosType & 0x41465300) == 0x41465300)
|
||||
{
|
||||
return string.Format(Localization.Unknown_ProfessionalFileSystem_type_0,
|
||||
AmigaDosTypeToString(amigaDosType));
|
||||
|
||||
@@ -65,8 +65,7 @@ public sealed class RioKarma : IPartition
|
||||
partitions = null;
|
||||
ErrorNumber errno = imagePlugin.ReadSector(sectorOffset, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return false;
|
||||
|
||||
Table table = Marshal.ByteArrayToStructureLittleEndian<Table>(sector);
|
||||
|
||||
@@ -71,8 +71,7 @@ public sealed class SGI : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(sectorOffset, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return false;
|
||||
|
||||
Label dvh = Marshal.ByteArrayToStructureBigEndian<Label>(sector);
|
||||
@@ -105,26 +104,22 @@ public sealed class SGI : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_shd0 = {0}", dvh.device_params.dp_shd0);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_trks0 = {0}", dvh.device_params.dp_trks0);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_ctq_depth = {0}",
|
||||
dvh.device_params.dp_ctq_depth);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_ctq_depth = {0}", dvh.device_params.dp_ctq_depth);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_cylshi = {0}", dvh.device_params.dp_cylshi);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_secs = {0}", dvh.device_params.dp_secs);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_secbytes = {0}",
|
||||
dvh.device_params.dp_secbytes);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_secbytes = {0}", dvh.device_params.dp_secbytes);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_interleave = {0}",
|
||||
dvh.device_params.dp_interleave);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_flags = {0}", dvh.device_params.dp_flags);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_datarate = {0}",
|
||||
dvh.device_params.dp_datarate);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_datarate = {0}", dvh.device_params.dp_datarate);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_nretries = {0}",
|
||||
dvh.device_params.dp_nretries);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_nretries = {0}", dvh.device_params.dp_nretries);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_mspw = {0}", dvh.device_params.dp_mspw);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "dvh.device_params.dp_xgap1 = {0}", dvh.device_params.dp_xgap1);
|
||||
@@ -159,8 +154,7 @@ public sealed class SGI : IPartition
|
||||
Scheme = Name
|
||||
};
|
||||
|
||||
if(part.Size <= 0 ||
|
||||
dvh.partitions[i].type is SGIType.Header or SGIType.Volume)
|
||||
if(part.Size <= 0 || dvh.partitions[i].type is SGIType.Header or SGIType.Volume)
|
||||
continue;
|
||||
|
||||
partitions.Add(part);
|
||||
|
||||
@@ -70,10 +70,17 @@ public sealed class SunDisklabel : IPartition
|
||||
/// <summary>Size of padding in SunOS disk label</summary>
|
||||
const int LEN_DKL_PAD = DK_LABEL_SIZE - (LEN_DKL_ASCII + NDKMAP * 8 + 14 * 2);
|
||||
/// <summary>Size of padding in Solaris disk label with 8 partitions</summary>
|
||||
const int LEN_DKL_PAD8 = DK_LABEL_SIZE - (LEN_DKL_ASCII + 136 + // sizeof(dk_vtoc8)
|
||||
NDKMAP * 8 + 14 * 2 + 2 * 2);
|
||||
const int LEN_DKL_PAD16 = DK_LABEL_SIZE - (456 + // sizeof(dk_vtoc16)
|
||||
4 * 4 + 12 * 2 + 2 * 2);
|
||||
const int LEN_DKL_PAD8 = DK_LABEL_SIZE -
|
||||
(LEN_DKL_ASCII +
|
||||
136 + // sizeof(dk_vtoc8)
|
||||
NDKMAP * 8 +
|
||||
14 * 2 +
|
||||
2 * 2);
|
||||
const int LEN_DKL_PAD16 = DK_LABEL_SIZE -
|
||||
(456 + // sizeof(dk_vtoc16)
|
||||
4 * 4 +
|
||||
12 * 2 +
|
||||
2 * 2);
|
||||
const string MODULE_NAME = "Sun partitions plugin";
|
||||
|
||||
#region IPartition Members
|
||||
@@ -123,9 +130,7 @@ public sealed class SunDisklabel : IPartition
|
||||
useDkl = true;
|
||||
}
|
||||
|
||||
if(!useDkl &&
|
||||
!useDkl8 &&
|
||||
!useDkl16)
|
||||
if(!useDkl && !useDkl8 && !useDkl16)
|
||||
{
|
||||
errno = imagePlugin.ReadSector(sectorOffset + 1, out sunSector);
|
||||
|
||||
@@ -147,9 +152,7 @@ public sealed class SunDisklabel : IPartition
|
||||
}
|
||||
}
|
||||
|
||||
if(!useDkl &&
|
||||
!useDkl8 &&
|
||||
!useDkl16)
|
||||
if(!useDkl && !useDkl8 && !useDkl16)
|
||||
return false;
|
||||
|
||||
if(useDkl16 && dkl16.dkl_magic == DKL_CIGAM)
|
||||
@@ -193,8 +196,7 @@ public sealed class SunDisklabel : IPartition
|
||||
|
||||
for(var i = 0; i < NDKMAP; i++)
|
||||
{
|
||||
if(dkl.dkl_map[i].dkl_cylno <= 0 ||
|
||||
dkl.dkl_map[i].dkl_nblk <= 0)
|
||||
if(dkl.dkl_map[i].dkl_cylno <= 0 || dkl.dkl_map[i].dkl_nblk <= 0)
|
||||
continue;
|
||||
|
||||
var part = new Partition
|
||||
@@ -202,16 +204,15 @@ public sealed class SunDisklabel : IPartition
|
||||
Size = (ulong)dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length = (ulong)(dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.Info.SectorSize),
|
||||
Sequence = (ulong)i,
|
||||
Offset =
|
||||
((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE,
|
||||
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.Info.SectorSize,
|
||||
DK_LABEL_SIZE /
|
||||
imagePlugin.Info.SectorSize,
|
||||
Type = Localization.SunOS_partition,
|
||||
Scheme = Name
|
||||
};
|
||||
|
||||
if(part.Start < imagePlugin.Info.Sectors &&
|
||||
part.End <= imagePlugin.Info.Sectors)
|
||||
if(part.Start < imagePlugin.Info.Sectors && part.End <= imagePlugin.Info.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
@@ -279,26 +280,26 @@ public sealed class SunDisklabel : IPartition
|
||||
var part = new Partition
|
||||
{
|
||||
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.Info.SectorSize),
|
||||
Sequence = (ulong)i,
|
||||
Offset = ((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
|
||||
DK_LABEL_SIZE,
|
||||
Size = (ulong)dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length = (ulong)(dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.Info.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.Info.SectorSize,
|
||||
DK_LABEL_SIZE /
|
||||
imagePlugin.Info.SectorSize,
|
||||
Type = SunIdToString(dkl8.dkl_vtoc.v_part[i].p_tag),
|
||||
Scheme = Name
|
||||
};
|
||||
|
||||
if(dkl8.dkl_vtoc.v_timestamp[i] != 0)
|
||||
{
|
||||
part.Description += "\n" + string.Format(Localization.Partition_timestamped_on_0,
|
||||
DateHandlers.
|
||||
UnixToDateTime(dkl8.dkl_vtoc.v_timestamp[i]));
|
||||
part.Description +=
|
||||
"\n" +
|
||||
string.Format(Localization.Partition_timestamped_on_0,
|
||||
DateHandlers.UnixToDateTime(dkl8.dkl_vtoc.v_timestamp[i]));
|
||||
}
|
||||
|
||||
if(part.Start < imagePlugin.Info.Sectors &&
|
||||
part.End <= imagePlugin.Info.Sectors)
|
||||
if(part.Start < imagePlugin.Info.Sectors && part.End <= imagePlugin.Info.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
@@ -366,11 +367,13 @@ public sealed class SunDisklabel : IPartition
|
||||
{
|
||||
Description = SunFlagsToString(dkl16.dkl_vtoc.v_part[i].p_flag),
|
||||
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 /
|
||||
Length = (ulong)(dkl16.dkl_vtoc.v_part[i].p_size *
|
||||
dkl16.dkl_vtoc.v_sectorsz /
|
||||
imagePlugin.Info.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 /
|
||||
Start = ((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) *
|
||||
dkl16.dkl_vtoc.v_sectorsz /
|
||||
imagePlugin.Info.SectorSize,
|
||||
Type = SunIdToString(dkl16.dkl_vtoc.v_part[i].p_tag),
|
||||
Scheme = Name
|
||||
@@ -378,13 +381,13 @@ public sealed class SunDisklabel : IPartition
|
||||
|
||||
if(dkl16.dkl_vtoc.v_timestamp[i] != 0)
|
||||
{
|
||||
part.Description += "\n" + string.Format(Localization.Partition_timestamped_on_0,
|
||||
DateHandlers.
|
||||
UnixToDateTime(dkl16.dkl_vtoc.v_timestamp[i]));
|
||||
part.Description +=
|
||||
"\n" +
|
||||
string.Format(Localization.Partition_timestamped_on_0,
|
||||
DateHandlers.UnixToDateTime(dkl16.dkl_vtoc.v_timestamp[i]));
|
||||
}
|
||||
|
||||
if(part.Start < imagePlugin.Info.Sectors &&
|
||||
part.End <= imagePlugin.Info.Sectors)
|
||||
if(part.Start < imagePlugin.Info.Sectors && part.End <= imagePlugin.Info.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,10 @@ public sealed class VTOC : IPartition
|
||||
var absolute = false;
|
||||
ErrorNumber errno;
|
||||
|
||||
foreach(ulong i in new ulong[] { 0, 1, 8, 29 }.TakeWhile(i => i + sectorOffset < imagePlugin.Info.Sectors))
|
||||
foreach(ulong i in new ulong[]
|
||||
{
|
||||
0, 1, 8, 29
|
||||
}.TakeWhile(i => i + sectorOffset < imagePlugin.Info.Sectors))
|
||||
{
|
||||
errno = imagePlugin.ReadSector(i + sectorOffset, out pdsector);
|
||||
|
||||
@@ -92,8 +95,7 @@ public sealed class VTOC : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.sanity_at_0_is_1_X8_should_be_2_X8_or_3_X8,
|
||||
i + sectorOffset, magic, PD_MAGIC, PD_CIGAM);
|
||||
|
||||
if(magic != PD_MAGIC &&
|
||||
magic != PD_CIGAM)
|
||||
if(magic != PD_MAGIC && magic != PD_CIGAM)
|
||||
continue;
|
||||
|
||||
magicFound = true;
|
||||
@@ -196,8 +198,7 @@ public sealed class VTOC : IPartition
|
||||
}
|
||||
}
|
||||
|
||||
if(!magicFound &&
|
||||
pd.version < XPDVERS)
|
||||
if(!magicFound && pd.version < XPDVERS)
|
||||
{
|
||||
magic = BitConverter.ToUInt32(vtocsector, 12);
|
||||
|
||||
@@ -323,8 +324,7 @@ public sealed class VTOC : IPartition
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_version = {0}", vtoc.v_version);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_volume = \"{0}\"",
|
||||
StringHandlers.CToString(vtoc.v_volume));
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_volume = \"{0}\"", StringHandlers.CToString(vtoc.v_volume));
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_pad = {0}", vtoc.v_pad);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_nparts = {0}", vtoc.v_nparts);
|
||||
@@ -334,8 +334,8 @@ public sealed class VTOC : IPartition
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_part[{0}].p_tag = {1} ({2})", i, vtoc.v_part[i].p_tag,
|
||||
(ushort)vtoc.v_part[i].p_tag);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_part[{0}].p_flag = {1} ({2})", i,
|
||||
vtoc.v_part[i].p_flag, (ushort)vtoc.v_part[i].p_flag);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_part[{0}].p_flag = {1} ({2})", i, vtoc.v_part[i].p_flag,
|
||||
(ushort)vtoc.v_part[i].p_flag);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_part[{0}].p_start = {1}", i, vtoc.v_part[i].p_start);
|
||||
|
||||
@@ -367,8 +367,7 @@ public sealed class VTOC : IPartition
|
||||
// This means partition starts are absolute, not relative, to the VTOC position
|
||||
for(var i = 0; i < V_NUMPAR; i++)
|
||||
{
|
||||
if(parts[i].p_tag != pTag.V_BACKUP ||
|
||||
(ulong)parts[i].p_start != sectorOffset)
|
||||
if(parts[i].p_tag != pTag.V_BACKUP || (ulong)parts[i].p_start != sectorOffset)
|
||||
continue;
|
||||
|
||||
absolute = true;
|
||||
@@ -395,8 +394,7 @@ public sealed class VTOC : IPartition
|
||||
var info = "";
|
||||
|
||||
// Apparently old ones are absolute :?
|
||||
if(!useOld &&
|
||||
!absolute)
|
||||
if(!useOld && !absolute)
|
||||
{
|
||||
part.Start += sectorOffset;
|
||||
part.Offset += sectorOffset * imagePlugin.Info.SectorSize;
|
||||
@@ -440,15 +438,15 @@ public sealed class VTOC : IPartition
|
||||
pTag.V_USER => "/usr",
|
||||
pTag.V_BACKUP => Localization.Whole_disk,
|
||||
pTag.V_STAND_OLD => isNew
|
||||
? "Stand"
|
||||
: Localization.Alternate_sector_space,
|
||||
? "Stand"
|
||||
: Localization.Alternate_sector_space,
|
||||
pTag.V_VAR_OLD => isNew ? "/var" : Localization.non_UNIX,
|
||||
pTag.V_HOME_OLD => isNew
|
||||
? "/home"
|
||||
: Localization.Alternate_track_space,
|
||||
? "/home"
|
||||
: Localization.Alternate_track_space,
|
||||
pTag.V_ALTSCTR_OLD => isNew
|
||||
? Localization.Alternate_sector_track
|
||||
: "Stand",
|
||||
? Localization.Alternate_sector_track
|
||||
: "Stand",
|
||||
pTag.V_CACHE => isNew ? Localization.Cache : "/var",
|
||||
pTag.V_RESERVED =>
|
||||
isNew ? Localization.Reserved : "/home",
|
||||
|
||||
@@ -86,8 +86,7 @@ public sealed class Xbox : IPartition
|
||||
|
||||
ErrorNumber errno = imagePlugin.ReadSector(0, out byte[] sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError ||
|
||||
sector.Length < 512)
|
||||
if(errno != ErrorNumber.NoError || sector.Length < 512)
|
||||
return false;
|
||||
|
||||
Xbox360DevKitPartitionTable table = Marshal.ByteArrayToStructureBigEndian<Xbox360DevKitPartitionTable>(sector);
|
||||
|
||||
Reference in New Issue
Block a user