mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🎨Converted all plugin types to interfaces.
This commit is contained in:
@@ -42,7 +42,7 @@ using DiscImageChef.DiscImages;
|
||||
namespace DiscImageChef.Partitions
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class SunDisklabel : PartitionPlugin
|
||||
public class SunDisklabel : IPartition
|
||||
{
|
||||
/// <summary>Sun disklabel magic number</summary>
|
||||
const ushort DKL_MAGIC = 0xDABE;
|
||||
@@ -70,19 +70,16 @@ namespace DiscImageChef.Partitions
|
||||
const int LEN_DKL_PAD16 = DK_LABEL_SIZE - (456 + // sizeof(dk_vtoc16)
|
||||
4 * 4 + 12 * 2 + 2 * 2);
|
||||
|
||||
public SunDisklabel()
|
||||
{
|
||||
Name = "Sun Disklabel";
|
||||
PluginUuid = new Guid("50F35CC4-8375-4445-8DCB-1BA550C931A3");
|
||||
}
|
||||
public virtual string Name => "Sun Disklabel";
|
||||
public virtual Guid Id => new Guid("50F35CC4-8375-4445-8DCB-1BA550C931A3");
|
||||
|
||||
public override bool GetInformation(ImagePlugin imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
public virtual bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
if(imagePlugin.ImageInfo.SectorSize < 512) return false;
|
||||
if(imagePlugin.Info.SectorSize < 512) return false;
|
||||
|
||||
if(sectorOffset + 2 >= imagePlugin.ImageInfo.Sectors) return false;
|
||||
if(sectorOffset + 2 >= imagePlugin.Info.Sectors) return false;
|
||||
|
||||
bool useDkl = false, useDkl8 = false, useDkl16 = false;
|
||||
|
||||
@@ -162,16 +159,16 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
Size = (ulong)dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length =
|
||||
(ulong)(dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.ImageInfo.SectorSize),
|
||||
(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,
|
||||
Start = ((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
|
||||
DK_LABEL_SIZE / imagePlugin.ImageInfo.SectorSize,
|
||||
DK_LABEL_SIZE / imagePlugin.Info.SectorSize,
|
||||
Type = "SunOS partition",
|
||||
Scheme = Name
|
||||
};
|
||||
if(part.Start < imagePlugin.ImageInfo.Sectors && part.End <= imagePlugin.ImageInfo.Sectors)
|
||||
if(part.Start < imagePlugin.Info.Sectors && part.End <= imagePlugin.Info.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
@@ -229,12 +226,12 @@ 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.ImageInfo.SectorSize),
|
||||
(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.ImageInfo.SectorSize,
|
||||
DK_LABEL_SIZE / imagePlugin.Info.SectorSize,
|
||||
Type = SunIdToString(dkl8.dkl_vtoc.v_part[i].p_tag),
|
||||
Scheme = Name
|
||||
};
|
||||
@@ -242,7 +239,7 @@ namespace DiscImageChef.Partitions
|
||||
part.Description +=
|
||||
$"\nPartition timestamped on {DateHandlers.UnixToDateTime(dkl8.dkl_vtoc.v_timestamp[i])}";
|
||||
|
||||
if(part.Start < imagePlugin.ImageInfo.Sectors && part.End <= imagePlugin.ImageInfo.Sectors)
|
||||
if(part.Start < imagePlugin.Info.Sectors && part.End <= imagePlugin.Info.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
@@ -297,19 +294,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.ImageInfo.SectorSize),
|
||||
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 / imagePlugin.ImageInfo.SectorSize,
|
||||
dkl16.dkl_vtoc.v_sectorsz / imagePlugin.Info.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.ImageInfo.Sectors && part.End <= imagePlugin.ImageInfo.Sectors)
|
||||
if(part.Start < imagePlugin.Info.Sectors && part.End <= imagePlugin.Info.Sectors)
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user