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

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