diff --git a/DiscImageChef.Decoders.csproj b/DiscImageChef.Decoders.csproj
index 82d05f8..0b5344f 100644
--- a/DiscImageChef.Decoders.csproj
+++ b/DiscImageChef.Decoders.csproj
@@ -43,7 +43,13 @@
false
+
+ ..\..\..\.nuget\packages\newtonsoft.json\11.0.2\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\..\..\.nuget\packages\system.componentmodel.annotations\4.5.0\ref\netstandard2.0\System.ComponentModel.Annotations.dll
+
diff --git a/SCSI/EVPD.cs b/SCSI/EVPD.cs
index 953c962..2d6222f 100644
--- a/SCSI/EVPD.cs
+++ b/SCSI/EVPD.cs
@@ -172,10 +172,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_81(byte[] pageResponse)
- {
- return PrettifyPage_81(DecodePage_81(pageResponse));
- }
+ public static string PrettifyPage_81(byte[] pageResponse) => PrettifyPage_81(DecodePage_81(pageResponse));
public static string DefinitionToString(ScsiDefinitions definition)
{
@@ -430,10 +427,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_83(byte[] pageResponse)
- {
- return PrettifyPage_83(DecodePage_83(pageResponse));
- }
+ public static string PrettifyPage_83(byte[] pageResponse) => PrettifyPage_83(DecodePage_83(pageResponse));
public static string PrettifyPage_83(Page_83? modePage)
{
@@ -823,10 +817,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_84(byte[] pageResponse)
- {
- return PrettifyPage_84(DecodePage_84(pageResponse));
- }
+ public static string PrettifyPage_84(byte[] pageResponse) => PrettifyPage_84(DecodePage_84(pageResponse));
public static string PrettifyPage_84(Page_84? modePage)
{
@@ -955,10 +946,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_85(byte[] pageResponse)
- {
- return PrettifyPage_85(DecodePage_85(pageResponse));
- }
+ public static string PrettifyPage_85(byte[] pageResponse) => PrettifyPage_85(DecodePage_85(pageResponse));
public static string PrettifyPage_85(Page_85? modePage)
{
@@ -1216,10 +1204,7 @@ namespace DiscImageChef.Decoders.SCSI
};
}
- public static string PrettifyPage_86(byte[] pageResponse)
- {
- return PrettifyPage_86(DecodePage_86(pageResponse));
- }
+ public static string PrettifyPage_86(byte[] pageResponse) => PrettifyPage_86(DecodePage_86(pageResponse));
public static string PrettifyPage_86(Page_86? modePage)
{
@@ -1384,10 +1369,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_89(byte[] pageResponse)
- {
- return PrettifyPage_89(DecodePage_89(pageResponse));
- }
+ public static string PrettifyPage_89(byte[] pageResponse) => PrettifyPage_89(DecodePage_89(pageResponse));
// TODO: Decode ATA signature?
public static string PrettifyPage_89(Page_89? modePage)
@@ -1433,7 +1415,7 @@ namespace DiscImageChef.Decoders.SCSI
}
Identify.IdentifyDevice? id = Identify.Decode(page.IdentifyData);
- if(id.HasValue)
+ if(id != null)
{
sb.AppendLine("\tATA IDENTIFY information follows:");
sb.AppendFormat("{0}", Identify.Prettify(id)).AppendLine();
@@ -1511,10 +1493,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_C0_Quantum(byte[] pageResponse)
- {
- return PrettifyPage_C0_Quantum(DecodePage_C0_Quantum(pageResponse));
- }
+ public static string PrettifyPage_C0_Quantum(byte[] pageResponse) =>
+ PrettifyPage_C0_Quantum(DecodePage_C0_Quantum(pageResponse));
public static string PrettifyPage_C0_Quantum(Page_C0_Quantum? modePage)
{
@@ -1593,10 +1573,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_C0_C1_Certance(byte[] pageResponse)
- {
- return PrettifyPage_C0_C1_Certance(DecodePage_C0_C1_Certance(pageResponse));
- }
+ public static string PrettifyPage_C0_C1_Certance(byte[] pageResponse) =>
+ PrettifyPage_C0_C1_Certance(DecodePage_C0_C1_Certance(pageResponse));
public static string PrettifyPage_C0_C1_Certance(Page_C0_C1_Certance? modePage)
{
@@ -1666,10 +1644,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_C2_C3_C4_C5_C6_Certance(byte[] pageResponse)
- {
- return PrettifyPage_C2_C3_C4_C5_C6_Certance(DecodePage_C2_C3_C4_C5_C6_Certance(pageResponse));
- }
+ public static string PrettifyPage_C2_C3_C4_C5_C6_Certance(byte[] pageResponse) =>
+ PrettifyPage_C2_C3_C4_C5_C6_Certance(DecodePage_C2_C3_C4_C5_C6_Certance(pageResponse));
public static string PrettifyPage_C2_C3_C4_C5_C6_Certance(Page_C2_C3_C4_C5_C6_Certance? modePage)
{
@@ -1837,10 +1813,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_DF_Certance(byte[] pageResponse)
- {
- return PrettifyPage_DF_Certance(DecodePage_DF_Certance(pageResponse));
- }
+ public static string PrettifyPage_DF_Certance(byte[] pageResponse) =>
+ PrettifyPage_DF_Certance(DecodePage_DF_Certance(pageResponse));
public static string PrettifyPage_DF_Certance(Page_DF_Certance? modePage)
{
@@ -2013,10 +1987,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_C0_IBM(byte[] pageResponse)
- {
- return PrettifyPage_C0_IBM(DecodePage_C0_IBM(pageResponse));
- }
+ public static string PrettifyPage_C0_IBM(byte[] pageResponse) =>
+ PrettifyPage_C0_IBM(DecodePage_C0_IBM(pageResponse));
public static string PrettifyPage_C0_IBM(Page_C0_IBM? modePage)
{
@@ -2084,10 +2056,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_C1_IBM(byte[] pageResponse)
- {
- return PrettifyPage_C1_IBM(DecodePage_C1_IBM(pageResponse));
- }
+ public static string PrettifyPage_C1_IBM(byte[] pageResponse) =>
+ PrettifyPage_C1_IBM(DecodePage_C1_IBM(pageResponse));
public static string PrettifyPage_C1_IBM(Page_C1_IBM? modePage)
{
@@ -2154,10 +2124,7 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_B0(byte[] pageResponse)
- {
- return PrettifyPage_B0(DecodePage_B0(pageResponse));
- }
+ public static string PrettifyPage_B0(byte[] pageResponse) => PrettifyPage_B0(DecodePage_B0(pageResponse));
public static string PrettifyPage_B0(Page_B0? modePage)
{
@@ -2339,10 +2306,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_C0_to_C5_HP(byte[] pageResponse)
- {
- return PrettifyPage_C0_to_C5_HP(DecodePage_C0_to_C5_HP(pageResponse));
- }
+ public static string PrettifyPage_C0_to_C5_HP(byte[] pageResponse) =>
+ PrettifyPage_C0_to_C5_HP(DecodePage_C0_to_C5_HP(pageResponse));
public static string PrettifyPage_C0_to_C5_HP(Page_C0_to_C5_HP? modePage)
{
@@ -2442,10 +2407,8 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyPage_C0_Seagate(byte[] pageResponse)
- {
- return PrettifyPage_C0_Seagate(DecodePage_C0_Seagate(pageResponse));
- }
+ public static string PrettifyPage_C0_Seagate(byte[] pageResponse) =>
+ PrettifyPage_C0_Seagate(DecodePage_C0_Seagate(pageResponse));
public static string PrettifyPage_C0_Seagate(Page_C0_Seagate? modePage)
{
diff --git a/SCSI/Modes/2A.cs b/SCSI/Modes/2A.cs
index e1a732e..05abba0 100644
--- a/SCSI/Modes/2A.cs
+++ b/SCSI/Modes/2A.cs
@@ -30,9 +30,11 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
+using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
+using Newtonsoft.Json;
namespace DiscImageChef.Decoders.SCSI
{
@@ -52,135 +54,139 @@ namespace DiscImageChef.Decoders.SCSI
/// 26 bytes in MMC-2
/// Variable bytes in MMC-3
///
- public struct ModePage_2A
+ public class ModePage_2A
{
+ public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
///
/// Parameters can be saved
///
- public bool PS;
+ public bool PS { get; set; }
///
/// Drive supports multi-session and/or Photo-CD
///
- public bool MultiSession;
+ public bool MultiSession { get; set; }
///
/// Drive is capable of reading sectors in Mode 2 Form 2 format
///
- public bool Mode2Form2;
+ public bool Mode2Form2 { get; set; }
///
/// Drive is capable of reading sectors in Mode 2 Form 1 format
///
- public bool Mode2Form1;
+ public bool Mode2Form1 { get; set; }
///
/// Drive is capable of playing audio
///
- public bool AudioPlay;
+ public bool AudioPlay { get; set; }
///
/// Drive can return the ISRC
///
- public bool ISRC;
+ public bool ISRC { get; set; }
///
/// Drive can return the media catalogue number
///
- public bool UPC;
+ public bool UPC { get; set; }
///
/// Drive can return C2 pointers
///
- public bool C2Pointer;
+ public bool C2Pointer { get; set; }
///
/// Drive can read, deinterlave and correct R-W subchannels
///
- public bool DeinterlaveSubchannel;
+ public bool DeinterlaveSubchannel { get; set; }
///
/// Drive can read interleaved and uncorrected R-W subchannels
///
- public bool Subchannel;
+ public bool Subchannel { get; set; }
///
/// Drive can continue from a loss of streaming on audio reading
///
- public bool AccurateCDDA;
+ public bool AccurateCDDA { get; set; }
///
/// Audio can be read as digital data
///
- public bool CDDACommand;
+ public bool CDDACommand { get; set; }
///
/// Loading Mechanism Type
///
- public byte LoadingMechanism;
+ public byte LoadingMechanism { get; set; }
///
/// Drive can eject discs
///
- public bool Eject;
+ public bool Eject { get; set; }
///
/// Drive's optional prevent jumper status
///
- public bool PreventJumper;
+ public bool PreventJumper { get; set; }
///
/// Current lock status
///
- public bool LockState;
+ public bool LockState { get; set; }
///
/// Drive can lock media
///
- public bool Lock;
+ public bool Lock { get; set; }
///
/// Each channel can be muted independently
///
- public bool SeparateChannelMute;
+ public bool SeparateChannelMute { get; set; }
///
/// Each channel's volume can be controlled independently
///
- public bool SeparateChannelVolume;
+ public bool SeparateChannelVolume { get; set; }
///
/// Maximum drive speed in Kbytes/second
///
- public ushort MaximumSpeed;
+ public ushort MaximumSpeed { get; set; }
///
/// Supported volume levels
///
- public ushort SupportedVolumeLevels;
+ public ushort SupportedVolumeLevels { get; set; }
///
/// Buffer size in Kbytes
///
- public ushort BufferSize;
+ public ushort BufferSize { get; set; }
///
/// Current drive speed in Kbytes/second
///
- public ushort CurrentSpeed;
+ public ushort CurrentSpeed { get; set; }
- public bool Method2;
- public bool ReadCDRW;
- public bool ReadCDR;
- public bool WriteCDRW;
- public bool WriteCDR;
- public bool DigitalPort2;
- public bool DigitalPort1;
- public bool Composite;
- public bool SSS;
- public bool SDP;
- public byte Length;
- public bool LSBF;
- public bool RCK;
- public bool BCK;
+ public bool Method2 { get; set; }
+ public bool ReadCDRW { get; set; }
+ public bool ReadCDR { get; set; }
+ public bool WriteCDRW { get; set; }
+ public bool WriteCDR { get; set; }
+ public bool DigitalPort2 { get; set; }
+ public bool DigitalPort1 { get; set; }
+ public bool Composite { get; set; }
+ public bool SSS { get; set; }
+ public bool SDP { get; set; }
+ public byte Length { get; set; }
+ public bool LSBF { get; set; }
+ public bool RCK { get; set; }
+ public bool BCK { get; set; }
- public bool TestWrite;
- public ushort MaxWriteSpeed;
- public ushort CurrentWriteSpeed;
+ public bool TestWrite { get; set; }
+ public ushort MaxWriteSpeed { get; set; }
+ public ushort CurrentWriteSpeed { get; set; }
- public bool ReadBarcode;
+ public bool ReadBarcode { get; set; }
- public bool ReadDVDRAM;
- public bool ReadDVDR;
- public bool ReadDVDROM;
- public bool WriteDVDRAM;
- public bool WriteDVDR;
- public bool LeadInPW;
- public bool SCC;
- public ushort CMRSupported;
+ public bool ReadDVDRAM { get; set; }
+ public bool ReadDVDR { get; set; }
+ public bool ReadDVDROM { get; set; }
+ public bool WriteDVDRAM { get; set; }
+ public bool WriteDVDR { get; set; }
+ public bool LeadInPW { get; set; }
+ public bool SCC { get; set; }
+ public ushort CMRSupported { get; set; }
- public bool BUF;
- public byte RotationControlSelected;
- public ushort CurrentWriteSpeedSelected;
- public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors;
+ public bool BUF { get; set; }
+ public byte RotationControlSelected { get; set; }
+ public ushort CurrentWriteSpeedSelected { get; set; }
+
+ [JsonIgnore]
+ [Key]
+ public int Id { get; set; }
}
public struct ModePage_2A_WriteDescriptor
@@ -189,7 +195,7 @@ namespace DiscImageChef.Decoders.SCSI
public ushort WriteSpeed;
}
- public static ModePage_2A? DecodeModePage_2A(byte[] pageResponse)
+ public static ModePage_2A DecodeModePage_2A(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40) return null;
@@ -293,16 +299,14 @@ namespace DiscImageChef.Decoders.SCSI
return decoded;
}
- public static string PrettifyModePage_2A(byte[] pageResponse)
- {
- return PrettifyModePage_2A(DecodeModePage_2A(pageResponse));
- }
+ public static string PrettifyModePage_2A(byte[] pageResponse) =>
+ PrettifyModePage_2A(DecodeModePage_2A(pageResponse));
- public static string PrettifyModePage_2A(ModePage_2A? modePage)
+ public static string PrettifyModePage_2A(ModePage_2A modePage)
{
- if(!modePage.HasValue) return null;
+ if(modePage is null) return null;
- ModePage_2A page = modePage.Value;
+ ModePage_2A page = modePage;
StringBuilder sb = new StringBuilder();
sb.AppendLine("SCSI CD-ROM capabilities page:");