General code refactor.

This commit is contained in:
2021-08-17 21:23:22 +01:00
parent 874a3d4bcb
commit d3451f3e4d
54 changed files with 934 additions and 1349 deletions

View File

@@ -34,9 +34,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Aaru.CommonTypes.Structs.Devices.SCSI
{
/// <summary>
/// List of known SCSI peripheral qualifiers
/// </summary>
/// <summary>List of known SCSI peripheral qualifiers</summary>
public enum PeripheralQualifiers : byte
{
/// <summary>Peripheral qualifier: Device is connected and supported</summary>
@@ -51,9 +49,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
VendorMask = 0x04
}
/// <summary>
/// List of known peripheral device types
/// </summary>
/// <summary>List of known peripheral device types</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum PeripheralDeviceTypes : byte
{
@@ -105,9 +101,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
UnknownDevice = 0x1F
}
/// <summary>
/// List of known ANSI SCSI standards
/// </summary>
/// <summary>List of known ANSI SCSI standards</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ANSIVersions : byte
{
@@ -127,9 +121,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
ANSI2008Version = 0x06
}
/// <summary>
/// List of known ECMA SCSI standards
/// </summary>
/// <summary>List of known ECMA SCSI standards</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ECMAVersions : byte
{
@@ -139,9 +131,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
ECMA111 = 0x01
}
/// <summary>
/// List of known ISO SCSI standards
/// </summary>
/// <summary>List of known ISO SCSI standards</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ISOVersions : byte
{
@@ -151,9 +141,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
ISO1995Version = 0x02
}
/// <summary>
/// List of known SCSI Parallel Interface clocking types
/// </summary>
/// <summary>List of known SCSI Parallel Interface clocking types</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum SPIClocking : byte
{
@@ -167,9 +155,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
STandDT = 0x03
}
/// <summary>
/// List of known TGPS values
/// </summary>
/// <summary>List of known TGPS values</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum TGPSValues : byte
{
@@ -183,9 +169,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
Both = 0x03
}
/// <summary>
/// List of known SCSI protocols
/// </summary>
/// <summary>List of known SCSI protocols</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ProtocolIdentifiers : byte
{
@@ -217,37 +201,23 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
NoProtocol = 15
}
/// <summary>
/// List of known SCSI definitions
/// </summary>
/// <summary>List of known SCSI definitions</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ScsiDefinitions : byte
{
/// <summary>
/// Unknown
/// </summary>
/// <summary>Unknown</summary>
Current = 0,
/// <summary>
/// SCSI-1
/// </summary>
/// <summary>SCSI-1</summary>
SCSI1 = 1,
/// <summary>
/// Unknown
/// </summary>
/// <summary>Unknown</summary>
CCS = 2,
/// <summary>
/// SCSI-2
/// </summary>
SCSI2 = 3,
/// <summary>
/// SCSI-3
/// </summary>
/// <summary>SCSI-2</summary>
SCSI2 = 3,
/// <summary>SCSI-3</summary>
SCSI3 = 4
}
/// <summary>
/// List of known SCSI physical interfaces
/// </summary>
/// <summary>List of known SCSI physical interfaces</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum PhysicalInterfaces : uint
{

View File

@@ -251,9 +251,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
0x48, 0x69, 0x2D, 0x4D, 0x44, 0x20, 0x20, 0x20
};
/// <summary>
/// Decodes a SCSI INQUIRY response
/// </summary>
/// <summary>Decodes a SCSI INQUIRY response</summary>
/// <param name="SCSIInquiryResponse">INQUIRY raw response data</param>
/// <returns>Decoded SCSI INQUIRY</returns>
#region Public methods
@@ -513,9 +511,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI
return decoded;
}
/// <summary>
/// Encodes a SCSI INQUIRY response
/// </summary>
/// <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)

View File

@@ -46,9 +46,7 @@ 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>
/// <summary>Write speed performance descriptors</summary>
public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
/// <summary>Parameters can be saved</summary>
public bool PS { get; set; }
@@ -97,133 +95,74 @@ 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>
/// <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>
/// <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>
/// Can deliver a composite audio and video data stream
/// 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 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; }
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>
/// <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>
/// <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>
/// <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>
/// <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>
/// <summary>Database ID</summary>
[JsonIgnore, Key]
public int Id { get; set; }
/// <summary>
/// Decodes the page 2Ah of a MODE SENSE response
/// </summary>
/// <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)
@@ -337,9 +276,7 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
return decoded;
}
/// <summary>
/// Encodes a page 2Ah of a MODE SENSE response
/// </summary>
/// <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)
@@ -564,19 +501,13 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes
}
}
/// <summary>
/// Page 2Ah write descriptor
/// </summary>
/// <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>
/// <summary>Rotational control</summary>
public byte RotationControl;
/// <summary>Write speed</summary>
public ushort WriteSpeed;
}
#endregion Mode Page 0x2A: CD-ROM capabilities page