Code cleanup.

This commit is contained in:
2020-10-17 04:06:30 +01:00
parent c5b2c23186
commit a88be9d29f
8 changed files with 39 additions and 31 deletions

View File

@@ -109,10 +109,10 @@ namespace Aaru.Decoders.DVD
dds.Reserved4 = (byte)((response[7] & 0x7C) >> 2);
dds.Reserved = new byte[68];
Array.Copy(response, 16, dds.Reserved, 0, 68);
dds.Zones = (ushort)((response[14] << 8) + response[15]);
dds.SpareAreaFirstPSN = (uint)((response[85] << 16) + (response[86] << 8) + response[87]);
dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]);
dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]);
dds.Zones = (ushort)((response[14] << 8) + response[15]);
dds.SpareAreaFirstPSN = (uint)((response[85] << 16) + (response[86] << 8) + response[87]);
dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]);
dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]);
dds.StartLSNForZone = new uint[dds.Zones];
for(int i = 0; i < dds.Zones; i++)

View File

@@ -170,14 +170,14 @@ namespace Aaru.Decoders.Floppy
{
byte b1 = buffer[(51 * 3) - i];
byte b2 = buffer[(51 * 2) - i];
byte b3 = buffer[51 - i];
byte b4 = (byte)((((b1 & 2) << 1) | (b2 & 2) | ((b3 & 2) >> 1)) & 0xFF);
byte b5 = (byte)((((b1 & 1) << 2) | ((b2 & 1) << 1) | (b3 & 1)) & 0xFF);
byte b3 = buffer[51 - i];
byte b4 = (byte)((((b1 & 2) << 1) | (b2 & 2) | ((b3 & 2) >> 1)) & 0xFF);
byte b5 = (byte)((((b1 & 1) << 2) | ((b2 & 1) << 1) | (b3 & 1)) & 0xFF);
output[250 - (5 * i)] = (byte)(((buffer[i + (51 * 3) + 1] << 3) | ((b1 >> 2) & 0x7)) & 0xFF);
output[251 - (5 * i)] = (byte)(((buffer[i + (51 * 4) + 1] << 3) | ((b2 >> 2) & 0x7)) & 0xFF);
output[252 - (5 * i)] = (byte)(((buffer[i + (51 * 5) + 1] << 3) | ((b3 >> 2) & 0x7)) & 0xFF);
output[253 - (5 * i)] = (byte)(((buffer[i + (51 * 6) + 1] << 3) | b4) & 0xFF);
output[254 - (5 * i)] = (byte)(((buffer[i + (51 * 7) + 1] << 3) | b5) & 0xFF);
output[253 - (5 * i)] = (byte)(((buffer[i + (51 * 6) + 1] << 3) | b4) & 0xFF);
output[254 - (5 * i)] = (byte)(((buffer[i + (51 * 7) + 1] << 3) | b5) & 0xFF);
}
output[255] = (byte)(((buffer[409] << 3) | (buffer[0] & 0x7)) & 0xFF);

View File

@@ -305,7 +305,7 @@ namespace Aaru.Decoders.SCSI.MMC
{
decoded.Extents[i].Reserved = new byte[8];
Array.Copy(AACSLBAExtsResponse, 0 + (i * 16) + 4, decoded.Extents[i].Reserved, 0, 8);
decoded.Extents[i].StartLBA = BigEndianBitConverter.ToUInt32(AACSLBAExtsResponse, 8 + (i * 16) + 4);
decoded.Extents[i].StartLBA = BigEndianBitConverter.ToUInt32(AACSLBAExtsResponse, 8 + (i * 16) + 4);
decoded.Extents[i].LBACount = BigEndianBitConverter.ToUInt32(AACSLBAExtsResponse, 12 + (i * 16) + 4);
}

View File

@@ -211,20 +211,27 @@ namespace Aaru.Decoders.SCSI.MMC
sb.AppendFormat("First track on disc is track {0}", information.Value.FirstTrackNumber).AppendLine();
sb.AppendFormat("Disc has {0} sessions", information.Value.Sessions).AppendLine();
sb.AppendFormat("First track in last session is track {0}", information.Value.FirstTrackLastSession).AppendLine();
sb.AppendFormat("Last track in last session is track {0}", information.Value.LastTrackLastSession).AppendLine();
sb.AppendFormat("First track in last session is track {0}", information.Value.FirstTrackLastSession).
AppendLine();
sb.AppendFormat("Last track in last session is track {0}", information.Value.LastTrackLastSession).
AppendLine();
sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}",
information.Value.LastSessionLeadInStartLBA, (information.Value.LastSessionLeadInStartLBA & 0xFF0000) >> 16,
(information.Value.LastSessionLeadInStartLBA & 0xFF00) >> 8,
information.Value.LastSessionLeadInStartLBA,
(information.Value.LastSessionLeadInStartLBA & 0xFF0000) >> 16,
(information.Value.LastSessionLeadInStartLBA & 0xFF00) >> 8,
information.Value.LastSessionLeadInStartLBA & 0xFF).AppendLine();
sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}",
information.Value.LastPossibleLeadOutStartLBA, (information.Value.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16,
(information.Value.LastPossibleLeadOutStartLBA & 0xFF00) >> 8,
information.Value.LastPossibleLeadOutStartLBA,
(information.Value.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16,
(information.Value.LastPossibleLeadOutStartLBA & 0xFF00) >> 8,
information.Value.LastPossibleLeadOutStartLBA & 0xFF).AppendLine();
sb.AppendLine(information.Value.URU ? "Disc is defined for unrestricted use" : "Disc is defined for restricted use");
sb.AppendLine(information.Value.URU ? "Disc is defined for unrestricted use"
: "Disc is defined for restricted use");
if(information.Value.DID_V)
sb.AppendFormat("Disc ID: {0:X6}", information.Value.DiscIdentification & 0x00FFFFFF).AppendLine();
@@ -284,7 +291,8 @@ namespace Aaru.Decoders.SCSI.MMC
sb.AppendFormat("{0} maximum possible appendable tracks on the disc", information.Value.AppendableTracks).
AppendLine();
sb.AppendFormat("{0} current appendable tracks on the disc", information.Value.MaxAppendableTracks).AppendLine();
sb.AppendFormat("{0} current appendable tracks on the disc", information.Value.MaxAppendableTracks).
AppendLine();
return sb.ToString();
}

View File

@@ -4844,8 +4844,8 @@ namespace Aaru.Decoders.SCSI.MMC
{
var dec = new SeparatedFeatures
{
DataLength = (uint)((response[0] << 24) + (response[1] << 16) + (response[2] << 8) + response[4]),
CurrentProfile = (ushort)((response[6] << 8) + response[7])
DataLength = (uint)((response[0] << 24) + (response[1] << 16) + (response[2] << 8) + response[4]),
CurrentProfile = (ushort)((response[6] << 8) + response[7])
};
uint offset = 8;

View File

@@ -132,7 +132,7 @@ namespace Aaru.Decoders.SCSI
decoded.DRA |= (pageResponse[12] & 0x20) == 0x20;
decoded.CacheSegments = pageResponse[13];
decoded.CacheSegmentSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]);
decoded.CacheSegmentSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]);
decoded.NonCacheSegmentSize = (uint)((pageResponse[17] << 16) + (pageResponse[18] << 8) + pageResponse[19]);
decoded.NV_DIS |= (pageResponse[12] & 0x01) == 0x01;

View File

@@ -294,14 +294,14 @@ namespace Aaru.Decoders.SCSI
for(int i = 0; i < header.BlockDescriptors.Length; i++)
{
byte[] temp = BitConverter.GetBytes(header.BlockDescriptors[i].Blocks);
hdr[7 + (i * 16) + 8] = temp[0];
hdr[6 + (i * 16) + 8] = temp[1];
hdr[5 + (i * 16) + 8] = temp[2];
hdr[4 + (i * 16) + 8] = temp[3];
hdr[3 + (i * 16) + 8] = temp[4];
hdr[2 + (i * 16) + 8] = temp[5];
hdr[1 + (i * 16) + 8] = temp[6];
hdr[0 + (i * 16) + 8] = temp[7];
hdr[7 + (i * 16) + 8] = temp[0];
hdr[6 + (i * 16) + 8] = temp[1];
hdr[5 + (i * 16) + 8] = temp[2];
hdr[4 + (i * 16) + 8] = temp[3];
hdr[3 + (i * 16) + 8] = temp[4];
hdr[2 + (i * 16) + 8] = temp[5];
hdr[1 + (i * 16) + 8] = temp[6];
hdr[0 + (i * 16) + 8] = temp[7];
hdr[12 + (i * 16) + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF000000) >> 24);
hdr[13 + (i * 16) + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF0000) >> 16);
hdr[14 + (i * 16) + 8] = (byte)((header.BlockDescriptors[i].BlockLength & 0xFF00) >> 8);

View File

@@ -48,8 +48,8 @@ namespace Aaru.Decoders.SCSI.SSC
return new BlockLimitsData
{
granularity = (byte)(response[0] & 0x1F),
maxBlockLen = (uint)((response[1] << 16) + (response[2] << 8) + response[3]),
minBlockLen = (ushort)((response[4] << 8) + response[5])
maxBlockLen = (uint)((response[1] << 16) + (response[2] << 8) + response[3]),
minBlockLen = (ushort)((response[4] << 8) + response[5])
};
}