REFACTOR: Reformat code.

This commit is contained in:
2017-12-19 20:33:03 +00:00
parent 77edc7c91c
commit e6f6ace80b
704 changed files with 82627 additions and 83641 deletions

View File

@@ -218,8 +218,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static AACSVolumeIdentifier? DecodeAACSVolumeIdentifier(byte[] AACSVIResponse)
{
if(AACSVIResponse == null)
return null;
if(AACSVIResponse == null) return null;
AACSVolumeIdentifier decoded = new AACSVolumeIdentifier();
@@ -237,18 +236,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyAACSVolumeIdentifier(AACSVolumeIdentifier? AACSVIResponse)
{
if(AACSVIResponse == null)
return null;
if(AACSVIResponse == null) return null;
AACSVolumeIdentifier response = AACSVIResponse.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("AACS Volume Identifier in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VolumeIdentifier, 80));
@@ -264,8 +260,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static AACSMediaSerialNumber? DecodeAACSMediaSerialNumber(byte[] AACSMSNResponse)
{
if(AACSMSNResponse == null)
return null;
if(AACSMSNResponse == null) return null;
AACSMediaSerialNumber decoded = new AACSMediaSerialNumber();
@@ -283,18 +278,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyAACSMediaSerialNumber(AACSMediaSerialNumber? AACSMSNResponse)
{
if(AACSMSNResponse == null)
return null;
if(AACSMSNResponse == null) return null;
AACSMediaSerialNumber response = AACSMSNResponse.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("AACS Media Serial Number in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaSerialNumber, 80));
@@ -310,8 +302,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static AACSMediaIdentifier? DecodeAACSMediaIdentifier(byte[] AACSMIResponse)
{
if(AACSMIResponse == null)
return null;
if(AACSMIResponse == null) return null;
AACSMediaIdentifier decoded = new AACSMediaIdentifier();
@@ -329,18 +320,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyAACSMediaIdentifier(AACSMediaIdentifier? AACSMIResponse)
{
if(AACSMIResponse == null)
return null;
if(AACSMIResponse == null) return null;
AACSMediaIdentifier response = AACSMIResponse.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("AACS Media Identifier in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaIdentifier, 80));
@@ -356,8 +344,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static AACSMediaKeyBlock? DecodeAACSMediaKeyBlock(byte[] AACSMKBResponse)
{
if(AACSMKBResponse == null)
return null;
if(AACSMKBResponse == null) return null;
AACSMediaKeyBlock decoded = new AACSMediaKeyBlock();
@@ -375,18 +362,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyAACSMediaKeyBlock(AACSMediaKeyBlock? AACSMKBResponse)
{
if(AACSMKBResponse == null)
return null;
if(AACSMKBResponse == null) return null;
AACSMediaKeyBlock response = AACSMKBResponse.Value;
StringBuilder sb = new StringBuilder();
#if DEBUG
if(response.Reserved != 0)
sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
#endif
sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks).AppendLine();
sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks)
.AppendLine();
sb.AppendFormat("AACS Media Key Blocks in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaKeyBlockPacks, 80));
@@ -401,8 +387,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static AACSDataKeys? DecodeAACSDataKeys(byte[] AACSDKResponse)
{
if(AACSDKResponse == null)
return null;
if(AACSDKResponse == null) return null;
AACSDataKeys decoded = new AACSDataKeys();
@@ -420,18 +405,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyAACSDataKeys(AACSDataKeys? AACSDKResponse)
{
if(AACSDKResponse == null)
return null;
if(AACSDKResponse == null) return null;
AACSDataKeys response = AACSDKResponse.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("AACS Data Keys in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DataKeys, 80));
@@ -447,8 +429,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static AACSLBAExtentsResponse? DecodeAACSLBAExtents(byte[] AACSLBAExtsResponse)
{
if(AACSLBAExtsResponse == null)
return null;
if(AACSLBAExtsResponse == null) return null;
AACSLBAExtentsResponse decoded = new AACSLBAExtentsResponse();
@@ -458,8 +439,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
decoded.Reserved = AACSLBAExtsResponse[2];
decoded.MaxLBAExtents = AACSLBAExtsResponse[3];
if((AACSLBAExtsResponse.Length - 4) % 16 != 0)
return decoded;
if((AACSLBAExtsResponse.Length - 4) % 16 != 0) return decoded;
decoded.Extents = new AACSLBAExtent[(AACSLBAExtsResponse.Length - 4) / 16];
@@ -476,8 +456,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyAACSLBAExtents(AACSLBAExtentsResponse? AACSLBAExtsResponse)
{
if(AACSLBAExtsResponse == null)
return null;
if(AACSLBAExtsResponse == null) return null;
AACSLBAExtentsResponse response = AACSLBAExtsResponse.Value;
@@ -485,16 +464,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC
if(response.MaxLBAExtents == 0)
{
if(response.DataLength > 2)
sb.AppendLine("Drive can store 256 LBA Extents");
else
sb.AppendLine("Drive cannot store LBA Extents");
if(response.DataLength > 2) sb.AppendLine("Drive can store 256 LBA Extents");
else sb.AppendLine("Drive cannot store LBA Extents");
}
else
sb.AppendFormat("Drive can store {0} LBA Extents", response.MaxLBAExtents).AppendLine();
else sb.AppendFormat("Drive can store {0} LBA Extents", response.MaxLBAExtents).AppendLine();
for(int i = 0; i < response.Extents.Length; i++)
sb.AppendFormat("LBA Extent {0} starts at LBA {1} and goes for {2} sectors", i, response.Extents[i].StartLBA, response.Extents[i].LBACount);
sb.AppendFormat("LBA Extent {0} starts at LBA {1} and goes for {2} sectors", i,
response.Extents[i].StartLBA, response.Extents[i].LBACount);
return sb.ToString();
}
@@ -505,5 +482,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
return PrettifyAACSLBAExtents(decoded);
}
}
}
}