REFACTOR: All refactor in DiscImageChef.Decoders.

This commit is contained in:
2017-12-22 02:04:18 +00:00
parent 7f829422a8
commit 49144eeb01
148 changed files with 2606 additions and 1939 deletions

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class AACS
{
public struct HDLeadInCopyright

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class ADIP
{
public struct ADIPInformation

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class BCA
{
public struct BurstCuttingArea

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class CPRM
{
public struct DiscMediaIdentifier

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace DiscImageChef.Decoders.DVD
@@ -50,6 +51,10 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class CSS_CPRM
{
public struct LeadInCopyright
@@ -117,21 +122,18 @@ namespace DiscImageChef.Decoders.DVD
public static LeadInCopyright? DecodeLeadInCopyright(byte[] response)
{
if(response == null) return null;
if(response?.Length != 8) return null;
if(response.Length != 8) return null;
LeadInCopyright cmi = new LeadInCopyright();
cmi.DataLength = (ushort)((response[0] << 8) + response[1]);
cmi.Reserved1 = response[2];
cmi.Reserved2 = response[3];
cmi.CopyrightType = (CopyrightType)response[4];
cmi.RegionInformation = response[5];
cmi.Reserved3 = response[6];
cmi.Reserved4 = response[7];
return cmi;
return new LeadInCopyright
{
DataLength = (ushort)((response[0] << 8) + response[1]),
Reserved1 = response[2],
Reserved2 = response[3],
CopyrightType = (CopyrightType)response[4],
RegionInformation = response[5],
Reserved3 = response[6],
Reserved4 = response[7]
};
}
public static string PrettifyLeadInCopyright(LeadInCopyright? cmi)

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace DiscImageChef.Decoders.DVD
@@ -49,6 +50,10 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class Cartridge
{
public struct MediumStatus
@@ -122,27 +127,24 @@ namespace DiscImageChef.Decoders.DVD
public static MediumStatus? Decode(byte[] response)
{
if(response == null) return null;
if(response?.Length != 8) return null;
if(response.Length != 8) return null;
MediumStatus status = new MediumStatus();
status.DataLength = (ushort)((response[0] << 8) + response[1]);
status.Reserved1 = response[2];
status.Reserved2 = response[3];
status.Cartridge |= (response[4] & 0x80) == 0x80;
status.OUT |= (response[4] & 0x40) == 0x40;
status.Reserved3 = (byte)((response[4] & 0x30) >> 4);
status.MSWI |= (response[4] & 0x08) == 0x08;
status.CWP |= (response[4] & 0x04) == 0x04;
status.PWP |= (response[4] & 0x02) == 0x02;
status.Reserved4 |= (response[4] & 0x01) == 0x01;
status.DiscType = response[5];
status.Reserved5 = response[6];
status.RAMSWI = response[7];
return status;
return new MediumStatus
{
DataLength = (ushort)((response[0] << 8) + response[1]),
Reserved1 = response[2],
Reserved2 = response[3],
Cartridge = (response[4] & 0x80) == 0x80,
OUT = (response[4] & 0x40) == 0x40,
Reserved3 = (byte)((response[4] & 0x30) >> 4),
MSWI = (response[4] & 0x08) == 0x08,
CWP = (response[4] & 0x04) == 0x04,
PWP = (response[4] & 0x02) == 0x02,
Reserved4 = (response[4] & 0x01) == 0x01,
DiscType = response[5],
Reserved5 = response[6],
RAMSWI = response[7]
};
}
public static string Prettify(MediumStatus? status)

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace DiscImageChef.Decoders.DVD
@@ -52,6 +53,10 @@ namespace DiscImageChef.Decoders.DVD
/// ECMA 272: 120 mm DVD Rewritable Disk (DVD-RAM)
/// ECMA 330: 120 mm (4,7 Gbytes per side) and 80 mm (1,46 Gbytes per side) DVD Rewritable Disk (DVD-RAM)
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class DDS
{
public struct DiscDefinitionStructure
@@ -196,13 +201,10 @@ namespace DiscImageChef.Decoders.DVD
public static DiscDefinitionStructure? Decode(byte[] response)
{
if(response == null) return null;
if(response?.Length != 2052) return null;
if(response.Length != 2052) return null;
DiscDefinitionStructure dds = new DiscDefinitionStructure();
dds.Identifier = (ushort)((response[4] << 8) + response[5]);
DiscDefinitionStructure dds =
new DiscDefinitionStructure {Identifier = (ushort)((response[4] << 8) + response[5])};
if(dds.Identifier != 0x0A0A) return null;

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class DMI
{
public struct DiscManufacturingInformation

View File

@@ -30,9 +30,12 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
#region Public enumerations
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DiskCategory : byte
{
/// <summary>
@@ -94,6 +97,7 @@ namespace DiscImageChef.Decoders.DVD
Nintendo = 15
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum MaximumRateField : byte
{
/// <summary>
@@ -119,6 +123,7 @@ namespace DiscImageChef.Decoders.DVD
Unspecified = 0x0F
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum LayerTypeFieldMask : byte
{
Embossed = 0x01,
@@ -127,6 +132,7 @@ namespace DiscImageChef.Decoders.DVD
Reserved = 0x08
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum LinearDensityField : byte
{
/// <summary>
@@ -159,6 +165,7 @@ namespace DiscImageChef.Decoders.DVD
ThreeFive = 0x08
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum TrackDensityField : byte
{
/// <summary>
@@ -183,6 +190,7 @@ namespace DiscImageChef.Decoders.DVD
Three = 0x04
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum CopyrightType : byte
{
/// <summary>
@@ -203,6 +211,7 @@ namespace DiscImageChef.Decoders.DVD
AACS = 0x10
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum WPDiscTypes : byte
{
/// <summary>
@@ -217,6 +226,7 @@ namespace DiscImageChef.Decoders.DVD
Reserved2 = 0x03
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DVDSize
{
/// <summary>
@@ -229,6 +239,7 @@ namespace DiscImageChef.Decoders.DVD
Eighty = 1
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DVDRAMDiscType
{
/// <summary>
@@ -241,6 +252,7 @@ namespace DiscImageChef.Decoders.DVD
Uncased = 1
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DVDLayerStructure
{
Unspecified = 0,
@@ -249,6 +261,7 @@ namespace DiscImageChef.Decoders.DVD
Reserved = 3
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DVDRecordingSpeed
{
None = 0,

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class Layers
{
public struct LayerCapacity

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace DiscImageChef.Decoders.DVD
@@ -66,6 +67,9 @@ namespace DiscImageChef.Decoders.DVD
/// ECMA 382: 120 mm (8,54 Gbytes per side) and 80 mm (2,66 Gbytes per side) DVD Recordable Disk for Dual Layer (DVD-R for DL)
/// ECMA 384: 120 mm (8,54 Gbytes per side) and 80 mm (2,66 Gbytes per side) DVD Re-recordable Disk for Dual Layer (DVD-RW for DL)
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class PFI
{
public struct PhysicalFormatInformation

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class PRI
{
public struct PreRecordedInformation

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class RMD
{
public struct LastBorderOutRMD

View File

@@ -30,6 +30,7 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace DiscImageChef.Decoders.DVD
@@ -49,6 +50,10 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class Spare
{
public struct SpareAreaInformation
@@ -87,23 +92,20 @@ namespace DiscImageChef.Decoders.DVD
public static SpareAreaInformation? Decode(byte[] response)
{
if(response == null) return null;
if(response?.Length != 16) return null;
if(response.Length != 16) return null;
SpareAreaInformation sai = new SpareAreaInformation();
sai.DataLength = (ushort)((response[0] << 8) + response[1]);
sai.Reserved1 = response[2];
sai.Reserved2 = response[3];
sai.UnusedPrimaryBlocks =
(uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
sai.UnusedSupplementaryBlocks =
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
sai.AllocatedSupplementaryBlocks =
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
return sai;
return new SpareAreaInformation
{
DataLength = (ushort)((response[0] << 8) + response[1]),
Reserved1 = response[2],
Reserved2 = response[3],
UnusedPrimaryBlocks =
(uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]),
UnusedSupplementaryBlocks =
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]),
AllocatedSupplementaryBlocks =
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15])
};
}
public static string Prettify(SpareAreaInformation? sai)

View File

@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace DiscImageChef.Decoders.DVD
{
/// <summary>
@@ -48,6 +50,9 @@ namespace DiscImageChef.Decoders.DVD
/// T10/1836-D revision 2g
/// ECMA 365
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
public static class UDI
{
public struct UniqueDiscIdentifier