mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] General reformat and clean-up.
This commit is contained in:
@@ -60,8 +60,8 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Sentry" />
|
||||
<PackageReference Include="Spectre.Console" />
|
||||
<PackageReference Include="Sentry"/>
|
||||
<PackageReference Include="Spectre.Console"/>
|
||||
<PackageReference Include="System.ComponentModel.Annotations"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Aaru.Checksums;
|
||||
|
||||
@@ -103,7 +103,7 @@ public static class PRI
|
||||
Array.Copy(response, 37, pri.ManufacturerId3, 0, 6);
|
||||
Array.Copy(response, 44, pri.Reserved8, 0, pri.Reserved8.Length);
|
||||
|
||||
byte[] tmp = new byte[18];
|
||||
var tmp = new byte[18];
|
||||
|
||||
Array.Copy(response, 21, tmp, 0, 6);
|
||||
Array.Copy(response, 29, tmp, 6, 6);
|
||||
@@ -309,7 +309,7 @@ public static class PRI
|
||||
[SuppressMessage("ReSharper", "StringLiteralTypo")]
|
||||
public static string ManufacturerFromPrePit(string manufacturerId)
|
||||
{
|
||||
string manufacturer = "";
|
||||
var manufacturer = "";
|
||||
|
||||
// Bad thing is that it also includes a media code...
|
||||
if(manufacturerId.StartsWith("RITEK", StringComparison.Ordinal))
|
||||
|
||||
@@ -300,8 +300,9 @@ public static partial class Decoders
|
||||
unit = "";
|
||||
|
||||
for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1)
|
||||
if((csd.Classes & mask) == mask)
|
||||
unit += $" {cl}";
|
||||
{
|
||||
if((csd.Classes & mask) == mask) unit += $" {cl}";
|
||||
}
|
||||
|
||||
sb.AppendFormat("\t" + Localization.Device_support_command_classes_0, unit).AppendLine();
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Helpers;
|
||||
@@ -2512,7 +2511,7 @@ public static class Inquiry
|
||||
{
|
||||
if(response.KreonPresent)
|
||||
{
|
||||
byte[] vendor = new byte[7];
|
||||
var vendor = new byte[7];
|
||||
Array.Copy(response.VendorSpecific, 11, vendor, 0, 7);
|
||||
sb.AppendLine($"[bold][blue]{Localization.Vendor_specific_bytes_47_to_55}[/][/]");
|
||||
sb.AppendLine("============================================================");
|
||||
|
||||
@@ -1193,7 +1193,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0000) return null;
|
||||
|
||||
@@ -1205,7 +1205,7 @@ public static class Features
|
||||
decoded.Persistent |= (feature[2] & 0x02) == 0x02;
|
||||
decoded.Version = (byte)((feature[2] & 0x3C) >> 2);
|
||||
|
||||
int offset = 4;
|
||||
var offset = 4;
|
||||
List<Profile> listProfiles = [];
|
||||
|
||||
while(offset < feature.Length)
|
||||
@@ -1231,7 +1231,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0001) return null;
|
||||
|
||||
@@ -1259,7 +1259,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0002) return null;
|
||||
|
||||
@@ -1284,7 +1284,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0003) return null;
|
||||
|
||||
@@ -1315,7 +1315,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0004) return null;
|
||||
|
||||
@@ -1343,7 +1343,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 12) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0010) return null;
|
||||
|
||||
@@ -1370,7 +1370,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x001D) return null;
|
||||
|
||||
@@ -1391,7 +1391,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x001E) return null;
|
||||
|
||||
@@ -1420,7 +1420,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x001F) return null;
|
||||
|
||||
@@ -1450,7 +1450,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 16) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0020) return null;
|
||||
|
||||
@@ -1480,7 +1480,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0021) return null;
|
||||
|
||||
@@ -1515,7 +1515,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0022) return null;
|
||||
|
||||
@@ -1536,7 +1536,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0023) return null;
|
||||
|
||||
@@ -1568,7 +1568,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0024) return null;
|
||||
|
||||
@@ -1591,7 +1591,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 12) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0025) return null;
|
||||
|
||||
@@ -1618,7 +1618,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0026) return null;
|
||||
|
||||
@@ -1639,7 +1639,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0027) return null;
|
||||
|
||||
@@ -1660,7 +1660,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0028) return null;
|
||||
|
||||
@@ -1688,7 +1688,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0029) return null;
|
||||
|
||||
@@ -1713,7 +1713,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x002A) return null;
|
||||
|
||||
@@ -1739,7 +1739,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x002B) return null;
|
||||
|
||||
@@ -1762,7 +1762,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x002C) return null;
|
||||
|
||||
@@ -1788,7 +1788,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x002D) return null;
|
||||
|
||||
@@ -1820,7 +1820,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x002E) return null;
|
||||
|
||||
@@ -1851,7 +1851,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x002F) return null;
|
||||
|
||||
@@ -1879,7 +1879,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0030) return null;
|
||||
|
||||
@@ -1900,7 +1900,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0031) return null;
|
||||
|
||||
@@ -1923,7 +1923,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0032) return null;
|
||||
|
||||
@@ -1947,7 +1947,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0033) return null;
|
||||
|
||||
@@ -1973,7 +1973,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0035) return null;
|
||||
|
||||
@@ -1994,7 +1994,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0037) return null;
|
||||
|
||||
@@ -2017,7 +2017,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0038) return null;
|
||||
|
||||
@@ -2038,7 +2038,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x003A) return null;
|
||||
|
||||
@@ -2063,7 +2063,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x003B) return null;
|
||||
|
||||
@@ -2086,7 +2086,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 32) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0040) return null;
|
||||
|
||||
@@ -2119,7 +2119,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 24) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0041) return null;
|
||||
|
||||
@@ -2150,7 +2150,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0042) return null;
|
||||
|
||||
@@ -2171,7 +2171,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0050) return null;
|
||||
|
||||
@@ -2195,7 +2195,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0051) return null;
|
||||
|
||||
@@ -2219,7 +2219,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0080) return null;
|
||||
|
||||
@@ -2242,7 +2242,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0100) return null;
|
||||
|
||||
@@ -2263,7 +2263,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0101) return null;
|
||||
|
||||
@@ -2286,7 +2286,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0102) return null;
|
||||
|
||||
@@ -2311,7 +2311,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0103) return null;
|
||||
|
||||
@@ -2337,7 +2337,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0104) return null;
|
||||
|
||||
@@ -2360,7 +2360,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0105) return null;
|
||||
|
||||
@@ -2386,7 +2386,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0106) return null;
|
||||
|
||||
@@ -2409,7 +2409,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0107) return null;
|
||||
|
||||
@@ -2444,7 +2444,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0108) return null;
|
||||
|
||||
@@ -2456,7 +2456,7 @@ public static class Features
|
||||
decoded.Persistent |= (feature[2] & 0x02) == 0x02;
|
||||
decoded.Version = (byte)((feature[2] & 0x3C) >> 2);
|
||||
|
||||
byte[] serial = new byte[feature.Length];
|
||||
var serial = new byte[feature.Length];
|
||||
Array.Copy(feature, 4, serial, 0, feature.Length - 4);
|
||||
decoded.Serial = StringHandlers.CToString(serial).Trim();
|
||||
|
||||
@@ -2469,7 +2469,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0109) return null;
|
||||
|
||||
@@ -2490,7 +2490,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x010A) return null;
|
||||
|
||||
@@ -2504,7 +2504,7 @@ public static class Features
|
||||
|
||||
decoded.DCBs = new uint[feature[3] / 4];
|
||||
|
||||
for(int i = 0; i < decoded.DCBs.Length; i++)
|
||||
for(var i = 0; i < decoded.DCBs.Length; i++)
|
||||
{
|
||||
decoded.DCBs[i] = (uint)((feature[0 + 4 + i * 4] << 24) +
|
||||
(feature[1 + 4 + i * 4] << 16) +
|
||||
@@ -2521,7 +2521,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x010B) return null;
|
||||
|
||||
@@ -2544,7 +2544,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 20) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x010C) return null;
|
||||
|
||||
@@ -2573,7 +2573,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x010D) return null;
|
||||
|
||||
@@ -2606,7 +2606,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x010E) return null;
|
||||
|
||||
@@ -2629,7 +2629,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 8) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0110) return null;
|
||||
|
||||
@@ -2650,7 +2650,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 4) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0113) return null;
|
||||
|
||||
@@ -2671,7 +2671,7 @@ public static class Features
|
||||
|
||||
if(feature.Length < 6) return null;
|
||||
|
||||
ushort number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
var number = (ushort)((feature[0] << 8) + feature[1]);
|
||||
|
||||
if(number != 0x0142) return null;
|
||||
|
||||
@@ -2690,7 +2690,7 @@ public static class Features
|
||||
|
||||
if(feature[5] * 2 + 6 != feature.Length) return decoded;
|
||||
|
||||
for(int i = 0; i < feature[5]; i++)
|
||||
for(var i = 0; i < feature[5]; i++)
|
||||
decoded.Profiles[i] = (ushort)((feature[0 + 6 + 2 * i] << 8) + feature[1 + 6 + 2 * i]);
|
||||
|
||||
return decoded;
|
||||
@@ -4170,7 +4170,7 @@ public static class Features
|
||||
Feature_010C ftr = feature.Value;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
byte[] temp = new byte[4];
|
||||
var temp = new byte[4];
|
||||
temp[0] = (byte)((ftr.Century & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr.Century & 0xFF);
|
||||
temp[2] = (byte)((ftr.Year & 0xFF00) >> 8);
|
||||
@@ -4339,7 +4339,7 @@ public static class Features
|
||||
|
||||
if(ftr.Profiles == null) return sb.ToString();
|
||||
|
||||
for(int i = 0; i < ftr.Profiles.Length; i++)
|
||||
for(var i = 0; i < ftr.Profiles.Length; i++)
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Profile_0_1}[/]", i, ftr.Profiles[i]).AppendLine();
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
@@ -42,7 +42,7 @@ public static partial class Modes
|
||||
{
|
||||
public static byte[] EncodeModePage_01(ModePage_01 page)
|
||||
{
|
||||
byte[] pg = new byte[8];
|
||||
var pg = new byte[8];
|
||||
|
||||
pg[0] = 0x01;
|
||||
pg[1] = 6;
|
||||
|
||||
@@ -42,7 +42,7 @@ public static partial class Modes
|
||||
{
|
||||
public static byte[] EncodeModePage_01_MMC(ModePage_01_MMC page)
|
||||
{
|
||||
byte[] pg = new byte[12];
|
||||
var pg = new byte[12];
|
||||
|
||||
pg[0] = 0x01;
|
||||
pg[1] = 10;
|
||||
@@ -126,24 +126,24 @@ public static partial class Modes
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
string AllUsed = $"\t[green]{Localization.All_available_recovery_procedures_will_be_used}[/]\n";
|
||||
string CIRCRetriesUsed = $"\t[olive]{Localization.Only_retries_and_CIRC_are_used}[/]\n";
|
||||
string RetriesUsed = $"\t[olive]{Localization.Only_retries_are_used}[/]\n";
|
||||
string RecoveredNotReported = $"\t[red]{Localization.Recovered_errors_will_not_be_reported}[/]\n";
|
||||
string RecoveredReported = $"\t[green]{Localization.Recovered_errors_will_be_reported}[/]\n";
|
||||
var AllUsed = $"\t[green]{Localization.All_available_recovery_procedures_will_be_used}[/]\n";
|
||||
var CIRCRetriesUsed = $"\t[olive]{Localization.Only_retries_and_CIRC_are_used}[/]\n";
|
||||
var RetriesUsed = $"\t[olive]{Localization.Only_retries_are_used}[/]\n";
|
||||
var RecoveredNotReported = $"\t[red]{Localization.Recovered_errors_will_not_be_reported}[/]\n";
|
||||
var RecoveredReported = $"\t[green]{Localization.Recovered_errors_will_be_reported}[/]\n";
|
||||
|
||||
string RecoveredAbort =
|
||||
var RecoveredAbort =
|
||||
$"\t[red]{Localization.Recovered_errors_will_be_reported_and_aborted_with_CHECK_CONDITION}[/]\n";
|
||||
|
||||
string UnrecECCAbort = $"\t[red]{Localization.Unrecovered_ECC_errors_will_return_CHECK_CONDITION}[/]";
|
||||
string UnrecCIRCAbort = $"\t[red]{Localization.Unrecovered_CIRC_errors_will_return_CHECK_CONDITION}[/]";
|
||||
string UnrecECCNotAbort = $"\t[red]{Localization.Unrecovered_ECC_errors_will_not_abort_the_transfer}[/]";
|
||||
string UnrecCIRCNotAbort = $"\t[red]{Localization.Unrecovered_CIRC_errors_will_not_abort_the_transfer}[/]";
|
||||
var UnrecECCAbort = $"\t[red]{Localization.Unrecovered_ECC_errors_will_return_CHECK_CONDITION}[/]";
|
||||
var UnrecCIRCAbort = $"\t[red]{Localization.Unrecovered_CIRC_errors_will_return_CHECK_CONDITION}[/]";
|
||||
var UnrecECCNotAbort = $"\t[red]{Localization.Unrecovered_ECC_errors_will_not_abort_the_transfer}[/]";
|
||||
var UnrecCIRCNotAbort = $"\t[red]{Localization.Unrecovered_CIRC_errors_will_not_abort_the_transfer}[/]";
|
||||
|
||||
string UnrecECCAbortData =
|
||||
var UnrecECCAbortData =
|
||||
$"\t[red]{Localization.Unrecovered_ECC_errors_will_return_CHECK_CONDITION_and_the_uncorrected_data}[/]";
|
||||
|
||||
string UnrecCIRCAbortData =
|
||||
var UnrecCIRCAbortData =
|
||||
$"\t[red]{Localization.Unrecovered_CIRC_errors_will_return_CHECK_CONDITION_and_the_uncorrected_data}[/]";
|
||||
|
||||
switch(page.Parameter)
|
||||
|
||||
@@ -185,19 +185,25 @@ public static partial class Modes
|
||||
}
|
||||
|
||||
if(page.DriveStepRate > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Drive_steps_in_0_μs}[/]",
|
||||
$"[lime]{(uint)page.DriveStepRate * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page.DriveStepPulse > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Each_step_pulse_is_0_ms}[/]",
|
||||
$"[lime]{page.DriveStepPulse}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page.HeadSettleDelay > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Heads_settles_in_0_μs}[/]",
|
||||
$"[lime]{(uint)page.HeadSettleDelay * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(!page.TRDY)
|
||||
{
|
||||
@@ -238,24 +244,32 @@ public static partial class Modes
|
||||
.AppendLine();
|
||||
|
||||
if(page.WriteCompensation > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Write_pre_compensation_is_0}[/]",
|
||||
$"[lime]{page.WriteCompensation}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page.HeadLoadDelay > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Head_takes_0_ms_to_load}[/]",
|
||||
$"[lime]{page.HeadLoadDelay}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page.HeadUnloadDelay > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Head_takes_0_ms_to_unload}[/]",
|
||||
$"[lime]{page.HeadUnloadDelay}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page.MediumRotationRate > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Medium_rotates_at_0_rpm}[/]",
|
||||
$"[lime]{page.MediumRotationRate}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
switch(page.Pin34 & 0x07)
|
||||
{
|
||||
|
||||
@@ -162,14 +162,18 @@ public static partial class Modes
|
||||
}
|
||||
|
||||
if(page.SecondsPerMinute > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Each_minute_has_0_seconds}[/]",
|
||||
$"[lime]{page.SecondsPerMinute}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page.FramesPerSecond > 0)
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Each_second_has_0_frames}[/]",
|
||||
$"[lime]{page.FramesPerSecond}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -148,14 +148,18 @@ public static partial class Modes
|
||||
if(page is { Standby: true, StandbyTimer: > 0 } or { Standby_Y: true, StandbyTimer_Y: > 0 })
|
||||
{
|
||||
if(page is { Standby: true, StandbyTimer: > 0 })
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Standby_timer_Z_is_set_to_0_ms}[/]",
|
||||
$"[teal]{page.StandbyTimer * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page is { Standby_Y: true, StandbyTimer_Y: > 0 })
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Standby_timer_Y_is_set_to_0_ms}[/]",
|
||||
$"[teal]{page.StandbyTimer_Y * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
}
|
||||
else
|
||||
sb.AppendLine($"\t[red]{Localization.Drive_will_not_enter_standby_mode}[/]");
|
||||
@@ -165,19 +169,25 @@ public static partial class Modes
|
||||
or { Idle_C: true, IdleTimer_C: > 0 })
|
||||
{
|
||||
if(page is { Idle: true, IdleTimer: > 0 })
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Idle_timer_A_is_set_to_0_ms}[/]",
|
||||
$"[teal]{page.IdleTimer * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page is { Idle_B: true, IdleTimer_B: > 0 })
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Idle_timer_B_is_set_to_0_ms}[/]",
|
||||
$"[teal]{page.IdleTimer_B * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(page is { Idle_C: true, IdleTimer_C: > 0 })
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Idle_timer_C_is_set_to_0_ms}[/]",
|
||||
$"[teal]{page.IdleTimer_C * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
}
|
||||
else
|
||||
sb.AppendLine($"\t[red]{Localization.Drive_will_not_enter_idle_mode}[/]");
|
||||
|
||||
@@ -188,9 +188,11 @@ public static partial class Modes
|
||||
if(page.IntervalTimer == 0xFFFFFFFF)
|
||||
sb.AppendLine($"\t[slateblue1]{Localization.Timer_interval_is_vendor_specific}[/]");
|
||||
else
|
||||
{
|
||||
sb.AppendFormat($"\t[slateblue1]{Localization.Timer_interval_is_0_ms}[/]",
|
||||
$"[teal]{page.IntervalTimer * 100}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
if(page.ReportCount > 0)
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
namespace Aaru.Decoders.SCSI;
|
||||
|
||||
|
||||
@@ -228,8 +228,10 @@ public static partial class Modes
|
||||
if(header.Value.Speed == 0)
|
||||
sb.AppendLine($"\t[green]{Localization.Device_uses_default_speed}[/]");
|
||||
else
|
||||
{
|
||||
sb.AppendFormat($"\t[green]{Localization.Device_uses_speed_0}[/]", $"[teal]{header.Value.Speed}[/]")
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
if(header.Value.WriteProtected) sb.AppendLine($"\t[red]{Localization.Medium_is_write_protected}[/]");
|
||||
|
||||
|
||||
@@ -57,11 +57,11 @@ public struct DecodedSense
|
||||
public DescriptorSense? Descriptor;
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public readonly byte ASC => Descriptor?.ASC ?? (Fixed?.ASC ?? 0);
|
||||
public readonly byte ASC => Descriptor?.ASC ?? Fixed?.ASC ?? 0;
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public readonly byte ASCQ => Descriptor?.ASCQ ?? (Fixed?.ASCQ ?? 0);
|
||||
public readonly SenseKeys SenseKey => Descriptor?.SenseKey ?? (Fixed?.SenseKey ?? SenseKeys.NoSense);
|
||||
public readonly byte ASCQ => Descriptor?.ASCQ ?? Fixed?.ASCQ ?? 0;
|
||||
public readonly SenseKeys SenseKey => Descriptor?.SenseKey ?? Fixed?.SenseKey ?? SenseKeys.NoSense;
|
||||
public readonly string Description => Sense.GetSenseDescription(ASC, ASCQ);
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ public static class Sense
|
||||
|
||||
senseDescription = GetSenseDescription(decoded.ASC, decoded.ASCQ);
|
||||
|
||||
int offset = 8;
|
||||
var offset = 8;
|
||||
|
||||
while(offset < sense.Length)
|
||||
{
|
||||
@@ -319,7 +319,7 @@ public static class Sense
|
||||
byte descType = sense[offset];
|
||||
int descLen = sense[offset + 1] + 2;
|
||||
|
||||
byte[] desc = new byte[descLen];
|
||||
var desc = new byte[descLen];
|
||||
|
||||
if(offset + descLen >= sense.Length) descLen = sense.Length - offset;
|
||||
|
||||
@@ -466,7 +466,7 @@ public static class Sense
|
||||
{
|
||||
if(descriptor.Length != 12 || descriptor[0] != 0x00) return 0;
|
||||
|
||||
byte[] temp = new byte[8];
|
||||
var temp = new byte[8];
|
||||
|
||||
temp[0] = descriptor[11];
|
||||
temp[1] = descriptor[10];
|
||||
@@ -487,7 +487,7 @@ public static class Sense
|
||||
{
|
||||
if(descriptor.Length != 12 || descriptor[0] != 0x01) return 0;
|
||||
|
||||
byte[] temp = new byte[8];
|
||||
var temp = new byte[8];
|
||||
|
||||
temp[0] = descriptor[11];
|
||||
temp[1] = descriptor[10];
|
||||
@@ -508,7 +508,7 @@ public static class Sense
|
||||
{
|
||||
if(descriptor.Length != 8 || descriptor[0] != 0x02) return null;
|
||||
|
||||
byte[] temp = new byte[3];
|
||||
var temp = new byte[3];
|
||||
Array.Copy(descriptor, 4, temp, 0, 3);
|
||||
|
||||
return temp;
|
||||
|
||||
@@ -290,8 +290,9 @@ public static partial class Decoders
|
||||
unit = "";
|
||||
|
||||
for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1)
|
||||
if((csd.Classes & mask) == mask)
|
||||
unit += $" {cl}";
|
||||
{
|
||||
if((csd.Classes & mask) == mask) unit += $" {cl}";
|
||||
}
|
||||
|
||||
sb.AppendFormat("\t" + Localization.Device_support_command_classes_0, unit).AppendLine();
|
||||
|
||||
|
||||
@@ -52,12 +52,14 @@ public static class DMI
|
||||
|
||||
// Catalogue number is two letters, five numbers, one letter
|
||||
for(var i = 12; i < 14; i++)
|
||||
if(dmi[i] < 0x41 || dmi[i] > 0x5A)
|
||||
return false;
|
||||
{
|
||||
if(dmi[i] < 0x41 || dmi[i] > 0x5A) return false;
|
||||
}
|
||||
|
||||
for(var i = 14; i < 19; i++)
|
||||
if(dmi[i] < 0x30 || dmi[i] > 0x39)
|
||||
return false;
|
||||
{
|
||||
if(dmi[i] < 0x30 || dmi[i] > 0x39) return false;
|
||||
}
|
||||
|
||||
if(dmi[19] < 0x41 || dmi[19] > 0x5A) return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user