mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Moved disc image plugins to a separate library.
This commit is contained in:
@@ -60,7 +60,7 @@ namespace DiscImageChef.PartPlugins
|
||||
PluginUUID = new Guid("36405F8D-4F1A-07F5-209C-223D735D6D22");
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions)
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
ulong apm_entries;
|
||||
uint sector_size;
|
||||
@@ -70,7 +70,7 @@ namespace DiscImageChef.PartPlugins
|
||||
else
|
||||
sector_size = imagePlugin.GetSectorSize();
|
||||
|
||||
partitions = new List<Partition>();
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
|
||||
AppleMapBootEntry APMB = new AppleMapBootEntry();
|
||||
AppleMapPartitionEntry APMEntry;
|
||||
@@ -143,7 +143,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if (APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) // It should have partition entry signature
|
||||
{
|
||||
Partition _partition = new Partition();
|
||||
CommonTypes.Partition _partition = new CommonTypes.Partition();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
_partition.PartitionSequence = i;
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace DiscImageChef.PartPlugins
|
||||
PluginUUID = new Guid("d1dd0f24-ec39-4c4d-9072-be31919a3b5e");
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions)
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
|
||||
if (imagePlugin.GetSectorSize() < 512)
|
||||
return false;
|
||||
@@ -155,7 +155,7 @@ namespace DiscImageChef.PartPlugins
|
||||
if (sectorSize == 2448 || sectorSize == 2352)
|
||||
sectorSize = 2048;
|
||||
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionLength = table.entries[i].length * sectorSize;
|
||||
part.PartitionSectors = table.entries[i].length;
|
||||
part.PartitionSequence = partitionSequence;
|
||||
@@ -235,7 +235,7 @@ namespace DiscImageChef.PartPlugins
|
||||
if (sectorSize == 2448 || sectorSize == 2352)
|
||||
sectorSize = 2048;
|
||||
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionLength = extendedTable.entries[j].length * sectorSize;
|
||||
part.PartitionSectors = extendedTable.entries[j].length;
|
||||
part.PartitionSequence = partitionSequence;
|
||||
@@ -306,7 +306,7 @@ namespace DiscImageChef.PartPlugins
|
||||
if (sectorSize == 2448 || sectorSize == 2352)
|
||||
sectorSize = 2048;
|
||||
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionLength = table.icdEntries[i].length * sectorSize;
|
||||
part.PartitionSectors = table.icdEntries[i].length;
|
||||
part.PartitionSequence = partitionSequence;
|
||||
|
||||
@@ -53,13 +53,13 @@ namespace DiscImageChef.PartPlugins
|
||||
PluginUUID = new Guid("5E8A34E8-4F1A-59E6-4BF7-7EA647063A76");
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions)
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
byte cyl_sect1, cyl_sect2; // For decoding cylinder and sector
|
||||
UInt16 signature;
|
||||
ulong counter = 0;
|
||||
|
||||
partitions = new List<Partition>();
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
|
||||
if (imagePlugin.GetSectorSize() < 512)
|
||||
return false;
|
||||
@@ -153,7 +153,7 @@ namespace DiscImageChef.PartPlugins
|
||||
// TODO: Handle disklabels bigger than 1 sector or search max no_parts
|
||||
for (int j = 0; j < no_parts; j++)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
byte bsd_type;
|
||||
|
||||
part.PartitionSectors = BitConverter.ToUInt32(disklabel_sector, 134 + j * 16 + 4);
|
||||
@@ -254,7 +254,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if ((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
// TODO: Check if device bps == disklabel bps
|
||||
part.PartitionStartSector = vtoc_ent.start;
|
||||
part.PartitionSectors = vtoc_ent.length;
|
||||
@@ -292,7 +292,7 @@ namespace DiscImageChef.PartPlugins
|
||||
{
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4);
|
||||
part.PartitionSectors = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 8);
|
||||
part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize(); // 68+4+j*12
|
||||
@@ -323,7 +323,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if (type == 0x81)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
minix_subs = true;
|
||||
part.PartitionDescription = "Minix subpartition";
|
||||
part.PartitionType = "Minix";
|
||||
@@ -348,7 +348,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if (valid)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
if (entry.lba_start > 0 && entry.lba_sectors > 0)
|
||||
{
|
||||
part.PartitionStartSector = entry.lba_start;
|
||||
@@ -455,7 +455,7 @@ namespace DiscImageChef.PartPlugins
|
||||
// TODO: Handle disklabels bigger than 1 sector or search max no_parts
|
||||
for (int j = 0; j < no_parts; j++)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
byte bsd_type;
|
||||
|
||||
part.PartitionSectors = BitConverter.ToUInt32(disklabel_sector, 134 + j * 16 + 4);
|
||||
@@ -556,7 +556,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if ((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
// TODO: Check if device bps == disklabel bps
|
||||
part.PartitionStartSector = vtoc_ent.start;
|
||||
part.PartitionSectors = vtoc_ent.length;
|
||||
@@ -594,7 +594,7 @@ namespace DiscImageChef.PartPlugins
|
||||
{
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4);
|
||||
part.PartitionSectors = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 8);
|
||||
part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize(); // 68+4+j*12
|
||||
@@ -625,7 +625,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if (type == 0x81)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
minix_subs = true;
|
||||
part.PartitionDescription = "Minix subpartition";
|
||||
part.PartitionType = "Minix";
|
||||
@@ -651,7 +651,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if (ext_valid)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
if (entry2.lba_start > 0 && entry2.lba_sectors > 0)
|
||||
{
|
||||
part.PartitionStartSector = entry2.lba_start;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace DiscImageChef.PartPlugins
|
||||
PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions)
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
byte[] cString;
|
||||
bool magic_found;
|
||||
@@ -77,7 +77,7 @@ namespace DiscImageChef.PartPlugins
|
||||
else
|
||||
sector_size = imagePlugin.GetSectorSize();
|
||||
|
||||
partitions = new List<Partition>();
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
|
||||
entry_sector = imagePlugin.ReadSector(0); // Starts on sector 0 on NeXT machines, CDs and floppies
|
||||
magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00);
|
||||
@@ -133,7 +133,7 @@ namespace DiscImageChef.PartPlugins
|
||||
|
||||
if (entry.sectors > 0 && entry.sectors < 0xFFFFFFFF && entry.start < 0xFFFFFFFF)
|
||||
{
|
||||
Partition part = new Partition();
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
part.PartitionLength = (ulong)entry.sectors * sector_size;
|
||||
|
||||
@@ -61,29 +61,6 @@ namespace DiscImageChef.PartPlugins
|
||||
/// <returns><c>true</c>, if partitioning scheme is recognized, <c>false</c> otherwise.</returns>
|
||||
/// <param name="imagePlugin">Disk image.</param>
|
||||
/// <param name="partitions">Returns list of partitions.</param>
|
||||
public abstract bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Partition structure.
|
||||
/// </summary>
|
||||
public struct Partition
|
||||
{
|
||||
/// <summary>Partition number, 0-started</summary>
|
||||
public ulong PartitionSequence;
|
||||
/// <summary>Partition type</summary>
|
||||
public string PartitionType;
|
||||
/// <summary>Partition name (if the scheme supports it)</summary>
|
||||
public string PartitionName;
|
||||
/// <summary>Start of the partition, in bytes</summary>
|
||||
public ulong PartitionStart;
|
||||
/// <summary>LBA of partition start</summary>
|
||||
public ulong PartitionStartSector;
|
||||
/// <summary>Length in bytes of the partition</summary>
|
||||
public ulong PartitionLength;
|
||||
/// <summary>Length in sectors of the partition</summary>
|
||||
public ulong PartitionSectors;
|
||||
/// <summary>Information that does not find space in this struct</summary>
|
||||
public string PartitionDescription;
|
||||
public abstract bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions);
|
||||
}
|
||||
}
|
||||
@@ -889,9 +889,9 @@ namespace DiscImageChef.PartPlugins
|
||||
public byte[] loadData;
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions)
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
ulong RDBBlock = 0;
|
||||
bool foundRDB = false;
|
||||
@@ -1363,7 +1363,7 @@ namespace DiscImageChef.PartPlugins
|
||||
ulong sequence = 0;
|
||||
foreach (PartitionEntry RDBEntry in PartitionEntries)
|
||||
{
|
||||
Partition entry = new Partition();
|
||||
CommonTypes.Partition entry = new CommonTypes.Partition();
|
||||
|
||||
entry.PartitionDescription = AmigaDOSTypeToDescriptionString(RDBEntry.dosEnvVec.dosType);
|
||||
entry.PartitionName = RDBEntry.driveName;
|
||||
|
||||
Reference in New Issue
Block a user