mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Reformatted.
This commit is contained in:
@@ -61,10 +61,10 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#region Public methods
|
||||
public static BurstCuttingArea? Decode(byte[] BCAResponse)
|
||||
{
|
||||
if (BCAResponse == null)
|
||||
if(BCAResponse == null)
|
||||
return null;
|
||||
|
||||
if (BCAResponse.Length != 68)
|
||||
if(BCAResponse.Length != 68)
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD BCA decoder", "Found incorrect Blu-ray BCA size ({0} bytes)", BCAResponse.Length);
|
||||
return null;
|
||||
@@ -85,19 +85,19 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
public static string Prettify(BurstCuttingArea? BCAResponse)
|
||||
{
|
||||
if (BCAResponse == null)
|
||||
if(BCAResponse == null)
|
||||
return null;
|
||||
|
||||
BurstCuttingArea response = BCAResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#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
|
||||
#endif
|
||||
|
||||
sb.AppendFormat("Blu-ray Burst Cutting Area in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.BCA, 80));
|
||||
|
||||
@@ -61,10 +61,10 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#region Public methods
|
||||
public static CartridgeStatus? Decode(byte[] CSResponse)
|
||||
{
|
||||
if (CSResponse == null)
|
||||
if(CSResponse == null)
|
||||
return null;
|
||||
|
||||
if (CSResponse.Length != 8)
|
||||
if(CSResponse.Length != 8)
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD Cartridge Status decoder", "Found incorrect Blu-ray Cartridge Status size ({0} bytes)", CSResponse.Length);
|
||||
return null;
|
||||
@@ -78,9 +78,9 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
decoded.Reserved1 = CSResponse[2];
|
||||
decoded.Reserved2 = CSResponse[3];
|
||||
decoded.Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4]&0x40);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x40);
|
||||
decoded.Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4]&0x04);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x04);
|
||||
decoded.Reserved4 = (byte)(CSResponse[4] & 0x03);
|
||||
decoded.Reserved5 = CSResponse[5];
|
||||
decoded.Reserved6 = CSResponse[6];
|
||||
@@ -91,14 +91,14 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
public static string Prettify(CartridgeStatus? CSResponse)
|
||||
{
|
||||
if (CSResponse == null)
|
||||
if(CSResponse == null)
|
||||
return null;
|
||||
|
||||
CartridgeStatus response = CSResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
@@ -113,26 +113,26 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
|
||||
if(response.Reserved7 != 0)
|
||||
sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (response.Cartridge)
|
||||
if(response.Cartridge)
|
||||
{
|
||||
sb.AppendLine("Media is inserted in a cartridge");
|
||||
if (response.OUT)
|
||||
if(response.OUT)
|
||||
sb.AppendLine("Media has been taken out, or inserted in, the cartridge");
|
||||
if (response.CWP)
|
||||
if(response.CWP)
|
||||
sb.AppendLine("Media is write protected");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine("Media is not in a cartridge");
|
||||
|
||||
#if DEBUG
|
||||
if (response.OUT)
|
||||
#if DEBUG
|
||||
if(response.OUT)
|
||||
sb.AppendLine("Media has out bit marked, shouldn't");
|
||||
if (response.CWP)
|
||||
if(response.CWP)
|
||||
sb.AppendLine("Media has write protection bit marked, shouldn't");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#region Public methods
|
||||
public static DiscDefinitionStructure? Decode(byte[] DDSResponse)
|
||||
{
|
||||
if (DDSResponse == null)
|
||||
if(DDSResponse == null)
|
||||
return null;
|
||||
|
||||
DiscDefinitionStructure decoded = new DiscDefinitionStructure();
|
||||
@@ -79,7 +79,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
decoded.Reserved1 = DDSResponse[2];
|
||||
decoded.Reserved2 = DDSResponse[3];
|
||||
decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4);
|
||||
if (decoded.Signature != DDSIdentifier)
|
||||
if(decoded.Signature != DDSIdentifier)
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})", decoded.Signature);
|
||||
return null;
|
||||
@@ -114,7 +114,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
public static string Prettify(DiscDefinitionStructure? DDSResponse)
|
||||
{
|
||||
if (DDSResponse == null)
|
||||
if(DDSResponse == null)
|
||||
return null;
|
||||
|
||||
DiscDefinitionStructure response = DDSResponse.Value;
|
||||
@@ -138,7 +138,7 @@ 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 DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
@@ -157,7 +157,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine();
|
||||
if(response.Reserved9 != 0)
|
||||
sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -73,10 +73,10 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#region Public methods
|
||||
public static DiscInformation? Decode(byte[] DIResponse)
|
||||
{
|
||||
if (DIResponse == null)
|
||||
if(DIResponse == null)
|
||||
return null;
|
||||
|
||||
if (DIResponse.Length != 4100)
|
||||
if(DIResponse.Length != 4100)
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD Disc Information decoder", "Found incorrect Blu-ray Disc Information size ({0} bytes)", DIResponse.Length);
|
||||
return null;
|
||||
@@ -93,15 +93,15 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
int offset = 4;
|
||||
List<DiscInformationUnits> units = new List<DiscInformationUnits>();
|
||||
|
||||
while (true)
|
||||
while(true)
|
||||
{
|
||||
if (offset >= 100)
|
||||
if(offset >= 100)
|
||||
break;
|
||||
|
||||
DiscInformationUnits unit = new DiscInformationUnits();
|
||||
unit.Signature = BigEndianBitConverter.ToUInt16(DIResponse, 0 + offset);
|
||||
|
||||
if (unit.Signature != DIUIdentifier)
|
||||
if(unit.Signature != DIUIdentifier)
|
||||
break;
|
||||
|
||||
unit.Format = DIResponse[2 + offset];
|
||||
@@ -113,7 +113,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
unit.DiscTypeIdentifier = new byte[3];
|
||||
Array.Copy(DIResponse, 8 + offset, unit.DiscTypeIdentifier, 0, 3);
|
||||
unit.DiscSizeClassVersion = DIResponse[11 + offset];
|
||||
switch (Encoding.ASCII.GetString(unit.DiscTypeIdentifier))
|
||||
switch(Encoding.ASCII.GetString(unit.DiscTypeIdentifier))
|
||||
{
|
||||
case DiscTypeBDROM:
|
||||
{
|
||||
@@ -146,10 +146,10 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
offset += unit.Length;
|
||||
}
|
||||
|
||||
if (units.Count > 0)
|
||||
if(units.Count > 0)
|
||||
{
|
||||
decoded.Units = new DiscInformationUnits[units.Count];
|
||||
for (int i = 0; i < units.Count; i++)
|
||||
for(int i = 0; i < units.Count; i++)
|
||||
decoded.Units[i] = units[i];
|
||||
}
|
||||
|
||||
@@ -158,24 +158,24 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
public static string Prettify(DiscInformation? DIResponse)
|
||||
{
|
||||
if (DIResponse == null)
|
||||
if(DIResponse == null)
|
||||
return null;
|
||||
|
||||
DiscInformation response = DIResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (DiscInformationUnits unit in response.Units)
|
||||
foreach(DiscInformationUnits unit in response.Units)
|
||||
{
|
||||
sb.AppendFormat("DI Unit Sequence: {0}", unit.Sequence).AppendLine();
|
||||
sb.AppendFormat("DI Unit Format: 0x{0:X2}", unit.Format).AppendLine();
|
||||
sb.AppendFormat("There are {0} per block", unit.UnitsPerBlock).AppendLine();
|
||||
if (Encoding.ASCII.GetString(unit.DiscTypeIdentifier) != DiscTypeBDROM)
|
||||
if(Encoding.ASCII.GetString(unit.DiscTypeIdentifier) != DiscTypeBDROM)
|
||||
sb.AppendFormat("Legacy value: 0x{0:X2}", unit.Legacy).AppendLine();
|
||||
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 size/class/version: {0}", unit.DiscSizeClassVersion).AppendLine();
|
||||
if (Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDR ||
|
||||
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();
|
||||
|
||||
@@ -61,10 +61,10 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#region Public methods
|
||||
public static SpareAreaInformation? Decode(byte[] SAIResponse)
|
||||
{
|
||||
if (SAIResponse == null)
|
||||
if(SAIResponse == null)
|
||||
return null;
|
||||
|
||||
if (SAIResponse.Length != 16)
|
||||
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;
|
||||
@@ -86,21 +86,21 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
public static string Prettify(SpareAreaInformation? SAIResponse)
|
||||
{
|
||||
if (SAIResponse == null)
|
||||
if(SAIResponse == null)
|
||||
return null;
|
||||
|
||||
SpareAreaInformation response = SAIResponse.Value;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#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
|
||||
#endif
|
||||
sb.AppendFormat("{0} free spare blocks", response.FreeSpareBlocks).AppendLine();
|
||||
sb.AppendFormat("{0} allocated spare blocks", response.AllocatedSpareBlocks).AppendLine();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user