mirror of
https://github.com/aaru-dps/Aaru.CommonTypes.git
synced 2025-12-16 19:24:30 +00:00
Add XML comments to public entities.
This commit is contained in:
@@ -75,6 +75,7 @@ namespace Aaru.CommonTypes
|
||||
/// <summary>Shows an error message</summary>
|
||||
public delegate void ErrorMessageHandler(string text);
|
||||
|
||||
/// <summary>Initializes a block map that's going to be filled with a media scan</summary>
|
||||
public delegate void InitBlockMapHandler(ulong blocks, ulong blockSize, ulong blocksToRead, ushort currentProfile);
|
||||
|
||||
/// <summary>Updates lists of time taken on scanning from the specified sector</summary>
|
||||
@@ -84,5 +85,6 @@ namespace Aaru.CommonTypes
|
||||
/// <summary>Specified a number of blocks could not be read on scan</summary>
|
||||
public delegate void ScanUnreadableHandler(ulong sector);
|
||||
|
||||
/// <summary>Sends the speed of scanning a specific sector</summary>
|
||||
public delegate void ScanSpeedHandler(ulong sector, double currentSpeed);
|
||||
}
|
||||
@@ -38,10 +38,38 @@
|
||||
|
||||
namespace Aaru.CommonTypes.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Device types
|
||||
/// </summary>
|
||||
public enum DeviceType
|
||||
{
|
||||
Unknown = -1, ATA = 1, ATAPI = 2,
|
||||
SCSI = 3, SecureDigital = 4, MMC = 5,
|
||||
/// <summary>
|
||||
/// Unknown device type
|
||||
/// </summary>
|
||||
Unknown = -1,
|
||||
/// <summary>
|
||||
/// ATA device
|
||||
/// </summary>
|
||||
ATA = 1,
|
||||
/// <summary>
|
||||
/// ATA Packet device (aka SCSI over ATA)
|
||||
/// </summary>
|
||||
ATAPI = 2,
|
||||
/// <summary>
|
||||
/// SCSI device (or USB-MSC, SBP2, FC, UAS, etc)
|
||||
/// </summary>
|
||||
SCSI = 3,
|
||||
/// <summary>
|
||||
/// SecureDigital memory card
|
||||
/// </summary>
|
||||
SecureDigital = 4,
|
||||
/// <summary>
|
||||
/// MultiMediaCard memory card
|
||||
/// </summary>
|
||||
MMC = 5,
|
||||
/// <summary>
|
||||
/// NVMe device
|
||||
/// </summary>
|
||||
NVMe = 6
|
||||
}
|
||||
}
|
||||
@@ -321,6 +321,9 @@ namespace Aaru.CommonTypes.Enums
|
||||
NotFound = 0x40
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Types of floppy disks
|
||||
/// </summary>
|
||||
public enum FloppyTypes : byte
|
||||
{
|
||||
/// <summary>8" floppy</summary>
|
||||
@@ -337,6 +340,9 @@ namespace Aaru.CommonTypes.Enums
|
||||
QuickDisk
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of floppy densities
|
||||
/// </summary>
|
||||
public enum FloppyDensities : byte
|
||||
{
|
||||
/// <summary>Standard coercivity (about 300Oe as found in 8" and 5.25"-double-density disks).</summary>
|
||||
@@ -349,16 +355,76 @@ namespace Aaru.CommonTypes.Enums
|
||||
Extended
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Capabilities for optical media image formats
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum OpticalImageCapabilities : ulong
|
||||
{
|
||||
CanStoreAudioTracks = 0x01, CanStoreVideoTracks = 0x02, CanStoreDataTracks = 0x03,
|
||||
CanStorePregaps = 0x04, CanStoreIndexes = 0x08, CanStoreSubchannelRw = 0x10,
|
||||
CanStoreSessions = 0x20, CanStoreIsrc = 0x40, CanStoreCdText = 0x80,
|
||||
CanStoreMcn = 0x100, CanStoreRawData = 0x200, CanStoreNotCdSessions = 0x2000,
|
||||
/// <summary>
|
||||
/// Can store Red Book audio tracks?
|
||||
/// </summary>
|
||||
CanStoreAudioTracks = 0x01,
|
||||
/// <summary>
|
||||
/// Can store CD-V analogue video tracks?
|
||||
/// </summary>
|
||||
CanStoreVideoTracks = 0x02,
|
||||
/// <summary>
|
||||
/// Can store Yellow Book data tracks?
|
||||
/// </summary>
|
||||
CanStoreDataTracks = 0x03,
|
||||
/// <summary>
|
||||
/// Can store pregaps without needing to interpret the subchannel?
|
||||
/// </summary>
|
||||
CanStorePregaps = 0x04,
|
||||
/// <summary>
|
||||
/// Can store indexes without needing to interpret the subchannel?
|
||||
/// </summary>
|
||||
CanStoreIndexes = 0x08,
|
||||
/// <summary>
|
||||
/// Can store raw P to W subchannel data?
|
||||
/// </summary>
|
||||
CanStoreSubchannelRw = 0x10,
|
||||
/// <summary>
|
||||
/// Can store more than one session?
|
||||
/// </summary>
|
||||
CanStoreSessions = 0x20,
|
||||
/// <summary>
|
||||
/// Can store track ISRCs without needing to interpret the subchannel?
|
||||
/// </summary>
|
||||
CanStoreIsrc = 0x40,
|
||||
/// <summary>
|
||||
/// Can store Lead-In's CD-TEXT?
|
||||
/// </summary>
|
||||
CanStoreCdText = 0x80,
|
||||
/// <summary>
|
||||
/// Can store the MCN without needing to interpret the subchannel?
|
||||
/// </summary>
|
||||
CanStoreMcn = 0x100,
|
||||
/// <summary>
|
||||
/// Can store the whole 2352 bytes of a sector?
|
||||
/// </summary>
|
||||
CanStoreRawData = 0x200,
|
||||
/// <summary>
|
||||
/// Can store more than 1 session in media that is not CD based (DVD et al)?
|
||||
/// </summary>
|
||||
CanStoreNotCdSessions = 0x2000,
|
||||
/// <summary>
|
||||
/// Can store more than 1 track in media that is not CD based (DVD et al)?
|
||||
/// </summary>
|
||||
CanStoreNotCdTracks = 0x4000,
|
||||
|
||||
// TODO: Implement
|
||||
CanStoreScrambledData = 0x400, CanStoreCookedData = 0x800, CanStoreMultipleTracks = 0x1000
|
||||
/// <summary>
|
||||
/// Can store scrambled data?
|
||||
/// </summary>
|
||||
CanStoreScrambledData = 0x400,
|
||||
/// <summary>
|
||||
/// Can store only the user area of a sector (2048, 2324, etc)?
|
||||
/// </summary>
|
||||
CanStoreCookedData = 0x800,
|
||||
/// <summary>
|
||||
/// Can store more than 1 track?
|
||||
/// </summary>
|
||||
CanStoreMultipleTracks = 0x1000
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,16 @@ using Schemas;
|
||||
|
||||
namespace Aaru.CommonTypes.Extents
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts extents
|
||||
/// </summary>
|
||||
public static class ExtentsConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts unsigned long integer extents into XML based extents
|
||||
/// </summary>
|
||||
/// <param name="extents">Extents</param>
|
||||
/// <returns>XML based extents</returns>
|
||||
public static ExtentType[] ToMetadata(ExtentsULong extents)
|
||||
{
|
||||
if(extents == null)
|
||||
@@ -63,6 +71,11 @@ namespace Aaru.CommonTypes.Extents
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts XML based extents into unsigned long integer extents
|
||||
/// </summary>
|
||||
/// <param name="extents">XML based extents</param>
|
||||
/// <returns>Extents</returns>
|
||||
public static ExtentsULong FromMetadata(ExtentType[] extents)
|
||||
{
|
||||
if(extents == null)
|
||||
|
||||
@@ -46,8 +46,14 @@ using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages the known filters
|
||||
/// </summary>
|
||||
public sealed class FiltersList
|
||||
{
|
||||
/// <summary>
|
||||
/// List of known filters
|
||||
/// </summary>
|
||||
public readonly SortedDictionary<string, IFilter> Filters;
|
||||
|
||||
/// <summary>Fills the list of all known filters</summary>
|
||||
|
||||
16
Geometry.cs
16
Geometry.cs
@@ -40,8 +40,14 @@ using System.Linq;
|
||||
|
||||
namespace Aaru.CommonTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles CHS geometries
|
||||
/// </summary>
|
||||
public static class Geometry
|
||||
{
|
||||
/// <summary>
|
||||
/// List of known disk geometries
|
||||
/// </summary>
|
||||
public static readonly (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding
|
||||
encoding, bool variableSectorsPerTrack, MediaType type)[] KnownGeometries =
|
||||
{
|
||||
@@ -116,6 +122,11 @@ namespace Aaru.CommonTypes
|
||||
(1024, 2, 32, 512, MediaEncoding.MFM, false, MediaType.FD32MB)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media type for a given geometry
|
||||
/// </summary>
|
||||
/// <param name="geometry">Geometry</param>
|
||||
/// <returns>Media type</returns>
|
||||
public static MediaType GetMediaType(
|
||||
(ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool
|
||||
variableSectorsPerTrack) geometry) => (from geom in KnownGeometries
|
||||
@@ -128,6 +139,11 @@ namespace Aaru.CommonTypes
|
||||
geometry.variableSectorsPerTrack select geom.type).
|
||||
FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the geometry for a given media type
|
||||
/// </summary>
|
||||
/// <param name="mediaType">Media type</param>
|
||||
/// <returns>Geometry</returns>
|
||||
public static (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding
|
||||
, bool variableSectorsPerTrack, MediaType type) GetGeometry(MediaType mediaType) =>
|
||||
(from geom in KnownGeometries where geom.type == mediaType select geom).FirstOrDefault();
|
||||
|
||||
@@ -39,6 +39,9 @@ using System.IO;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Supported archive features
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ArchiveSupportedFeature : uint
|
||||
{
|
||||
@@ -68,6 +71,9 @@ namespace Aaru.CommonTypes.Interfaces
|
||||
SupportsXAttrs = 1 << 6
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the interface to handle an archive (e.g. ZIP, WAD, etc)
|
||||
/// </summary>
|
||||
public interface IArchive
|
||||
{
|
||||
/// <summary>Descriptive name of the plugin</summary>
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the interface to implement a checksum or hashing algorithm
|
||||
/// </summary>
|
||||
public interface IChecksum
|
||||
{
|
||||
/// <summary>Updates the hash with data.</summary>
|
||||
|
||||
@@ -45,6 +45,9 @@ namespace Aaru.CommonTypes.Interfaces
|
||||
/// <summary>Interface to implement filesystem plugins.</summary>
|
||||
public interface IFilesystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the encoding used to interpret strings in the filesystem
|
||||
/// </summary>
|
||||
Encoding Encoding { get; }
|
||||
/// <summary>Plugin name.</summary>
|
||||
string Name { get; }
|
||||
|
||||
@@ -41,6 +41,10 @@ using System.IO;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a filter, that is, a transformation of the data from a file, like, for example, a compressor (e.g. GZIP),
|
||||
/// or a container (e.g. AppleDouble)
|
||||
/// </summary>
|
||||
public interface IFilter
|
||||
{
|
||||
/// <summary>Descriptive name of the plugin</summary>
|
||||
|
||||
@@ -41,6 +41,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines an image that can contain partitions
|
||||
/// </summary>
|
||||
public interface IPartitionableMediaImage
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -41,6 +41,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a register of all known plugins
|
||||
/// </summary>
|
||||
public interface IPluginRegister
|
||||
{
|
||||
/// <summary>Gets all checksum plugins</summary>
|
||||
|
||||
@@ -45,12 +45,17 @@ using Aaru.CommonTypes.Structs;
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>Interface to implement filesystem plugins.</summary>
|
||||
/// <summary>
|
||||
/// Defines the interface to implement reading the contents of a filesystem
|
||||
/// </summary>
|
||||
public interface IReadOnlyFilesystem : IFilesystem
|
||||
{
|
||||
/// <summary>Retrieves a list of options supported by the filesystem, with name, type and description</summary>
|
||||
IEnumerable<(string name, Type type, string description)> SupportedOptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Supported namespaces
|
||||
/// </summary>
|
||||
Dictionary<string, string> Namespaces { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -90,7 +95,7 @@ namespace Aaru.CommonTypes.Interfaces
|
||||
/// <summary>Reads an extended attribute, alternate data stream or fork from the given file.</summary>
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">File path.</param>
|
||||
/// <param name="xattr">Extendad attribute, alternate data stream or fork name.</param>
|
||||
/// <param name="xattr">Extended attribute, alternate data stream or fork name.</param>
|
||||
/// <param name="buf">Buffer.</param>
|
||||
Errno GetXattr(string path, string xattr, ref byte[] buf);
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines an image that can store the information from streaming, digital, tapes
|
||||
/// </summary>
|
||||
public interface ITapeImage : IMediaImage
|
||||
{
|
||||
/// <summary>Gets a list of all the files registered in the image</summary>
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines an image that can verify the integrity of the image itself, but not its contents
|
||||
/// </summary>
|
||||
public interface IVerifiableImage
|
||||
{
|
||||
/// <summary>Verifies media image internal checksum.</summary>
|
||||
|
||||
@@ -41,6 +41,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines an image that can verify the integrity of the sectors it contains
|
||||
/// </summary>
|
||||
public interface IVerifiableSectorsImage
|
||||
{
|
||||
/// <summary>Verifies a sector.</summary>
|
||||
|
||||
@@ -62,7 +62,13 @@ namespace Aaru.CommonTypes.Interfaces
|
||||
/// <summary>Gets a list of known extensions for format auto-choosing</summary>
|
||||
IEnumerable<string> KnownExtensions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// If set to <c>true</c> means the image is opened for writing
|
||||
/// </summary>
|
||||
bool IsWriting { get; }
|
||||
/// <summary>
|
||||
/// Contains a description of the last error
|
||||
/// </summary>
|
||||
string ErrorMessage { get; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -42,8 +42,14 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines an image that is writable and can store an optical disc (CD, DVD, etc)
|
||||
/// </summary>
|
||||
public interface IWritableOpticalImage : IWritableImage, IOpticalMediaImage
|
||||
{
|
||||
/// <summary>
|
||||
/// Image format capabilities
|
||||
/// </summary>
|
||||
OpticalImageCapabilities OpticalCapabilities { get; }
|
||||
|
||||
/// <summary>Sets tracks for optical media</summary>
|
||||
|
||||
@@ -41,6 +41,9 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.CommonTypes.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines an image that is writable and can store information about a streaming, digital, tape
|
||||
/// </summary>
|
||||
public interface IWritableTapeImage : ITapeImage, IWritableImage
|
||||
{
|
||||
/// <summary>Registers a new file in the image</summary>
|
||||
|
||||
@@ -44,14 +44,29 @@ using System.Security.Principal;
|
||||
|
||||
namespace Aaru.CommonTypes.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Detects the underlying execution framework and operating system
|
||||
/// </summary>
|
||||
public static class DetectOS
|
||||
{
|
||||
/// <summary>
|
||||
/// Are we running under Mono?
|
||||
/// </summary>
|
||||
public static readonly bool IsMono =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith("Mono", StringComparison.Ordinal);
|
||||
/// <summary>
|
||||
/// Are we running under .NET Framework?
|
||||
/// </summary>
|
||||
public static readonly bool IsNetFramework =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal);
|
||||
/// <summary>
|
||||
/// Are we running under .NET Core?
|
||||
/// </summary>
|
||||
public static readonly bool IsNetCore =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.Ordinal);
|
||||
/// <summary>
|
||||
/// Are we running under .NET Native?
|
||||
/// </summary>
|
||||
public static readonly bool IsNetNative =
|
||||
RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.Ordinal);
|
||||
|
||||
@@ -61,6 +76,9 @@ namespace Aaru.CommonTypes.Interop
|
||||
/// <summary>Checks if the underlying runtime runs in 32-bit mode</summary>
|
||||
public static readonly bool Is32Bit = IntPtr.Size == 4;
|
||||
|
||||
/// <summary>
|
||||
/// Are we running under Windows?
|
||||
/// </summary>
|
||||
public static bool IsWindows => GetRealPlatformID() == PlatformID.Win32NT ||
|
||||
GetRealPlatformID() == PlatformID.Win32S ||
|
||||
GetRealPlatformID() == PlatformID.Win32Windows ||
|
||||
@@ -68,6 +86,9 @@ namespace Aaru.CommonTypes.Interop
|
||||
GetRealPlatformID() == PlatformID.WindowsPhone ||
|
||||
GetRealPlatformID() == PlatformID.Xbox;
|
||||
|
||||
/// <summary>
|
||||
/// Are we running with administrative (root) privileges?
|
||||
/// </summary>
|
||||
public static bool IsAdmin
|
||||
{
|
||||
get
|
||||
|
||||
@@ -115,6 +115,8 @@ namespace Aaru.CommonTypes.Interop
|
||||
/// <summary>SCO UnixWare</summary>
|
||||
UnixWare = 34,
|
||||
/// <summary>IBM z/OS</summary>
|
||||
zOS = 35, Unknown = -1
|
||||
zOS = 35,
|
||||
/// <summary>Unknown</summary>
|
||||
Unknown = -1
|
||||
}
|
||||
}
|
||||
@@ -42,12 +42,19 @@ using System.Runtime;
|
||||
|
||||
namespace Aaru.CommonTypes.Interop
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets our own, or the runtime's version
|
||||
/// </summary>
|
||||
public static class Version
|
||||
{
|
||||
/// <summary>Gets version string</summary>
|
||||
/// <returns>Version</returns>
|
||||
public static string GetVersion() => typeof(Version).Assembly.GetName().Version?.ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Gets .NET Core version
|
||||
/// </summary>
|
||||
/// <returns>Version</returns>
|
||||
public static string GetNetCoreVersion()
|
||||
{
|
||||
Assembly assembly = typeof(GCSettings).Assembly;
|
||||
@@ -69,6 +76,10 @@ namespace Aaru.CommonTypes.Interop
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Mono version
|
||||
/// </summary>
|
||||
/// <returns>Version</returns>
|
||||
public static string GetMonoVersion()
|
||||
{
|
||||
if(!DetectOS.IsMono)
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
// TODO: Rename contents
|
||||
|
||||
using System;
|
||||
#pragma warning disable 1591
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable IdentifierTypo
|
||||
|
||||
@@ -38,6 +38,16 @@ namespace Aaru.CommonTypes
|
||||
{
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the media type from an ATA (not ATAPI) device
|
||||
/// </summary>
|
||||
/// <param name="manufacturer">Manufacturer string</param>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="removable">Is the device removable?</param>
|
||||
/// <param name="compactFlash">Does the device self-identify as CompactFlash?</param>
|
||||
/// <param name="pcmcia">Is the device attached thru PCMCIA or CardBus?</param>
|
||||
/// <param name="blocks">Number of blocks in device</param>
|
||||
/// <returns>The media type</returns>
|
||||
public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash,
|
||||
bool pcmcia, ulong blocks)
|
||||
{
|
||||
|
||||
@@ -37,8 +37,22 @@ using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the media type from a real device
|
||||
/// </summary>
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the media type from an SCSI MultiMedia Commands compliant device
|
||||
/// </summary>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="densityCode">Density code from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in media</param>
|
||||
/// <param name="blockSize">Size of a block in bytes</param>
|
||||
/// <param name="isUsb">Is the device USB attached</param>
|
||||
/// <param name="opticalDisc">Is the media an optical disc</param>
|
||||
/// <returns>Media type</returns>
|
||||
static MediaType GetFromMmc(string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize,
|
||||
bool isUsb, bool opticalDisc)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,13 @@ namespace Aaru.CommonTypes
|
||||
{
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the device type from a SCSI Optical Device
|
||||
/// </summary>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in device</param>
|
||||
/// <param name="blockSize">Size in bytes of a block</param>
|
||||
/// <returns>Media type</returns>
|
||||
static MediaType GetFromOdc(byte mediumType, ulong blocks, uint blockSize)
|
||||
{
|
||||
if(mediumType != 0x01 &&
|
||||
|
||||
@@ -39,6 +39,15 @@ namespace Aaru.CommonTypes
|
||||
{
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the media type from a SCSI Block Commands compliant device
|
||||
/// </summary>
|
||||
/// <param name="vendor">Vendor string</param>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in device</param>
|
||||
/// <param name="blockSize">Size of a block in bytes</param>
|
||||
/// <returns>Media type</returns>
|
||||
static MediaType GetFromSbc(string vendor, string model, byte mediumType, ulong blocks, uint blockSize)
|
||||
{
|
||||
if(vendor.ToLowerInvariant() == "syquest" &&
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace Aaru.CommonTypes
|
||||
/// <param name="blocks">How many blocks are on the media</param>
|
||||
/// <param name="blockSize">Size in bytes of each block</param>
|
||||
/// <param name="isUsb">Device is USB</param>
|
||||
/// <param name="opticalDisc"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="opticalDisc">Is media an optical disc?</param>
|
||||
/// <returns>The media type</returns>
|
||||
public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType,
|
||||
byte densityCode, ulong blocks, uint blockSize, bool isUsb,
|
||||
bool opticalDisc)
|
||||
|
||||
@@ -39,6 +39,17 @@ namespace Aaru.CommonTypes
|
||||
{
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the media type from an SCSI Streaming Commands compliant device
|
||||
/// </summary>
|
||||
/// <param name="scsiPeripheralType">Peripheral type</param>
|
||||
/// <param name="vendor">Vendor string</param>
|
||||
/// <param name="model">Model string</param>
|
||||
/// <param name="mediumType">Medium type from MODE SENSE</param>
|
||||
/// <param name="densityCode">Density code from MODE SENSE</param>
|
||||
/// <param name="blocks">Number of blocks in media</param>
|
||||
/// <param name="blockSize">Size of a block in bytes</param>
|
||||
/// <returns>Media type</returns>
|
||||
public static MediaType GetFromSsc(byte scsiPeripheralType, string vendor, string model, byte mediumType,
|
||||
byte densityCode, ulong blocks, uint blockSize)
|
||||
{
|
||||
|
||||
@@ -40,12 +40,30 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Aaru.CommonTypes.Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes CD reading offset
|
||||
/// </summary>
|
||||
public class CdOffset
|
||||
{
|
||||
/// <summary>
|
||||
/// Drive manufacturer
|
||||
/// </summary>
|
||||
public string Manufacturer { get; set; }
|
||||
/// <summary>
|
||||
/// Drive model
|
||||
/// </summary>
|
||||
public string Model { get; set; }
|
||||
/// <summary>
|
||||
/// Reading offset
|
||||
/// </summary>
|
||||
public short Offset { get; set; }
|
||||
/// <summary>
|
||||
/// Number of times this offset has been submitted
|
||||
/// </summary>
|
||||
public int Submissions { get; set; }
|
||||
/// <summary>
|
||||
/// Percentage of submissions in agreement with this offset
|
||||
/// </summary>
|
||||
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:P0}")]
|
||||
public float Agreement { get; set; }
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI.Modes;
|
||||
using Newtonsoft.Json;
|
||||
// This is obsolete
|
||||
#pragma warning disable 1591
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
|
||||
@@ -47,6 +47,8 @@ using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI.Modes;
|
||||
using Newtonsoft.Json;
|
||||
// TODO: Re-enable CS1591 in this file
|
||||
#pragma warning disable 1591
|
||||
|
||||
// ReSharper disable VirtualMemberNeverOverridden.Global
|
||||
// ReSharper disable VirtualMemberCallInConstructor
|
||||
|
||||
@@ -42,8 +42,16 @@ using Schemas;
|
||||
|
||||
namespace Aaru.CommonTypes.Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Physical dimensions for media types
|
||||
/// </summary>
|
||||
public static class Dimensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the physical dimensions, in metadata expected format, for a given media type
|
||||
/// </summary>
|
||||
/// <param name="dskType">Media type</param>
|
||||
/// <returns>Dimensions metadata</returns>
|
||||
public static DimensionsType DimensionsFromMediaType(CommonTypes.MediaType dskType)
|
||||
{
|
||||
var dmns = new DimensionsType();
|
||||
|
||||
@@ -39,8 +39,16 @@
|
||||
#pragma warning disable 612
|
||||
namespace Aaru.CommonTypes.Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles media type for metadata
|
||||
/// </summary>
|
||||
public static class MediaType
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a media type of a pair of type and subtype strings to use in metadata
|
||||
/// </summary>
|
||||
/// <param name="dskType">Media type</param>
|
||||
/// <returns>Media type and subtype for metadata</returns>
|
||||
public static (string type, string subType) MediaTypeToString(CommonTypes.MediaType dskType)
|
||||
{
|
||||
string discType;
|
||||
|
||||
@@ -43,26 +43,61 @@ using Schemas;
|
||||
|
||||
namespace Aaru.CommonTypes.Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Information that allows to resume a dump
|
||||
/// </summary>
|
||||
[Serializable, XmlRoot("DicResume", Namespace = "", IsNullable = false)]
|
||||
public class Resume
|
||||
{
|
||||
/// <summary>
|
||||
/// List of blocks that returned an error on reading
|
||||
/// </summary>
|
||||
[XmlArrayItem("Block")]
|
||||
public List<ulong> BadBlocks;
|
||||
/// <summary>
|
||||
/// Date/time this resume file was created
|
||||
/// </summary>
|
||||
[XmlElement(DataType = "dateTime")]
|
||||
public DateTime CreationDate;
|
||||
/// <summary>
|
||||
/// Last block on media
|
||||
/// </summary>
|
||||
public ulong LastBlock;
|
||||
/// <summary>
|
||||
/// Date/time this resume file was last written to
|
||||
/// </summary>
|
||||
[XmlElement(DataType = "dateTime")]
|
||||
public DateTime LastWriteDate;
|
||||
/// <summary>
|
||||
/// Next block to read
|
||||
/// </summary>
|
||||
public ulong NextBlock;
|
||||
/// <summary>
|
||||
/// Is media removable?
|
||||
/// </summary>
|
||||
public bool Removable;
|
||||
/// <summary>
|
||||
/// Is media a tape?
|
||||
/// </summary>
|
||||
public bool Tape;
|
||||
/// <summary>
|
||||
/// List of CD subchannels that did not read correctly
|
||||
/// </summary>
|
||||
[XmlArrayItem("Block")]
|
||||
public List<int> BadSubchannels;
|
||||
/// <summary>
|
||||
/// Extents of BLANK sectors for magneto-opticals
|
||||
/// </summary>
|
||||
[XmlArrayItem("Extent")]
|
||||
public ExtentType[] BlankExtents;
|
||||
/// <summary>
|
||||
/// Title keys that has not been read
|
||||
/// </summary>
|
||||
[XmlArrayItem("Block")]
|
||||
public List<ulong> MissingTitleKeys;
|
||||
|
||||
/// <summary>
|
||||
/// List of dump tries
|
||||
/// </summary>
|
||||
[XmlArrayItem("DumpTry")]
|
||||
public List<DumpHardwareType> Tries;
|
||||
}
|
||||
|
||||
@@ -39,166 +39,351 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Xml.Serialization;
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
namespace Aaru.CommonTypes.Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Statistics
|
||||
/// </summary>
|
||||
[XmlRoot("DicStats", Namespace = "", IsNullable = false)]
|
||||
public class Stats
|
||||
{
|
||||
/// <summary>Executed commands</summary>
|
||||
public CommandsStats Commands;
|
||||
/// <summary>Operating systems Aaru has run from</summary>
|
||||
[XmlArrayItem("OperatingSystem")]
|
||||
public List<OsStats> OperatingSystems { get; set; }
|
||||
/// <summary>Aaru versions</summary>
|
||||
[XmlArrayItem("Version")]
|
||||
public List<NameValueStats> Versions { get; set; }
|
||||
/// <summary>Detected filesystems</summary>
|
||||
[XmlArrayItem("Filesystem")]
|
||||
public List<NameValueStats> Filesystems { get; set; }
|
||||
/// <summary>Detected partitioning schemes</summary>
|
||||
[XmlArrayItem("Scheme")]
|
||||
public List<NameValueStats> Partitions { get; set; }
|
||||
/// <summary>Media image formats</summary>
|
||||
[XmlArrayItem("Format")]
|
||||
public List<NameValueStats> MediaImages { get; set; }
|
||||
/// <summary>Used filters</summary>
|
||||
[XmlArrayItem("Filter", IsNullable = true)]
|
||||
public List<NameValueStats> Filters { get; set; }
|
||||
/// <summary>Found devices</summary>
|
||||
[XmlArrayItem("Device", IsNullable = true)]
|
||||
public List<DeviceStats> Devices { get; set; }
|
||||
/// <summary>Found media types, real, and in image</summary>
|
||||
[XmlArrayItem("Media")]
|
||||
public List<MediaStats> Medias { get; set; }
|
||||
/// <summary>Benchmark statistics</summary>
|
||||
public BenchmarkStats Benchmark { get; set; }
|
||||
/// <summary>Media scanning statistics</summary>
|
||||
public MediaScanStats MediaScan { get; set; }
|
||||
/// <summary>Image verification statistics</summary>
|
||||
public VerifyStats Verify { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DTO for statistics
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "CollectionNeverQueried.Global")]
|
||||
public class StatsDto
|
||||
{
|
||||
/// <summary>Executed commands</summary>
|
||||
public List<NameValueStats> Commands { get; set; }
|
||||
/// <summary>Operating systems Aaru has run from</summary>
|
||||
public List<OsStats> OperatingSystems { get; set; }
|
||||
/// <summary>Aaru versions</summary>
|
||||
public List<NameValueStats> Versions { get; set; }
|
||||
/// <summary>Detected filesystems</summary>
|
||||
public List<NameValueStats> Filesystems { get; set; }
|
||||
/// <summary>Detected partitioning schemes</summary>
|
||||
public List<NameValueStats> Partitions { get; set; }
|
||||
/// <summary>Media image formats</summary>
|
||||
public List<NameValueStats> MediaFormats { get; set; }
|
||||
/// <summary>Used filters</summary>
|
||||
public List<NameValueStats> Filters { get; set; }
|
||||
/// <summary>Found devices</summary>
|
||||
public List<DeviceStats> Devices { get; set; }
|
||||
/// <summary>Found media types, real, and in image</summary>
|
||||
public List<MediaStats> Medias { get; set; }
|
||||
/// <summary>Remote applications</summary>
|
||||
public List<OsStats> RemoteApplications { get; set; }
|
||||
/// <summary>Remote application architectures</summary>
|
||||
public List<NameValueStats> RemoteArchitectures { get; set; }
|
||||
/// <summary>Operating systems where a remote application has been running</summary>
|
||||
public List<OsStats> RemoteOperatingSystems { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command execution statistics
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "UnassignedField.Global")]
|
||||
public class CommandsStats
|
||||
{
|
||||
/// <summary>Number of times the filesystem info command has been used</summary>
|
||||
public long Analyze;
|
||||
/// <summary>Number of times the benchmark command has been used</summary>
|
||||
public long Benchmark;
|
||||
/// <summary>Number of times the image checksum command has been used</summary>
|
||||
public long Checksum;
|
||||
/// <summary>Number of times the image compare command has been used</summary>
|
||||
public long Compare;
|
||||
/// <summary>Number of times the image convert command has been used</summary>
|
||||
public long ConvertImage;
|
||||
/// <summary>Number of times the image create-sidecar command has been used</summary>
|
||||
public long CreateSidecar;
|
||||
/// <summary>Number of times the image decode command has been used</summary>
|
||||
public long Decode;
|
||||
/// <summary>Number of times the device info command has been used</summary>
|
||||
public long DeviceInfo;
|
||||
/// <summary>Number of times the device report command has been used</summary>
|
||||
public long DeviceReport;
|
||||
/// <summary>Number of times the media dump command has been used</summary>
|
||||
public long DumpMedia;
|
||||
/// <summary>Number of times the image entropy command has been used</summary>
|
||||
public long Entropy;
|
||||
/// <summary>Number of times the filesystem extract command has been used</summary>
|
||||
public long ExtractFiles;
|
||||
/// <summary>Number of times the list formats command has been used</summary>
|
||||
public long Formats;
|
||||
/// <summary>Number of times the image info command has been used</summary>
|
||||
public long ImageInfo;
|
||||
/// <summary>Number of times the device list command has been used</summary>
|
||||
public long ListDevices;
|
||||
/// <summary>Number of times the list encodings command has been used</summary>
|
||||
public long ListEncodings;
|
||||
/// <summary>Number of times the filesystem ls command has been used</summary>
|
||||
public long Ls;
|
||||
/// <summary>Number of times the media info command has been used</summary>
|
||||
public long MediaInfo;
|
||||
/// <summary>Number of times the media scan command has been used</summary>
|
||||
public long MediaScan;
|
||||
/// <summary>Number of times the image printhex command has been used</summary>
|
||||
public long PrintHex;
|
||||
/// <summary>Number of times the image verify command has been used</summary>
|
||||
public long Verify;
|
||||
}
|
||||
|
||||
/// <summary>Statistics of verified media</summary>
|
||||
public class VerifiedItems
|
||||
{
|
||||
/// <summary>Number of correct images</summary>
|
||||
public long Correct;
|
||||
/// <summary>Number of failed images</summary>
|
||||
public long Failed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verification statistics
|
||||
/// </summary>
|
||||
public class VerifyStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Image verification statistics
|
||||
/// </summary>
|
||||
public VerifiedItems MediaImages;
|
||||
/// <summary>
|
||||
/// Image contents verification statistics
|
||||
/// </summary>
|
||||
public ScannedSectors Sectors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Image contents verification statistics
|
||||
/// </summary>
|
||||
public class ScannedSectors
|
||||
{
|
||||
/// <summary>
|
||||
/// Sectors found to be correct
|
||||
/// </summary>
|
||||
public long Correct;
|
||||
/// <summary>
|
||||
/// Sectors found to be incorrect
|
||||
/// </summary>
|
||||
public long Error;
|
||||
/// <summary>
|
||||
/// Total number of verified sectors
|
||||
/// </summary>
|
||||
public long Total;
|
||||
/// <summary>
|
||||
/// Total number of sectors that could not be verified
|
||||
/// </summary>
|
||||
public long Unverifiable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Media scanning time statistics
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class TimeStats
|
||||
{
|
||||
/// <summary>Number of sectors that took more than 3ms but less than 100ms to read</summary>
|
||||
public long LessThan10ms;
|
||||
/// <summary>Number of sectors that took more than 50ms but less than 150ms to read</summary>
|
||||
public long LessThan150ms;
|
||||
/// <summary>Number of sectors that took less than 3ms to read</summary>
|
||||
public long LessThan3ms;
|
||||
/// <summary>Number of sectors that took more than 150ms but less than 500ms to read</summary>
|
||||
public long LessThan500ms;
|
||||
/// <summary>Number of sectors that took more than 10ms but less than 50ms to read</summary>
|
||||
public long LessThan50ms;
|
||||
/// <summary>Number of sectors that took more than 500ms to read</summary>
|
||||
public long MoreThan500ms;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Media scanning statistics
|
||||
/// </summary>
|
||||
public class MediaScanStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Statistics of scanned sectors
|
||||
/// </summary>
|
||||
public ScannedSectors Sectors;
|
||||
/// <summary>
|
||||
/// Scan time statistics
|
||||
/// </summary>
|
||||
public TimeStats Times;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checksum type statistics
|
||||
/// </summary>
|
||||
public class ChecksumStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Checksum algorithm
|
||||
/// </summary>
|
||||
[XmlAttribute]
|
||||
public string algorithm;
|
||||
/// <summary>
|
||||
/// Time taken to execute algorithm
|
||||
/// </summary>
|
||||
[XmlText]
|
||||
public double Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Benchmark statistics
|
||||
/// </summary>
|
||||
public class BenchmarkStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Total time taken to run the checksum algorithms in parallel
|
||||
/// </summary>
|
||||
public double All;
|
||||
/// <summary>
|
||||
/// List of time taken by each checksum algorithm
|
||||
/// </summary>
|
||||
[XmlElement("Checksum")]
|
||||
public List<ChecksumStats> Checksum;
|
||||
/// <summary>
|
||||
/// Time taken to benchmark entropy calculation
|
||||
/// </summary>
|
||||
public double Entropy;
|
||||
/// <summary>
|
||||
/// Maximum amount of memory used while running the benchmark
|
||||
/// </summary>
|
||||
public long MaxMemory;
|
||||
/// <summary>
|
||||
/// Minimum amount of memory used while running the benchmark
|
||||
/// </summary>
|
||||
public long MinMemory;
|
||||
/// <summary>
|
||||
/// Total time taken to run the checksum algorithms sequentially
|
||||
/// </summary>
|
||||
public double Sequential;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Media statistics
|
||||
/// </summary>
|
||||
public class MediaStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Found in a real device?
|
||||
/// </summary>
|
||||
[XmlAttribute]
|
||||
public bool real;
|
||||
/// <summary>
|
||||
/// Media type
|
||||
/// </summary>
|
||||
[XmlAttribute]
|
||||
public string type;
|
||||
/// <summary>
|
||||
/// Number of times it has been found
|
||||
/// </summary>
|
||||
[XmlText]
|
||||
public long Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Device statistics
|
||||
/// </summary>
|
||||
public class DeviceStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Is manufacturer null?
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public bool ManufacturerSpecified;
|
||||
/// <summary>
|
||||
/// Manufacturer string
|
||||
/// </summary>
|
||||
public string Manufacturer { get; set; }
|
||||
/// <summary>
|
||||
/// Model string
|
||||
/// </summary>
|
||||
public string Model { get; set; }
|
||||
/// <summary>
|
||||
/// Revision or firmware version
|
||||
/// </summary>
|
||||
public string Revision { get; set; }
|
||||
/// <summary>
|
||||
/// Bus the device was attached to
|
||||
/// </summary>
|
||||
public string Bus { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name=value pair statistics
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class NameValueStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Name
|
||||
/// </summary>
|
||||
[XmlAttribute]
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// Number of times it has been used/found
|
||||
/// </summary>
|
||||
[XmlText]
|
||||
public long Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Operating system statistics
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public class OsStats
|
||||
{
|
||||
/// <summary>
|
||||
/// Operating system name
|
||||
/// </summary>
|
||||
[XmlAttribute]
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// Operating system version
|
||||
/// </summary>
|
||||
[XmlAttribute]
|
||||
public string version { get; set; }
|
||||
/// <summary>
|
||||
/// Number of times Aaru run on it
|
||||
/// </summary>
|
||||
[XmlText]
|
||||
public long Value { get; set; }
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ using Schemas;
|
||||
|
||||
namespace Aaru.CommonTypes.Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages Aaru's version for metadata
|
||||
/// </summary>
|
||||
public static class Version
|
||||
{
|
||||
/// <summary>Gets XML software type for the running version</summary>
|
||||
|
||||
@@ -64,13 +64,16 @@ namespace Aaru.CommonTypes
|
||||
/// <summary>Name of partition scheme that contains this partition</summary>
|
||||
public string Scheme;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>Compares two partitions</summary>
|
||||
/// <param name="other">Partition to compare with</param>
|
||||
/// <returns>0 if both partitions start and end at the same sector</returns>
|
||||
public bool Equals(Partition other) => Start == other.Start && Length == other.Length;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object obj) => obj is Partition partition && Equals(partition);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode() => Start.GetHashCode() + End.GetHashCode();
|
||||
|
||||
/// <summary>
|
||||
@@ -79,6 +82,7 @@ namespace Aaru.CommonTypes
|
||||
/// </summary>
|
||||
/// <param name="other">Partition to compare with</param>
|
||||
/// <returns>A value that indicates the relative equality of the partitions being compared.</returns>
|
||||
/// <inheritdoc />
|
||||
public int CompareTo(Partition other)
|
||||
{
|
||||
if(Start == other.Start &&
|
||||
|
||||
@@ -82,6 +82,10 @@ namespace Aaru.CommonTypes
|
||||
Archives = new SortedDictionary<string, IArchive>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds plugins to the central plugin register
|
||||
/// </summary>
|
||||
/// <param name="pluginRegister">Plugin register</param>
|
||||
public void AddPlugins(IPluginRegister pluginRegister)
|
||||
{
|
||||
foreach(Type type in pluginRegister.GetAllChecksumPlugins() ?? Enumerable.Empty<Type>())
|
||||
|
||||
@@ -106,15 +106,19 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
/// <summary>MUST NOT be set</summary>
|
||||
MustBeClear = 0x8000,
|
||||
/// <summary>MUST be set</summary>
|
||||
MustBeSet = 0x4000, Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
|
||||
MustBeSet = 0x4000,
|
||||
#pragma warning disable 1591
|
||||
Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
|
||||
Reserved10 = 0x0400, Reserved09 = 0x0200, Reserved08 = 0x0100,
|
||||
Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
|
||||
Reserved04 = 0x0010, Reserved03 = 0x0008, Reserved02 = 0x0004,
|
||||
Reserved01 = 0x0002,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Indicates a device specific minimum standby timer value</summary>
|
||||
SpecificStandbyTimer = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>Even more capabilities flag bits.</summary>
|
||||
[Flags]
|
||||
public enum CapabilitiesBit3 : byte
|
||||
{
|
||||
@@ -129,12 +133,15 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
/// <summary>If unset, sanitize commands are specified by ACS-2</summary>
|
||||
SanitizeCommands = 0x0008,
|
||||
/// <summary>SANITIZE ANTIFREEZE LOCK EXT is supported</summary>
|
||||
SanitizeAntifreeze = 0x0004, Reserved01 = 0x0002,
|
||||
SanitizeAntifreeze = 0x0004,
|
||||
#pragma warning disable 1591
|
||||
Reserved01 = 0x0002,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Multiple logical sector setting is valid</summary>
|
||||
MultipleValid = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>More capabilities flag bits.</summary>
|
||||
/// <summary>Command set flag bits.</summary>
|
||||
[Flags]
|
||||
public enum CommandSetBit : ushort
|
||||
{
|
||||
@@ -172,7 +179,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
SMART = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>More capabilities flag bits.</summary>
|
||||
/// <summary>More command set flag bits.</summary>
|
||||
[Flags]
|
||||
public enum CommandSetBit2 : ushort
|
||||
{
|
||||
@@ -210,7 +217,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
DownloadMicrocode = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>More capabilities flag bits.</summary>
|
||||
/// <summary>Even more command set flag bits.</summary>
|
||||
[Flags]
|
||||
public enum CommandSetBit3 : ushort
|
||||
{
|
||||
@@ -248,15 +255,18 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
SMARTLog = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>More capabilities flag bits.</summary>
|
||||
/// <summary>Yet more command set flag bits.</summary>
|
||||
[Flags]
|
||||
public enum CommandSetBit4 : ushort
|
||||
{
|
||||
/// <summary>MUST NOT be set</summary>
|
||||
MustBeClear = 0x8000,
|
||||
/// <summary>MUST be set</summary>
|
||||
MustBeSet = 0x4000, Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
|
||||
MustBeSet = 0x4000,
|
||||
#pragma warning disable 1591
|
||||
Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
|
||||
Reserved10 = 0x0400,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>DSN feature set is supported</summary>
|
||||
DSN = 0x0200,
|
||||
/// <summary>Accessible Max Address Configuration is supported</summary>
|
||||
@@ -279,6 +289,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
DT1825 = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>Yet again more command set flag bits.</summary>
|
||||
[Flags]
|
||||
public enum CommandSetBit5 : ushort
|
||||
{
|
||||
@@ -316,18 +327,26 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
ZonedBit0 = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data set management flag bits.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum DataSetMgmtBit : ushort
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
|
||||
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
|
||||
Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080,
|
||||
Reserved06 = 0x0040, Reserved05 = 0x0020, Reserved04 = 0x0010,
|
||||
Reserved03 = 0x0008, Reserved02 = 0x0004, Reserved01 = 0x0002,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>TRIM is supported</summary>
|
||||
Trim = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Device form factor
|
||||
/// </summary>
|
||||
public enum DeviceFormFactorEnum : ushort
|
||||
{
|
||||
/// <summary>Size not reported</summary>
|
||||
@@ -410,8 +429,10 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
[Flags]
|
||||
public enum MajorVersionBit : ushort
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
|
||||
Reserved12 = 0x1000,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>ACS-4</summary>
|
||||
ACS4 = 0x0800,
|
||||
/// <summary>ACS-3</summary>
|
||||
@@ -433,9 +454,15 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
/// <summary>ATA-2</summary>
|
||||
Ata2 = 0x0004,
|
||||
/// <summary>ATA-1</summary>
|
||||
Ata1 = 0x0002, Reserved00 = 0x0001
|
||||
Ata1 = 0x0002,
|
||||
#pragma warning disable 1591
|
||||
Reserved00 = 0x0001
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SATA capabilities flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum SATACapabilitiesBit : ushort
|
||||
{
|
||||
@@ -454,8 +481,11 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
/// <summary>Supports receipt of host initiated power management requests</summary>
|
||||
PowerReceipt = 0x0200,
|
||||
/// <summary>Supports NCQ</summary>
|
||||
NCQ = 0x0100, Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
|
||||
NCQ = 0x0100,
|
||||
#pragma warning disable 1591
|
||||
Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
|
||||
Reserved04 = 0x0010,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Supports SATA Gen. 3 Signaling Speed (6.0Gb/s)</summary>
|
||||
Gen3Speed = 0x0008,
|
||||
/// <summary>Supports SATA Gen. 2 Signaling Speed (3.0Gb/s)</summary>
|
||||
@@ -466,12 +496,17 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
Clear = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// More SATA capabilities flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum SATACapabilitiesBit2 : ushort
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
|
||||
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
|
||||
Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Supports RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED</summary>
|
||||
FPDMAQ = 0x0040,
|
||||
/// <summary>Supports NCQ Queue Management</summary>
|
||||
@@ -492,12 +527,17 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
Clear = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SATA features flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum SATAFeaturesBit : ushort
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
|
||||
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
|
||||
Reserved09 = 0x0200, Reserved08 = 0x0100,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Supports NCQ autosense</summary>
|
||||
NCQAutoSense = 0x0080,
|
||||
/// <summary>Automatic Partial to Slumber transitions are enabled</summary>
|
||||
@@ -520,13 +560,18 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
Clear = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SCT Command Transport flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum SCTCommandTransportBit : ushort
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Vendor15 = 0x8000, Vendor14 = 0x4000, Vendor13 = 0x2000,
|
||||
Vendor12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
|
||||
Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080,
|
||||
Reserved06 = 0x0040,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>SCT Command Transport Data Tables supported</summary>
|
||||
DataTables = 0x0020,
|
||||
/// <summary>SCT Command Transport Features Control supported</summary>
|
||||
@@ -541,15 +586,20 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
Supported = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>More capabilities flag bits.</summary>
|
||||
/// <summary>Security status flag bits.</summary>
|
||||
[Flags]
|
||||
public enum SecurityStatusBit : ushort
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000,
|
||||
Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400,
|
||||
Reserved09 = 0x0200,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Maximum security level</summary>
|
||||
Maximum = 0x0100, Reserved07 = 0x0080, Reserved06 = 0x0040,
|
||||
Maximum = 0x0100,
|
||||
#pragma warning disable 1591
|
||||
Reserved07 = 0x0080, Reserved06 = 0x0040,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Supports enhanced security erase</summary>
|
||||
Enhanced = 0x0020,
|
||||
/// <summary>Security count expired</summary>
|
||||
@@ -564,6 +614,9 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
Supported = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specific configuration flags
|
||||
/// </summary>
|
||||
public enum SpecificConfigurationEnum : ushort
|
||||
{
|
||||
/// <summary>Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete</summary>
|
||||
@@ -576,29 +629,43 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
NotRequiresSetCompleteResponse = 0xC837
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transfer mode flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum TransferMode : byte
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
Mode7 = 0x80, Mode6 = 0x40, Mode5 = 0x20,
|
||||
Mode4 = 0x10, Mode3 = 0x08, Mode2 = 0x04,
|
||||
Mode1 = 0x02, Mode0 = 0x01
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trusted Computing flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum TrustedComputingBit : ushort
|
||||
{
|
||||
/// <summary>MUST NOT be set</summary>
|
||||
Clear = 0x8000,
|
||||
/// <summary>MUST be set</summary>
|
||||
Set = 0x4000, Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
|
||||
Set = 0x4000,
|
||||
#pragma warning disable 1591
|
||||
Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800,
|
||||
Reserved10 = 0x0400, Reserved09 = 0x0200, Reserved08 = 0x0100,
|
||||
Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020,
|
||||
Reserved04 = 0x0010, Reserved03 = 0x0008, Reserved02 = 0x0004,
|
||||
Reserved01 = 0x0002,
|
||||
#pragma warning restore 1591
|
||||
/// <summary>Trusted Computing feature set is supported</summary>
|
||||
TrustedComputing = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IDENTIFY DEVICE decoded response
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)]
|
||||
public struct IdentifyDevice
|
||||
{
|
||||
@@ -950,6 +1017,11 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
public byte Checksum;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodes a raw IDENTIFY DEVICE response
|
||||
/// </summary>
|
||||
/// <param name="IdentifyDeviceResponse">Raw IDENTIFY DEVICE response</param>
|
||||
/// <returns>Decoded IDENTIFY DEVICE</returns>
|
||||
public static IdentifyDevice? Decode(byte[] IdentifyDeviceResponse)
|
||||
{
|
||||
if(IdentifyDeviceResponse == null)
|
||||
@@ -978,6 +1050,11 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA
|
||||
return ATAID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encodes a raw IDENTIFY DEVICE response
|
||||
/// </summary>
|
||||
/// <param name="identify">Decoded IDENTIFY DEVICE</param>
|
||||
/// <returns>Raw IDENTIFY DEVICE response</returns>
|
||||
public static byte[] Encode(IdentifyDevice? identify)
|
||||
{
|
||||
if(identify is null)
|
||||
|
||||
@@ -34,6 +34,9 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
{
|
||||
/// <summary>
|
||||
/// List of known SCSI peripheral qualifiers
|
||||
/// </summary>
|
||||
public enum PeripheralQualifiers : byte
|
||||
{
|
||||
/// <summary>Peripheral qualifier: Device is connected and supported</summary>
|
||||
@@ -48,6 +51,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
VendorMask = 0x04
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known peripheral device types
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum PeripheralDeviceTypes : byte
|
||||
{
|
||||
@@ -99,6 +105,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
UnknownDevice = 0x1F
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known ANSI SCSI standards
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ANSIVersions : byte
|
||||
{
|
||||
@@ -118,6 +127,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
ANSI2008Version = 0x06
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known ECMA SCSI standards
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ECMAVersions : byte
|
||||
{
|
||||
@@ -127,6 +139,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
ECMA111 = 0x01
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known ISO SCSI standards
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ISOVersions : byte
|
||||
{
|
||||
@@ -136,6 +151,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
ISO1995Version = 0x02
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known SCSI Parallel Interface clocking types
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum SPIClocking : byte
|
||||
{
|
||||
@@ -149,6 +167,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
STandDT = 0x03
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known TGPS values
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum TGPSValues : byte
|
||||
{
|
||||
@@ -162,6 +183,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
Both = 0x03
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known SCSI protocols
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ProtocolIdentifiers : byte
|
||||
{
|
||||
@@ -193,13 +217,37 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
NoProtocol = 15
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known SCSI definitions
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ScsiDefinitions : byte
|
||||
{
|
||||
Current = 0, SCSI1 = 1, CCS = 2,
|
||||
SCSI2 = 3, SCSI3 = 4
|
||||
/// <summary>
|
||||
/// Unknown
|
||||
/// </summary>
|
||||
Current = 0,
|
||||
/// <summary>
|
||||
/// SCSI-1
|
||||
/// </summary>
|
||||
SCSI1 = 1,
|
||||
/// <summary>
|
||||
/// Unknown
|
||||
/// </summary>
|
||||
CCS = 2,
|
||||
/// <summary>
|
||||
/// SCSI-2
|
||||
/// </summary>
|
||||
SCSI2 = 3,
|
||||
/// <summary>
|
||||
/// SCSI-3
|
||||
/// </summary>
|
||||
SCSI3 = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of known SCSI physical interfaces
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum PhysicalInterfaces : uint
|
||||
{
|
||||
|
||||
@@ -251,6 +251,11 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
0x48, 0x69, 0x2D, 0x4D, 0x44, 0x20, 0x20, 0x20
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Decodes a SCSI INQUIRY response
|
||||
/// </summary>
|
||||
/// <param name="SCSIInquiryResponse">INQUIRY raw response data</param>
|
||||
/// <returns>Decoded SCSI INQUIRY</returns>
|
||||
#region Public methods
|
||||
public static Inquiry? Decode(byte[] SCSIInquiryResponse)
|
||||
{
|
||||
@@ -508,6 +513,11 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
|
||||
return decoded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encodes a SCSI INQUIRY response
|
||||
/// </summary>
|
||||
/// <param name="inq">Decoded SCSI INQUIRY</param>
|
||||
/// <returns>Raw SCSI INQUIRY response</returns>
|
||||
public static byte[] Encode(Inquiry? inq)
|
||||
{
|
||||
if(inq is null)
|
||||
|
||||
@@ -46,6 +46,9 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
|
||||
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public class ModePage_2A
|
||||
{
|
||||
/// <summary>
|
||||
/// Write speed performance descriptors
|
||||
/// </summary>
|
||||
public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
|
||||
/// <summary>Parameters can be saved</summary>
|
||||
public bool PS { get; set; }
|
||||
@@ -94,43 +97,135 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
|
||||
/// <summary>Current drive speed in Kbytes/second</summary>
|
||||
public ushort CurrentSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Can read packet media
|
||||
/// </summary>
|
||||
public bool Method2 { get; set; }
|
||||
/// <summary>
|
||||
/// Can read CD-RW
|
||||
/// </summary>
|
||||
public bool ReadCDRW { get; set; }
|
||||
/// <summary>
|
||||
/// Can read CD-R
|
||||
/// </summary>
|
||||
public bool ReadCDR { get; set; }
|
||||
/// <summary>
|
||||
/// Can write CD-RW
|
||||
/// </summary>
|
||||
public bool WriteCDRW { get; set; }
|
||||
/// <summary>
|
||||
/// Can write CD-R
|
||||
/// </summary>
|
||||
public bool WriteCDR { get; set; }
|
||||
/// <summary>
|
||||
/// Supports IEC-958 digital output on port 2
|
||||
/// </summary>
|
||||
public bool DigitalPort2 { get; set; }
|
||||
/// <summary>
|
||||
/// Supports IEC-958 digital output on port 1
|
||||
/// </summary>
|
||||
public bool DigitalPort1 { get; set; }
|
||||
/// <summary>
|
||||
/// Can deliver a composite audio and video data stream
|
||||
/// </summary>
|
||||
public bool Composite { get; set; }
|
||||
/// <summary>
|
||||
/// This bit controls the behavior of the LOAD/UNLOAD command when trying to load a Slot with no Disc present
|
||||
/// </summary>
|
||||
public bool SSS { get; set; }
|
||||
/// <summary>
|
||||
/// Contains a changer that can report the exact contents of the slots
|
||||
/// </summary>
|
||||
public bool SDP { get; set; }
|
||||
/// <summary>
|
||||
/// Page length
|
||||
/// </summary>
|
||||
public byte Length { get; set; }
|
||||
/// <summary>
|
||||
/// Set if LSB comes first
|
||||
/// </summary>
|
||||
public bool LSBF { get; set; }
|
||||
/// <summary>
|
||||
/// Set if HIGH on LRCK indicates left channel. Clear if HIGH on LRCK indicates right channel.
|
||||
/// </summary>
|
||||
public bool RCK { get; set; }
|
||||
/// <summary>
|
||||
/// Set if data valid on the falling edge of the BCK signal. Clear if data valid on the rising edge of the BCK signal
|
||||
/// </summary>
|
||||
public bool BCK { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Can do a test write
|
||||
/// </summary>
|
||||
public bool TestWrite { get; set; }
|
||||
/// <summary>
|
||||
/// Maximum write speed
|
||||
/// </summary>
|
||||
public ushort MaxWriteSpeed { get; set; }
|
||||
/// <summary>
|
||||
/// Current write speed
|
||||
/// </summary>
|
||||
public ushort CurrentWriteSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Can read disc's barcode
|
||||
/// </summary>
|
||||
public bool ReadBarcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Can read DVD-RAM
|
||||
/// </summary>
|
||||
public bool ReadDVDRAM { get; set; }
|
||||
/// <summary>
|
||||
/// Can read DVD-R
|
||||
/// </summary>
|
||||
public bool ReadDVDR { get; set; }
|
||||
/// <summary>
|
||||
/// Can read DVD-ROM
|
||||
/// </summary>
|
||||
public bool ReadDVDROM { get; set; }
|
||||
/// <summary>
|
||||
/// Can write DVD-RAM
|
||||
/// </summary>
|
||||
public bool WriteDVDRAM { get; set; }
|
||||
/// <summary>
|
||||
/// Can write DVD-R
|
||||
/// </summary>
|
||||
public bool WriteDVDR { get; set; }
|
||||
/// <summary>
|
||||
/// Can read raw R-W subchannel from the Lead-In
|
||||
/// </summary>
|
||||
public bool LeadInPW { get; set; }
|
||||
/// <summary>
|
||||
/// Can read both sides of a disc
|
||||
/// </summary>
|
||||
public bool SCC { get; set; }
|
||||
/// <summary>
|
||||
/// Support copyright management
|
||||
/// </summary>
|
||||
public ushort CMRSupported { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Supports buffer under-run free recording
|
||||
/// </summary>
|
||||
public bool BUF { get; set; }
|
||||
/// <summary>
|
||||
/// Selected rotational control
|
||||
/// </summary>
|
||||
public byte RotationControlSelected { get; set; }
|
||||
/// <summary>
|
||||
/// Current write speed selected
|
||||
/// </summary>
|
||||
public ushort CurrentWriteSpeedSelected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Database ID
|
||||
/// </summary>
|
||||
[JsonIgnore, Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Decodes the page 2Ah of a MODE SENSE response
|
||||
/// </summary>
|
||||
/// <param name="pageResponse">Raw page 2Ah</param>
|
||||
/// <returns>Decoded page 2Ah</returns>
|
||||
public static ModePage_2A Decode(byte[] pageResponse)
|
||||
{
|
||||
if((pageResponse?[0] & 0x40) == 0x40)
|
||||
@@ -242,6 +337,11 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
|
||||
return decoded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encodes a page 2Ah of a MODE SENSE response
|
||||
/// </summary>
|
||||
/// <param name="decoded">Decoded page 2Ah</param>
|
||||
/// <returns>Raw page 2Ah</returns>
|
||||
public static byte[] Encode(ModePage_2A decoded)
|
||||
{
|
||||
byte[] pageResponse = new byte[512];
|
||||
@@ -464,10 +564,19 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Page 2Ah write descriptor
|
||||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public struct ModePage_2A_WriteDescriptor
|
||||
{
|
||||
/// <summary>
|
||||
/// Rotational control
|
||||
/// </summary>
|
||||
public byte RotationControl;
|
||||
/// <summary>
|
||||
/// Write speed
|
||||
/// </summary>
|
||||
public ushort WriteSpeed;
|
||||
}
|
||||
#endregion Mode Page 0x2A: CD-ROM capabilities page
|
||||
|
||||
@@ -227,6 +227,9 @@ namespace Aaru.CommonTypes.Structs
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Information about a volume
|
||||
/// </summary>
|
||||
public class FileSystemInfo
|
||||
{
|
||||
/// <summary>Blocks for this filesystem</summary>
|
||||
@@ -246,25 +249,53 @@ namespace Aaru.CommonTypes.Structs
|
||||
/// <summary>Filesystem type</summary>
|
||||
public string Type;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an empty instance of this structure
|
||||
/// </summary>
|
||||
public FileSystemInfo() => Id = new FileSystemId();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a clone of this structure
|
||||
/// </summary>
|
||||
/// <returns>Clone of this structure</returns>
|
||||
public FileSystemInfo ShallowCopy() => (FileSystemInfo)MemberwiseClone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores a filesystem volume unique identifier or serial number
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct FileSystemId
|
||||
{
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if the identifier is a 32-bit integer
|
||||
/// </summary>
|
||||
[FieldOffset(0)]
|
||||
public bool IsInt;
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if the identifier is a 64-bit integer
|
||||
/// </summary>
|
||||
[FieldOffset(1)]
|
||||
public bool IsLong;
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if the identifier is a GUID
|
||||
/// </summary>
|
||||
[FieldOffset(2)]
|
||||
public bool IsGuid;
|
||||
|
||||
/// <summary>
|
||||
/// Identifier as a 32-bit integer
|
||||
/// </summary>
|
||||
[FieldOffset(3)]
|
||||
public uint Serial32;
|
||||
/// <summary>
|
||||
/// Identifier as a 64-bit integer
|
||||
/// </summary>
|
||||
[FieldOffset(3)]
|
||||
public ulong Serial64;
|
||||
/// <summary>
|
||||
/// Identifier as a GUID
|
||||
/// </summary>
|
||||
[FieldOffset(3)]
|
||||
public Guid uuid;
|
||||
}
|
||||
|
||||
@@ -167,6 +167,9 @@ namespace Aaru.CommonTypes.Structs
|
||||
/// <summary>Partition type</summary>
|
||||
public TrackType TrackType;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes an empty instance of this structure
|
||||
/// </summary>
|
||||
public Track() => Indexes = new Dictionary<ushort, int>();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
|
||||
namespace Aaru.CommonTypes.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a tape file
|
||||
/// </summary>
|
||||
public struct TapeFile
|
||||
{
|
||||
/// <summary>File number</summary>
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
|
||||
namespace Aaru.CommonTypes.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a tape partition
|
||||
/// </summary>
|
||||
public struct TapePartition
|
||||
{
|
||||
/// <summary>Partition number</summary>
|
||||
|
||||
Reference in New Issue
Block a user