Rename Aaru.Console project to Aaru.Logging.

This commit is contained in:
2025-08-17 05:50:25 +01:00
parent 1a6f7a02c6
commit 02ec8a05d8
365 changed files with 5465 additions and 5347 deletions

View File

@@ -36,7 +36,7 @@
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Images\Aaru.Images.csproj"/>
<ProjectReference Include="..\Aaru.Checksums\Aaru.Checksums.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Logging\Aaru.Logging.csproj"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.LGPL">

View File

@@ -38,8 +38,8 @@ using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -91,7 +91,7 @@ public sealed class AppleMap : IPartition
{
case 256:
{
var tmp = new byte[512];
byte[] tmp = new byte[512];
Array.Copy(ddmSector, 0, tmp, 0, 256);
ddmSector = tmp;
maxDrivers = 29;
@@ -120,9 +120,9 @@ public sealed class AppleMap : IPartition
{
ddm.sbMap = new AppleDriverEntry[ddm.sbDrvrCount];
for(var i = 0; i < ddm.sbDrvrCount; i++)
for(int i = 0; i < ddm.sbDrvrCount; i++)
{
var tmp = new byte[8];
byte[] tmp = new byte[8];
Array.Copy(ddmSector, 18 + i * 8, tmp, 0, 8);
ddm.sbMap[i] = Marshal.ByteArrayToStructureBigEndian<AppleDriverEntry>(tmp);
@@ -163,9 +163,9 @@ public sealed class AppleMap : IPartition
// This is the easy one, no sector size mixing
if(oldMap.pdSig == APM_MAGIC_OLD)
{
for(var i = 2; i < partSector.Length; i += 12)
for(int i = 2; i < partSector.Length; i += 12)
{
var tmp = new byte[12];
byte[] tmp = new byte[12];
Array.Copy(partSector, i, tmp, 0, 12);
AppleMapOldPartitionEntry oldEntry =
@@ -221,7 +221,7 @@ public sealed class AppleMap : IPartition
// If sector is bigger than 512
if(ddmSector.Length > 512)
{
var tmp = new byte[512];
byte[] tmp = new byte[512];
Array.Copy(ddmSector, 512, tmp, 0, 512);
entry = Marshal.ByteArrayToStructureBigEndian<AppleMapPartitionEntry>(tmp);
@@ -275,13 +275,13 @@ public sealed class AppleMap : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "skip_ddm = {0}", skipDdm);
AaruConsole.DebugWriteLine(MODULE_NAME, "sectors_to_read = {0}", sectorsToRead);
var copy = new byte[entries.Length - skipDdm];
byte[] copy = new byte[entries.Length - skipDdm];
Array.Copy(entries, skipDdm, copy, 0, copy.Length);
entries = copy;
for(var i = 0; i < entryCount; i++)
for(int i = 0; i < entryCount; i++)
{
var tmp = new byte[entrySize];
byte[] tmp = new byte[entrySize];
Array.Copy(entries, i * entrySize, tmp, 0, entrySize);
entry = Marshal.ByteArrayToStructureBigEndian<AppleMapPartitionEntry>(tmp);

View File

@@ -36,8 +36,8 @@ using System.Runtime.InteropServices;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -296,10 +296,10 @@ public sealed class Apricot : IPartition
"label.spareRamDisk is null? = {0}",
ArrayHelpers.ArrayIsNullOrEmpty(label.spareRamDisk));
for(var i = 0; i < 32; i++)
for(int i = 0; i < 32; i++)
AaruConsole.DebugWriteLine(MODULE_NAME, "label.badBlocks[{1}] = {0}", label.badBlocks[i], i);
for(var i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME, "label.partitions[{1}].bps = {0}", label.partitions[i].bps, i);

View File

@@ -37,8 +37,8 @@ using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Spectre.Console;
namespace Aaru.Partitions;
@@ -91,7 +91,7 @@ public sealed class AtariPartitions : IPartition
Array.Copy(sector, 0, table.Boot, 0, 342);
for(var i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
table.IcdEntries[i].Type = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 0);
table.IcdEntries[i].Start = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 4);
@@ -102,7 +102,7 @@ public sealed class AtariPartitions : IPartition
table.Size = BigEndianBitConverter.ToUInt32(sector, 450);
for(var i = 0; i < 4; i++)
for(int i = 0; i < 4; i++)
{
table.Entries[i].Type = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 0);
table.Entries[i].Start = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 4);
@@ -117,7 +117,7 @@ public sealed class AtariPartitions : IPartition
sha1Ctx.Update(table.Boot);
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Boot_code_SHA1_0, sha1Ctx.End());
for(var i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
Markup.Escape("table.icdEntries[{0}].flag = 0x{1:X2}"),
@@ -142,7 +142,7 @@ public sealed class AtariPartitions : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "table.size = {0}", table.Size);
for(var i = 0; i < 4; i++)
for(int i = 0; i < 4; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
Markup.Escape("table.entries[{0}].flag = 0x{1:X2}"),
@@ -169,10 +169,10 @@ public sealed class AtariPartitions : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "table.badLength = {0}", table.BadLength);
AaruConsole.DebugWriteLine(MODULE_NAME, "table.checksum = 0x{0:X4}", table.Checksum);
var validTable = false;
bool validTable = false;
ulong partitionSequence = 0;
for(var i = 0; i < 4; i++)
for(int i = 0; i < 4; i++)
{
uint type = table.Entries[i].Type & 0x00FFFFFF;
@@ -203,7 +203,7 @@ public sealed class AtariPartitions : IPartition
if(sectorSize is 2448 or 2352) sectorSize = 2048;
var partType = new byte[3];
byte[] partType = new byte[3];
partType[0] = (byte)((type & 0xFF0000) >> 16);
partType[1] = (byte)((type & 0x00FF00) >> 8);
partType[2] = (byte)(type & 0x0000FF);
@@ -249,7 +249,7 @@ public sealed class AtariPartitions : IPartition
Entries = new AtariEntry[4]
};
for(var j = 0; j < 4; j++)
for(int j = 0; j < 4; j++)
{
extendedTable.Entries[j].Type =
BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 0);
@@ -261,7 +261,7 @@ public sealed class AtariPartitions : IPartition
BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 8);
}
for(var j = 0; j < 4; j++)
for(int j = 0; j < 4; j++)
{
uint extendedType = extendedTable.Entries[j].Type & 0x00FFFFFF;
@@ -292,7 +292,7 @@ public sealed class AtariPartitions : IPartition
if(sectorSize is 2448 or 2352) sectorSize = 2048;
var partType = new byte[3];
byte[] partType = new byte[3];
partType[0] = (byte)((extendedType & 0xFF0000) >> 16);
partType[1] = (byte)((extendedType & 0x00FF00) >> 8);
partType[2] = (byte)(extendedType & 0x0000FF);
@@ -333,7 +333,7 @@ public sealed class AtariPartitions : IPartition
if(!validTable) return partitions.Count > 0;
for(var i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
uint type = table.IcdEntries[i].Type & 0x00FFFFFF;
@@ -359,7 +359,7 @@ public sealed class AtariPartitions : IPartition
if(sectorSize is 2448 or 2352) sectorSize = 2048;
var partType = new byte[3];
byte[] partType = new byte[3];
partType[0] = (byte)((type & 0xFF0000) >> 16);
partType[1] = (byte)((type & 0x00FF00) >> 8);
partType[2] = (byte)(type & 0x0000FF);

View File

@@ -38,8 +38,8 @@ using System.Runtime.InteropServices;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -78,8 +78,8 @@ public sealed class BSD : IPartition
if((MAX_LABEL_SIZE + _labelOffsets.Last()) % imagePlugin.Info.SectorSize > 0) run++;
var dl = new DiskLabel();
var found = false;
var dl = new DiskLabel();
bool found = false;
foreach(ulong location in _labelLocations)
{
@@ -91,7 +91,7 @@ public sealed class BSD : IPartition
foreach(uint offset in _labelOffsets)
{
var sector = new byte[MAX_LABEL_SIZE];
byte[] sector = new byte[MAX_LABEL_SIZE];
if(offset + MAX_LABEL_SIZE > tmp.Length) break;
@@ -159,9 +159,9 @@ public sealed class BSD : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "dl.d_sbsize = {0}", dl.d_sbsize);
ulong counter = 0;
var addSectorOffset = false;
bool addSectorOffset = false;
for(var i = 0; i < dl.d_npartitions && i < 22; i++)
for(int i = 0; i < dl.d_npartitions && i < 22; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME, "dl.d_partitions[i].p_offset = {0}", dl.d_partitions[i].p_offset);
@@ -245,11 +245,11 @@ public sealed class BSD : IPartition
{
dl = (DiskLabel)Marshal.SwapStructureMembersEndian(dl);
for(var i = 0; i < dl.d_drivedata.Length; i++) dl.d_drivedata[i] = Swapping.Swap(dl.d_drivedata[i]);
for(int i = 0; i < dl.d_drivedata.Length; i++) dl.d_drivedata[i] = Swapping.Swap(dl.d_drivedata[i]);
for(var i = 0; i < dl.d_spare.Length; i++) dl.d_spare[i] = Swapping.Swap(dl.d_spare[i]);
for(int i = 0; i < dl.d_spare.Length; i++) dl.d_spare[i] = Swapping.Swap(dl.d_spare[i]);
for(var i = 0; i < dl.d_partitions.Length; i++)
for(int i = 0; i < dl.d_partitions.Length; i++)
dl.d_partitions[i] = (BSDPartition)Marshal.SwapStructureMembersEndian(dl.d_partitions[i]);
return dl;

View File

@@ -38,7 +38,7 @@ using System.Runtime.InteropServices;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -76,8 +76,8 @@ public sealed class GuidPartitionTable : IPartition
Header hdr;
var signature = BitConverter.ToUInt64(hdrBytes, 0);
var misaligned = false;
ulong signature = BitConverter.ToUInt64(hdrBytes, 0);
bool misaligned = false;
AaruConsole.DebugWriteLine(MODULE_NAME, "hdr.signature = 0x{0:X16}", signature);
@@ -95,7 +95,7 @@ public sealed class GuidPartitionTable : IPartition
if(signature == GPT_MAGIC)
{
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Found_unaligned_signature, signature);
var real = new byte[512];
byte[] real = new byte[512];
Array.Copy(hdrBytes, 512, real, 0, 512);
hdrBytes = real;
misaligned = true;
@@ -157,15 +157,15 @@ public sealed class GuidPartitionTable : IPartition
if(errno != ErrorNumber.NoError) return false;
var entriesBytes = new byte[temp.Length - modulo * 512];
byte[] entriesBytes = new byte[temp.Length - modulo * 512];
Array.Copy(temp, modulo * 512, entriesBytes, 0, entriesBytes.Length);
List<Entry> entries = [];
for(var i = 0; i < hdr.entries; i++)
for(int i = 0; i < hdr.entries; i++)
{
try
{
var entryBytes = new byte[hdr.entriesSize];
byte[] entryBytes = new byte[hdr.entriesSize];
Array.Copy(entriesBytes, hdr.entriesSize * i, entryBytes, 0, hdr.entriesSize);
entries.Add(Marshal.ByteArrayToStructureLittleEndian<Entry>(entryBytes));
}

View File

@@ -37,8 +37,8 @@ using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -104,7 +104,7 @@ public sealed class Human68K : IPartition
if(table.magic != X68K_MAGIC) return false;
for(var i = 0; i < table.entries.Length; i++)
for(int i = 0; i < table.entries.Length; i++)
table.entries[i] = (Entry)Marshal.SwapStructureMembersEndian(table.entries[i]);
AaruConsole.DebugWriteLine(MODULE_NAME, "table.size = {0:X4}", table.size);

View File

@@ -37,8 +37,8 @@ using System.Runtime.InteropServices;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -360,7 +360,7 @@ public sealed class MBR : IPartition
if(errno != ErrorNumber.NoError) return false;
var signature = BitConverter.ToUInt64(hdrBytes, 0);
ulong signature = BitConverter.ToUInt64(hdrBytes, 0);
AaruConsole.DebugWriteLine(MODULE_NAME, "gpt.signature = 0x{0:X16}", signature);
@@ -389,18 +389,18 @@ public sealed class MBR : IPartition
foreach(PartitionEntry entry in entries)
{
var startSector = (byte)(entry.start_sector & 0x3F);
var startCylinder = (ushort)((entry.start_sector & 0xC0) << 2 | entry.start_cylinder);
var endSector = (byte)(entry.end_sector & 0x3F);
var endCylinder = (ushort)((entry.end_sector & 0xC0) << 2 | entry.end_cylinder);
ulong lbaStart = entry.lba_start;
ulong lbaSectors = entry.lba_sectors;
byte startSector = (byte)(entry.start_sector & 0x3F);
ushort startCylinder = (ushort)((entry.start_sector & 0xC0) << 2 | entry.start_cylinder);
byte endSector = (byte)(entry.end_sector & 0x3F);
ushort endCylinder = (ushort)((entry.end_sector & 0xC0) << 2 | entry.end_cylinder);
ulong lbaStart = entry.lba_start;
ulong lbaSectors = entry.lba_sectors;
// Let's start the fun...
var valid = true;
var extended = false;
var minix = false;
bool valid = true;
bool extended = false;
bool minix = false;
if(entry.status != 0x00 && entry.status != 0x80) return false; // Maybe a FAT filesystem
@@ -511,7 +511,7 @@ public sealed class MBR : IPartition
if(!extended) continue;
var processingExtended = true;
bool processingExtended = true;
ulong chainStart = lbaStart;
while(processingExtended)
@@ -530,14 +530,14 @@ public sealed class MBR : IPartition
foreach(PartitionEntry ebrEntry in ebr.entries)
{
var extValid = true;
bool extValid = true;
startSector = (byte)(ebrEntry.start_sector & 0x3F);
startCylinder = (ushort)((ebrEntry.start_sector & 0xC0) << 2 | ebrEntry.start_cylinder);
endSector = (byte)(ebrEntry.end_sector & 0x3F);
endCylinder = (ushort)((ebrEntry.end_sector & 0xC0) << 2 | ebrEntry.end_cylinder);
ulong extStart = ebrEntry.lba_start;
ulong extSectors = ebrEntry.lba_sectors;
var extMinix = false;
bool extMinix = false;
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.status {0}", ebrEntry.status);
AaruConsole.DebugWriteLine(MODULE_NAME, "ebr_entry.type {0}", ebrEntry.type);
@@ -668,17 +668,17 @@ public sealed class MBR : IPartition
if(mnx.magic != MBR_MAGIC) return false;
var anyMnx = false;
bool anyMnx = false;
foreach(PartitionEntry mnxEntry in mnx.entries)
{
var mnxValid = true;
var startSector = (byte)(mnxEntry.start_sector & 0x3F);
var startCylinder = (ushort)((mnxEntry.start_sector & 0xC0) << 2 | mnxEntry.start_cylinder);
var endSector = (byte)(mnxEntry.end_sector & 0x3F);
var endCylinder = (ushort)((mnxEntry.end_sector & 0xC0) << 2 | mnxEntry.end_cylinder);
ulong mnxStart = mnxEntry.lba_start;
ulong mnxSectors = mnxEntry.lba_sectors;
bool mnxValid = true;
byte startSector = (byte)(mnxEntry.start_sector & 0x3F);
ushort startCylinder = (ushort)((mnxEntry.start_sector & 0xC0) << 2 | mnxEntry.start_cylinder);
byte endSector = (byte)(mnxEntry.end_sector & 0x3F);
ushort endCylinder = (ushort)((mnxEntry.end_sector & 0xC0) << 2 | mnxEntry.end_cylinder);
ulong mnxStart = mnxEntry.lba_start;
ulong mnxSectors = mnxEntry.lba_sectors;
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.status {0}", mnxEntry.status);
AaruConsole.DebugWriteLine(MODULE_NAME, "mnx_entry.type {0}", mnxEntry.type);

View File

@@ -41,8 +41,8 @@ using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -79,7 +79,7 @@ public sealed class NeXTDisklabel : IPartition
/// <inheritdoc />
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
{
var magicFound = false;
bool magicFound = false;
byte[] labelSector;
uint sectorSize = imagePlugin.Info.SectorSize is 2352 or 2448 ? 2048 : imagePlugin.Info.SectorSize;
@@ -98,7 +98,7 @@ public sealed class NeXTDisklabel : IPartition
if(errno != ErrorNumber.NoError) continue;
var magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00);
uint magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00);
if(magic != NEXT_MAGIC1 && magic != NEXT_MAGIC2 && magic != NEXT_MAGIC3) continue;
@@ -118,8 +118,8 @@ public sealed class NeXTDisklabel : IPartition
if(errno != ErrorNumber.NoError) return false;
Label label = Marshal.ByteArrayToStructureBigEndian<Label>(labelSector);
var disktabB = new byte[498];
Label label = Marshal.ByteArrayToStructureBigEndian<Label>(labelSector);
byte[] disktabB = new byte[498];
Array.Copy(labelSector, 44, disktabB, 0, 498);
label.dl_dt = Marshal.ByteArrayToStructureBigEndian<DiskTab>(disktabB);
label.dl_dt.d_partitions = new Entry[8];
@@ -168,9 +168,9 @@ public sealed class NeXTDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "label.dl_dt.d_rootpartition = {0}", label.dl_dt.d_rootpartition);
AaruConsole.DebugWriteLine(MODULE_NAME, "label.dl_dt.d_rwpartition = {0}", label.dl_dt.d_rwpartition);
for(var i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
var partB = new byte[44];
byte[] partB = new byte[44];
Array.Copy(labelSector, 44 + 146 + 44 * i, partB, 0, 44);
label.dl_dt.d_partitions[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(partB);

View File

@@ -36,8 +36,8 @@ using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;

View File

@@ -41,8 +41,8 @@ using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Partitions;
@@ -194,7 +194,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
{
partitions = [];
ulong rdbBlock = 0;
var foundRdb = false;
bool foundRdb = false;
ErrorNumber errno;
while(rdbBlock < 16)
@@ -212,7 +212,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
continue;
}
var magic = BigEndianBitConverter.ToUInt32(tmpSector, 0);
uint magic = BigEndianBitConverter.ToUInt32(tmpSector, 0);
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Possible_magic_at_block_0_is_1_X8, rdbBlock, magic);
@@ -279,7 +279,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
rdb.HighCylinder = BigEndianBitConverter.ToUInt32(sector, 0x98);
rdb.Reserved15 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
var tmpString = new byte[8];
byte[] tmpString = new byte[8];
Array.Copy(sector, 0xA0, tmpString, 0, 8);
rdb.DiskVendor = StringHandlers.SpacePaddedToString(tmpString);
tmpString = new byte[16];
@@ -380,7 +380,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
if(errno != ErrorNumber.NoError) break;
var magic = BigEndianBitConverter.ToUInt32(sector, 0);
uint magic = BigEndianBitConverter.ToUInt32(sector, 0);
if(magic != BAD_BLOCK_LIST_MAGIC) break;
@@ -441,7 +441,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
if(errno != ErrorNumber.NoError) break;
var magic = BigEndianBitConverter.ToUInt32(sector, 0);
uint magic = BigEndianBitConverter.ToUInt32(sector, 0);
if(magic != PARTITION_BLOCK_MAGIC) break;
@@ -499,7 +499,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
}
};
var driveName = new byte[32];
byte[] driveName = new byte[32];
Array.Copy(sector, 0x24, driveName, 0, 32);
partEntry.DriveName = StringHandlers.PascalToString(driveName, Encoding.GetEncoding("iso-8859-1"));
@@ -624,7 +624,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
if(errno != ErrorNumber.NoError) break;
var magic = BigEndianBitConverter.ToUInt32(sector, 0);
uint magic = BigEndianBitConverter.ToUInt32(sector, 0);
if(magic != FILESYSTEM_HEADER_MAGIC) break;
@@ -690,8 +690,8 @@ public sealed class AmigaRigidDiskBlock : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "FSHD.dnode.global_vec = 0x{0:X8}", fshd.Dnode.GlobalVec);
nextBlock = fshd.Dnode.SeglistPtr;
var thereAreLoadSegments = false;
var sha1Ctx = new Sha1Context();
bool thereAreLoadSegments = false;
var sha1Ctx = new Sha1Context();
while(nextBlock != 0xFFFFFFFF)
{
@@ -703,7 +703,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
if(errno != ErrorNumber.NoError) break;
var magicSeg = BigEndianBitConverter.ToUInt32(sector, 0);
uint magicSeg = BigEndianBitConverter.ToUInt32(sector, 0);
if(magicSeg != LOAD_SEG_MAGIC) break;
@@ -941,7 +941,7 @@ public sealed class AmigaRigidDiskBlock : IPartition
static string AmigaDosTypeToString(uint amigaDosType, bool quoted = true)
{
var textPart = new byte[3];
byte[] textPart = new byte[3];
textPart[0] = (byte)((amigaDosType & 0xFF000000) >> 24);
textPart[1] = (byte)((amigaDosType & 0x00FF0000) >> 16);

View File

@@ -36,8 +36,8 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
#pragma warning disable 169
@@ -75,10 +75,10 @@ public sealed class SGI : IPartition
Label dvh = Marshal.ByteArrayToStructureBigEndian<Label>(sector);
for(var i = 0; i < dvh.volume.Length; i++)
for(int i = 0; i < dvh.volume.Length; i++)
dvh.volume[i] = (Volume)Marshal.SwapStructureMembersEndian(dvh.volume[i]);
for(var i = 0; i < dvh.partitions.Length; i++)
for(int i = 0; i < dvh.partitions.Length; i++)
dvh.partitions[i] = (Partition)Marshal.SwapStructureMembersEndian(dvh.partitions[i]);
AaruConsole.DebugWriteLine(MODULE_NAME,
@@ -135,7 +135,7 @@ public sealed class SGI : IPartition
ulong counter = 0;
for(var i = 0; i < dvh.partitions.Length; i++)
for(int i = 0; i < dvh.partitions.Length; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
"dvh.partitions[{0}].num_blocks = {1}",

View File

@@ -38,8 +38,8 @@ using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -159,7 +159,7 @@ public sealed class SunDisklabel : IPartition
if(useDkl)
{
var sectorsPerCylinder = (ulong)(dkl.dkl_nsect * dkl.dkl_nhead);
ulong sectorsPerCylinder = (ulong)(dkl.dkl_nsect * dkl.dkl_nhead);
AaruConsole.DebugWriteLine(MODULE_NAME,
"dkl.dkl_asciilabel = \"{0}\"",
@@ -178,7 +178,7 @@ public sealed class SunDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "dkl.dkl_bhead = {0}", dkl.dkl_bhead);
AaruConsole.DebugWriteLine(MODULE_NAME, "dkl.dkl_ppart = {0}", dkl.dkl_ppart);
for(var i = 0; i < NDKMAP; i++)
for(int i = 0; i < NDKMAP; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
"dkl.dkl_map[{0}].dkl_cylno = {1}",
@@ -192,7 +192,7 @@ public sealed class SunDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "dkl.dkl_cksum = 0x{0:X4}", dkl.dkl_cksum);
AaruConsole.DebugWriteLine(MODULE_NAME, "sectorsPerCylinder = {0}", sectorsPerCylinder);
for(var i = 0; i < NDKMAP; i++)
for(int i = 0; i < NDKMAP; i++)
{
if(dkl.dkl_map[i].dkl_cylno <= 0 || dkl.dkl_map[i].dkl_nblk <= 0) continue;
@@ -214,7 +214,7 @@ public sealed class SunDisklabel : IPartition
}
else if(useDkl8)
{
var sectorsPerCylinder = (ulong)(dkl8.dkl_nsect * dkl8.dkl_nhead);
ulong sectorsPerCylinder = (ulong)(dkl8.dkl_nsect * dkl8.dkl_nhead);
AaruConsole.DebugWriteLine(MODULE_NAME,
"dkl8.dkl_asciilabel = \"{0}\"",
@@ -243,7 +243,7 @@ public sealed class SunDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "dkl8.dkl_obs3 = {0}", dkl8.dkl_obs3);
AaruConsole.DebugWriteLine(MODULE_NAME, "dkl8.dkl_obs4 = {0}", dkl8.dkl_obs4);
for(var i = 0; i < NDKMAP; i++)
for(int i = 0; i < NDKMAP; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
"dkl8.dkl_map[{0}].dkl_cylno = {1}",
@@ -279,7 +279,7 @@ public sealed class SunDisklabel : IPartition
if(dkl8.dkl_vtoc.v_nparts > NDKMAP) return false;
for(var i = 0; i < dkl8.dkl_vtoc.v_nparts; i++)
for(int i = 0; i < dkl8.dkl_vtoc.v_nparts; i++)
{
if(dkl8.dkl_map[i].dkl_nblk <= 0 ||
dkl8.dkl_vtoc.v_part[i].p_tag == SunTag.SunEmpty ||
@@ -342,7 +342,7 @@ public sealed class SunDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "dkl16.dkl_read_reinstruct = {0}", dkl16.dkl_read_reinstruct);
for(var i = 0; i < NDKMAP16; i++)
for(int i = 0; i < NDKMAP16; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
"dkl16.dkl_vtoc.v_part[{0}].p_start = {1}",
@@ -377,7 +377,7 @@ public sealed class SunDisklabel : IPartition
if(dkl16.dkl_vtoc.v_nparts > NDKMAP16) return false;
for(var i = 0; i < dkl16.dkl_vtoc.v_nparts; i++)
for(int i = 0; i < dkl16.dkl_vtoc.v_nparts; i++)
{
if(dkl16.dkl_vtoc.v_part[i].p_size <= 0 ||
dkl16.dkl_vtoc.v_part[i].p_tag == SunTag.SunEmpty ||
@@ -423,7 +423,7 @@ public sealed class SunDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Swapping_dk_label);
label = (dk_label)Marshal.SwapStructureMembersEndian(label);
for(var i = 0; i < label.dkl_map.Length; i++)
for(int i = 0; i < label.dkl_map.Length; i++)
label.dkl_map[i] = (dk_map)Marshal.SwapStructureMembersEndian(label.dkl_map[i]);
return label;
@@ -434,22 +434,22 @@ public sealed class SunDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Swapping_dk_label8);
label = (dk_label8)Marshal.SwapStructureMembersEndian(label);
for(var i = 0; i < label.dkl_map.Length; i++)
for(int i = 0; i < label.dkl_map.Length; i++)
label.dkl_map[i] = (dk_map)Marshal.SwapStructureMembersEndian(label.dkl_map[i]);
for(var i = 0; i < label.dkl_vtoc.v_bootinfo.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_bootinfo.Length; i++)
label.dkl_vtoc.v_bootinfo[i] = Swapping.Swap(label.dkl_vtoc.v_bootinfo[i]);
for(var i = 0; i < label.dkl_vtoc.v_part.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_part.Length; i++)
{
label.dkl_vtoc.v_part[i].p_flag = (SunFlags)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_flag);
label.dkl_vtoc.v_part[i].p_tag = (SunTag)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_tag);
}
for(var i = 0; i < label.dkl_vtoc.v_timestamp.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_timestamp.Length; i++)
label.dkl_vtoc.v_timestamp[i] = Swapping.Swap(label.dkl_vtoc.v_timestamp[i]);
for(var i = 0; i < label.dkl_vtoc.v_reserved.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_reserved.Length; i++)
label.dkl_vtoc.v_reserved[i] = Swapping.Swap(label.dkl_vtoc.v_reserved[i]);
return label;
@@ -460,10 +460,10 @@ public sealed class SunDisklabel : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Swapping_dk_label16);
label = (dk_label16)Marshal.SwapStructureMembersEndian(label);
for(var i = 0; i < label.dkl_vtoc.v_bootinfo.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_bootinfo.Length; i++)
label.dkl_vtoc.v_bootinfo[i] = Swapping.Swap(label.dkl_vtoc.v_bootinfo[i]);
for(var i = 0; i < label.dkl_vtoc.v_part.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_part.Length; i++)
{
label.dkl_vtoc.v_part[i].p_flag = (SunFlags)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_flag);
label.dkl_vtoc.v_part[i].p_tag = (SunTag)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_tag);
@@ -471,10 +471,10 @@ public sealed class SunDisklabel : IPartition
label.dkl_vtoc.v_part[i].p_start = Swapping.Swap(label.dkl_vtoc.v_part[i].p_start);
}
for(var i = 0; i < label.dkl_vtoc.v_timestamp.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_timestamp.Length; i++)
label.dkl_vtoc.v_timestamp[i] = Swapping.Swap(label.dkl_vtoc.v_timestamp[i]);
for(var i = 0; i < label.dkl_vtoc.v_reserved.Length; i++)
for(int i = 0; i < label.dkl_vtoc.v_reserved.Length; i++)
label.dkl_vtoc.v_reserved[i] = Swapping.Swap(label.dkl_vtoc.v_reserved[i]);
return label;

View File

@@ -38,8 +38,8 @@ using System.Runtime.InteropServices;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -76,8 +76,8 @@ public sealed class VTOC : IPartition
uint magic = 0;
ulong pdloc = 0;
byte[] pdsector = null;
var magicFound = false;
var absolute = false;
bool magicFound = false;
bool absolute = false;
ErrorNumber errno;
foreach(ulong i in new ulong[]
@@ -167,7 +167,7 @@ public sealed class VTOC : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "pdinfo.pad[7] = {0}", pd.pad[7]);
magicFound = false;
var useOld = false;
bool useOld = false;
errno = imagePlugin.ReadSector(pdloc + sectorOffset + 1, out byte[] vtocsector);
if(errno != ErrorNumber.NoError) return false;
@@ -187,7 +187,7 @@ public sealed class VTOC : IPartition
{
vtoc = Marshal.ByteArrayToStructureBigEndian<Vtoc>(vtocsector);
for(var i = 0; i < vtoc.v_part.Length; i++)
for(int i = 0; i < vtoc.v_part.Length; i++)
{
vtoc.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtoc.v_part[i].p_tag);
vtoc.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtoc.v_part[i].p_flag);
@@ -214,7 +214,7 @@ public sealed class VTOC : IPartition
{
vtocOld = Marshal.ByteArrayToStructureBigEndian<VTocOld>(vtocsector);
for(var i = 0; i < vtocOld.v_part.Length; i++)
for(int i = 0; i < vtocOld.v_part.Length; i++)
{
vtocOld.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtocOld.v_part[i].p_tag);
vtocOld.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtocOld.v_part[i].p_flag);
@@ -267,7 +267,7 @@ public sealed class VTOC : IPartition
{
vtoc = Marshal.ByteArrayToStructureBigEndian<Vtoc>(vtocsector);
for(var i = 0; i < vtoc.v_part.Length; i++)
for(int i = 0; i < vtoc.v_part.Length; i++)
{
vtoc.v_part[i].p_tag = (pTag)Swapping.Swap((ushort)vtoc.v_part[i].p_tag);
vtoc.v_part[i].p_flag = (pFlag)Swapping.Swap((ushort)vtoc.v_part[i].p_flag);
@@ -302,7 +302,7 @@ public sealed class VTOC : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "vtocOld.v_sectorsz = {0}", vtocOld.v_sectorsz);
AaruConsole.DebugWriteLine(MODULE_NAME, "vtocOld.v_nparts = {0}", vtocOld.v_nparts);
for(var i = 0; i < V_NUMPAR; i++)
for(int i = 0; i < V_NUMPAR; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
"vtocOld.v_part[{0}].p_tag = {1} ({2})",
@@ -346,7 +346,7 @@ public sealed class VTOC : IPartition
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_pad = {0}", vtoc.v_pad);
AaruConsole.DebugWriteLine(MODULE_NAME, "vtoc.v_nparts = {0}", vtoc.v_nparts);
for(var i = 0; i < V_NUMPAR; i++)
for(int i = 0; i < V_NUMPAR; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
"vtoc.v_part[{0}].p_tag = {1} ({2})",
@@ -390,7 +390,7 @@ public sealed class VTOC : IPartition
// Check for a partition describing the VTOC whose start is the same as the start we know.
// This means partition starts are absolute, not relative, to the VTOC position
for(var i = 0; i < V_NUMPAR; i++)
for(int i = 0; i < V_NUMPAR; i++)
{
if(parts[i].p_tag != pTag.V_BACKUP || (ulong)parts[i].p_start != sectorOffset) continue;
@@ -399,7 +399,7 @@ public sealed class VTOC : IPartition
break;
}
for(var i = 0; i < V_NUMPAR; i++)
for(int i = 0; i < V_NUMPAR; i++)
{
if(parts[i].p_tag == pTag.V_UNUSED) continue;
@@ -414,7 +414,7 @@ public sealed class VTOC : IPartition
Scheme = Name
};
var info = "";
string info = "";
// Apparently old ones are absolute :?
if(!useOld && !absolute)

View File

@@ -35,7 +35,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Partitions;
@@ -84,7 +84,7 @@ public sealed class XENIX : IPartition
if(xnxtbl.p_magic != PAMAGIC) return false;
for(var i = 0; i < MAXPARTS; i++)
for(int i = 0; i < MAXPARTS; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME, "xnxtbl.p[{0}].p_off = {1}", i, xnxtbl.p[i].p_off);
AaruConsole.DebugWriteLine(MODULE_NAME, "xnxtbl.p[{0}].p_size = {1}", i, xnxtbl.p[i].p_size);