mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -56,12 +56,12 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#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);
|
||||
DicConsole.DebugWriteLine("BD BCA decoder", "Found incorrect Blu-ray BCA size ({0} bytes)",
|
||||
BCAResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -80,18 +80,15 @@ 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();
|
||||
|
||||
#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.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:");
|
||||
@@ -132,5 +129,4 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
}
|
||||
#endregion Public structures
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,12 +56,13 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#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);
|
||||
DicConsole.DebugWriteLine("BD Cartridge Status decoder",
|
||||
"Found incorrect Blu-ray Cartridge Status size ({0} bytes)",
|
||||
CSResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -86,47 +87,35 @@ 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();
|
||||
|
||||
#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();
|
||||
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");
|
||||
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();
|
||||
@@ -199,5 +188,4 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
}
|
||||
#endregion Public structures
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,8 +63,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#region Public methods
|
||||
public static DiscDefinitionStructure? Decode(byte[] DDSResponse)
|
||||
{
|
||||
if(DDSResponse == null)
|
||||
return null;
|
||||
if(DDSResponse == null) return null;
|
||||
|
||||
DiscDefinitionStructure decoded = new DiscDefinitionStructure();
|
||||
|
||||
@@ -76,10 +75,11 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4);
|
||||
if(decoded.Signature != DDSIdentifier)
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})", decoded.Signature);
|
||||
DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})",
|
||||
decoded.Signature);
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
decoded.Format = DDSResponse[6];
|
||||
decoded.Reserved3 = DDSResponse[7];
|
||||
decoded.UpdateCount = BigEndianBitConverter.ToUInt32(DDSResponse, 8);
|
||||
@@ -109,8 +109,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
public static string Prettify(DiscDefinitionStructure? DDSResponse)
|
||||
{
|
||||
if(DDSResponse == null)
|
||||
return null;
|
||||
if(DDSResponse == null) return null;
|
||||
|
||||
DiscDefinitionStructure response = DDSResponse.Value;
|
||||
|
||||
@@ -134,24 +133,15 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
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();
|
||||
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();
|
||||
@@ -294,5 +284,4 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
}
|
||||
#endregion Public structures
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,12 +68,13 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#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);
|
||||
DicConsole.DebugWriteLine("BD Disc Information decoder",
|
||||
"Found incorrect Blu-ray Disc Information size ({0} bytes)",
|
||||
DIResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -90,14 +91,12 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
while(true)
|
||||
{
|
||||
if(offset >= 100)
|
||||
break;
|
||||
if(offset >= 100) break;
|
||||
|
||||
DiscInformationUnits unit = new DiscInformationUnits();
|
||||
unit.Signature = BigEndianBitConverter.ToUInt16(DIResponse, 0 + offset);
|
||||
|
||||
if(unit.Signature != DIUIdentifier)
|
||||
break;
|
||||
if(unit.Signature != DIUIdentifier) break;
|
||||
|
||||
unit.Format = DIResponse[2 + offset];
|
||||
unit.UnitsPerBlock = DIResponse[3 + offset];
|
||||
@@ -111,29 +110,31 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
switch(Encoding.ASCII.GetString(unit.DiscTypeIdentifier))
|
||||
{
|
||||
case DiscTypeBDROM:
|
||||
{
|
||||
unit.FormatDependentContents = new byte[52];
|
||||
Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 52);
|
||||
break;
|
||||
}
|
||||
{
|
||||
unit.FormatDependentContents = new byte[52];
|
||||
Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 52);
|
||||
break;
|
||||
}
|
||||
case DiscTypeBDRE:
|
||||
case DiscTypeBDR:
|
||||
{
|
||||
unit.FormatDependentContents = new byte[88];
|
||||
Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 88);
|
||||
unit.ManufacturerID = new byte[6];
|
||||
Array.Copy(DIResponse, 100 + offset, unit.ManufacturerID, 0, 6);
|
||||
unit.MediaTypeID = new byte[3];
|
||||
Array.Copy(DIResponse, 106 + offset, unit.MediaTypeID, 0, 3);
|
||||
unit.TimeStamp = BigEndianBitConverter.ToUInt16(DIResponse, 109 + offset);
|
||||
unit.ProductRevisionNumber = DIResponse[111 + offset];
|
||||
break;
|
||||
}
|
||||
{
|
||||
unit.FormatDependentContents = new byte[88];
|
||||
Array.Copy(DIResponse, 12 + offset, unit.DiscTypeIdentifier, 0, 88);
|
||||
unit.ManufacturerID = new byte[6];
|
||||
Array.Copy(DIResponse, 100 + offset, unit.ManufacturerID, 0, 6);
|
||||
unit.MediaTypeID = new byte[3];
|
||||
Array.Copy(DIResponse, 106 + offset, unit.MediaTypeID, 0, 3);
|
||||
unit.TimeStamp = BigEndianBitConverter.ToUInt16(DIResponse, 109 + offset);
|
||||
unit.ProductRevisionNumber = DIResponse[111 + offset];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD Disc Information decoder", "Found unknown disc type identifier \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier));
|
||||
break;
|
||||
}
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD Disc Information decoder",
|
||||
"Found unknown disc type identifier \"{0}\"",
|
||||
Encoding.ASCII.GetString(unit.DiscTypeIdentifier));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
units.Add(unit);
|
||||
@@ -144,8 +145,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
if(units.Count > 0)
|
||||
{
|
||||
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;
|
||||
@@ -153,8 +153,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
public static string Prettify(DiscInformation? DIResponse)
|
||||
{
|
||||
if(DIResponse == null)
|
||||
return null;
|
||||
if(DIResponse == null) return null;
|
||||
|
||||
DiscInformation response = DIResponse.Value;
|
||||
|
||||
@@ -168,13 +167,16 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
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 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 ||
|
||||
Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDRE)
|
||||
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();
|
||||
}
|
||||
@@ -292,5 +294,4 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
}
|
||||
#endregion Public structures
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,12 +56,13 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
#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);
|
||||
DicConsole.DebugWriteLine("BD Spare Area Information decoder",
|
||||
"Found incorrect Blu-ray Spare Area Information size ({0} bytes)",
|
||||
SAIResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -81,20 +82,16 @@ 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();
|
||||
|
||||
#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.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();
|
||||
@@ -144,5 +141,4 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
}
|
||||
#endregion Public structures
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user