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);
}
}
}
}

View File

@@ -78,8 +78,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static CPRMMediaKeyBlock? DecodeCPRMMediaKeyBlock(byte[] CPRMMKBResponse)
{
if(CPRMMKBResponse == null)
return null;
if(CPRMMKBResponse == null) return null;
CPRMMediaKeyBlock decoded = new CPRMMediaKeyBlock();
@@ -97,18 +96,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyCPRMMediaKeyBlock(CPRMMediaKeyBlock? CPRMMKBResponse)
{
if(CPRMMKBResponse == null)
return null;
if(CPRMMKBResponse == null) return null;
CPRMMediaKeyBlock response = CPRMMKBResponse.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 CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks).AppendLine();
sb.AppendFormat("Total number of CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks)
.AppendLine();
sb.AppendFormat("CPRM Media Key Blocks in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MKBPackData, 80));
@@ -121,5 +119,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
return PrettifyCPRMMediaKeyBlock(decoded);
}
}
}
}

View File

@@ -275,17 +275,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static StandardDiscInformation? Decode000b(byte[] response)
{
if(response.Length < 34)
return null;
if(response.Length < 34) return null;
if((response[2] & 0xE0) != 0)
return null;
if((response[2] & 0xE0) != 0) return null;
StandardDiscInformation decoded = new StandardDiscInformation();
decoded.DataLength = (ushort)((response[0] << 8) + response[1]);
if((decoded.DataLength + 2) != response.Length)
return null;
if((decoded.DataLength + 2) != response.Length) return null;
decoded.DataType = (byte)((response[2] & 0xE0) >> 5);
decoded.Erasable |= (response[2] & 0x10) == 0x10;
@@ -304,12 +301,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC
decoded.Dbit |= (response[7] & 0x04) == 0x04;
decoded.BGFormatStatus = (byte)(response[7] & 0x03);
decoded.DiscIdentification = (uint)((response[12] << 24) + (response[13] << 16) +
(response[14] << 8) + response[15]);
decoded.LastSessionLeadInStartLBA = (uint)((response[16] << 24) + (response[17] << 16) +
(response[18] << 8) + response[19]);
decoded.LastPossibleLeadOutStartLBA = (uint)((response[20] << 24) + (response[21] << 16) +
(response[22] << 8) + response[23]);
decoded.DiscIdentification =
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
decoded.LastSessionLeadInStartLBA =
(uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]);
decoded.LastPossibleLeadOutStartLBA =
(uint)((response[20] << 24) + (response[21] << 16) + (response[22] << 8) + response[23]);
byte[] temp = new byte[8];
Array.Copy(response, 24, temp, 0, 8);
@@ -335,13 +332,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string Prettify000b(StandardDiscInformation? information)
{
if(!information.HasValue)
return null;
if(!information.HasValue) return null;
StandardDiscInformation decoded = information.Value;
if(decoded.DataType != 0)
return null;
if(decoded.DataType != 0) return null;
StringBuilder sb = new StringBuilder();
@@ -377,8 +372,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
break;
}
if(decoded.Erasable)
sb.AppendLine("Disc is erasable");
if(decoded.Erasable) sb.AppendLine("Disc is erasable");
switch(decoded.LastSessionStatus)
{
@@ -409,41 +403,35 @@ namespace DiscImageChef.Decoders.SCSI.MMC
break;
}
if(decoded.Dbit)
sb.AppendLine("MRW is dirty");
if(decoded.Dbit) sb.AppendLine("MRW is dirty");
sb.AppendFormat("First track on disc is track {0}", decoded.FirstTrackNumber).AppendLine();
sb.AppendFormat("Disc has {0} sessions", decoded.Sessions).AppendLine();
sb.AppendFormat("First track in last session is track {0}", decoded.FirstTrackLastSession).AppendLine();
sb.AppendFormat("Last track in last session is track {0}", decoded.LastTrackLastSession).AppendLine();
sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastSessionLeadInStartLBA,
(decoded.LastSessionLeadInStartLBA & 0xFF0000) >> 16,
(decoded.LastSessionLeadInStartLBA & 0xFF00) >> 8,
(decoded.LastSessionLeadInStartLBA & 0xFF)).AppendLine();
sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastPossibleLeadOutStartLBA,
(decoded.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16,
(decoded.LastPossibleLeadOutStartLBA & 0xFF00) >> 8,
(decoded.LastPossibleLeadOutStartLBA & 0xFF)).AppendLine();
sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}",
decoded.LastSessionLeadInStartLBA, (decoded.LastSessionLeadInStartLBA & 0xFF0000) >> 16,
(decoded.LastSessionLeadInStartLBA & 0xFF00) >> 8,
(decoded.LastSessionLeadInStartLBA & 0xFF)).AppendLine();
sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}",
decoded.LastPossibleLeadOutStartLBA, (decoded.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16,
(decoded.LastPossibleLeadOutStartLBA & 0xFF00) >> 8,
(decoded.LastPossibleLeadOutStartLBA & 0xFF)).AppendLine();
if(decoded.URU)
sb.AppendLine("Disc is defined for unrestricted use");
else
sb.AppendLine("Disc is defined for restricted use");
if(decoded.URU) sb.AppendLine("Disc is defined for unrestricted use");
else sb.AppendLine("Disc is defined for restricted use");
if(decoded.DID_V)
sb.AppendFormat("Disc ID: {0:X6}", decoded.DiscIdentification & 0x00FFFFFF).AppendLine();
if(decoded.DBC_V)
sb.AppendFormat("Disc barcode: {0:X16}", decoded.DiscBarcode).AppendLine();
if(decoded.DAC_V)
sb.AppendFormat("Disc application code: {0}", decoded.DiscApplicationCode).AppendLine();
if(decoded.DID_V) sb.AppendFormat("Disc ID: {0:X6}", decoded.DiscIdentification & 0x00FFFFFF).AppendLine();
if(decoded.DBC_V) sb.AppendFormat("Disc barcode: {0:X16}", decoded.DiscBarcode).AppendLine();
if(decoded.DAC_V) sb.AppendFormat("Disc application code: {0}", decoded.DiscApplicationCode).AppendLine();
if(decoded.OPCTables != null)
{
foreach(OPCTable table in decoded.OPCTables)
{
sb.AppendFormat("OPC values for {0}Kbit/sec.: {1}, {2}, {3}, {4}, {5}, {6}", table.Speed,
table.OPCValues[0], table.OPCValues[1], table.OPCValues[2],
table.OPCValues[3], table.OPCValues[4], table.OPCValues[5]).AppendLine();
table.OPCValues[0], table.OPCValues[1], table.OPCValues[2], table.OPCValues[3],
table.OPCValues[4], table.OPCValues[5]).AppendLine();
}
}
@@ -452,17 +440,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static TrackResourcesInformation? Decode001b(byte[] response)
{
if(response.Length != 12)
return null;
if(response.Length != 12) return null;
if((response[2] & 0xE0) != 0x20)
return null;
if((response[2] & 0xE0) != 0x20) return null;
TrackResourcesInformation decoded = new TrackResourcesInformation();
decoded.DataLength = (ushort)((response[0] << 8) + response[1]);
if((decoded.DataLength + 2) != response.Length)
return null;
if((decoded.DataLength + 2) != response.Length) return null;
decoded.DataType = (byte)((response[2] & 0xE0) >> 5);
decoded.MaxTracks = (ushort)((response[4] << 8) + response[5]);
@@ -475,19 +460,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string Prettify001b(TrackResourcesInformation? information)
{
if(!information.HasValue)
return null;
if(!information.HasValue) return null;
TrackResourcesInformation decoded = information.Value;
if(decoded.DataType != 1)
return null;
if(decoded.DataType != 1) return null;
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0} maximum possible tracks on the disc", decoded.MaxTracks).AppendLine();
sb.AppendFormat("{0} assigned tracks on the disc", decoded.AssignedTracks).AppendLine();
sb.AppendFormat("{0} maximum possible appendable tracks on the disc", decoded.AppendableTracks).AppendLine();
sb.AppendFormat("{0} maximum possible appendable tracks on the disc", decoded.AppendableTracks)
.AppendLine();
sb.AppendFormat("{0} current appendable tracks on the disc", decoded.MaxAppendableTracks).AppendLine();
return sb.ToString();
@@ -495,40 +479,39 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static POWResourcesInformation? Decode010b(byte[] response)
{
if(response.Length != 16)
return null;
if(response.Length != 16) return null;
if((response[2] & 0xE0) != 0x40)
return null;
if((response[2] & 0xE0) != 0x40) return null;
POWResourcesInformation decoded = new POWResourcesInformation();
decoded.DataLength = (ushort)((response[0] << 8) + response[1]);
if((decoded.DataLength + 2) != response.Length)
return null;
if((decoded.DataLength + 2) != response.Length) return null;
decoded.DataType = (byte)((response[2] & 0xE0) >> 5);
decoded.RemainingPOWReplacements = (ushort)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
decoded.RemainingPOWReallocation = (ushort)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
decoded.RemainingPOWUpdates = (ushort)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
decoded.RemainingPOWReplacements =
(ushort)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
decoded.RemainingPOWReallocation =
(ushort)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
decoded.RemainingPOWUpdates =
(ushort)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
return decoded;
}
public static string Prettify010b(POWResourcesInformation? information)
{
if(!information.HasValue)
return null;
if(!information.HasValue) return null;
POWResourcesInformation decoded = information.Value;
if(decoded.DataType != 1)
return null;
if(decoded.DataType != 1) return null;
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0} remaining POW replacements", decoded.RemainingPOWReplacements).AppendLine();
sb.AppendFormat("{0} remaining POW reallocation map entries", decoded.RemainingPOWReallocation).AppendLine();
sb.AppendFormat("{0} remaining POW reallocation map entries", decoded.RemainingPOWReallocation)
.AppendLine();
sb.AppendFormat("{0} remaining POW updates", decoded.RemainingPOWUpdates).AppendLine();
return sb.ToString();
@@ -536,24 +519,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string Prettify(byte[] response)
{
if(response == null)
return null;
if(response == null) return null;
if(response.Length < 12)
return null;
if(response.Length < 12) return null;
switch(response[2] & 0xE0)
{
case 0x00:
return Prettify000b(Decode000b(response));
case 0x20:
return Prettify001b(Decode001b(response));
case 0x40:
return Prettify010b(Decode010b(response));
case 0x00: return Prettify000b(Decode000b(response));
case 0x20: return Prettify001b(Decode001b(response));
case 0x40: return Prettify010b(Decode010b(response));
}
return null;
}
}
}
}

View File

@@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
CDROMXA = 0x20,
Undefined = 0xFF
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -103,11 +103,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static RecognizedFormatLayers? DecodeFormatLayers(byte[] FormatLayersResponse)
{
if(FormatLayersResponse == null)
return null;
if(FormatLayersResponse == null) return null;
if(FormatLayersResponse.Length < 8)
return null;
if(FormatLayersResponse.Length < 8) return null;
RecognizedFormatLayers decoded = new RecognizedFormatLayers();
@@ -134,8 +132,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyFormatLayers(RecognizedFormatLayers? FormatLayersResponse)
{
if(FormatLayersResponse == null)
return null;
if(FormatLayersResponse == null) return null;
RecognizedFormatLayers response = FormatLayersResponse.Value;
@@ -148,50 +145,41 @@ namespace DiscImageChef.Decoders.SCSI.MMC
switch(response.FormatLayers[i])
{
case (ushort)FormatLayerTypeCodes.BDLayer:
{
sb.AppendFormat("Layer {0} is of type Blu-ray", i).AppendLine();
if(response.DefaultFormatLayer == i)
sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i)
sb.AppendLine("This is the layer actually in use.");
break;
}
{
sb.AppendFormat("Layer {0} is of type Blu-ray", i).AppendLine();
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
case (ushort)FormatLayerTypeCodes.CDLayer:
{
sb.AppendFormat("Layer {0} is of type CD", i).AppendLine();
if(response.DefaultFormatLayer == i)
sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i)
sb.AppendLine("This is the layer actually in use.");
break;
}
{
sb.AppendFormat("Layer {0} is of type CD", i).AppendLine();
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
case (ushort)FormatLayerTypeCodes.DVDLayer:
{
sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine();
if(response.DefaultFormatLayer == i)
sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i)
sb.AppendLine("This is the layer actually in use.");
break;
}
{
sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine();
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
case (ushort)FormatLayerTypeCodes.HDDVDLayer:
{
sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine();
if(response.DefaultFormatLayer == i)
sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i)
sb.AppendLine("This is the layer actually in use.");
break;
}
{
sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine();
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
default:
{
sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i]).AppendLine();
if(response.DefaultFormatLayer == i)
sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i)
sb.AppendLine("This is the layer actually in use.");
break;
}
{
sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i])
.AppendLine();
if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer.");
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
}
}
@@ -204,5 +192,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
return PrettifyFormatLayers(decoded);
}
}
}
}

View File

@@ -113,8 +113,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static WriteProtectionStatus? DecodeWriteProtectionStatus(byte[] WPSResponse)
{
if(WPSResponse == null)
return null;
if(WPSResponse == null) return null;
WriteProtectionStatus decoded = new WriteProtectionStatus();
@@ -137,35 +136,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC
public static string PrettifyWriteProtectionStatus(WriteProtectionStatus? WPSResponse)
{
if(WPSResponse == null)
return null;
if(WPSResponse == null) return null;
WriteProtectionStatus response = WPSResponse.Value;
StringBuilder sb = new StringBuilder();
if(response.MSWI)
sb.AppendLine("Writing inhibited by media specific reason");
if(response.CWP)
sb.AppendLine("Cartridge sets write protection");
if(response.PWP)
sb.AppendLine("Media surface sets write protection");
if(response.SWPP)
sb.AppendLine("Software write protection is set until power down");
if(response.MSWI) sb.AppendLine("Writing inhibited by media specific reason");
if(response.CWP) sb.AppendLine("Cartridge sets write protection");
if(response.PWP) sb.AppendLine("Media surface sets write protection");
if(response.SWPP) sb.AppendLine("Software write protection is set until power down");
#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:X2}", response.Reserved4).AppendLine();
if(response.Reserved5 != 0)
sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine();
if(response.Reserved6 != 0)
sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).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:X2}", response.Reserved4).AppendLine();
if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine();
if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine();
#endif
return sb.ToString();
@@ -177,5 +165,4 @@ namespace DiscImageChef.Decoders.SCSI.MMC
return PrettifyWriteProtectionStatus(decoded);
}
}
}
}