mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Fixed MOST name inconsistencies.
This commit is contained in:
@@ -38,7 +38,7 @@ using System.Runtime.InteropServices;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Filters;
|
||||
using DiscImageChef.ImagePlugins;
|
||||
using DiscImageChef.DiscImages;
|
||||
using Extents;
|
||||
|
||||
namespace DiscImageChef.DiscImages
|
||||
@@ -46,21 +46,21 @@ namespace DiscImageChef.DiscImages
|
||||
public class PartClone : ImagePlugin
|
||||
{
|
||||
#region Internal constants
|
||||
readonly byte[] PartCloneMagic =
|
||||
readonly byte[] partCloneMagic =
|
||||
{0x70, 0x61, 0x72, 0x74, 0x63, 0x6C, 0x6F, 0x6E, 0x65, 0x2D, 0x69, 0x6D, 0x61, 0x67, 0x65};
|
||||
readonly byte[] BiTmAgIc = {0x42, 0x69, 0x54, 0x6D, 0x41, 0x67, 0x49, 0x63};
|
||||
readonly byte[] biTmAgIc = {0x42, 0x69, 0x54, 0x6D, 0x41, 0x67, 0x49, 0x63};
|
||||
const int CRC_SIZE = 4;
|
||||
#endregion
|
||||
|
||||
#region Internal Structures
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
/// <summary>
|
||||
/// PartClone disk image header, little-endian
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct PartCloneHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Magic, <see cref="PartCloneMagic"/>
|
||||
/// Magic, <see cref="PartClone.partCloneMagic"/>
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] magic;
|
||||
/// <summary>
|
||||
@@ -107,8 +107,8 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
Dictionary<ulong, byte[]> sectorCache;
|
||||
|
||||
const uint MaxCacheSize = 16777216;
|
||||
uint maxCachedSectors = MaxCacheSize / 512;
|
||||
const uint MAX_CACHE_SIZE = 16777216;
|
||||
uint maxCachedSectors = MAX_CACHE_SIZE / 512;
|
||||
|
||||
ExtentsULong extents;
|
||||
Dictionary<ulong, ulong> extentsOff;
|
||||
@@ -116,27 +116,27 @@ namespace DiscImageChef.DiscImages
|
||||
public PartClone()
|
||||
{
|
||||
Name = "PartClone disk image";
|
||||
PluginUUID = new Guid("AB1D7518-B548-4099-A4E2-C29C53DDE0C3");
|
||||
PluginUuid = new Guid("AB1D7518-B548-4099-A4E2-C29C53DDE0C3");
|
||||
ImageInfo = new ImageInfo();
|
||||
ImageInfo.readableSectorTags = new List<SectorTagType>();
|
||||
ImageInfo.readableMediaTags = new List<MediaTagType>();
|
||||
ImageInfo.imageHasPartitions = false;
|
||||
ImageInfo.imageHasSessions = false;
|
||||
ImageInfo.imageApplication = "PartClone";
|
||||
ImageInfo.imageApplicationVersion = null;
|
||||
ImageInfo.imageCreator = null;
|
||||
ImageInfo.imageComments = null;
|
||||
ImageInfo.mediaManufacturer = null;
|
||||
ImageInfo.mediaModel = null;
|
||||
ImageInfo.mediaSerialNumber = null;
|
||||
ImageInfo.mediaBarcode = null;
|
||||
ImageInfo.mediaPartNumber = null;
|
||||
ImageInfo.mediaSequence = 0;
|
||||
ImageInfo.lastMediaSequence = 0;
|
||||
ImageInfo.driveManufacturer = null;
|
||||
ImageInfo.driveModel = null;
|
||||
ImageInfo.driveSerialNumber = null;
|
||||
ImageInfo.driveFirmwareRevision = null;
|
||||
ImageInfo.ReadableSectorTags = new List<SectorTagType>();
|
||||
ImageInfo.ReadableMediaTags = new List<MediaTagType>();
|
||||
ImageInfo.ImageHasPartitions = false;
|
||||
ImageInfo.ImageHasSessions = false;
|
||||
ImageInfo.ImageApplication = "PartClone";
|
||||
ImageInfo.ImageApplicationVersion = null;
|
||||
ImageInfo.ImageCreator = null;
|
||||
ImageInfo.ImageComments = null;
|
||||
ImageInfo.MediaManufacturer = null;
|
||||
ImageInfo.MediaModel = null;
|
||||
ImageInfo.MediaSerialNumber = null;
|
||||
ImageInfo.MediaBarcode = null;
|
||||
ImageInfo.MediaPartNumber = null;
|
||||
ImageInfo.MediaSequence = 0;
|
||||
ImageInfo.LastMediaSequence = 0;
|
||||
ImageInfo.DriveManufacturer = null;
|
||||
ImageInfo.DriveModel = null;
|
||||
ImageInfo.DriveSerialNumber = null;
|
||||
ImageInfo.DriveFirmwareRevision = null;
|
||||
}
|
||||
|
||||
public override bool IdentifyImage(Filter imageFilter)
|
||||
@@ -146,11 +146,11 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
if(stream.Length < 512) return false;
|
||||
|
||||
byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)];
|
||||
stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr));
|
||||
byte[] pHdrB = new byte[Marshal.SizeOf(pHdr)];
|
||||
stream.Read(pHdrB, 0, Marshal.SizeOf(pHdr));
|
||||
pHdr = new PartCloneHeader();
|
||||
IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr));
|
||||
Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(pHdr));
|
||||
Marshal.Copy(pHdrB, 0, headerPtr, Marshal.SizeOf(pHdr));
|
||||
pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader));
|
||||
Marshal.FreeHGlobal(headerPtr);
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace DiscImageChef.DiscImages
|
||||
byte[] bitmagic = new byte[8];
|
||||
stream.Read(bitmagic, 0, 8);
|
||||
|
||||
return PartCloneMagic.SequenceEqual(pHdr.magic) && BiTmAgIc.SequenceEqual(bitmagic);
|
||||
return partCloneMagic.SequenceEqual(pHdr.magic) && biTmAgIc.SequenceEqual(bitmagic);
|
||||
}
|
||||
|
||||
public override bool OpenImage(Filter imageFilter)
|
||||
@@ -171,11 +171,11 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
if(stream.Length < 512) return false;
|
||||
|
||||
byte[] pHdr_b = new byte[Marshal.SizeOf(pHdr)];
|
||||
stream.Read(pHdr_b, 0, Marshal.SizeOf(pHdr));
|
||||
byte[] pHdrB = new byte[Marshal.SizeOf(pHdr)];
|
||||
stream.Read(pHdrB, 0, Marshal.SizeOf(pHdr));
|
||||
pHdr = new PartCloneHeader();
|
||||
IntPtr headerPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pHdr));
|
||||
Marshal.Copy(pHdr_b, 0, headerPtr, Marshal.SizeOf(pHdr));
|
||||
Marshal.Copy(pHdrB, 0, headerPtr, Marshal.SizeOf(pHdr));
|
||||
pHdr = (PartCloneHeader)Marshal.PtrToStructure(headerPtr, typeof(PartCloneHeader));
|
||||
Marshal.FreeHGlobal(headerPtr);
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
DicConsole.DebugWriteLine("PartClone plugin", "pHdr.bitmagic = {0}", StringHandlers.CToString(bitmagic));
|
||||
|
||||
if(!BiTmAgIc.SequenceEqual(bitmagic))
|
||||
if(!biTmAgIc.SequenceEqual(bitmagic))
|
||||
throw new ImageNotSupportedException("Could not find partclone BiTmAgIc, not continuing...");
|
||||
|
||||
dataOff = stream.Position;
|
||||
@@ -242,14 +242,14 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
sectorCache = new Dictionary<ulong, byte[]>();
|
||||
|
||||
ImageInfo.imageCreationTime = imageFilter.GetCreationTime();
|
||||
ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime();
|
||||
ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
|
||||
ImageInfo.sectors = pHdr.totalBlocks;
|
||||
ImageInfo.sectorSize = pHdr.blockSize;
|
||||
ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
|
||||
ImageInfo.mediaType = MediaType.GENERIC_HDD;
|
||||
ImageInfo.imageSize = (ulong)(stream.Length - (4096 + 0x40 + (long)pHdr.totalBlocks));
|
||||
ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
|
||||
ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
|
||||
ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
|
||||
ImageInfo.Sectors = pHdr.totalBlocks;
|
||||
ImageInfo.SectorSize = pHdr.blockSize;
|
||||
ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
|
||||
ImageInfo.MediaType = MediaType.GENERIC_HDD;
|
||||
ImageInfo.ImageSize = (ulong)(stream.Length - (4096 + 0x40 + (long)pHdr.totalBlocks));
|
||||
imageStream = stream;
|
||||
|
||||
return true;
|
||||
@@ -264,7 +264,7 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
public override byte[] ReadSector(ulong sectorAddress)
|
||||
{
|
||||
if(sectorAddress > ImageInfo.sectors - 1)
|
||||
if(sectorAddress > ImageInfo.Sectors - 1)
|
||||
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
|
||||
string.Format("Sector address {0} not found", sectorAddress));
|
||||
|
||||
@@ -289,11 +289,11 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
public override byte[] ReadSectors(ulong sectorAddress, uint length)
|
||||
{
|
||||
if(sectorAddress > ImageInfo.sectors - 1)
|
||||
if(sectorAddress > ImageInfo.Sectors - 1)
|
||||
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
|
||||
string.Format("Sector address {0} not found", sectorAddress));
|
||||
|
||||
if(sectorAddress + length > ImageInfo.sectors)
|
||||
if(sectorAddress + length > ImageInfo.Sectors)
|
||||
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
|
||||
|
||||
MemoryStream ms = new MemoryStream();
|
||||
@@ -326,17 +326,17 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
public override ulong GetImageSize()
|
||||
{
|
||||
return ImageInfo.imageSize;
|
||||
return ImageInfo.ImageSize;
|
||||
}
|
||||
|
||||
public override ulong GetSectors()
|
||||
{
|
||||
return ImageInfo.sectors;
|
||||
return ImageInfo.Sectors;
|
||||
}
|
||||
|
||||
public override uint GetSectorSize()
|
||||
{
|
||||
return ImageInfo.sectorSize;
|
||||
return ImageInfo.SectorSize;
|
||||
}
|
||||
|
||||
public override string GetImageFormat()
|
||||
@@ -346,47 +346,47 @@ namespace DiscImageChef.DiscImages
|
||||
|
||||
public override string GetImageVersion()
|
||||
{
|
||||
return ImageInfo.imageVersion;
|
||||
return ImageInfo.ImageVersion;
|
||||
}
|
||||
|
||||
public override string GetImageApplication()
|
||||
{
|
||||
return ImageInfo.imageApplication;
|
||||
return ImageInfo.ImageApplication;
|
||||
}
|
||||
|
||||
public override string GetImageApplicationVersion()
|
||||
{
|
||||
return ImageInfo.imageApplicationVersion;
|
||||
return ImageInfo.ImageApplicationVersion;
|
||||
}
|
||||
|
||||
public override string GetImageCreator()
|
||||
{
|
||||
return ImageInfo.imageCreator;
|
||||
return ImageInfo.ImageCreator;
|
||||
}
|
||||
|
||||
public override DateTime GetImageCreationTime()
|
||||
{
|
||||
return ImageInfo.imageCreationTime;
|
||||
return ImageInfo.ImageCreationTime;
|
||||
}
|
||||
|
||||
public override DateTime GetImageLastModificationTime()
|
||||
{
|
||||
return ImageInfo.imageLastModificationTime;
|
||||
return ImageInfo.ImageLastModificationTime;
|
||||
}
|
||||
|
||||
public override string GetImageName()
|
||||
{
|
||||
return ImageInfo.imageName;
|
||||
return ImageInfo.ImageName;
|
||||
}
|
||||
|
||||
public override string GetImageComments()
|
||||
{
|
||||
return ImageInfo.imageComments;
|
||||
return ImageInfo.ImageComments;
|
||||
}
|
||||
|
||||
public override MediaType GetMediaType()
|
||||
{
|
||||
return ImageInfo.mediaType;
|
||||
return ImageInfo.MediaType;
|
||||
}
|
||||
|
||||
#region Unsupported features
|
||||
@@ -530,18 +530,18 @@ namespace DiscImageChef.DiscImages
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> FailingLBAs,
|
||||
out List<ulong> UnknownLBAs)
|
||||
public override bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
|
||||
out List<ulong> unknownLbas)
|
||||
{
|
||||
FailingLBAs = new List<ulong>();
|
||||
UnknownLBAs = new List<ulong>();
|
||||
for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i);
|
||||
failingLbas = new List<ulong>();
|
||||
unknownLbas = new List<ulong>();
|
||||
for(ulong i = 0; i < ImageInfo.Sectors; i++) unknownLbas.Add(i);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> FailingLBAs,
|
||||
out List<ulong> UnknownLBAs)
|
||||
public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List<ulong> failingLbas,
|
||||
out List<ulong> unknownLbas)
|
||||
{
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user