mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code restyling.
This commit is contained in:
@@ -34,13 +34,9 @@ namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class DiscFerret
|
||||
{
|
||||
/// <summary>
|
||||
/// "DFER"
|
||||
/// </summary>
|
||||
/// <summary>"DFER"</summary>
|
||||
const uint DFI_MAGIC = 0x52454644;
|
||||
/// <summary>
|
||||
/// "DFE2"
|
||||
/// </summary>
|
||||
/// <summary>"DFE2"</summary>
|
||||
const uint DFI_MAGIC2 = 0x32454644;
|
||||
}
|
||||
}
|
||||
@@ -40,35 +40,23 @@ namespace Aaru.DiscImages
|
||||
public partial class DiscFerret : IMediaImage, IVerifiableSectorsImage
|
||||
{
|
||||
ImageInfo imageInfo;
|
||||
|
||||
// TODO: These variables have been made public so create-sidecar can access to this information until I define an API >4.0
|
||||
public SortedDictionary<int, long> TrackLengths;
|
||||
public SortedDictionary<int, long> TrackOffsets;
|
||||
|
||||
public DiscFerret()
|
||||
public DiscFerret() => imageInfo = new ImageInfo
|
||||
{
|
||||
imageInfo = new ImageInfo
|
||||
{
|
||||
ReadableSectorTags = new List<SectorTagType>(),
|
||||
ReadableMediaTags = new List<MediaTagType>(),
|
||||
HasPartitions = false,
|
||||
HasSessions = false,
|
||||
Version = null,
|
||||
Application = null,
|
||||
ApplicationVersion = null,
|
||||
Creator = null,
|
||||
Comments = null,
|
||||
MediaManufacturer = null,
|
||||
MediaModel = null,
|
||||
MediaSerialNumber = null,
|
||||
MediaBarcode = null,
|
||||
MediaPartNumber = null,
|
||||
MediaSequence = 0,
|
||||
LastMediaSequence = 0,
|
||||
DriveManufacturer = null,
|
||||
DriveModel = null,
|
||||
DriveSerialNumber = null,
|
||||
DriveFirmwareRevision = null
|
||||
};
|
||||
}
|
||||
ReadableSectorTags = new List<SectorTagType>(), ReadableMediaTags = new List<MediaTagType>(),
|
||||
HasPartitions = false, HasSessions = false, Version = null,
|
||||
Application = null,
|
||||
ApplicationVersion = null, Creator = null, Comments = null,
|
||||
MediaManufacturer = null,
|
||||
MediaModel = null, MediaSerialNumber = null, MediaBarcode = null,
|
||||
MediaPartNumber = null,
|
||||
MediaSequence = 0, LastMediaSequence = 0, DriveManufacturer = null,
|
||||
DriveModel = null,
|
||||
DriveSerialNumber = null, DriveFirmwareRevision = null
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,9 @@ namespace Aaru.DiscImages
|
||||
stream.Read(magicB, 0, 4);
|
||||
uint magic = BitConverter.ToUInt32(magicB, 0);
|
||||
|
||||
if(magic != DFI_MAGIC && magic != DFI_MAGIC2) return false;
|
||||
if(magic != DFI_MAGIC &&
|
||||
magic != DFI_MAGIC2)
|
||||
return false;
|
||||
|
||||
TrackOffsets = new SortedDictionary<int, long>();
|
||||
TrackLengths = new SortedDictionary<int, long>();
|
||||
@@ -66,41 +68,50 @@ namespace Aaru.DiscImages
|
||||
DfiBlockHeader blockHeader = Marshal.ByteArrayToStructureBigEndian<DfiBlockHeader>(blk);
|
||||
|
||||
AaruConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.cylinder = {1}", thisOffset,
|
||||
blockHeader.cylinder);
|
||||
blockHeader.cylinder);
|
||||
|
||||
AaruConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.head = {1}", thisOffset, blockHeader.head);
|
||||
|
||||
AaruConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.sector = {1}", thisOffset,
|
||||
blockHeader.sector);
|
||||
blockHeader.sector);
|
||||
|
||||
AaruConsole.DebugWriteLine("DiscFerret plugin", "block@{0}.length = {1}", thisOffset,
|
||||
blockHeader.length);
|
||||
blockHeader.length);
|
||||
|
||||
if(stream.Position + blockHeader.length > stream.Length)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("DiscFerret plugin", "Invalid track block found at {0}", thisOffset);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
stream.Position += blockHeader.length;
|
||||
|
||||
if(blockHeader.cylinder > 0 && blockHeader.cylinder > lastCylinder)
|
||||
if(blockHeader.cylinder > 0 &&
|
||||
blockHeader.cylinder > lastCylinder)
|
||||
{
|
||||
lastCylinder = blockHeader.cylinder;
|
||||
lastHead = 0;
|
||||
TrackOffsets.Add(t, offset);
|
||||
TrackLengths.Add(t, thisOffset - offset + 1);
|
||||
TrackLengths.Add(t, (thisOffset - offset) + 1);
|
||||
offset = thisOffset;
|
||||
t++;
|
||||
}
|
||||
else if(blockHeader.head > 0 && blockHeader.head > lastHead)
|
||||
else if(blockHeader.head > 0 &&
|
||||
blockHeader.head > lastHead)
|
||||
{
|
||||
lastHead = blockHeader.head;
|
||||
TrackOffsets.Add(t, offset);
|
||||
TrackLengths.Add(t, thisOffset - offset + 1);
|
||||
TrackLengths.Add(t, (thisOffset - offset) + 1);
|
||||
offset = thisOffset;
|
||||
t++;
|
||||
}
|
||||
|
||||
if(blockHeader.cylinder > imageInfo.Cylinders) imageInfo.Cylinders = blockHeader.cylinder;
|
||||
if(blockHeader.head > imageInfo.Heads) imageInfo.Heads = blockHeader.head;
|
||||
if(blockHeader.cylinder > imageInfo.Cylinders)
|
||||
imageInfo.Cylinders = blockHeader.cylinder;
|
||||
|
||||
if(blockHeader.head > imageInfo.Heads)
|
||||
imageInfo.Heads = blockHeader.head;
|
||||
}
|
||||
|
||||
imageInfo.Heads++;
|
||||
|
||||
@@ -39,10 +39,10 @@ namespace Aaru.DiscImages
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct DfiBlockHeader
|
||||
{
|
||||
public ushort cylinder;
|
||||
public ushort head;
|
||||
public ushort sector;
|
||||
public uint length;
|
||||
public readonly ushort cylinder;
|
||||
public readonly ushort head;
|
||||
public readonly ushort sector;
|
||||
public readonly uint length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace Aaru.DiscImages
|
||||
public bool? VerifySector(ulong sectorAddress) =>
|
||||
throw new NotImplementedException("Flux decoding is not yet implemented.");
|
||||
|
||||
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
|
||||
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
|
||||
out List<ulong> unknownLbas) =>
|
||||
throw new NotImplementedException("Flux decoding is not yet implemented.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user