Code reformat.

This commit is contained in:
2019-11-25 00:54:38 +00:00
parent a5c650440d
commit d864bfab6c
116 changed files with 16544 additions and 19331 deletions

View File

@@ -38,44 +38,45 @@ using DiscImageChef.Console;
namespace DiscImageChef.Decoders.Bluray
{
/// <summary>
/// Information from the following standards:
/// ANSI X3.304-1997
/// T10/1048-D revision 9.0
/// T10/1048-D revision 10a
/// T10/1228-D revision 7.0c
/// T10/1228-D revision 11a
/// T10/1363-D revision 10g
/// T10/1545-D revision 1d
/// T10/1545-D revision 5
/// T10/1545-D revision 5a
/// T10/1675-D revision 2c
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
/// Information from the following standards: ANSI X3.304-1997 T10/1048-D revision 9.0 T10/1048-D revision 10a
/// T10/1228-D revision 7.0c T10/1228-D revision 11a T10/1363-D revision 10g T10/1545-D revision 1d T10/1545-D revision
/// 5 T10/1545-D revision 5a T10/1675-D revision 2c 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")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class BCA
{
#region Public structures
public struct BurstCuttingArea
{
/// <summary>Bytes 0 to 1 Always 66</summary>
public ushort DataLength;
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>Byte 4 to 67 BCA data</summary>
public byte[] BCA;
}
#endregion Public structures
#region Public methods
public static BurstCuttingArea? Decode(byte[] BCAResponse)
{
if(BCAResponse == null) return null;
if(BCAResponse == null)
return null;
if(BCAResponse.Length != 68)
{
DicConsole.DebugWriteLine("BD BCA decoder", "Found incorrect Blu-ray BCA size ({0} bytes)",
BCAResponse.Length);
return null;
}
BurstCuttingArea decoded = new BurstCuttingArea
var decoded = new BurstCuttingArea
{
DataLength = BigEndianBitConverter.ToUInt16(BCAResponse, 0),
Reserved1 = BCAResponse[2],
Reserved2 = BCAResponse[3],
BCA = new byte[64]
DataLength = BigEndianBitConverter.ToUInt16(BCAResponse, 0), Reserved1 = BCAResponse[2],
Reserved2 = BCAResponse[3], BCA = new byte[64]
};
Array.Copy(BCAResponse, 4, decoded.BCA, 0, 64);
@@ -85,16 +86,20 @@ namespace DiscImageChef.Decoders.Bluray
public static string Prettify(BurstCuttingArea? BCAResponse)
{
if(BCAResponse == null) return null;
if(BCAResponse == null)
return null;
BurstCuttingArea response = BCAResponse.Value;
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
#if DEBUG
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
#endif
#if DEBUG
if(response.Reserved1 != 0)
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0)
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
#endif
sb.AppendFormat("Blu-ray Burst Cutting Area in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.BCA, 80));
@@ -104,31 +109,5 @@ namespace DiscImageChef.Decoders.Bluray
public static string Prettify(byte[] BCAResponse) => Prettify(Decode(BCAResponse));
#endregion Public methods
#region Public structures
public struct BurstCuttingArea
{
/// <summary>
/// Bytes 0 to 1
/// Always 66
/// </summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
public byte Reserved2;
/// <summary>
/// Byte 4 to 67
/// BCA data
/// </summary>
public byte[] BCA;
}
#endregion Public structures
}
}

View File

@@ -38,53 +38,72 @@ using DiscImageChef.Console;
namespace DiscImageChef.Decoders.Bluray
{
/// <summary>
/// Information from the following standards:
/// ANSI X3.304-1997
/// T10/1048-D revision 9.0
/// T10/1048-D revision 10a
/// T10/1228-D revision 7.0c
/// T10/1228-D revision 11a
/// T10/1363-D revision 10g
/// T10/1545-D revision 1d
/// T10/1545-D revision 5
/// T10/1545-D revision 5a
/// T10/1675-D revision 2c
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
/// Information from the following standards: ANSI X3.304-1997 T10/1048-D revision 9.0 T10/1048-D revision 10a
/// T10/1228-D revision 7.0c T10/1228-D revision 11a T10/1363-D revision 10g T10/1545-D revision 1d T10/1545-D revision
/// 5 T10/1545-D revision 5a T10/1675-D revision 2c 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")]
[SuppressMessage("ReSharper", "UnassignedField.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global"),
SuppressMessage("ReSharper", "UnassignedField.Global")]
public static class Cartridge
{
#region Public structures
public struct CartridgeStatus
{
/// <summary>Bytes 0 to 1 Always 6</summary>
public ushort DataLength;
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>Byte 4, bit 7 Medium is inserted in a cartridge</summary>
public bool Cartridge;
/// <summary>Byte 4, bit 6 Medium taken out / put in a cartridge</summary>
public bool OUT;
/// <summary>Byte 4, bits 5 to 3 Reserved</summary>
public byte Reserved3;
/// <summary>Byte 4, bit 2 Cartridge sets write protection</summary>
public bool CWP;
/// <summary>Byte 4, bits 1 to 0 Reserved</summary>
public byte Reserved4;
/// <summary>Byte 5 Reserved</summary>
public byte Reserved5;
/// <summary>Byte 6 Reserved</summary>
public byte Reserved6;
/// <summary>Byte 7 Reserved</summary>
public byte Reserved7;
}
#endregion Public structures
#region Public methods
public static CartridgeStatus? Decode(byte[] CSResponse)
{
if(CSResponse == null) return null;
if(CSResponse == null)
return null;
if(CSResponse.Length != 8)
{
DicConsole.DebugWriteLine("BD Cartridge Status decoder",
"Found incorrect Blu-ray Cartridge Status size ({0} bytes)",
CSResponse.Length);
return null;
}
CartridgeStatus decoded = new CartridgeStatus
var decoded = new CartridgeStatus
{
DataLength = BigEndianBitConverter.ToUInt16(CSResponse, 0),
Reserved1 = CSResponse[2],
DataLength = BigEndianBitConverter.ToUInt16(CSResponse, 0), Reserved1 = CSResponse[2],
Reserved2 = CSResponse[3],
Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80),
OUT = Convert.ToBoolean(CSResponse[4] & 0x40),
Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3),
CWP = Convert.ToBoolean(CSResponse[4] & 0x04),
Reserved4 = (byte)(CSResponse[4] & 0x03),
Reserved5 = CSResponse[5],
Reserved6 = CSResponse[6],
Reserved7 = CSResponse[7]
OUT =
Convert.ToBoolean(CSResponse[4] & 0x40),
Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3),
CWP =
Convert.ToBoolean(CSResponse[4] & 0x04),
Reserved4 = (byte)(CSResponse[4] & 0x03),
Reserved5 = CSResponse[5],
Reserved6 =
CSResponse[6],
Reserved7 = CSResponse[7]
};
return decoded;
@@ -92,36 +111,57 @@ namespace DiscImageChef.Decoders.Bluray
public static string Prettify(CartridgeStatus? CSResponse)
{
if(CSResponse == null) return null;
if(CSResponse == null)
return null;
CartridgeStatus response = CSResponse.Value;
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
#if DEBUG
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
if(response.Reserved4 != 0) sb.AppendFormat("Reserved4 = 0x{0:X8}", response.Reserved4).AppendLine();
if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
if(response.Reserved7 != 0) sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine();
#endif
#if DEBUG
if(response.Reserved1 != 0)
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0)
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
if(response.Reserved3 != 0)
sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
if(response.Reserved4 != 0)
sb.AppendFormat("Reserved4 = 0x{0:X8}", response.Reserved4).AppendLine();
if(response.Reserved5 != 0)
sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
if(response.Reserved6 != 0)
sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
if(response.Reserved7 != 0)
sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine();
#endif
if(response.Cartridge)
{
sb.AppendLine("Media is inserted in a cartridge");
if(response.OUT) sb.AppendLine("Media has been taken out, or inserted in, the cartridge");
if(response.CWP) sb.AppendLine("Media is write protected");
if(response.OUT)
sb.AppendLine("Media has been taken out, or inserted in, the cartridge");
if(response.CWP)
sb.AppendLine("Media is write protected");
}
else
{
sb.AppendLine("Media is not in a cartridge");
#if DEBUG
if(response.OUT) sb.AppendLine("Media has out bit marked, shouldn't");
if(response.CWP) sb.AppendLine("Media has write protection bit marked, shouldn't");
#endif
#if DEBUG
if(response.OUT)
sb.AppendLine("Media has out bit marked, shouldn't");
if(response.CWP)
sb.AppendLine("Media has write protection bit marked, shouldn't");
#endif
}
return sb.ToString();
@@ -129,66 +169,5 @@ namespace DiscImageChef.Decoders.Bluray
public static string Prettify(byte[] CSResponse) => Prettify(Decode(CSResponse));
#endregion Public methods
#region Public structures
public struct CartridgeStatus
{
/// <summary>
/// Bytes 0 to 1
/// Always 6
/// </summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
public byte Reserved2;
/// <summary>
/// Byte 4, bit 7
/// Medium is inserted in a cartridge
/// </summary>
public bool Cartridge;
/// <summary>
/// Byte 4, bit 6
/// Medium taken out / put in a cartridge
/// </summary>
public bool OUT;
/// <summary>
/// Byte 4, bits 5 to 3
/// Reserved
/// </summary>
public byte Reserved3;
/// <summary>
/// Byte 4, bit 2
/// Cartridge sets write protection
/// </summary>
public bool CWP;
/// <summary>
/// Byte 4, bits 1 to 0
/// Reserved
/// </summary>
public byte Reserved4;
/// <summary>
/// Byte 5
/// Reserved
/// </summary>
public byte Reserved5;
/// <summary>
/// Byte 6
/// Reserved
/// </summary>
public byte Reserved6;
/// <summary>
/// Byte 7
/// Reserved
/// </summary>
public byte Reserved7;
}
#endregion Public structures
}
}

View File

@@ -38,42 +38,84 @@ using DiscImageChef.Console;
namespace DiscImageChef.Decoders.Bluray
{
/// <summary>
/// Information from the following standards:
/// ANSI X3.304-1997
/// T10/1048-D revision 9.0
/// T10/1048-D revision 10a
/// T10/1228-D revision 7.0c
/// T10/1228-D revision 11a
/// T10/1363-D revision 10g
/// T10/1545-D revision 1d
/// T10/1545-D revision 5
/// T10/1545-D revision 5a
/// T10/1675-D revision 2c
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
/// Information from the following standards: ANSI X3.304-1997 T10/1048-D revision 9.0 T10/1048-D revision 10a
/// T10/1228-D revision 7.0c T10/1228-D revision 11a T10/1363-D revision 10g T10/1545-D revision 1d T10/1545-D revision
/// 5 T10/1545-D revision 5a T10/1675-D revision 2c 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")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class DDS
{
#region Private constants
/// <summary>
/// Disc Definition Structure Identifier "DS"
/// </summary>
/// <summary>Disc Definition Structure Identifier "DS"</summary>
const ushort DDSIdentifier = 0x4453;
#endregion Private constants
#region Public structures
public struct DiscDefinitionStructure
{
/// <summary>Bytes 0 to 1 Data Length</summary>
public ushort DataLength;
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>Bytes 4 to 5 "DS"</summary>
public ushort Signature;
/// <summary>Byte 6 DDS format</summary>
public byte Format;
/// <summary>Byte 7 Reserved</summary>
public byte Reserved3;
/// <summary>Bytes 8 to 11 DDS update count</summary>
public uint UpdateCount;
/// <summary>Bytes 12 to 19 Reserved</summary>
public ulong Reserved4;
/// <summary>Bytes 20 to 23 First PSN of Drive Area</summary>
public uint DriveAreaPSN;
/// <summary>Bytes 24 to 27 Reserved</summary>
public uint Reserved5;
/// <summary>Bytes 28 to 31 First PSN of Defect List</summary>
public uint DefectListPSN;
/// <summary>Bytes 32 to 35 Reserved</summary>
public uint Reserved6;
/// <summary>Bytes 36 to 39 PSN of LSN 0 of user data area</summary>
public uint PSNofLSNZero;
/// <summary>Bytes 40 to 43 Last LSN of user data area</summary>
public uint LastUserAreaLSN;
/// <summary>Bytes 44 to 47 ISA0 size</summary>
public uint ISA0;
/// <summary>Bytes 48 to 51 OSA size</summary>
public uint OSA;
/// <summary>Bytes 52 to 55 ISA1 size</summary>
public uint ISA1;
/// <summary>Byte 56 Spare Area full flags</summary>
public byte SpareAreaFullFlags;
/// <summary>Byte 57 Reserved</summary>
public byte Reserved7;
/// <summary>Byte 58 Disc type specific field</summary>
public byte DiscTypeSpecificField1;
/// <summary>Byte 59 Reserved</summary>
public byte Reserved8;
/// <summary>Byte 60 to 63 Disc type specific field</summary>
public uint DiscTypeSpecificField2;
/// <summary>Byte 64 to 67 Reserved</summary>
public uint Reserved9;
/// <summary>Bytes 68 to 99 Status bits of INFO1/2 and PAC1/2 on L0 and L1</summary>
public byte[] StatusBits;
/// <summary>Bytes 100 to end Disc type specific data</summary>
public byte[] DiscTypeSpecificData;
}
#endregion Public structures
#region Public methods
public static DiscDefinitionStructure? Decode(byte[] DDSResponse)
{
if(DDSResponse == null) return null;
if(DDSResponse == null)
return null;
DiscDefinitionStructure decoded = new DiscDefinitionStructure
var decoded = new DiscDefinitionStructure
{
DataLength = BigEndianBitConverter.ToUInt16(DDSResponse, 0),
Reserved1 = DDSResponse[2],
DataLength = BigEndianBitConverter.ToUInt16(DDSResponse, 0), Reserved1 = DDSResponse[2],
Reserved2 = DDSResponse[3],
Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4)
};
@@ -82,6 +124,7 @@ namespace DiscImageChef.Decoders.Bluray
{
DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})",
decoded.Signature);
return null;
}
@@ -114,11 +157,12 @@ namespace DiscImageChef.Decoders.Bluray
public static string Prettify(DiscDefinitionStructure? DDSResponse)
{
if(DDSResponse == null) return null;
if(DDSResponse == null)
return null;
DiscDefinitionStructure response = DDSResponse.Value;
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
sb.AppendFormat("DDS Format: 0x{0:X2}", response.Format).AppendLine();
sb.AppendFormat("DDS has ben updated {0} times", response.UpdateCount).AppendLine();
@@ -137,153 +181,39 @@ namespace DiscImageChef.Decoders.Bluray
sb.AppendFormat("Blu-ray DDS Disc Type Specific Data in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DiscTypeSpecificData, 80));
#if DEBUG
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
if(response.Reserved4 != 0) sb.AppendFormat("Reserved4 = 0x{0:X16}", response.Reserved4).AppendLine();
if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
if(response.Reserved7 != 0) sb.AppendFormat("Reserved7 = 0x{0:X2}", response.Reserved7).AppendLine();
if(response.Reserved8 != 0) sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine();
if(response.Reserved9 != 0) sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine();
#endif
#if DEBUG
if(response.Reserved1 != 0)
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0)
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
if(response.Reserved3 != 0)
sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
if(response.Reserved4 != 0)
sb.AppendFormat("Reserved4 = 0x{0:X16}", response.Reserved4).AppendLine();
if(response.Reserved5 != 0)
sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
if(response.Reserved6 != 0)
sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
if(response.Reserved7 != 0)
sb.AppendFormat("Reserved7 = 0x{0:X2}", response.Reserved7).AppendLine();
if(response.Reserved8 != 0)
sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine();
if(response.Reserved9 != 0)
sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine();
#endif
return sb.ToString();
}
public static string Prettify(byte[] DDSResponse) => Prettify(Decode(DDSResponse));
#endregion Public methods
#region Public structures
public struct DiscDefinitionStructure
{
/// <summary>
/// Bytes 0 to 1
/// Data Length
/// </summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to 5
/// "DS"
/// </summary>
public ushort Signature;
/// <summary>
/// Byte 6
/// DDS format
/// </summary>
public byte Format;
/// <summary>
/// Byte 7
/// Reserved
/// </summary>
public byte Reserved3;
/// <summary>
/// Bytes 8 to 11
/// DDS update count
/// </summary>
public uint UpdateCount;
/// <summary>
/// Bytes 12 to 19
/// Reserved
/// </summary>
public ulong Reserved4;
/// <summary>
/// Bytes 20 to 23
/// First PSN of Drive Area
/// </summary>
public uint DriveAreaPSN;
/// <summary>
/// Bytes 24 to 27
/// Reserved
/// </summary>
public uint Reserved5;
/// <summary>
/// Bytes 28 to 31
/// First PSN of Defect List
/// </summary>
public uint DefectListPSN;
/// <summary>
/// Bytes 32 to 35
/// Reserved
/// </summary>
public uint Reserved6;
/// <summary>
/// Bytes 36 to 39
/// PSN of LSN 0 of user data area
/// </summary>
public uint PSNofLSNZero;
/// <summary>
/// Bytes 40 to 43
/// Last LSN of user data area
/// </summary>
public uint LastUserAreaLSN;
/// <summary>
/// Bytes 44 to 47
/// ISA0 size
/// </summary>
public uint ISA0;
/// <summary>
/// Bytes 48 to 51
/// OSA size
/// </summary>
public uint OSA;
/// <summary>
/// Bytes 52 to 55
/// ISA1 size
/// </summary>
public uint ISA1;
/// <summary>
/// Byte 56
/// Spare Area full flags
/// </summary>
public byte SpareAreaFullFlags;
/// <summary>
/// Byte 57
/// Reserved
/// </summary>
public byte Reserved7;
/// <summary>
/// Byte 58
/// Disc type specific field
/// </summary>
public byte DiscTypeSpecificField1;
/// <summary>
/// Byte 59
/// Reserved
/// </summary>
public byte Reserved8;
/// <summary>
/// Byte 60 to 63
/// Disc type specific field
/// </summary>
public uint DiscTypeSpecificField2;
/// <summary>
/// Byte 64 to 67
/// Reserved
/// </summary>
public uint Reserved9;
/// <summary>
/// Bytes 68 to 99
/// Status bits of INFO1/2 and PAC1/2 on L0 and L1
/// </summary>
public byte[] StatusBits;
/// <summary>
/// Bytes 100 to end
/// Disc type specific data
/// </summary>
public byte[] DiscTypeSpecificData;
}
#endregion Public structures
}
}

View File

@@ -39,54 +39,64 @@ using DiscImageChef.Console;
namespace DiscImageChef.Decoders.Bluray
{
/// <summary>
/// Information from the following standards:
/// ANSI X3.304-1997
/// T10/1048-D revision 9.0
/// T10/1048-D revision 10a
/// T10/1228-D revision 7.0c
/// T10/1228-D revision 11a
/// T10/1363-D revision 10g
/// T10/1545-D revision 1d
/// T10/1545-D revision 5
/// T10/1545-D revision 5a
/// T10/1675-D revision 2c
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
/// Information from the following standards: ANSI X3.304-1997 T10/1048-D revision 9.0 T10/1048-D revision 10a
/// T10/1228-D revision 7.0c T10/1228-D revision 11a T10/1363-D revision 10g T10/1545-D revision 1d T10/1545-D revision
/// 5 T10/1545-D revision 5a T10/1675-D revision 2c 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")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class DI
{
public enum BluSize : byte
{
/// <summary>120mm</summary>
OneTwenty = 0, /// <summary>80mm</summary>
Eighty = 1
}
public enum ChannelLength : byte
{
/// <summary>74.5nm channel or 25Gb/layer</summary>
Seventy = 1, /// <summary>69.0nm channel or 27Gb/layer</summary>
Sixty = 2
}
public enum HybridLayer : byte
{
/// <summary>No hybrid layer</summary>
None = 0, /// <summary>-ROM layer</summary>
ReadOnly = 1, /// <summary>-R layer</summary>
Recordable = 2, /// <summary>-RW layer</summary>
Rewritable = 3
}
#region Private constants
const string DiscTypeBDROM = "BDO";
const string DiscTypeBDRE = "BDW";
const string DiscTypeBDR = "BDR";
/// <summary>
/// Disc Information Unit Identifier "DI"
/// </summary>
/// <summary>Disc Information Unit Identifier "DI"</summary>
const ushort DIUIdentifier = 0x4449;
#endregion Private constants
#region Public methods
public static DiscInformation? Decode(byte[] DIResponse)
{
if(DIResponse == null) return null;
if(DIResponse == null)
return null;
if(DIResponse.Length != 4100)
{
DicConsole.DebugWriteLine("BD Disc Information decoder",
"Found incorrect Blu-ray Disc Information size ({0} bytes)",
DIResponse.Length);
return null;
}
DiscInformation decoded = new DiscInformation
var decoded = new DiscInformation
{
DataLength = BigEndianBitConverter.ToUInt16(DIResponse, 0),
Reserved1 = DIResponse[2],
DataLength = BigEndianBitConverter.ToUInt16(DIResponse, 0), Reserved1 = DIResponse[2],
Reserved2 = DIResponse[3]
};
@@ -95,14 +105,16 @@ namespace DiscImageChef.Decoders.Bluray
while(true)
{
if(offset >= 4100) break;
if(offset >= 4100)
break;
DiscInformationUnits unit = new DiscInformationUnits
var unit = new DiscInformationUnits
{
Signature = BigEndianBitConverter.ToUInt16(DIResponse, 0 + offset)
};
if(unit.Signature != DIUIdentifier) break;
if(unit.Signature != DIUIdentifier)
break;
unit.Format = DIResponse[2 + offset];
unit.UnitsPerBlock = (byte)((DIResponse[3 + offset] & 0xF8) >> 3);
@@ -125,19 +137,24 @@ namespace DiscImageChef.Decoders.Bluray
unit.RecordedPolarity = DIResponse[14 + offset];
unit.Bca = (byte)(DIResponse[16 + offset] & 0x0F);
unit.MaxTransfer = DIResponse[17 + offset];
unit.LastPsn = (uint)((DIResponse[20 + offset] << 24) + (DIResponse[21 + offset] << 16) +
(DIResponse[22 + offset] << 8) + DIResponse[23 + offset]);
// TODO: In -R/-RE how does this relate to layer size???
unit.FirstAun = (uint)((DIResponse[24 + offset] << 24) + (DIResponse[25 + offset] << 16) +
(DIResponse[26 + offset] << 8) + DIResponse[27 + offset]);
unit.LastAun = (uint)((DIResponse[28 + offset] << 24) + (DIResponse[29 + offset] << 16) +
(DIResponse[30 + offset] << 8) + DIResponse[31 + offset]);
switch(Encoding.ASCII.GetString(unit.DiscTypeIdentifier))
{
case DiscTypeBDROM:
{
unit.FormatDependentContents = new byte[32];
Array.Copy(DIResponse, 32 + offset, unit.FormatDependentContents, 0, 32);
break;
}
@@ -154,6 +171,7 @@ namespace DiscImageChef.Decoders.Bluray
unit.ProductRevisionNumber = DIResponse[111 + offset];
offset += 14;
break;
}
@@ -162,6 +180,7 @@ namespace DiscImageChef.Decoders.Bluray
DicConsole.DebugWriteLine("BD Disc Information decoder",
"Found unknown disc type identifier \"{0}\"",
Encoding.ASCII.GetString(unit.DiscTypeIdentifier));
break;
}
}
@@ -171,21 +190,25 @@ namespace DiscImageChef.Decoders.Bluray
offset += unit.Length;
}
if(units.Count <= 0) return decoded;
if(units.Count <= 0)
return decoded;
decoded.Units = new DiscInformationUnits[units.Count];
for(int i = 0; i < units.Count; i++) decoded.Units[i] = units[i];
for(int i = 0; i < units.Count; i++)
decoded.Units[i] = units[i];
return decoded;
}
public static string Prettify(DiscInformation? DIResponse)
{
if(DIResponse == null) return null;
if(DIResponse == null)
return null;
DiscInformation response = DIResponse.Value;
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
foreach(DiscInformationUnits unit in response.Units)
{
@@ -193,41 +216,53 @@ namespace DiscImageChef.Decoders.Bluray
sb.AppendFormat("DI Unit Format: 0x{0:X2}", unit.Format).AppendLine();
sb.AppendFormat("There are {0} per block", unit.UnitsPerBlock).AppendLine();
sb.AppendFormat("This DI refers to layer {0}", unit.Layer).AppendLine();
if(Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDRE)
sb.AppendFormat("Legacy value: 0x{0:X2}", unit.Legacy).AppendLine();
sb.AppendLine(unit.Continuation ? "This DI continues previous unit" : "This DI starts a new unit");
sb.AppendFormat("DI Unit is {0} bytes", unit.Length).AppendLine();
sb.AppendFormat("Disc type identifier: \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier))
.AppendLine();
sb.AppendFormat("Disc type identifier: \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier)).
AppendLine();
switch(unit.DiscSize)
{
case BluSize.OneTwenty:
sb.AppendLine("Disc size: 120mm");
break;
case BluSize.Eighty:
sb.AppendLine("Disc size: 80mm");
break;
default:
sb.AppendFormat("Disc size: Unknown code {0}", (byte)unit.DiscSize).AppendLine();
break;
}
sb.AppendFormat("Disc class: {0}", unit.DiscClass).AppendLine();
sb.AppendFormat("Disc version: {0}", unit.DiscVersion).AppendLine();
sb.AppendFormat("This disc has {0} layers", unit.Layers).AppendLine();
switch(unit.DvdLayer)
{
case HybridLayer.None:
sb.AppendLine("This disc does not contain a DVD layer.");
break;
case HybridLayer.ReadOnly:
sb.AppendLine("This disc contains a DVD-ROM layer.");
break;
case HybridLayer.Recordable:
sb.AppendLine("This disc contains a DVD-R layer.");
break;
case HybridLayer.Rewritable:
sb.AppendLine("This disc contains a DVD-RW layer.");
break;
}
@@ -235,15 +270,19 @@ namespace DiscImageChef.Decoders.Bluray
{
case HybridLayer.None:
sb.AppendLine("This disc does not contain a CD layer.");
break;
case HybridLayer.ReadOnly:
sb.AppendLine("This disc contains a CD-ROM layer.");
break;
case HybridLayer.Recordable:
sb.AppendLine("This disc contains a CD-R layer.");
break;
case HybridLayer.Rewritable:
sb.AppendLine("This disc contains a CD-RW layer.");
break;
}
@@ -251,13 +290,16 @@ namespace DiscImageChef.Decoders.Bluray
{
case ChannelLength.Seventy:
sb.AppendLine("Disc uses a 74.5nm channel giving 25 Gb per layer.");
break;
case ChannelLength.Sixty:
sb.AppendLine("Disc uses a 69.0nm channel giving 27 Gb per layer.");
break;
default:
sb.AppendFormat("Disc uses unknown channel length with code {0}", (byte)unit.ChannelLength)
.AppendLine();
sb.AppendFormat("Disc uses unknown channel length with code {0}", (byte)unit.ChannelLength).
AppendLine();
break;
}
@@ -265,12 +307,15 @@ namespace DiscImageChef.Decoders.Bluray
{
case 0:
sb.AppendLine("Disc uses positive polarity.");
break;
case 1:
sb.AppendLine("Disc uses negative polarity.");
break;
default:
sb.AppendFormat("Disc uses unknown polarity with code {0}", unit.Polarity).AppendLine();
break;
}
@@ -279,13 +324,16 @@ namespace DiscImageChef.Decoders.Bluray
{
case 0:
sb.AppendLine("Recorded marks have a lower reflectivity than unrecorded ones (HTL disc).");
break;
case 1:
sb.AppendLine("Recorded marks have a higher reflectivity than unrecorded ones (LTH disc).");
break;
default:
sb.AppendFormat("Disc uses unknown recorded reflectivity polarity with code {0}",
unit.RecordedPolarity).AppendLine();
break;
}
@@ -293,31 +341,39 @@ namespace DiscImageChef.Decoders.Bluray
{
case 0:
sb.AppendLine("Disc doesn't have a BCA.");
break;
case 1:
sb.AppendLine("Disc has a BCA.");
break;
default:
sb.AppendFormat("Disc uses unknown BCA code {0}", unit.Bca).AppendLine();
break;
}
if(unit.MaxTransfer > 0)
sb.AppendFormat("Disc has a maximum transfer rate of {0} Mbit/sec.", unit.MaxTransfer).AppendLine();
else sb.AppendLine("Disc does not specify a maximum transfer rate.");
else
sb.AppendLine("Disc does not specify a maximum transfer rate.");
sb.AppendFormat("Last user data PSN for disc: {0}", unit.LastPsn).AppendLine();
sb.AppendFormat("First address unit number of data zone in this layer: {0}", unit.FirstAun)
.AppendLine();
sb.AppendFormat("First address unit number of data zone in this layer: {0}", unit.FirstAun).
AppendLine();
sb.AppendFormat("Last address unit number of data zone in this layer: {0}", unit.LastAun).AppendLine();
if(Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDR ||
Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDRE)
{
sb.AppendFormat("Disc manufacturer ID: \"{0}\"", Encoding.ASCII.GetString(unit.ManufacturerID))
.AppendLine();
sb.AppendFormat("Disc media type ID: \"{0}\"", Encoding.ASCII.GetString(unit.MediaTypeID))
.AppendLine();
sb.AppendFormat("Disc manufacturer ID: \"{0}\"", Encoding.ASCII.GetString(unit.ManufacturerID)).
AppendLine();
sb.AppendFormat("Disc media type ID: \"{0}\"", Encoding.ASCII.GetString(unit.MediaTypeID)).
AppendLine();
sb.AppendFormat("Disc timestamp: 0x{0:X2}", unit.TimeStamp).AppendLine();
sb.AppendFormat("Disc product revison number: {0}", unit.ProductRevisionNumber).AppendLine();
}
@@ -335,219 +391,86 @@ namespace DiscImageChef.Decoders.Bluray
#region Public structures
public struct DiscInformation
{
/// <summary>
/// Bytes 0 to 1
/// Always 4098
/// </summary>
/// <summary>Bytes 0 to 1 Always 4098</summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 4 to 4099
/// Disc information units
/// </summary>
/// <summary>Byte 4 to 4099 Disc information units</summary>
public DiscInformationUnits[] Units;
}
public struct DiscInformationUnits
{
/// <summary>
/// Byte 0
/// "DI"
/// </summary>
/// <summary>Byte 0 "DI"</summary>
public ushort Signature;
/// <summary>
/// Byte 2
/// Disc information format
/// </summary>
/// <summary>Byte 2 Disc information format</summary>
public byte Format;
/// <summary>
/// Byte 3, bits 7 to 3
/// Number of DI units per block
/// </summary>
/// <summary>Byte 3, bits 7 to 3 Number of DI units per block</summary>
public byte UnitsPerBlock;
/// <summary>
/// Byte 3, bits 2 to 0
/// Layer this DI refers to
/// </summary>
/// <summary>Byte 3, bits 2 to 0 Layer this DI refers to</summary>
public byte Layer;
/// <summary>
/// Byte 4
/// Reserved for BD-ROM, legacy information for BD-R/-RE
/// </summary>
/// <summary>Byte 4 Reserved for BD-ROM, legacy information for BD-R/-RE</summary>
public byte Legacy;
/// <summary>
/// Byte 5
/// Sequence number for this DI unit
/// </summary>
/// <summary>Byte 5 Sequence number for this DI unit</summary>
public byte Sequence;
/// <summary>
/// Byte 6, bit 7
/// If set this DI is a continuation of the previous one
/// </summary>
/// <summary>Byte 6, bit 7 If set this DI is a continuation of the previous one</summary>
public bool Continuation;
/// <summary>
/// Byte 6, bits 6 to 0
/// Number of bytes used by this DI unit, should be 64 for BD-ROM and 112 for BD-R/-RE
/// </summary>
/// <summary>Byte 6, bits 6 to 0 Number of bytes used by this DI unit, should be 64 for BD-ROM and 112 for BD-R/-RE</summary>
public byte Length;
/// <summary>
/// Byte 7
/// Reserved
/// </summary>
/// <summary>Byte 7 Reserved</summary>
public byte Reserved;
/// <summary>
/// Bytes 8 to 10
/// Disc type identifier
/// </summary>
/// <summary>Bytes 8 to 10 Disc type identifier</summary>
public byte[] DiscTypeIdentifier;
/// <summary>
/// Byte 11, bits 7 to 6
/// Disc size
/// </summary>
/// <summary>Byte 11, bits 7 to 6 Disc size</summary>
public BluSize DiscSize;
/// <summary>
/// Byte 11, bits 5 to 4
/// Disc class
/// </summary>
/// <summary>Byte 11, bits 5 to 4 Disc class</summary>
public byte DiscClass;
/// <summary>
/// Byte 11, bits 3 to 0
/// Disc version
/// </summary>
/// <summary>Byte 11, bits 3 to 0 Disc version</summary>
public byte DiscVersion;
/// <summary>
/// Byte 12, bits 7 to 4
/// Layers in this disc
/// </summary>
/// <summary>Byte 12, bits 7 to 4 Layers in this disc</summary>
public byte Layers;
/// <summary>
/// Byte 12, bits 3 to 0
/// Reserved
/// </summary>
/// <summary>Byte 12, bits 3 to 0 Reserved</summary>
public byte Reserved2;
/// <summary>
/// Byte 13, bits 7 to 6
/// DVD layer
/// </summary>
/// <summary>Byte 13, bits 7 to 6 DVD layer</summary>
public HybridLayer DvdLayer;
/// <summary>
/// Byte 13, bits 5 to 4
/// CD layer
/// </summary>
/// <summary>Byte 13, bits 5 to 4 CD layer</summary>
public HybridLayer CdLayer;
/// <summary>
/// Byte 13, bits 3 to 0
/// Channel length
/// </summary>
/// <summary>Byte 13, bits 3 to 0 Channel length</summary>
public ChannelLength ChannelLength;
/// <summary>
/// Byte 14
/// Polarity
/// </summary>
/// <summary>Byte 14 Polarity</summary>
public byte Polarity;
/// <summary>
/// Byte 15
/// Recorded polarity
/// </summary>
/// <summary>Byte 15 Recorded polarity</summary>
public byte RecordedPolarity;
/// <summary>
/// Byte 16, bits 7 to 4
/// Reserved
/// </summary>
/// <summary>Byte 16, bits 7 to 4 Reserved</summary>
public byte Reserved3;
/// <summary>
/// Byte 16, bits 3 to 0
/// If 0 no BCA, if 1 BCA, rest not defined
/// </summary>
/// <summary>Byte 16, bits 3 to 0 If 0 no BCA, if 1 BCA, rest not defined</summary>
public byte Bca;
/// <summary>
/// Byte 17
/// Maximum transfer speed in megabits/second, 0 if no maximum
/// </summary>
/// <summary>Byte 17 Maximum transfer speed in megabits/second, 0 if no maximum</summary>
public byte MaxTransfer;
/// <summary>
/// Bytes 18 to 19
/// Reserved
/// </summary>
/// <summary>Bytes 18 to 19 Reserved</summary>
public ushort Reserved4;
/// <summary>
/// Bytes 20 to 23
/// Last user data PSN for disc
/// </summary>
/// <summary>Bytes 20 to 23 Last user data PSN for disc</summary>
public uint LastPsn;
/// <summary>
/// Bytes 24 to 27
/// First address unit number of data zone in this layer
/// </summary>
/// <summary>Bytes 24 to 27 First address unit number of data zone in this layer</summary>
public uint FirstAun;
/// <summary>
/// Bytes 28 to 31
/// Last address unit number of data zone in this layer
/// </summary>
/// <summary>Bytes 28 to 31 Last address unit number of data zone in this layer</summary>
public uint LastAun;
/// <summary>
/// Bytes 32 to 63 for BD-ROM, bytes 32 to 99 for BD-R/-RE
/// Format dependent contents, disclosed in private blu-ray specifications
/// Bytes 32 to 63 for BD-ROM, bytes 32 to 99 for BD-R/-RE Format dependent contents, disclosed in private blu-ray
/// specifications
/// </summary>
public byte[] FormatDependentContents;
/// <summary>
/// Bytes 100 to 105, BD-R/-RE only
/// Manufacturer ID
/// </summary>
/// <summary>Bytes 100 to 105, BD-R/-RE only Manufacturer ID</summary>
public byte[] ManufacturerID;
/// <summary>
/// Bytes 106 to 108, BD-R/-RE only
/// Media type ID
/// </summary>
/// <summary>Bytes 106 to 108, BD-R/-RE only Media type ID</summary>
public byte[] MediaTypeID;
/// <summary>
/// Bytes 109 to 110, BD-R/-RE only
/// Timestamp
/// </summary>
/// <summary>Bytes 109 to 110, BD-R/-RE only Timestamp</summary>
public ushort TimeStamp;
/// <summary>
/// Byte 111
/// Product revision number
/// </summary>
/// <summary>Byte 111 Product revision number</summary>
public byte ProductRevisionNumber;
}
#endregion Public structures
public enum BluSize : byte
{
/// <summary>120mm</summary>
OneTwenty = 0,
/// <summary>80mm</summary>
Eighty = 1
}
public enum HybridLayer : byte
{
/// <summary>No hybrid layer</summary>
None = 0,
/// <summary>-ROM layer</summary>
ReadOnly = 1,
/// <summary>-R layer</summary>
Recordable = 2,
/// <summary>-RW layer</summary>
Rewritable = 3
}
public enum ChannelLength : byte
{
/// <summary>74.5nm channel or 25Gb/layer</summary>
Seventy = 1,
/// <summary>69.0nm channel or 27Gb/layer</summary>
Sixty = 2
}
}
}

View File

@@ -37,43 +37,49 @@ using DiscImageChef.Console;
namespace DiscImageChef.Decoders.Bluray
{
/// <summary>
/// Information from the following standards:
/// ANSI X3.304-1997
/// T10/1048-D revision 9.0
/// T10/1048-D revision 10a
/// T10/1228-D revision 7.0c
/// T10/1228-D revision 11a
/// T10/1363-D revision 10g
/// T10/1545-D revision 1d
/// T10/1545-D revision 5
/// T10/1545-D revision 5a
/// T10/1675-D revision 2c
/// T10/1675-D revision 4
/// T10/1836-D revision 2g
/// Information from the following standards: ANSI X3.304-1997 T10/1048-D revision 9.0 T10/1048-D revision 10a
/// T10/1228-D revision 7.0c T10/1228-D revision 11a T10/1363-D revision 10g T10/1545-D revision 1d T10/1545-D revision
/// 5 T10/1545-D revision 5a T10/1675-D revision 2c 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")]
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class Spare
{
#region Public structures
public struct SpareAreaInformation
{
/// <summary>Bytes 0 to 1 Always 14</summary>
public ushort DataLength;
/// <summary>Byte 2 Reserved</summary>
public byte Reserved1;
/// <summary>Byte 3 Reserved</summary>
public byte Reserved2;
/// <summary>Bytes 4 to 7 Reserved</summary>
public uint Reserved3;
/// <summary>Bytes 8 to 11 Free spare blocks</summary>
public uint FreeSpareBlocks;
/// <summary>Bytes 12 to 15 Allocated spare blocks</summary>
public uint AllocatedSpareBlocks;
}
#endregion Public structures
#region Public methods
public static SpareAreaInformation? Decode(byte[] SAIResponse)
{
if(SAIResponse == null) return null;
if(SAIResponse == null)
return null;
if(SAIResponse.Length != 16)
{
DicConsole.DebugWriteLine("BD Spare Area Information decoder",
"Found incorrect Blu-ray Spare Area Information size ({0} bytes)",
SAIResponse.Length);
return null;
}
SpareAreaInformation decoded = new SpareAreaInformation
var decoded = new SpareAreaInformation
{
DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0),
Reserved1 = SAIResponse[2],
DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0), Reserved1 = SAIResponse[2],
Reserved2 = SAIResponse[3],
Reserved3 = BigEndianBitConverter.ToUInt32(SAIResponse, 4),
FreeSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 8),
@@ -85,17 +91,23 @@ namespace DiscImageChef.Decoders.Bluray
public static string Prettify(SpareAreaInformation? SAIResponse)
{
if(SAIResponse == null) return null;
if(SAIResponse == null)
return null;
SpareAreaInformation response = SAIResponse.Value;
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
#if DEBUG
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
#endif
#if DEBUG
if(response.Reserved1 != 0)
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
if(response.Reserved2 != 0)
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
if(response.Reserved3 != 0)
sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
#endif
sb.AppendFormat("{0} free spare blocks", response.FreeSpareBlocks).AppendLine();
sb.AppendFormat("{0} allocated spare blocks", response.AllocatedSpareBlocks).AppendLine();
@@ -104,41 +116,5 @@ namespace DiscImageChef.Decoders.Bluray
public static string Prettify(byte[] SAIResponse) => Prettify(Decode(SAIResponse));
#endregion Public methods
#region Public structures
public struct SpareAreaInformation
{
/// <summary>
/// Bytes 0 to 1
/// Always 14
/// </summary>
public ushort DataLength;
/// <summary>
/// Byte 2
/// Reserved
/// </summary>
public byte Reserved1;
/// <summary>
/// Byte 3
/// Reserved
/// </summary>
public byte Reserved2;
/// <summary>
/// Bytes 4 to 7
/// Reserved
/// </summary>
public uint Reserved3;
/// <summary>
/// Bytes 8 to 11
/// Free spare blocks
/// </summary>
public uint FreeSpareBlocks;
/// <summary>
/// Bytes 12 to 15
/// Allocated spare blocks
/// </summary>
public uint AllocatedSpareBlocks;
}
#endregion Public structures
}
}