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