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

@@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD
public byte[] CopyrightInformation;
}
}
}
}

View File

@@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD
public byte[] ADIP;
}
}
}
}

View File

@@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD
public byte[] BCA;
}
}
}
}

View File

@@ -98,5 +98,4 @@ namespace DiscImageChef.Decoders.DVD
public byte[] MediaKeyBlock;
}
}
}
}

View File

@@ -117,11 +117,9 @@ namespace DiscImageChef.Decoders.DVD
public static LeadInCopyright? DecodeLeadInCopyright(byte[] response)
{
if(response == null)
return null;
if(response == null) return null;
if(response.Length != 8)
return null;
if(response.Length != 8) return null;
LeadInCopyright cmi = new LeadInCopyright();
@@ -138,8 +136,7 @@ namespace DiscImageChef.Decoders.DVD
public static string PrettifyLeadInCopyright(LeadInCopyright? cmi)
{
if(cmi == null)
return null;
if(cmi == null) return null;
LeadInCopyright decoded = cmi.Value;
StringBuilder sb = new StringBuilder();
@@ -163,32 +160,21 @@ namespace DiscImageChef.Decoders.DVD
break;
}
if(decoded.CopyrightType == 0)
return sb.ToString();
if(decoded.CopyrightType == 0) return sb.ToString();
if(decoded.RegionInformation == 0xFF)
sb.AppendLine("Disc cannot be played in any region at all.");
else if(decoded.RegionInformation == 0x00)
sb.AppendLine("Disc can be played in any region.");
if(decoded.RegionInformation == 0xFF) sb.AppendLine("Disc cannot be played in any region at all.");
else if(decoded.RegionInformation == 0x00) sb.AppendLine("Disc can be played in any region.");
else
{
sb.Append("Disc can be played in the following regions:");
if((decoded.RegionInformation & 0x01) != 0x01)
sb.Append(" 0");
if((decoded.RegionInformation & 0x02) != 0x02)
sb.Append(" 1");
if((decoded.RegionInformation & 0x04) != 0x04)
sb.Append(" 2");
if((decoded.RegionInformation & 0x08) != 0x08)
sb.Append(" 3");
if((decoded.RegionInformation & 0x10) != 0x10)
sb.Append(" 4");
if((decoded.RegionInformation & 0x20) != 0x20)
sb.Append(" 5");
if((decoded.RegionInformation & 0x40) != 0x40)
sb.Append(" 6");
if((decoded.RegionInformation & 0x80) != 0x80)
sb.Append(" 7");
if((decoded.RegionInformation & 0x01) != 0x01) sb.Append(" 0");
if((decoded.RegionInformation & 0x02) != 0x02) sb.Append(" 1");
if((decoded.RegionInformation & 0x04) != 0x04) sb.Append(" 2");
if((decoded.RegionInformation & 0x08) != 0x08) sb.Append(" 3");
if((decoded.RegionInformation & 0x10) != 0x10) sb.Append(" 4");
if((decoded.RegionInformation & 0x20) != 0x20) sb.Append(" 5");
if((decoded.RegionInformation & 0x40) != 0x40) sb.Append(" 6");
if((decoded.RegionInformation & 0x80) != 0x80) sb.Append(" 7");
}
return sb.ToString();
@@ -199,5 +185,4 @@ namespace DiscImageChef.Decoders.DVD
return PrettifyLeadInCopyright(DecodeLeadInCopyright(response));
}
}
}
}

View File

@@ -122,11 +122,9 @@ namespace DiscImageChef.Decoders.DVD
public static MediumStatus? Decode(byte[] response)
{
if(response == null)
return null;
if(response == null) return null;
if(response.Length != 8)
return null;
if(response.Length != 8) return null;
MediumStatus status = new MediumStatus();
@@ -149,22 +147,18 @@ namespace DiscImageChef.Decoders.DVD
public static string Prettify(MediumStatus? status)
{
if(status == null)
return null;
if(status == null) return null;
MediumStatus decoded = status.Value;
StringBuilder sb = new StringBuilder();
if(decoded.PWP)
sb.AppendLine("Disc surface is set to write protected status");
if(decoded.PWP) sb.AppendLine("Disc surface is set to write protected status");
if(decoded.Cartridge)
{
sb.AppendLine("Disc comes in a cartridge");
if(decoded.OUT)
sb.AppendLine("Disc has been extracted from the cartridge");
if(decoded.CWP)
sb.AppendLine("Cartridge is set to write protected");
if(decoded.OUT) sb.AppendLine("Disc has been extracted from the cartridge");
if(decoded.CWP) sb.AppendLine("Cartridge is set to write protected");
}
switch(decoded.DiscType)
@@ -184,8 +178,7 @@ namespace DiscImageChef.Decoders.DVD
{
switch(decoded.RAMSWI)
{
case 0:
break;
case 0: break;
case 1:
sb.AppendLine("Disc is write inhibited because it has been extracted from the cartridge");
break;
@@ -193,7 +186,8 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc is write inhibited for an unspecified reason");
break;
default:
sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI).AppendLine();
sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI)
.AppendLine();
break;
}
}
@@ -206,5 +200,4 @@ namespace DiscImageChef.Decoders.DVD
return Prettify(Decode(response));
}
}
}
}

View File

@@ -196,18 +196,15 @@ namespace DiscImageChef.Decoders.DVD
public static DiscDefinitionStructure? Decode(byte[] response)
{
if(response == null)
return null;
if(response == null) return null;
if(response.Length != 2052)
return null;
if(response.Length != 2052) return null;
DiscDefinitionStructure dds = new DiscDefinitionStructure();
dds.Identifier = (ushort)((response[4] << 8) + response[5]);
if(dds.Identifier != 0x0A0A)
return null;
if(dds.Identifier != 0x0A0A) return null;
// Common to both DVD-RAM versions
dds.DataLength = (ushort)((response[0] << 8) + response[1]);
@@ -252,7 +249,8 @@ namespace DiscImageChef.Decoders.DVD
dds.StartLSNForZone = new uint[dds.Zones];
for(int i = 0; i < dds.Zones; i++)
dds.StartLSNForZone[i] = (uint)((response[260 + i * 4 + 1] << 16) + (response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]);
dds.StartLSNForZone[i] = (uint)((response[260 + i * 4 + 1] << 16) +
(response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]);
}
return dds;
@@ -260,8 +258,7 @@ namespace DiscImageChef.Decoders.DVD
public static string Prettify(DiscDefinitionStructure? dds)
{
if(dds == null)
return null;
if(dds == null) return null;
DiscDefinitionStructure decoded = dds.Value;
StringBuilder sb = new StringBuilder();
@@ -271,17 +268,13 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Formatting in progress.");
if(decoded.Groups == 24)
{
if(decoded.PartialCertification)
sb.AppendLine("Formatting is only using partial certification");
if(decoded.FormattingOnlyAGroup)
sb.AppendLine("Only a group is being formatted");
if(decoded.PartialCertification) sb.AppendLine("Formatting is only using partial certification");
if(decoded.FormattingOnlyAGroup) sb.AppendLine("Only a group is being formatted");
}
}
if(decoded.UserCertification)
sb.AppendLine("Disc has been certified by an user");
if(decoded.ManufacturerCertification)
sb.AppendLine("Disc has been certified by a manufacturer");
if(decoded.UserCertification) sb.AppendLine("Disc has been certified by an user");
if(decoded.ManufacturerCertification) sb.AppendLine("Disc has been certified by a manufacturer");
sb.AppendFormat("DDS has been updated {0} times", decoded.UpdateCount).AppendLine();
@@ -303,7 +296,8 @@ namespace DiscImageChef.Decoders.DVD
if(decoded.Groups == 1)
{
sb.AppendFormat("Disc has {0} zones", decoded.Zones).AppendLine();
sb.AppendFormat("Primary Spare Area stats at PSN {0:X}h and ends at PSN {1:X}h, inclusively", decoded.SpareAreaFirstPSN, decoded.SpareAreaLastPSN).AppendLine();
sb.AppendFormat("Primary Spare Area stats at PSN {0:X}h and ends at PSN {1:X}h, inclusively",
decoded.SpareAreaFirstPSN, decoded.SpareAreaLastPSN).AppendLine();
sb.AppendFormat("LSN 0 is at PSN {0:X}h", decoded.LSN0Location).AppendLine();
for(int i = 0; i < decoded.StartLSNForZone.Length; i++)
@@ -318,5 +312,4 @@ namespace DiscImageChef.Decoders.DVD
return Prettify(Decode(response));
}
}
}
}

View File

@@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD
public byte[] DMI;
}
}
}
}

View File

@@ -260,5 +260,4 @@ namespace DiscImageChef.Decoders.DVD
Twelve = 0x50
}
#endregion
}
}

View File

@@ -236,5 +236,4 @@ namespace DiscImageChef.Decoders.DVD
public uint LBA;
}
}
}
}

View File

@@ -1049,11 +1049,9 @@ namespace DiscImageChef.Decoders.DVD
public static PhysicalFormatInformation? Decode(byte[] response)
{
if(response == null)
return null;
if(response == null) return null;
if(response.Length < 2052)
return null;
if(response.Length < 2052) return null;
PhysicalFormatInformation pfi = new PhysicalFormatInformation();
byte[] tmp;
@@ -1073,8 +1071,10 @@ namespace DiscImageChef.Decoders.DVD
pfi.LayerType = (LayerTypeFieldMask)(response[6] & 0x07);
pfi.LinearDensity = (LinearDensityField)((response[7] & 0xF0) >> 4);
pfi.TrackDensity = (TrackDensityField)(response[7] & 0x0F);
pfi.DataAreaStartPSN = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
pfi.DataAreaEndPSN = (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
pfi.DataAreaStartPSN =
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
pfi.DataAreaEndPSN =
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
pfi.Layer0EndPSN = (uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]);
pfi.BCA |= (response[20] & 0x80) == 0x80;
@@ -1182,13 +1182,13 @@ namespace DiscImageChef.Decoders.DVD
}
// DVD-R and DVD-RW
if((pfi.DiskCategory == DiskCategory.DVDR &&
pfi.PartVersion < 6) ||
(pfi.DiskCategory == DiskCategory.DVDRW &&
pfi.PartVersion < 3))
if((pfi.DiskCategory == DiskCategory.DVDR && pfi.PartVersion < 6) ||
(pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion < 3))
{
pfi.CurrentBorderOutSector = (uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector = (uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
pfi.CurrentBorderOutSector =
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector =
(uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
}
// DVD+RW
@@ -1216,10 +1216,8 @@ namespace DiscImageChef.Decoders.DVD
}
// DVD+R, DVD+RW, DVD+R DL and DVD+RW DL
if(pfi.DiskCategory == DiskCategory.DVDPR ||
pfi.DiskCategory == DiskCategory.DVDPRW ||
pfi.DiskCategory == DiskCategory.DVDPRDL ||
pfi.DiskCategory == DiskCategory.DVDPRWDL)
if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRW ||
pfi.DiskCategory == DiskCategory.DVDPRDL || pfi.DiskCategory == DiskCategory.DVDPRWDL)
{
pfi.VCPS |= (response[20] & 0x40) == 0x40;
pfi.ApplicationCode = response[21];
@@ -1230,13 +1228,13 @@ namespace DiscImageChef.Decoders.DVD
tmp = new byte[3];
Array.Copy(response, 31, tmp, 0, 3);
pfi.MediaTypeID = StringHandlers.CToString(tmp);
pfi.ProductRevision = pfi.DiskCategory == DiskCategory.DVDPRDL ? (byte)(response[34] & 0x3F) : response[34];
pfi.ProductRevision =
pfi.DiskCategory == DiskCategory.DVDPRDL ? (byte)(response[34] & 0x3F) : response[34];
pfi.PFIUsedInADIP = response[35];
}
// DVD+RW
if(pfi.DiskCategory == DiskCategory.DVDPRW &&
pfi.PartVersion == 2)
if(pfi.DiskCategory == DiskCategory.DVDPRW && pfi.PartVersion == 2)
{
pfi.TopFirstPulseDuration = response[55];
pfi.MultiPulseDuration = response[56];
@@ -1246,8 +1244,7 @@ namespace DiscImageChef.Decoders.DVD
}
// DVD+R and DVD+R DL
if(pfi.DiskCategory == DiskCategory.DVDPR ||
pfi.DiskCategory == DiskCategory.DVDPRDL)
if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRDL)
{
pfi.PrimaryVelocity = response[36];
pfi.UpperVelocity = response[37];
@@ -1305,10 +1302,8 @@ namespace DiscImageChef.Decoders.DVD
}
// DVD-R DL and DVD-RW DL
if((pfi.DiskCategory == DiskCategory.DVDR &&
pfi.PartVersion == 6) ||
(pfi.DiskCategory == DiskCategory.DVDRW &&
pfi.PartVersion == 3))
if((pfi.DiskCategory == DiskCategory.DVDR && pfi.PartVersion == 6) ||
(pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion == 3))
{
pfi.MaxRecordingSpeed = (DVDRecordingSpeed)response[21];
pfi.MinRecordingSpeed = (DVDRecordingSpeed)response[22];
@@ -1321,8 +1316,10 @@ namespace DiscImageChef.Decoders.DVD
pfi.RecordingSpeed7 = (DVDRecordingSpeed)response[29];
pfi.Class = response[30];
pfi.ExtendedVersion = response[31];
pfi.CurrentBorderOutSector = (uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector = (uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
pfi.CurrentBorderOutSector =
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
pfi.NextBorderInSector =
(uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
pfi.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01;
pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02;
pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08;
@@ -1335,8 +1332,7 @@ namespace DiscImageChef.Decoders.DVD
public static string Prettify(PhysicalFormatInformation? pfi)
{
if(pfi == null)
return null;
if(pfi == null) return null;
PhysicalFormatInformation decoded = pfi.Value;
StringBuilder sb = new StringBuilder();
@@ -1377,12 +1373,12 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc claims conformation to ECMA-330");
break;
}
break;
case DiskCategory.DVDR:
if(decoded.PartVersion >= 6)
sb.AppendFormat(categorySentence, sizeString, "DVD-R DL", decoded.PartVersion).AppendLine();
else
sb.AppendFormat(categorySentence, sizeString, "DVD-R", decoded.PartVersion).AppendLine();
else sb.AppendFormat(categorySentence, sizeString, "DVD-R", decoded.PartVersion).AppendLine();
switch(decoded.PartVersion)
{
case 1:
@@ -1395,12 +1391,12 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc claims conformation to ECMA-382");
break;
}
break;
case DiskCategory.DVDRW:
if(decoded.PartVersion >= 3)
sb.AppendFormat(categorySentence, sizeString, "DVD-RW DL", decoded.PartVersion).AppendLine();
else
sb.AppendFormat(categorySentence, sizeString, "DVD-RW", decoded.PartVersion).AppendLine();
else sb.AppendFormat(categorySentence, sizeString, "DVD-RW", decoded.PartVersion).AppendLine();
switch(decoded.PartVersion)
{
case 2:
@@ -1410,18 +1406,19 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc claims conformation to ECMA-384");
break;
}
break;
case DiskCategory.UMD:
if(decoded.DiscSize == DVDSize.OneTwenty)
sb.AppendFormat(categorySentence, "60mm", "UMD", decoded.PartVersion).AppendLine();
else
sb.AppendFormat(categorySentence, "invalid size", "UMD", decoded.PartVersion).AppendLine();
else sb.AppendFormat(categorySentence, "invalid size", "UMD", decoded.PartVersion).AppendLine();
switch(decoded.PartVersion)
{
case 0:
sb.AppendLine("Disc claims conformation to ECMA-365");
break;
}
break;
case DiskCategory.DVDPRW:
sb.AppendFormat(categorySentence, sizeString, "DVD+RW", decoded.PartVersion).AppendLine();
@@ -1437,6 +1434,7 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc claims conformation to ECMA-371");
break;
}
break;
case DiskCategory.DVDPR:
sb.AppendFormat(categorySentence, sizeString, "DVD+R", decoded.PartVersion).AppendLine();
@@ -1446,6 +1444,7 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc claims conformation to ECMA-349");
break;
}
break;
case DiskCategory.DVDPRWDL:
sb.AppendFormat(categorySentence, sizeString, "DVD+RW DL", decoded.PartVersion).AppendLine();
@@ -1455,6 +1454,7 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc claims conformation to ECMA-374");
break;
}
break;
case DiskCategory.DVDPRDL:
sb.AppendFormat(categorySentence, sizeString, "DVD+R DL", decoded.PartVersion).AppendLine();
@@ -1464,6 +1464,7 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc claims conformation to ECMA-364");
break;
}
break;
case DiskCategory.Nintendo:
if(decoded.PartVersion == 15)
@@ -1472,11 +1473,9 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc is a Nintendo Gamecube Optical Disc (GOD)");
else if(decoded.DiscSize == DVDSize.OneTwenty)
sb.AppendLine("Disc is a Nintendo Wii Optical Disc (WOD)");
else
goto default;
else goto default;
}
else
goto default;
else goto default;
break;
case DiskCategory.HDDVDROM:
sb.AppendFormat(categorySentence, sizeString, "HD DVD-ROM", decoded.PartVersion).AppendLine();
@@ -1491,7 +1490,8 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendFormat(categorySentence, sizeString, "HD DVD-RW", decoded.PartVersion).AppendLine();
break;
default:
sb.AppendFormat(categorySentence, sizeString, "unknown disc type", decoded.PartVersion).AppendLine();
sb.AppendFormat(categorySentence, sizeString, "unknown disc type", decoded.PartVersion)
.AppendLine();
break;
}
@@ -1516,15 +1516,14 @@ namespace DiscImageChef.Decoders.DVD
sb.AppendLine("Disc maximum transfer rate is unspecified.");
break;
default:
sb.AppendFormat("Disc maximum transfer rate is specified by unknown key {0}", decoded.MaximumRate).AppendLine();
sb.AppendFormat("Disc maximum transfer rate is specified by unknown key {0}", decoded.MaximumRate)
.AppendLine();
break;
}
sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine();
if(decoded.TrackPath && decoded.Layers == 1)
sb.AppendLine("Layers are in parallel track path");
else if(!decoded.TrackPath && decoded.Layers == 1)
sb.AppendLine("Layers are in opposite track path");
if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel track path");
else if(!decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in opposite track path");
switch(decoded.LinearDensity)
{
@@ -1585,14 +1584,11 @@ namespace DiscImageChef.Decoders.DVD
if(decoded.Layers == 1 && !decoded.TrackPath)
sb.AppendFormat("Layer 0 ends at PSN {0:X}h", decoded.Layer0EndPSN).AppendLine();
}
else
sb.AppendLine("Disc is empty");
else sb.AppendLine("Disc is empty");
}
else
sb.AppendLine("Disc is empty");
else sb.AppendLine("Disc is empty");
if(decoded.BCA)
sb.AppendLine("Disc has a burst cutting area");
if(decoded.BCA) sb.AppendLine("Disc has a burst cutting area");
if(decoded.DiskCategory == DiskCategory.UMD)
sb.AppendFormat("Media attribute is {0}", decoded.MediaAttribute).AppendLine();
@@ -1615,45 +1611,39 @@ namespace DiscImageChef.Decoders.DVD
if(decoded.PartVersion == 6)
{
sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturer).AppendLine();
sb.AppendFormat("Disc manufacturer supplementary information is {0}", decoded.DiskManufacturerSupplementary).AppendLine();
sb.AppendFormat("Disc manufacturer supplementary information is {0}",
decoded.DiskManufacturerSupplementary).AppendLine();
}
}
if((decoded.DiskCategory == DiskCategory.DVDR &&
decoded.PartVersion < 6) ||
(decoded.DiskCategory == DiskCategory.DVDRW &&
decoded.PartVersion < 3))
if((decoded.DiskCategory == DiskCategory.DVDR && decoded.PartVersion < 6) ||
(decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion < 3))
{
sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector).AppendLine();
sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector)
.AppendLine();
sb.AppendFormat("Next Border-In first sector is PSN {0:X}h", decoded.NextBorderInSector).AppendLine();
}
if(decoded.DiskCategory == DiskCategory.DVDPR ||
decoded.DiskCategory == DiskCategory.DVDPRW ||
decoded.DiskCategory == DiskCategory.DVDPRDL ||
decoded.DiskCategory == DiskCategory.DVDPRWDL)
if(decoded.DiskCategory == DiskCategory.DVDPR || decoded.DiskCategory == DiskCategory.DVDPRW ||
decoded.DiskCategory == DiskCategory.DVDPRDL || decoded.DiskCategory == DiskCategory.DVDPRWDL)
{
if(decoded.VCPS)
sb.AppendLine("Disc contains extended information for VCPS");
if(decoded.VCPS) sb.AppendLine("Disc contains extended information for VCPS");
sb.AppendFormat("Disc application code is {0}", decoded.ApplicationCode).AppendLine();
sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturerID).AppendLine();
sb.AppendFormat("Disc media type is {0}", decoded.MediaTypeID).AppendLine();
sb.AppendFormat("Disc product revision is {0}", decoded.ProductRevision).AppendLine();
}
if((decoded.DiskCategory == DiskCategory.DVDR &&
decoded.PartVersion >= 6) ||
(decoded.DiskCategory == DiskCategory.DVDRW &&
decoded.PartVersion >= 3))
if((decoded.DiskCategory == DiskCategory.DVDR && decoded.PartVersion >= 6) ||
(decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion >= 3))
{
sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h", decoded.CurrentRMDExtraBorderPSN).AppendLine();
sb.AppendFormat("PFI in extra Border zone starts at PSN {0:X}h", decoded.PFIExtraBorderPSN).AppendLine();
if(!decoded.PreRecordedControlDataInv)
sb.AppendLine("Control Data Zone is pre-recorded");
if(decoded.PreRecordedLeadIn)
sb.AppendLine("Lead-In is pre-recorded");
if(decoded.PreRecordedLeadOut)
sb.AppendLine("Lead-Out is pre-recorded");
sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h",
decoded.CurrentRMDExtraBorderPSN).AppendLine();
sb.AppendFormat("PFI in extra Border zone starts at PSN {0:X}h", decoded.PFIExtraBorderPSN)
.AppendLine();
if(!decoded.PreRecordedControlDataInv) sb.AppendLine("Control Data Zone is pre-recorded");
if(decoded.PreRecordedLeadIn) sb.AppendLine("Lead-In is pre-recorded");
if(decoded.PreRecordedLeadOut) sb.AppendLine("Lead-Out is pre-recorded");
}
return sb.ToString();
@@ -1664,5 +1654,4 @@ namespace DiscImageChef.Decoders.DVD
return Prettify(Decode(response));
}
}
}
}

View File

@@ -74,5 +74,4 @@ namespace DiscImageChef.Decoders.DVD
public byte[] PRI;
}
}
}
}

View File

@@ -113,5 +113,4 @@ namespace DiscImageChef.Decoders.DVD
public ushort CurrentRemainingRMDs;
}
}
}
}

View File

@@ -87,35 +87,36 @@ namespace DiscImageChef.Decoders.DVD
public static SpareAreaInformation? Decode(byte[] response)
{
if(response == null)
return null;
if(response == null) return null;
if(response.Length != 16)
return null;
if(response.Length != 16) return null;
SpareAreaInformation sai = new SpareAreaInformation();
sai.DataLength = (ushort)((response[0] << 8) + response[1]);
sai.Reserved1 = response[2];
sai.Reserved2 = response[3];
sai.UnusedPrimaryBlocks = (uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
sai.UnusedSupplementaryBlocks = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
sai.AllocatedSupplementaryBlocks = (uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
sai.UnusedPrimaryBlocks =
(uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]);
sai.UnusedSupplementaryBlocks =
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
sai.AllocatedSupplementaryBlocks =
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
return sai;
}
public static string Prettify(SpareAreaInformation? sai)
{
if(sai == null)
return null;
if(sai == null) return null;
SpareAreaInformation decoded = sai.Value;
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0} unused primary spare blocks", decoded.UnusedPrimaryBlocks).AppendLine();
sb.AppendFormat("{0} unused supplementary spare blocks", decoded.UnusedSupplementaryBlocks).AppendLine();
sb.AppendFormat("{0} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks).AppendLine();
sb.AppendFormat("{0} allocated supplementary spare blocks", decoded.AllocatedSupplementaryBlocks)
.AppendLine();
return sb.ToString();
}
@@ -125,5 +126,4 @@ namespace DiscImageChef.Decoders.DVD
return Prettify(Decode(response));
}
}
}
}

View File

@@ -114,5 +114,4 @@ namespace DiscImageChef.Decoders.DVD
public ushort Second;
}
}
}
}