diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..585e7fdd
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+[*]
+charset=utf-8
+end_of_line=lf
+trim_trailing_whitespace=true
+insert_final_newline=false
+indent_style=space
+indent_size=4
+
+[{.babelrc,.stylelintrc,.eslintrc,jest.config,*.uplugin,*.bowerrc,*.jsb3,*.jsb2,*.json}]
+indent_style=space
+indent_size=2
+
+[{*.yml,*.yaml}]
+indent_style=space
+indent_size=2
+
diff --git a/DiscImageChef.Server/App_Start/Ata.cs b/DiscImageChef.Server/App_Start/Ata.cs
index fb793c88..d7072079 100644
--- a/DiscImageChef.Server/App_Start/Ata.cs
+++ b/DiscImageChef.Server/App_Start/Ata.cs
@@ -51,36 +51,36 @@ namespace DiscImageChef.Server
/// List to put key=value pairs on
/// List of tested media
public static void Report(CommonTypes.Metadata.Ata ataReport, bool cfa, bool atapi,
- ref bool removable,
- ref List ataOneValue, ref Dictionary ataTwoValue,
- ref List testedMedia)
+ ref bool removable,
+ ref List ataOneValue, ref Dictionary ataTwoValue,
+ ref List testedMedia)
{
uint logicalsectorsize = 0;
- Identify.IdentifyDevice? ataIdentifyNullable = Identify.Decode(ataReport.Identify);
- if(!ataIdentifyNullable.HasValue) return;
+ var ataIdentifyNullable = Identify.Decode(ataReport.Identify);
+ if (!ataIdentifyNullable.HasValue) return;
- Identify.IdentifyDevice ataIdentify = ataIdentifyNullable.Value;
+ var ataIdentify = ataIdentifyNullable.Value;
- if(!string.IsNullOrEmpty(ataIdentify.Model)) ataTwoValue.Add("Model", ataIdentify.Model);
- if(!string.IsNullOrEmpty(ataIdentify.FirmwareRevision))
+ if (!string.IsNullOrEmpty(ataIdentify.Model)) ataTwoValue.Add("Model", ataIdentify.Model);
+ if (!string.IsNullOrEmpty(ataIdentify.FirmwareRevision))
ataTwoValue.Add("Firmware revision", ataIdentify.FirmwareRevision);
- if(!string.IsNullOrEmpty(ataIdentify.AdditionalPID))
+ if (!string.IsNullOrEmpty(ataIdentify.AdditionalPID))
ataTwoValue.Add("Additional product ID", ataIdentify.AdditionalPID);
bool ata1 = false,
- ata2 = false,
- ata3 = false,
- ata4 = false,
- ata5 = false,
- ata6 = false,
- ata7 = false,
- acs = false,
- acs2 = false,
- acs3 = false,
- acs4 = false;
+ ata2 = false,
+ ata3 = false,
+ ata4 = false,
+ ata5 = false,
+ ata6 = false,
+ ata7 = false,
+ acs = false,
+ acs2 = false,
+ acs3 = false,
+ acs4 = false;
- if((ushort)ataIdentify.MajorVersion == 0x0000 || (ushort)ataIdentify.MajorVersion == 0xFFFF)
+ if ((ushort) ataIdentify.MajorVersion == 0x0000 || (ushort) ataIdentify.MajorVersion == 0xFFFF)
{
// Obsolete in ATA-2, if present, device supports ATA-1
ata1 |= ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FastIDE) ||
@@ -91,13 +91,13 @@ namespace DiscImageChef.Server
ataIdentify.ExtendedIdentify.HasFlag(Identify.ExtendedIdentifyBit.Words64to70Valid) ||
ataIdentify.ExtendedIdentify.HasFlag(Identify.ExtendedIdentifyBit.Word88Valid);
- if(!ata1 && !ata2 && !atapi && !cfa) ata2 = true;
+ if (!ata1 && !ata2 && !atapi && !cfa) ata2 = true;
ata4 |= atapi;
ata3 |= cfa;
- if(cfa && ata1) ata1 = false;
- if(cfa && ata2) ata2 = false;
+ if (cfa && ata1) ata1 = false;
+ if (cfa && ata2) ata2 = false;
}
else
{
@@ -108,97 +108,97 @@ namespace DiscImageChef.Server
ata5 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.AtaAtapi5);
ata6 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.AtaAtapi6);
ata7 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.AtaAtapi7);
- acs |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.Ata8ACS);
+ acs |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.Ata8ACS);
acs2 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.ACS2);
acs3 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.ACS3);
acs4 |= ataIdentify.MajorVersion.HasFlag(Identify.MajorVersionBit.ACS4);
}
- int maxatalevel = 0;
- int minatalevel = 255;
- string tmpString = "";
- if(ata1)
+ var maxatalevel = 0;
+ var minatalevel = 255;
+ var tmpString = "";
+ if (ata1)
{
- tmpString += "ATA-1 ";
- maxatalevel = 1;
- if(minatalevel > 1) minatalevel = 1;
+ tmpString += "ATA-1 ";
+ maxatalevel = 1;
+ if (minatalevel > 1) minatalevel = 1;
}
- if(ata2)
+ if (ata2)
{
- tmpString += "ATA-2 ";
- maxatalevel = 2;
- if(minatalevel > 2) minatalevel = 2;
+ tmpString += "ATA-2 ";
+ maxatalevel = 2;
+ if (minatalevel > 2) minatalevel = 2;
}
- if(ata3)
+ if (ata3)
{
- tmpString += "ATA-3 ";
- maxatalevel = 3;
- if(minatalevel > 3) minatalevel = 3;
+ tmpString += "ATA-3 ";
+ maxatalevel = 3;
+ if (minatalevel > 3) minatalevel = 3;
}
- if(ata4)
+ if (ata4)
{
- tmpString += "ATA/ATAPI-4 ";
- maxatalevel = 4;
- if(minatalevel > 4) minatalevel = 4;
+ tmpString += "ATA/ATAPI-4 ";
+ maxatalevel = 4;
+ if (minatalevel > 4) minatalevel = 4;
}
- if(ata5)
+ if (ata5)
{
- tmpString += "ATA/ATAPI-5 ";
- maxatalevel = 5;
- if(minatalevel > 5) minatalevel = 5;
+ tmpString += "ATA/ATAPI-5 ";
+ maxatalevel = 5;
+ if (minatalevel > 5) minatalevel = 5;
}
- if(ata6)
+ if (ata6)
{
- tmpString += "ATA/ATAPI-6 ";
- maxatalevel = 6;
- if(minatalevel > 6) minatalevel = 6;
+ tmpString += "ATA/ATAPI-6 ";
+ maxatalevel = 6;
+ if (minatalevel > 6) minatalevel = 6;
}
- if(ata7)
+ if (ata7)
{
- tmpString += "ATA/ATAPI-7 ";
- maxatalevel = 7;
- if(minatalevel > 7) minatalevel = 7;
+ tmpString += "ATA/ATAPI-7 ";
+ maxatalevel = 7;
+ if (minatalevel > 7) minatalevel = 7;
}
- if(acs)
+ if (acs)
{
- tmpString += "ATA8-ACS ";
- maxatalevel = 8;
- if(minatalevel > 8) minatalevel = 8;
+ tmpString += "ATA8-ACS ";
+ maxatalevel = 8;
+ if (minatalevel > 8) minatalevel = 8;
}
- if(acs2)
+ if (acs2)
{
- tmpString += "ATA8-ACS2 ";
- maxatalevel = 9;
- if(minatalevel > 9) minatalevel = 9;
+ tmpString += "ATA8-ACS2 ";
+ maxatalevel = 9;
+ if (minatalevel > 9) minatalevel = 9;
}
- if(acs3)
+ if (acs3)
{
- tmpString += "ATA8-ACS3 ";
- maxatalevel = 10;
- if(minatalevel > 10) minatalevel = 10;
+ tmpString += "ATA8-ACS3 ";
+ maxatalevel = 10;
+ if (minatalevel > 10) minatalevel = 10;
}
- if(acs4)
+ if (acs4)
{
- tmpString += "ATA8-ACS4 ";
- maxatalevel = 11;
- if(minatalevel > 11) minatalevel = 11;
+ tmpString += "ATA8-ACS4 ";
+ maxatalevel = 11;
+ if (minatalevel > 11) minatalevel = 11;
}
- if(tmpString != "") ataTwoValue.Add("Supported ATA versions", tmpString);
+ if (tmpString != "") ataTwoValue.Add("Supported ATA versions", tmpString);
- if(maxatalevel >= 3)
+ if (maxatalevel >= 3)
{
- switch(ataIdentify.MinorVersion)
+ switch (ataIdentify.MinorVersion)
{
case 0x0000:
case 0xFFFF:
@@ -351,21 +351,21 @@ namespace DiscImageChef.Server
}
tmpString = "";
- switch((ataIdentify.TransportMajorVersion & 0xF000) >> 12)
+ switch ((ataIdentify.TransportMajorVersion & 0xF000) >> 12)
{
case 0x0:
- if((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "ATA/ATAPI-7 ";
- if((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-APT ";
+ if ((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "ATA/ATAPI-7 ";
+ if ((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-APT ";
ataTwoValue.Add("Parallel ATA device", tmpString);
break;
case 0x1:
- if((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-AST ";
- if((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "SATA 1.0a ";
- if((ataIdentify.TransportMajorVersion & 0x0004) == 0x0004) tmpString += "SATA II Extensions ";
- if((ataIdentify.TransportMajorVersion & 0x0008) == 0x0008) tmpString += "SATA 2.5 ";
- if((ataIdentify.TransportMajorVersion & 0x0010) == 0x0010) tmpString += "SATA 2.6 ";
- if((ataIdentify.TransportMajorVersion & 0x0020) == 0x0020) tmpString += "SATA 3.0 ";
- if((ataIdentify.TransportMajorVersion & 0x0040) == 0x0040) tmpString += "SATA 3.1 ";
+ if ((ataIdentify.TransportMajorVersion & 0x0001) == 0x0001) tmpString += "ATA8-AST ";
+ if ((ataIdentify.TransportMajorVersion & 0x0002) == 0x0002) tmpString += "SATA 1.0a ";
+ if ((ataIdentify.TransportMajorVersion & 0x0004) == 0x0004) tmpString += "SATA II Extensions ";
+ if ((ataIdentify.TransportMajorVersion & 0x0008) == 0x0008) tmpString += "SATA 2.5 ";
+ if ((ataIdentify.TransportMajorVersion & 0x0010) == 0x0010) tmpString += "SATA 2.6 ";
+ if ((ataIdentify.TransportMajorVersion & 0x0020) == 0x0020) tmpString += "SATA 3.0 ";
+ if ((ataIdentify.TransportMajorVersion & 0x0040) == 0x0040) tmpString += "SATA 3.1 ";
ataTwoValue.Add("Serial ATA device: ", tmpString);
break;
case 0xE:
@@ -373,14 +373,14 @@ namespace DiscImageChef.Server
break;
default:
ataTwoValue.Add("Unknown transport type",
- $"0x{(ataIdentify.TransportMajorVersion & 0xF000) >> 12:X1}");
+ $"0x{(ataIdentify.TransportMajorVersion & 0xF000) >> 12:X1}");
break;
}
- if(atapi)
+ if (atapi)
{
// Bits 12 to 8, SCSI Peripheral Device Type
- switch((PeripheralDeviceTypes)(((ushort)ataIdentify.GeneralConfiguration & 0x1F00) >> 8))
+ switch ((PeripheralDeviceTypes) (((ushort) ataIdentify.GeneralConfiguration & 0x1F00) >> 8))
{
case PeripheralDeviceTypes.DirectAccess: //0x00,
ataOneValue.Add("ATAPI Direct-access device");
@@ -447,12 +447,13 @@ namespace DiscImageChef.Server
break;
default:
ataOneValue
- .Add($"ATAPI Unknown device type field value 0x{((ushort)ataIdentify.GeneralConfiguration & 0x1F00) >> 8:X2}");
+ .Add(
+ $"ATAPI Unknown device type field value 0x{((ushort) ataIdentify.GeneralConfiguration & 0x1F00) >> 8:X2}");
break;
}
// ATAPI DRQ behaviour
- switch(((ushort)ataIdentify.GeneralConfiguration & 0x60) >> 5)
+ switch (((ushort) ataIdentify.GeneralConfiguration & 0x60) >> 5)
{
case 0:
ataOneValue.Add("Device shall set DRQ within 3 ms of receiving PACKET");
@@ -465,12 +466,13 @@ namespace DiscImageChef.Server
break;
default:
ataOneValue
- .Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataIdentify.GeneralConfiguration & 0x60) >> 5}");
+ .Add(
+ $"Unknown ATAPI DRQ behaviour code {((ushort) ataIdentify.GeneralConfiguration & 0x60) >> 5}");
break;
}
// ATAPI PACKET size
- switch((ushort)ataIdentify.GeneralConfiguration & 0x03)
+ switch ((ushort) ataIdentify.GeneralConfiguration & 0x03)
{
case 0:
ataOneValue.Add("ATAPI device uses 12 byte command packet");
@@ -480,399 +482,411 @@ namespace DiscImageChef.Server
break;
default:
ataOneValue
- .Add($"Unknown ATAPI packet size code {(ushort)ataIdentify.GeneralConfiguration & 0x03}");
+ .Add($"Unknown ATAPI packet size code {(ushort) ataIdentify.GeneralConfiguration & 0x03}");
break;
}
}
- else if(!cfa)
+ else if (!cfa)
{
- if(minatalevel >= 5)
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.IncompleteResponse))
+ if (minatalevel >= 5)
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.IncompleteResponse))
ataOneValue.Add("Incomplete identify response");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NonMagnetic))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NonMagnetic))
ataOneValue.Add("Device uses non-magnetic media");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable))
ataOneValue.Add("Device is removable");
- if(minatalevel <= 5)
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Fixed))
+ if (minatalevel <= 5)
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Fixed))
ataOneValue.Add("Device is fixed");
- if(ata1)
+ if (ata1)
{
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SlowIDE))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SlowIDE))
ataOneValue.Add("Device transfer rate is <= 5 Mb/s");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FastIDE))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FastIDE))
ataOneValue.Add("Device transfer rate is > 5 Mb/s but <= 10 Mb/s");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.UltraFastIDE))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.UltraFastIDE))
ataOneValue.Add("Device transfer rate is > 10 Mb/s");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SoftSector))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SoftSector))
ataOneValue.Add("Device is soft sectored");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HardSector))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HardSector))
ataOneValue.Add("Device is hard sectored");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NotMFM))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.NotMFM))
ataOneValue.Add("Device is not MFM encoded");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FormatGapReq))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.FormatGapReq))
ataOneValue.Add("Format speed tolerance gap is required");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.TrackOffset))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.TrackOffset))
ataOneValue.Add("Track offset option is available");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.DataStrobeOffset))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.DataStrobeOffset))
ataOneValue.Add("Data strobe offset option is available");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit
- .RotationalSpeedTolerance))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit
+ .RotationalSpeedTolerance))
ataOneValue.Add("Rotational speed tolerance is higher than 0,5%");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SpindleControl))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.SpindleControl))
ataOneValue.Add("Spindle motor control is implemented");
- if(ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HighHeadSwitch))
+ if (ataIdentify.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.HighHeadSwitch))
ataOneValue.Add("Head switch time is bigger than 15 µs.");
}
}
- if((ushort)ataIdentify.SpecificConfiguration != 0x0000 &&
- (ushort)ataIdentify.SpecificConfiguration != 0xFFFF)
- switch(ataIdentify.SpecificConfiguration)
+ if ((ushort) ataIdentify.SpecificConfiguration != 0x0000 &&
+ (ushort) ataIdentify.SpecificConfiguration != 0xFFFF)
+ switch (ataIdentify.SpecificConfiguration)
{
case Identify.SpecificConfigurationEnum.RequiresSetIncompleteResponse:
ataOneValue
- .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete.");
+ .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete.");
break;
case Identify.SpecificConfigurationEnum.RequiresSetCompleteResponse:
ataOneValue
- .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete.");
+ .Add("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete.");
break;
case Identify.SpecificConfigurationEnum.NotRequiresSetIncompleteResponse:
ataOneValue
- .Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete.");
+ .Add(
+ "Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete.");
break;
case Identify.SpecificConfigurationEnum.NotRequiresSetCompleteResponse:
ataOneValue
- .Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete.");
+ .Add(
+ "Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete.");
break;
default:
ataOneValue
- .Add($"Unknown device specific configuration 0x{(ushort)ataIdentify.SpecificConfiguration:X4}");
+ .Add(
+ $"Unknown device specific configuration 0x{(ushort) ataIdentify.SpecificConfiguration:X4}");
break;
}
// Obsolete since ATA-2, however, it is yet used in ATA-8 devices
- if(ataIdentify.BufferSize != 0x0000 && ataIdentify.BufferSize != 0xFFFF &&
- ataIdentify.BufferType != 0x0000 && ataIdentify.BufferType != 0xFFFF)
- switch(ataIdentify.BufferType)
+ if (ataIdentify.BufferSize != 0x0000 && ataIdentify.BufferSize != 0xFFFF &&
+ ataIdentify.BufferType != 0x0000 && ataIdentify.BufferType != 0xFFFF)
+ switch (ataIdentify.BufferType)
{
case 1:
ataOneValue
- .Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer");
+ .Add(
+ $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer");
break;
case 2:
ataOneValue
- .Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer");
+ .Add(
+ $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer");
break;
case 3:
ataOneValue
- .Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching");
+ .Add(
+ $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching");
break;
default:
ataOneValue
- .Add($"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataIdentify.BufferType} buffer");
+ .Add(
+ $"{ataIdentify.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataIdentify.BufferType} buffer");
break;
}
ataOneValue.Add("Device capabilities:");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.StandardStanbyTimer))
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.StandardStanbyTimer))
ataOneValue.Add("Standby time values are standard");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.IORDY))
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.IORDY))
ataOneValue.Add(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.CanDisableIORDY)
- ? "IORDY is supported and can be disabled"
- : "IORDY is supported");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.DMASupport))
+ ? "IORDY is supported and can be disabled"
+ : "IORDY is supported");
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.DMASupport))
ataOneValue.Add("DMA is supported");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment1) ||
- ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment0))
- ataOneValue.Add($"Long Physical Alignment setting is {(ushort)ataIdentify.Capabilities & 0x03}");
- if(atapi)
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment1) ||
+ ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.PhysicalAlignment0))
+ ataOneValue.Add($"Long Physical Alignment setting is {(ushort) ataIdentify.Capabilities & 0x03}");
+ if (atapi)
{
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.InterleavedDMA))
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.InterleavedDMA))
ataOneValue.Add("ATAPI device supports interleaved DMA");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.CommandQueue))
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.CommandQueue))
ataOneValue.Add("ATAPI device supports command queueing");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.OverlapOperation))
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.OverlapOperation))
ataOneValue.Add("ATAPI device supports overlapped operations");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.RequiresATASoftReset))
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.RequiresATASoftReset))
ataOneValue.Add("ATAPI device requires ATA software reset");
}
- if(ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeSet) &&
- !ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeClear))
- if(ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.SpecificStandbyTimer))
+ if (ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeSet) &&
+ !ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.MustBeClear))
+ if (ataIdentify.Capabilities2.HasFlag(Identify.CapabilitiesBit2.SpecificStandbyTimer))
ataOneValue.Add("Device indicates a specific minimum standby timer value");
- if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.MultipleValid))
+ if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.MultipleValid))
{
- ataOneValue.Add($"A maximum of {ataIdentify.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE");
+ ataOneValue.Add(
+ $"A maximum of {ataIdentify.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE");
ataOneValue.Add($"Device supports setting a maximum of {ataIdentify.MultipleMaxSectors} sectors");
}
- if(ata1)
- if(ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing))
+ if (ata1)
+ if (ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing))
ataOneValue.Add("Device supports doubleword I/O");
- if(minatalevel <= 3)
+ if (minatalevel <= 3)
{
- if(ataIdentify.PIOTransferTimingMode > 0)
+ if (ataIdentify.PIOTransferTimingMode > 0)
ataTwoValue.Add("PIO timing mode", $"{ataIdentify.PIOTransferTimingMode}");
- if(ataIdentify.DMATransferTimingMode > 0)
+ if (ataIdentify.DMATransferTimingMode > 0)
ataTwoValue.Add("DMA timing mode", $"{ataIdentify.DMATransferTimingMode}");
}
tmpString = "";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode0)) tmpString += "PIO0 ";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode1)) tmpString += "PIO1 ";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode2)) tmpString += "PIO2 ";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode3)) tmpString += "PIO3 ";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode4)) tmpString += "PIO4 ";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode5)) tmpString += "PIO5 ";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode6)) tmpString += "PIO6 ";
- if(ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode7)) tmpString += "PIO7 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode0)) tmpString += "PIO0 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode1)) tmpString += "PIO1 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode2)) tmpString += "PIO2 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode3)) tmpString += "PIO3 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode4)) tmpString += "PIO4 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode5)) tmpString += "PIO5 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode6)) tmpString += "PIO6 ";
+ if (ataIdentify.APIOSupported.HasFlag(Identify.TransferMode.Mode7)) tmpString += "PIO7 ";
- if(!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Advanced PIO", tmpString);
+ if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Advanced PIO", tmpString);
- if(minatalevel <= 3 && !atapi)
+ if (minatalevel <= 3 && !atapi)
{
tmpString = "";
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode0))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode0))
{
tmpString += "DMA0 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) ";
}
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode1))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode1))
{
tmpString += "DMA1 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) ";
}
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode2))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode2))
{
tmpString += "DMA2 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) ";
}
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode3))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode3))
{
tmpString += "DMA3 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) ";
}
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode4))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode4))
{
tmpString += "DMA4 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) ";
}
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode5))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode5))
{
tmpString += "DMA5 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) ";
}
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode6))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode6))
{
tmpString += "DMA6 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) ";
}
- if(ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode7))
+ if (ataIdentify.DMASupported.HasFlag(Identify.TransferMode.Mode7))
{
tmpString += "DMA7 ";
- if(ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) ";
+ if (ataIdentify.DMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) ";
}
- if(!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Single-word DMA", tmpString);
+ if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Single-word DMA", tmpString);
}
tmpString = "";
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode0))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode0))
{
tmpString += "MDMA0 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) ";
}
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode1))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode1))
{
tmpString += "MDMA1 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) ";
}
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode2))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode2))
{
tmpString += "MDMA2 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) ";
}
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode3))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode3))
{
tmpString += "MDMA3 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) ";
}
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode4))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode4))
{
tmpString += "MDMA4 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) ";
}
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode5))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode5))
{
tmpString += "MDMA5 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) ";
}
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode6))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode6))
{
tmpString += "MDMA6 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) ";
}
- if(ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode7))
+ if (ataIdentify.MDMASupported.HasFlag(Identify.TransferMode.Mode7))
{
tmpString += "MDMA7 ";
- if(ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) ";
+ if (ataIdentify.MDMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) ";
}
- if(!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Multi-word DMA", tmpString);
+ if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Multi-word DMA", tmpString);
tmpString = "";
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode0))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode0))
{
tmpString += "UDMA0 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode0)) tmpString += "(active) ";
}
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode1))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode1))
{
tmpString += "UDMA1 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode1)) tmpString += "(active) ";
}
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode2))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode2))
{
tmpString += "UDMA2 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode2)) tmpString += "(active) ";
}
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode3))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode3))
{
tmpString += "UDMA3 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode3)) tmpString += "(active) ";
}
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode4))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode4))
{
tmpString += "UDMA4 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode4)) tmpString += "(active) ";
}
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode5))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode5))
{
tmpString += "UDMA5 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode5)) tmpString += "(active) ";
}
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode6))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode6))
{
tmpString += "UDMA6 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode6)) tmpString += "(active) ";
}
- if(ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode7))
+ if (ataIdentify.UDMASupported.HasFlag(Identify.TransferMode.Mode7))
{
tmpString += "UDMA7 ";
- if(ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) ";
+ if (ataIdentify.UDMAActive.HasFlag(Identify.TransferMode.Mode7)) tmpString += "(active) ";
}
- if(!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Ultra DMA", tmpString);
+ if (!string.IsNullOrEmpty(tmpString)) ataTwoValue.Add("Ultra DMA", tmpString);
- if(ataIdentify.MinMDMACycleTime != 0 && ataIdentify.RecMDMACycleTime != 0)
- ataOneValue.Add($"At minimum {ataIdentify.MinMDMACycleTime} ns. transfer cycle time per word in MDMA, " +
- $"{ataIdentify.RecMDMACycleTime} ns. recommended");
- if(ataIdentify.MinPIOCycleTimeNoFlow != 0)
- ataOneValue.Add($"At minimum {ataIdentify.MinPIOCycleTimeNoFlow} ns. transfer cycle time per word in PIO, " +
- "without flow control");
- if(ataIdentify.MinPIOCycleTimeFlow != 0)
- ataOneValue.Add($"At minimum {ataIdentify.MinPIOCycleTimeFlow} ns. transfer cycle time per word in PIO, " +
- "with IORDY flow control");
+ if (ataIdentify.MinMDMACycleTime != 0 && ataIdentify.RecMDMACycleTime != 0)
+ ataOneValue.Add(
+ $"At minimum {ataIdentify.MinMDMACycleTime} ns. transfer cycle time per word in MDMA, " +
+ $"{ataIdentify.RecMDMACycleTime} ns. recommended");
+ if (ataIdentify.MinPIOCycleTimeNoFlow != 0)
+ ataOneValue.Add(
+ $"At minimum {ataIdentify.MinPIOCycleTimeNoFlow} ns. transfer cycle time per word in PIO, " +
+ "without flow control");
+ if (ataIdentify.MinPIOCycleTimeFlow != 0)
+ ataOneValue.Add(
+ $"At minimum {ataIdentify.MinPIOCycleTimeFlow} ns. transfer cycle time per word in PIO, " +
+ "with IORDY flow control");
- if(ataIdentify.MaxQueueDepth != 0)
+ if (ataIdentify.MaxQueueDepth != 0)
ataOneValue.Add($"{ataIdentify.MaxQueueDepth + 1} depth of queue maximum");
- if(atapi)
+ if (atapi)
{
- if(ataIdentify.PacketBusRelease != 0)
+ if (ataIdentify.PacketBusRelease != 0)
ataOneValue
- .Add($"{ataIdentify.PacketBusRelease} ns. typical to release bus from receipt of PACKET");
- if(ataIdentify.ServiceBusyClear != 0)
+ .Add($"{ataIdentify.PacketBusRelease} ns. typical to release bus from receipt of PACKET");
+ if (ataIdentify.ServiceBusyClear != 0)
ataOneValue
- .Add($"{ataIdentify.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE");
+ .Add($"{ataIdentify.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE");
}
- if((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 ||
- (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE)
+ if ((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 ||
+ (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE)
{
- if(!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear))
+ if (!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear))
{
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen1Speed))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen1Speed))
ataOneValue.Add("SATA 1.5Gb/s is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen2Speed))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen2Speed))
ataOneValue.Add("SATA 3.0Gb/s is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen3Speed))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Gen3Speed))
ataOneValue.Add("SATA 6.0Gb/s is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PowerReceipt))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PowerReceipt))
ataOneValue.Add("Receipt of host initiated power management requests is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PHYEventCounter))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.PHYEventCounter))
ataOneValue.Add("PHY Event counters are supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.HostSlumbTrans))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.HostSlumbTrans))
ataOneValue.Add("Supports host automatic partial to slumber transitions is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.DevSlumbTrans))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.DevSlumbTrans))
ataOneValue.Add("Supports device automatic partial to slumber transitions is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ))
{
ataOneValue.Add("NCQ is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQPriority))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQPriority))
ataOneValue.Add("NCQ priority is supported");
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.UnloadNCQ))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.UnloadNCQ))
ataOneValue.Add("Unload is supported with outstanding NCQ commands");
}
}
- if(!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear))
+ if (!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear))
{
- if(!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear) &&
- ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ))
+ if (!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear) &&
+ ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.NCQ))
{
- if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQMgmt))
+ if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQMgmt))
ataOneValue.Add("NCQ queue management is supported");
- if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQStream))
+ if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.NCQStream))
ataOneValue.Add("NCQ streaming is supported");
}
- if(atapi)
+ if (atapi)
{
- if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.HostEnvDetect))
+ if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.HostEnvDetect))
ataOneValue.Add("ATAPI device supports host environment detection");
- if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.DevAttSlimline))
+ if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.DevAttSlimline))
ataOneValue.Add("ATAPI device supports attention on slimline connected devices");
}
}
}
- if(ataIdentify.InterseekDelay != 0x0000 && ataIdentify.InterseekDelay != 0xFFFF)
- ataOneValue.Add($"{ataIdentify.InterseekDelay} microseconds of interseek delay for ISO-7779 accoustic testing");
+ if (ataIdentify.InterseekDelay != 0x0000 && ataIdentify.InterseekDelay != 0xFFFF)
+ ataOneValue.Add(
+ $"{ataIdentify.InterseekDelay} microseconds of interseek delay for ISO-7779 accoustic testing");
- if((ushort)ataIdentify.DeviceFormFactor != 0x0000 && (ushort)ataIdentify.DeviceFormFactor != 0xFFFF)
- switch(ataIdentify.DeviceFormFactor)
+ if ((ushort) ataIdentify.DeviceFormFactor != 0x0000 && (ushort) ataIdentify.DeviceFormFactor != 0xFFFF)
+ switch (ataIdentify.DeviceFormFactor)
{
case Identify.DeviceFormFactorEnum.FiveAndQuarter:
ataOneValue.Add("Device nominal size is 5.25\"");
@@ -894,420 +908,424 @@ namespace DiscImageChef.Server
break;
}
- if(atapi)
- if(ataIdentify.ATAPIByteCount > 0)
+ if (atapi)
+ if (ataIdentify.ATAPIByteCount > 0)
ataOneValue.Add($"{ataIdentify.ATAPIByteCount} bytes count limit for ATAPI");
- if(cfa)
- if((ataIdentify.CFAPowerMode & 0x8000) == 0x8000)
+ if (cfa)
+ if ((ataIdentify.CFAPowerMode & 0x8000) == 0x8000)
{
ataOneValue.Add("CompactFlash device supports power mode 1");
- if((ataIdentify.CFAPowerMode & 0x2000) == 0x2000)
+ if ((ataIdentify.CFAPowerMode & 0x2000) == 0x2000)
ataOneValue.Add("CompactFlash power mode 1 required for one or more commands");
- if((ataIdentify.CFAPowerMode & 0x1000) == 0x1000)
+ if ((ataIdentify.CFAPowerMode & 0x1000) == 0x1000)
ataOneValue.Add("CompactFlash power mode 1 is disabled");
ataOneValue.Add($"CompactFlash device uses a maximum of {ataIdentify.CFAPowerMode & 0x0FFF} mA");
}
ataOneValue.Add("Command set and features:");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Nop))
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Nop))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Nop)
- ? "NOP is supported and enabled"
- : "NOP is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.ReadBuffer))
+ ? "NOP is supported and enabled"
+ : "NOP is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.ReadBuffer))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.ReadBuffer)
- ? "READ BUFFER is supported and enabled"
- : "READ BUFFER is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteBuffer))
+ ? "READ BUFFER is supported and enabled"
+ : "READ BUFFER is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteBuffer))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.WriteBuffer)
- ? "WRITE BUFFER is supported and enabled"
- : "WRITE BUFFER is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.HPA))
+ ? "WRITE BUFFER is supported and enabled"
+ : "WRITE BUFFER is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.HPA))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.HPA)
- ? "Host Protected Area is supported and enabled"
- : "Host Protected Area is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.DeviceReset))
+ ? "Host Protected Area is supported and enabled"
+ : "Host Protected Area is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.DeviceReset))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.DeviceReset)
- ? "DEVICE RESET is supported and enabled"
- : "DEVICE RESET is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Service))
+ ? "DEVICE RESET is supported and enabled"
+ : "DEVICE RESET is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Service))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Service)
- ? "SERVICE interrupt is supported and enabled"
- : "SERVICE interrupt is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Release))
+ ? "SERVICE interrupt is supported and enabled"
+ : "SERVICE interrupt is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Release))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Release)
- ? "Release is supported and enabled"
- : "Release is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.LookAhead))
+ ? "Release is supported and enabled"
+ : "Release is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.LookAhead))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.LookAhead)
- ? "Look-ahead read is supported and enabled"
- : "Look-ahead read is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteCache))
+ ? "Look-ahead read is supported and enabled"
+ : "Look-ahead read is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.WriteCache))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.WriteCache)
- ? "Write cache is supported and enabled"
- : "Write cache is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Packet))
+ ? "Write cache is supported and enabled"
+ : "Write cache is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.Packet))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.Packet)
- ? "PACKET is supported and enabled"
- : "PACKET is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.PowerManagement))
+ ? "PACKET is supported and enabled"
+ : "PACKET is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.PowerManagement))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.PowerManagement)
- ? "Power management is supported and enabled"
- : "Power management is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.RemovableMedia))
+ ? "Power management is supported and enabled"
+ : "Power management is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.RemovableMedia))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.RemovableMedia)
- ? "Removable media feature set is supported and enabled"
- : "Removable media feature set is supported");
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SecurityMode))
+ ? "Removable media feature set is supported and enabled"
+ : "Removable media feature set is supported");
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SecurityMode))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.SecurityMode)
- ? "Security mode is supported and enabled"
- : "Security mode is supported");
- if(ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
+ ? "Security mode is supported and enabled"
+ : "Security mode is supported");
+ if (ataIdentify.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
ataOneValue.Add("28-bit LBA is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeSet) &&
- !ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeClear))
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeSet) &&
+ !ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.MustBeClear))
{
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48))
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)
- ? "48-bit LBA is supported and enabled"
- : "48-bit LBA is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCache))
+ ? "48-bit LBA is supported and enabled"
+ : "48-bit LBA is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCache))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.FlushCache)
- ? "FLUSH CACHE is supported and enabled"
- : "FLUSH CACHE is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCacheExt))
+ ? "FLUSH CACHE is supported and enabled"
+ : "FLUSH CACHE is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.FlushCacheExt))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.FlushCacheExt)
- ? "FLUSH CACHE EXT is supported and enabled"
- : "FLUSH CACHE EXT is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DCO))
+ ? "FLUSH CACHE EXT is supported and enabled"
+ : "FLUSH CACHE EXT is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DCO))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.DCO)
- ? "Device Configuration Overlay feature set is supported and enabled"
- : "Device Configuration Overlay feature set is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AAM))
+ ? "Device Configuration Overlay feature set is supported and enabled"
+ : "Device Configuration Overlay feature set is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AAM))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.AAM)
- ? $"Automatic Acoustic Management is supported and enabled with value {ataIdentify.CurrentAAM} (vendor recommends {ataIdentify.RecommendedAAM}"
- : "Automatic Acoustic Management is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetMax))
+ ? $"Automatic Acoustic Management is supported and enabled with value {ataIdentify.CurrentAAM} (vendor recommends {ataIdentify.RecommendedAAM}"
+ : "Automatic Acoustic Management is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetMax))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.SetMax)
- ? "SET MAX security extension is supported and enabled"
- : "SET MAX security extension is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AddressOffsetReservedAreaBoot))
+ ? "SET MAX security extension is supported and enabled"
+ : "SET MAX security extension is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.AddressOffsetReservedAreaBoot))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2
- .AddressOffsetReservedAreaBoot)
- ? "Address Offset Reserved Area Boot is supported and enabled"
- : "Address Offset Reserved Area Boot is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetFeaturesRequired))
+ .AddressOffsetReservedAreaBoot)
+ ? "Address Offset Reserved Area Boot is supported and enabled"
+ : "Address Offset Reserved Area Boot is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.SetFeaturesRequired))
ataOneValue.Add("SET FEATURES is required before spin-up");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.PowerUpInStandby))
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.PowerUpInStandby))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.PowerUpInStandby)
- ? "Power-up in standby is supported and enabled"
- : "Power-up in standby is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RemovableNotification))
+ ? "Power-up in standby is supported and enabled"
+ : "Power-up in standby is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RemovableNotification))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2
- .RemovableNotification)
- ? "Removable Media Status Notification is supported and enabled"
- : "Removable Media Status Notification is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.APM))
+ .RemovableNotification)
+ ? "Removable Media Status Notification is supported and enabled"
+ : "Removable Media Status Notification is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.APM))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.APM)
- ? $"Advanced Power Management is supported and enabled with value {ataIdentify.CurrentAPM}"
- : "Advanced Power Management is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.CompactFlash))
+ ? $"Advanced Power Management is supported and enabled with value {ataIdentify.CurrentAPM}"
+ : "Advanced Power Management is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.CompactFlash))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.CompactFlash)
- ? "CompactFlash feature set is supported and enabled"
- : "CompactFlash feature set is supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RWQueuedDMA))
+ ? "CompactFlash feature set is supported and enabled"
+ : "CompactFlash feature set is supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.RWQueuedDMA))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.RWQueuedDMA)
- ? "READ DMA QUEUED and WRITE DMA QUEUED are supported and enabled"
- : "READ DMA QUEUED and WRITE DMA QUEUED are supported");
- if(ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DownloadMicrocode))
+ ? "READ DMA QUEUED and WRITE DMA QUEUED are supported and enabled"
+ : "READ DMA QUEUED and WRITE DMA QUEUED are supported");
+ if (ataIdentify.CommandSet2.HasFlag(Identify.CommandSetBit2.DownloadMicrocode))
ataOneValue.Add(ataIdentify.EnabledCommandSet2.HasFlag(Identify.CommandSetBit2.DownloadMicrocode)
- ? "DOWNLOAD MICROCODE is supported and enabled"
- : "DOWNLOAD MICROCODE is supported");
+ ? "DOWNLOAD MICROCODE is supported and enabled"
+ : "DOWNLOAD MICROCODE is supported");
}
- if(ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SMART))
+ if (ataIdentify.CommandSet.HasFlag(Identify.CommandSetBit.SMART))
ataOneValue.Add(ataIdentify.EnabledCommandSet.HasFlag(Identify.CommandSetBit.SMART)
- ? "S.M.A.R.T. is supported and enabled"
- : "S.M.A.R.T. is supported");
+ ? "S.M.A.R.T. is supported and enabled"
+ : "S.M.A.R.T. is supported");
- if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported))
+ if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported))
ataOneValue.Add("S.M.A.R.T. Command Transport is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) &&
- !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear))
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) &&
+ !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear))
{
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTSelfTest))
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTSelfTest))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.SMARTSelfTest)
- ? "S.M.A.R.T. self-testing is supported and enabled"
- : "S.M.A.R.T. self-testing is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTLog))
+ ? "S.M.A.R.T. self-testing is supported and enabled"
+ : "S.M.A.R.T. self-testing is supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.SMARTLog))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.SMARTLog)
- ? "S.M.A.R.T. error logging is supported and enabled"
- : "S.M.A.R.T. error logging is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.IdleImmediate))
+ ? "S.M.A.R.T. error logging is supported and enabled"
+ : "S.M.A.R.T. error logging is supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.IdleImmediate))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.IdleImmediate)
- ? "IDLE IMMEDIATE with UNLOAD FEATURE is supported and enabled"
- : "IDLE IMMEDIATE with UNLOAD FEATURE is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WriteURG))
+ ? "IDLE IMMEDIATE with UNLOAD FEATURE is supported and enabled"
+ : "IDLE IMMEDIATE with UNLOAD FEATURE is supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WriteURG))
ataOneValue.Add("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.ReadURG))
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.ReadURG))
ataOneValue.Add("URG bit is supported in READ STREAM DMA EXT and READ STREAM EXT");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WWN))
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.WWN))
ataOneValue.Add("Device has a World Wide Name");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWriteQ))
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWriteQ))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.FUAWriteQ)
- ? "WRITE DMA QUEUED FUA EXT is supported and enabled"
- : "WRITE DMA QUEUED FUA EXT is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWrite))
+ ? "WRITE DMA QUEUED FUA EXT is supported and enabled"
+ : "WRITE DMA QUEUED FUA EXT is supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.FUAWrite))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.FUAWrite)
- ? "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported and enabled"
- : "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.GPL))
+ ? "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported and enabled"
+ : "WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.GPL))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.GPL)
- ? "General Purpose Logging is supported and enabled"
- : "General Purpose Logging is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming))
+ ? "General Purpose Logging is supported and enabled"
+ : "General Purpose Logging is supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.Streaming)
- ? "Streaming feature set is supported and enabled"
- : "Streaming feature set is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MCPT))
+ ? "Streaming feature set is supported and enabled"
+ : "Streaming feature set is supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MCPT))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MCPT)
- ? "Media Card Pass Through command set is supported and enabled"
- : "Media Card Pass Through command set is supported");
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial))
+ ? "Media Card Pass Through command set is supported and enabled"
+ : "Media Card Pass Through command set is supported");
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial))
ataOneValue.Add(ataIdentify.EnabledCommandSet3.HasFlag(Identify.CommandSetBit3.MediaSerial)
- ? "Media Serial is supported and valid"
- : "Media Serial is supported");
+ ? "Media Serial is supported and valid"
+ : "Media Serial is supported");
}
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeSet) &&
- !ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeClear))
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeSet) &&
+ !ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.MustBeClear))
{
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DSN))
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DSN))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.DSN)
- ? "DSN feature set is supported and enabled"
- : "DSN feature set is supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.AMAC))
+ ? "DSN feature set is supported and enabled"
+ : "DSN feature set is supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.AMAC))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.AMAC)
- ? "Accessible Max Address Configuration is supported and enabled"
- : "Accessible Max Address Configuration is supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtPowerCond))
+ ? "Accessible Max Address Configuration is supported and enabled"
+ : "Accessible Max Address Configuration is supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtPowerCond))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.ExtPowerCond)
- ? "Extended Power Conditions are supported and enabled"
- : "Extended Power Conditions are supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtStatusReport))
+ ? "Extended Power Conditions are supported and enabled"
+ : "Extended Power Conditions are supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.ExtStatusReport))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.ExtStatusReport)
- ? "Extended Status Reporting is supported and enabled"
- : "Extended Status Reporting is supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.FreeFallControl))
+ ? "Extended Status Reporting is supported and enabled"
+ : "Extended Status Reporting is supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.FreeFallControl))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.FreeFallControl)
- ? "Free-fall control feature set is supported and enabled"
- : "Free-fall control feature set is supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.SegmentedDownloadMicrocode))
+ ? "Free-fall control feature set is supported and enabled"
+ : "Free-fall control feature set is supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.SegmentedDownloadMicrocode))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4
- .SegmentedDownloadMicrocode)
- ? "Segmented feature in DOWNLOAD MICROCODE is supported and enabled"
- : "Segmented feature in DOWNLOAD MICROCODE is supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.RWDMAExtGpl))
+ .SegmentedDownloadMicrocode)
+ ? "Segmented feature in DOWNLOAD MICROCODE is supported and enabled"
+ : "Segmented feature in DOWNLOAD MICROCODE is supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.RWDMAExtGpl))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.RWDMAExtGpl)
- ? "READ/WRITE DMA EXT GPL are supported and enabled"
- : "READ/WRITE DMA EXT GPL are supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WriteUnc))
+ ? "READ/WRITE DMA EXT GPL are supported and enabled"
+ : "READ/WRITE DMA EXT GPL are supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WriteUnc))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WriteUnc)
- ? "WRITE UNCORRECTABLE is supported and enabled"
- : "WRITE UNCORRECTABLE is supported");
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WRV))
+ ? "WRITE UNCORRECTABLE is supported and enabled"
+ : "WRITE UNCORRECTABLE is supported");
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.WRV))
{
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WRV)
- ? "Write/Read/Verify is supported and enabled"
- : "Write/Read/Verify is supported");
+ ? "Write/Read/Verify is supported and enabled"
+ : "Write/Read/Verify is supported");
ataOneValue.Add($"{ataIdentify.WRVSectorCountMode2} sectors for Write/Read/Verify mode 2");
ataOneValue.Add($"{ataIdentify.WRVSectorCountMode3} sectors for Write/Read/Verify mode 3");
- if(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WRV))
+ if (ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.WRV))
ataOneValue.Add($"Current Write/Read/Verify mode: {ataIdentify.WRVMode}");
}
- if(ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DT1825))
+ if (ataIdentify.CommandSet4.HasFlag(Identify.CommandSetBit4.DT1825))
ataOneValue.Add(ataIdentify.EnabledCommandSet4.HasFlag(Identify.CommandSetBit4.DT1825)
- ? "DT1825 is supported and enabled"
- : "DT1825 is supported");
+ ? "DT1825 is supported and enabled"
+ : "DT1825 is supported");
}
- if(true)
+ if (true)
{
- if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.BlockErase))
+ if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.BlockErase))
ataOneValue.Add("BLOCK ERASE EXT is supported");
- if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Overwrite))
+ if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Overwrite))
ataOneValue.Add("OVERWRITE EXT is supported");
- if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.CryptoScramble))
+ if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.CryptoScramble))
ataOneValue.Add("CRYPTO SCRAMBLE EXT is supported");
}
- if(true)
+ if (true)
{
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeviceConfDMA))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeviceConfDMA))
ataOneValue.Add("DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadBufferDMA))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadBufferDMA))
ataOneValue.Add("READ BUFFER DMA is supported");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.WriteBufferDMA))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.WriteBufferDMA))
ataOneValue.Add("WRITE BUFFER DMA is supported");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DownloadMicroCodeDMA))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DownloadMicroCodeDMA))
ataOneValue.Add("DOWNLOAD MICROCODE DMA is supported");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.SetMaxDMA))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.SetMaxDMA))
ataOneValue.Add("SET PASSWORD DMA and SET UNLOCK DMA are supported");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Ata28))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Ata28))
ataOneValue.Add("Not all 28-bit commands are supported");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.CFast))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.CFast))
ataOneValue.Add("Device follows CFast specification");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.IEEE1667))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.IEEE1667))
ataOneValue.Add("Device follows IEEE-1667");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeterministicTrim))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.DeterministicTrim))
{
ataOneValue.Add("Read after TRIM is deterministic");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadZeroTrim))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ReadZeroTrim))
ataOneValue.Add("Read after TRIM returns empty data");
}
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.LongPhysSectorAligError))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.LongPhysSectorAligError))
ataOneValue.Add("Device supports Long Physical Sector Alignment Error Reporting Control");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Encrypted))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.Encrypted))
ataOneValue.Add("Device encrypts all user data");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.AllCacheNV))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.AllCacheNV))
ataOneValue.Add("Device's write cache is non-volatile");
- if(ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit0) ||
- ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit1))
+ if (ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit0) ||
+ ataIdentify.CommandSet5.HasFlag(Identify.CommandSetBit5.ZonedBit1))
ataOneValue.Add("Device is zoned");
}
- if(true)
- if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Sanitize))
+ if (true)
+ if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.Sanitize))
{
ataOneValue.Add("Sanitize feature set is supported");
ataOneValue.Add(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.SanitizeCommands)
- ? "Sanitize commands are specified by ACS-3 or higher"
- : "Sanitize commands are specified by ACS-2");
+ ? "Sanitize commands are specified by ACS-3 or higher"
+ : "Sanitize commands are specified by ACS-2");
- if(ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.SanitizeAntifreeze))
+ if (ataIdentify.Capabilities3.HasFlag(Identify.CapabilitiesBit3.SanitizeAntifreeze))
ataOneValue.Add("SANITIZE ANTIFREEZE LOCK EXT is supported");
}
- if(!ata1 && maxatalevel >= 8)
- if(ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Set) &&
- !ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Clear) &&
- ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing))
+ if (!ata1 && maxatalevel >= 8)
+ if (ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Set) &&
+ !ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.Clear) &&
+ ataIdentify.TrustedComputing.HasFlag(Identify.TrustedComputingBit.TrustedComputing))
ataOneValue.Add("Trusted Computing feature set is supported");
- if((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 ||
- (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE)
+ if ((ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0x1 ||
+ (ataIdentify.TransportMajorVersion & 0xF000) >> 12 == 0xE)
{
- if(true)
- if(!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear))
- if(ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.ReadLogDMAExt))
+ if (true)
+ if (!ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.Clear))
+ if (ataIdentify.SATACapabilities.HasFlag(Identify.SATACapabilitiesBit.ReadLogDMAExt))
ataOneValue.Add("READ LOG DMA EXT is supported");
- if(true)
- if(!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear))
- if(ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.FPDMAQ))
+ if (true)
+ if (!ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.Clear))
+ if (ataIdentify.SATACapabilities2.HasFlag(Identify.SATACapabilitiesBit2.FPDMAQ))
ataOneValue.Add("RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED are supported");
- if(true)
- if(!ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.Clear))
+ if (true)
+ if (!ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.Clear))
{
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NonZeroBufferOffset))
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NonZeroBufferOffset))
ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit
- .NonZeroBufferOffset)
- ? "Non-zero buffer offsets are supported and enabled"
- : "Non-zero buffer offsets are supported");
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.DMASetup))
+ .NonZeroBufferOffset)
+ ? "Non-zero buffer offsets are supported and enabled"
+ : "Non-zero buffer offsets are supported");
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.DMASetup))
ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.DMASetup)
- ? "DMA Setup auto-activation is supported and enabled"
- : "DMA Setup auto-activation is supported");
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InitPowerMgmt))
+ ? "DMA Setup auto-activation is supported and enabled"
+ : "DMA Setup auto-activation is supported");
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InitPowerMgmt))
ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit
- .InitPowerMgmt)
- ? "Device-initiated power management is supported and enabled"
- : "Device-initiated power management is supported");
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InOrderData))
+ .InitPowerMgmt)
+ ? "Device-initiated power management is supported and enabled"
+ : "Device-initiated power management is supported");
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.InOrderData))
ataOneValue.Add(ataIdentify.EnabledSATAFeatures
- .HasFlag(Identify.SATAFeaturesBit.InOrderData)
- ? "In-order data delivery is supported and enabled"
- : "In-order data delivery is supported");
- if(!atapi)
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.HardwareFeatureControl))
+ .HasFlag(Identify.SATAFeaturesBit.InOrderData)
+ ? "In-order data delivery is supported and enabled"
+ : "In-order data delivery is supported");
+ if (!atapi)
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.HardwareFeatureControl))
ataOneValue.Add(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit
- .HardwareFeatureControl)
- ? "Hardware Feature Control is supported and enabled"
- : "Hardware Feature Control is supported");
- if(atapi)
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification))
- if(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification))
+ .HardwareFeatureControl)
+ ? "Hardware Feature Control is supported and enabled"
+ : "Hardware Feature Control is supported");
+ if (atapi)
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification))
+ if (ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.AsyncNotification))
ataOneValue.Add("Asynchronous notification is supported");
else
ataOneValue.Add("Asynchronous notification is supported");
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve))
- if(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve))
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve))
+ if (ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.SettingsPreserve))
ataOneValue.Add("Software Settings Preservation is supported");
else
ataOneValue.Add("Software Settings Preservation is supported");
- if(ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NCQAutoSense))
+ if (ataIdentify.SATAFeatures.HasFlag(Identify.SATAFeaturesBit.NCQAutoSense))
ataOneValue.Add("NCQ Autosense is supported");
- if(ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.EnabledSlumber))
+ if (ataIdentify.EnabledSATAFeatures.HasFlag(Identify.SATAFeaturesBit.EnabledSlumber))
ataOneValue.Add("Automatic Partial to Slumber transitions are enabled");
}
}
- if((ataIdentify.RemovableStatusSet & 0x03) > 0)
+ if ((ataIdentify.RemovableStatusSet & 0x03) > 0)
ataOneValue.Add("Removable Media Status Notification feature set is supported");
- if(ataIdentify.FreeFallSensitivity != 0x00 && ataIdentify.FreeFallSensitivity != 0xFF)
+ if (ataIdentify.FreeFallSensitivity != 0x00 && ataIdentify.FreeFallSensitivity != 0xFF)
ataOneValue.Add($"Free-fall sensitivity set to {ataIdentify.FreeFallSensitivity}");
- if(ataIdentify.DataSetMgmt.HasFlag(Identify.DataSetMgmtBit.Trim)) ataOneValue.Add("TRIM is supported");
- if(ataIdentify.DataSetMgmtSize > 0)
- ataOneValue.Add($"DATA SET MANAGEMENT can receive a maximum of {ataIdentify.DataSetMgmtSize} blocks of 512 bytes");
+ if (ataIdentify.DataSetMgmt.HasFlag(Identify.DataSetMgmtBit.Trim)) ataOneValue.Add("TRIM is supported");
+ if (ataIdentify.DataSetMgmtSize > 0)
+ ataOneValue.Add(
+ $"DATA SET MANAGEMENT can receive a maximum of {ataIdentify.DataSetMgmtSize} blocks of 512 bytes");
- if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Supported))
+ if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Supported))
{
ataOneValue.Add("Security:");
- if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enabled))
+ if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enabled))
{
ataOneValue.Add("Security is enabled");
ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Locked)
- ? "Security is locked"
- : "Security is not locked");
+ ? "Security is locked"
+ : "Security is not locked");
ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Frozen)
- ? "Security is frozen"
- : "Security is not frozen");
+ ? "Security is frozen"
+ : "Security is not frozen");
ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Expired)
- ? "Security count has expired"
- : "Security count has notexpired");
+ ? "Security count has expired"
+ : "Security count has notexpired");
ataOneValue.Add(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Maximum)
- ? "Security level is maximum"
- : "Security level is high");
+ ? "Security level is maximum"
+ : "Security level is high");
+ }
+ else
+ {
+ ataOneValue.Add("Security is not enabled");
}
- else ataOneValue.Add("Security is not enabled");
- if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced))
+ if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced))
ataOneValue.Add("Supports enhanced security erase");
ataOneValue.Add($"{ataIdentify.SecurityEraseTime * 2} minutes to complete secure erase");
- if(ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced))
+ if (ataIdentify.SecurityStatus.HasFlag(Identify.SecurityStatusBit.Enhanced))
ataOneValue
- .Add($"{ataIdentify.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase");
+ .Add($"{ataIdentify.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase");
ataOneValue.Add($"Master password revision code: {ataIdentify.MasterPasswordRevisionCode}");
}
- if(ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) &&
- !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) &&
- ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming))
+ if (ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeSet) &&
+ !ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.MustBeClear) &&
+ ataIdentify.CommandSet3.HasFlag(Identify.CommandSetBit3.Streaming))
{
ataOneValue.Add("Streaming:");
ataOneValue.Add($"Minimum request size is {ataIdentify.StreamMinReqSize}");
@@ -1317,30 +1335,30 @@ namespace DiscImageChef.Server
ataOneValue.Add($"Streaming performance granularity is {ataIdentify.StreamPerformanceGranularity}");
}
- if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported))
+ if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.Supported))
{
ataOneValue.Add("S.M.A.R.T. Command Transport (SCT):");
- if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.LongSectorAccess))
+ if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.LongSectorAccess))
ataOneValue.Add("SCT Long Sector Address is supported");
- if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.WriteSame))
+ if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.WriteSame))
ataOneValue.Add("SCT Write Same is supported");
- if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.ErrorRecoveryControl))
+ if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.ErrorRecoveryControl))
ataOneValue.Add("SCT Error Recovery Control is supported");
- if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.FeaturesControl))
+ if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.FeaturesControl))
ataOneValue.Add("SCT Features Control is supported");
- if(ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.DataTables))
+ if (ataIdentify.SCTCommandTransport.HasFlag(Identify.SCTCommandTransportBit.DataTables))
ataOneValue.Add("SCT Data Tables are supported");
}
- if((ataIdentify.NVCacheCaps & 0x0010) == 0x0010)
+ if ((ataIdentify.NVCacheCaps & 0x0010) == 0x0010)
{
ataOneValue.Add("Non-Volatile Cache:");
ataOneValue.Add($"Version {(ataIdentify.NVCacheCaps & 0xF000) >> 12}");
- if((ataIdentify.NVCacheCaps & 0x0001) == 0x0001)
+ if ((ataIdentify.NVCacheCaps & 0x0001) == 0x0001)
{
ataOneValue.Add((ataIdentify.NVCacheCaps & 0x0002) == 0x0002
- ? "Power mode feature set is supported and enabled"
- : "Power mode feature set is supported");
+ ? "Power mode feature set is supported and enabled"
+ : "Power mode feature set is supported");
ataOneValue.Add($"Version {(ataIdentify.NVCacheCaps & 0x0F00) >> 8}");
}
@@ -1348,151 +1366,155 @@ namespace DiscImageChef.Server
ataOneValue.Add($"Non-Volatile Cache is {ataIdentify.NVCacheSize * logicalsectorsize} bytes");
}
- if(ataReport.ReadCapabilities != null)
+ if (ataReport.ReadCapabilities != null)
{
removable = false;
ataOneValue.Add("");
- if(ataReport.ReadCapabilities.NominalRotationRate != null &&
- ataReport.ReadCapabilities.NominalRotationRate != 0x0000 &&
- ataReport.ReadCapabilities.NominalRotationRate != 0xFFFF)
+ if (ataReport.ReadCapabilities.NominalRotationRate != null &&
+ ataReport.ReadCapabilities.NominalRotationRate != 0x0000 &&
+ ataReport.ReadCapabilities.NominalRotationRate != 0xFFFF)
ataOneValue.Add(ataReport.ReadCapabilities.NominalRotationRate == 0x0001
- ? "Device does not rotate."
- : $"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm");
+ ? "Device does not rotate."
+ : $"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm");
- if(!atapi)
+ if (!atapi)
{
- if(ataReport.ReadCapabilities.BlockSize != null)
+ if (ataReport.ReadCapabilities.BlockSize != null)
{
ataTwoValue.Add("Logical sector size", $"{ataReport.ReadCapabilities.BlockSize} bytes");
logicalsectorsize = ataReport.ReadCapabilities.BlockSize.Value;
}
- if(ataReport.ReadCapabilities.PhysicalBlockSize != null)
+ if (ataReport.ReadCapabilities.PhysicalBlockSize != null)
ataTwoValue.Add("Physical sector size",
- $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes");
- if(ataReport.ReadCapabilities.LongBlockSize != null)
+ $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes");
+ if (ataReport.ReadCapabilities.LongBlockSize != null)
ataTwoValue.Add("READ LONG sector size", $"{ataReport.ReadCapabilities.LongBlockSize} bytes");
- if(ataReport.ReadCapabilities.BlockSize != null &&
- ataReport.ReadCapabilities.PhysicalBlockSize != null &&
- ataReport.ReadCapabilities.BlockSize.Value !=
- ataReport.ReadCapabilities.PhysicalBlockSize.Value &&
- (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 &&
- (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000)
+ if (ataReport.ReadCapabilities.BlockSize != null &&
+ ataReport.ReadCapabilities.PhysicalBlockSize != null &&
+ ataReport.ReadCapabilities.BlockSize.Value !=
+ ataReport.ReadCapabilities.PhysicalBlockSize.Value &&
+ (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 &&
+ (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000)
ataOneValue
- .Add($"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector");
+ .Add(
+ $"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector");
- if(ataReport.ReadCapabilities.CHS != null && ataReport.ReadCapabilities.CurrentCHS != null)
+ if (ataReport.ReadCapabilities.CHS != null && ataReport.ReadCapabilities.CurrentCHS != null)
{
- int currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders *
- ataReport.ReadCapabilities.CurrentCHS.Heads *
+ var currentSectors = ataReport.ReadCapabilities.CurrentCHS.Cylinders *
+ ataReport.ReadCapabilities.CurrentCHS.Heads *
ataReport.ReadCapabilities.CurrentCHS.Sectors;
ataTwoValue.Add("Cylinders",
- $"{ataReport.ReadCapabilities.CHS.Cylinders} max., {ataReport.ReadCapabilities.CurrentCHS.Cylinders} current");
+ $"{ataReport.ReadCapabilities.CHS.Cylinders} max., {ataReport.ReadCapabilities.CurrentCHS.Cylinders} current");
ataTwoValue.Add("Heads",
- $"{ataReport.ReadCapabilities.CHS.Heads} max., {ataReport.ReadCapabilities.CurrentCHS.Heads} current");
+ $"{ataReport.ReadCapabilities.CHS.Heads} max., {ataReport.ReadCapabilities.CurrentCHS.Heads} current");
ataTwoValue.Add("Sectors per track",
- $"{ataReport.ReadCapabilities.CHS.Sectors} max., {ataReport.ReadCapabilities.CurrentCHS.Sectors} current");
+ $"{ataReport.ReadCapabilities.CHS.Sectors} max., {ataReport.ReadCapabilities.CurrentCHS.Sectors} current");
ataTwoValue.Add("Sectors addressable in CHS mode",
- $"{ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors} max., {currentSectors} current");
+ $"{ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors} max., {currentSectors} current");
ataTwoValue.Add("Device size in CHS mode",
- $"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
+ $"{(ulong) currentSectors * logicalsectorsize} bytes, {(ulong) currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
}
- else if(ataReport.ReadCapabilities.CHS != null)
+ else if (ataReport.ReadCapabilities.CHS != null)
{
- int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders *
- ataReport.ReadCapabilities.CHS.Heads *
+ var currentSectors = ataReport.ReadCapabilities.CHS.Cylinders *
+ ataReport.ReadCapabilities.CHS.Heads *
ataReport.ReadCapabilities.CHS.Sectors;
ataTwoValue.Add("Cylinders",
- $"{ataReport.ReadCapabilities.CHS.Cylinders}");
- ataTwoValue.Add("Heads", $"{ataReport.ReadCapabilities.CHS.Heads}");
- ataTwoValue.Add("Sectors per track", $"{ataReport.ReadCapabilities.CHS.Sectors}");
+ $"{ataReport.ReadCapabilities.CHS.Cylinders}");
+ ataTwoValue.Add("Heads", $"{ataReport.ReadCapabilities.CHS.Heads}");
+ ataTwoValue.Add("Sectors per track", $"{ataReport.ReadCapabilities.CHS.Sectors}");
ataTwoValue.Add("Sectors addressable in CHS mode", $"{currentSectors}");
ataTwoValue.Add("Device size in CHS mode",
- $"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
+ $"{(ulong) currentSectors * logicalsectorsize} bytes, {(ulong) currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
}
- if(ataReport.ReadCapabilities.LBASectors != null)
+ if (ataReport.ReadCapabilities.LBASectors != null)
{
ataTwoValue.Add("Sectors addressable in sectors in 28-bit LBA mode",
- $"{ataReport.ReadCapabilities.LBASectors}");
+ $"{ataReport.ReadCapabilities.LBASectors}");
- if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000000)
+ if ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000000)
ataTwoValue.Add("Device size in 28-bit LBA mode",
- $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
- else if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000)
+ $"{(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double) ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
+ else if ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000)
ataTwoValue.Add("Device size in 28-bit LBA mode",
- $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB");
+ $"{(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double) ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB");
else
ataTwoValue.Add("Device size in 28-bit LBA mode",
- $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
+ $"{(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000} Mb, {(double) ((ulong) ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
}
- if(ataReport.ReadCapabilities.LBA48Sectors != null)
+ if (ataReport.ReadCapabilities.LBA48Sectors != null)
{
ataTwoValue.Add("Sectors addressable in sectors in 48-bit LBA mode",
- $"{ataReport.ReadCapabilities.LBA48Sectors}");
+ $"{ataReport.ReadCapabilities.LBA48Sectors}");
- if(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000000)
+ if (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000000)
ataTwoValue.Add("Device size in 48-bit LBA mode",
- $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
- else if(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000)
+ $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
+ else if (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000)
ataTwoValue.Add("Device size in 48-bit LBA mode",
- $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB");
+ $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double) (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB");
else
ataTwoValue.Add("Device size in 48-bit LBA mode",
- $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000} Mb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
+ $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000} Mb, {(double) (ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
}
- if(ata1 || cfa)
+ if (ata1 || cfa)
{
- if(ataReport.ReadCapabilities.UnformattedBPT > 0)
+ if (ataReport.ReadCapabilities.UnformattedBPT > 0)
ataTwoValue.Add("Bytes per unformatted track",
- $"{ataReport.ReadCapabilities.UnformattedBPT}");
- if(ataReport.ReadCapabilities.UnformattedBPS > 0)
+ $"{ataReport.ReadCapabilities.UnformattedBPT}");
+ if (ataReport.ReadCapabilities.UnformattedBPS > 0)
ataTwoValue.Add("Bytes per unformatted sector",
- $"{ataReport.ReadCapabilities.UnformattedBPS}");
+ $"{ataReport.ReadCapabilities.UnformattedBPS}");
}
}
- if(ataReport.ReadCapabilities.SupportsReadSectors == true)
+ if (ataReport.ReadCapabilities.SupportsReadSectors == true)
ataOneValue.Add("Device supports READ SECTOR(S) command in CHS mode");
- if(ataReport.ReadCapabilities.SupportsReadRetry == true)
+ if (ataReport.ReadCapabilities.SupportsReadRetry == true)
ataOneValue.Add("Device supports READ SECTOR(S) RETRY command in CHS mode");
- if(ataReport.ReadCapabilities.SupportsReadDma == true)
+ if (ataReport.ReadCapabilities.SupportsReadDma == true)
ataOneValue.Add("Device supports READ DMA command in CHS mode");
- if(ataReport.ReadCapabilities.SupportsReadDmaRetry == true)
+ if (ataReport.ReadCapabilities.SupportsReadDmaRetry == true)
ataOneValue.Add("Device supports READ DMA RETRY command in CHS mode");
- if(ataReport.ReadCapabilities.SupportsReadLong == true)
+ if (ataReport.ReadCapabilities.SupportsReadLong == true)
ataOneValue.Add("Device supports READ LONG command in CHS mode");
- if(ataReport.ReadCapabilities.SupportsReadLongRetry == true)
+ if (ataReport.ReadCapabilities.SupportsReadLongRetry == true)
ataOneValue.Add("Device supports READ LONG RETRY command in CHS mode");
- if(ataReport.ReadCapabilities.SupportsReadLba == true)
+ if (ataReport.ReadCapabilities.SupportsReadLba == true)
ataOneValue.Add("Device supports READ SECTOR(S) command in 28-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsReadRetryLba == true)
+ if (ataReport.ReadCapabilities.SupportsReadRetryLba == true)
ataOneValue.Add("Device supports READ SECTOR(S) RETRY command in 28-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsReadDmaLba == true)
+ if (ataReport.ReadCapabilities.SupportsReadDmaLba == true)
ataOneValue.Add("Device supports READ DMA command in 28-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsReadDmaRetryLba == true)
+ if (ataReport.ReadCapabilities.SupportsReadDmaRetryLba == true)
ataOneValue.Add("Device supports READ DMA RETRY command in 28-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsReadLongLba == true)
+ if (ataReport.ReadCapabilities.SupportsReadLongLba == true)
ataOneValue.Add("Device supports READ LONG command in 28-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsReadLongRetryLba == true)
+ if (ataReport.ReadCapabilities.SupportsReadLongRetryLba == true)
ataOneValue.Add("Device supports READ LONG RETRY command in 28-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsReadLba48 == true)
+ if (ataReport.ReadCapabilities.SupportsReadLba48 == true)
ataOneValue.Add("Device supports READ SECTOR(S) command in 48-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsReadDmaLba48 == true)
+ if (ataReport.ReadCapabilities.SupportsReadDmaLba48 == true)
ataOneValue.Add("Device supports READ DMA command in 48-bit LBA mode");
- if(ataReport.ReadCapabilities.SupportsSeek == true)
+ if (ataReport.ReadCapabilities.SupportsSeek == true)
ataOneValue.Add("Device supports SEEK command in CHS mode");
- if(ataReport.ReadCapabilities.SupportsSeekLba == true)
+ if (ataReport.ReadCapabilities.SupportsSeekLba == true)
ataOneValue.Add("Device supports SEEK command in 28-bit LBA mode");
}
- else testedMedia = ataReport.RemovableMedias;
+ else
+ {
+ testedMedia = ataReport.RemovableMedias;
+ }
}
}
}
\ No newline at end of file
diff --git a/DiscImageChef.Server/App_Start/ScsiEvpd.cs b/DiscImageChef.Server/App_Start/ScsiEvpd.cs
index 9a290e8e..dc3092d2 100644
--- a/DiscImageChef.Server/App_Start/ScsiEvpd.cs
+++ b/DiscImageChef.Server/App_Start/ScsiEvpd.cs
@@ -47,44 +47,44 @@ namespace DiscImageChef.Server
/// List to put the key=value pairs on
public static void Report(IEnumerable pages, string vendor, ref Dictionary evpdPages)
{
- foreach(ScsiPage evpd in pages)
+ foreach (var evpd in pages)
{
string decoded;
- if(evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = EVPD.DecodeASCIIPage(evpd.value);
- else if(evpd.page == 0x81) decoded = EVPD.PrettifyPage_81(evpd.value);
- else if(evpd.page == 0x82) decoded = EVPD.DecodePage82(evpd.value);
- else if(evpd.page == 0x83) decoded = EVPD.PrettifyPage_83(evpd.value);
- else if(evpd.page == 0x84) decoded = EVPD.PrettifyPage_84(evpd.value);
- else if(evpd.page == 0x85) decoded = EVPD.PrettifyPage_85(evpd.value);
- else if(evpd.page == 0x86) decoded = EVPD.PrettifyPage_86(evpd.value);
- else if(evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value);
- else if(evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value);
- else if(evpd.page == 0xB2)
+ if (evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = EVPD.DecodeASCIIPage(evpd.value);
+ else if (evpd.page == 0x81) decoded = EVPD.PrettifyPage_81(evpd.value);
+ else if (evpd.page == 0x82) decoded = EVPD.DecodePage82(evpd.value);
+ else if (evpd.page == 0x83) decoded = EVPD.PrettifyPage_83(evpd.value);
+ else if (evpd.page == 0x84) decoded = EVPD.PrettifyPage_84(evpd.value);
+ else if (evpd.page == 0x85) decoded = EVPD.PrettifyPage_85(evpd.value);
+ else if (evpd.page == 0x86) decoded = EVPD.PrettifyPage_86(evpd.value);
+ else if (evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value);
+ else if (evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value);
+ else if (evpd.page == 0xB2)
decoded =
$"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}
";
- else if(evpd.page == 0xB4) decoded = EVPD.DecodePageB4(evpd.value);
- else if(evpd.page == 0xC0 && vendor.Trim() == "quantum")
+ else if (evpd.page == 0xB4) decoded = EVPD.DecodePageB4(evpd.value);
+ else if (evpd.page == 0xC0 && vendor.Trim() == "quantum")
decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value);
- else if(evpd.page == 0xC0 && vendor.Trim() == "seagate")
+ else if (evpd.page == 0xC0 && vendor.Trim() == "seagate")
decoded =
EVPD.PrettifyPage_C0_Seagate(evpd.value);
- else if(evpd.page == 0xC0 && vendor.Trim() == "ibm")
+ else if (evpd.page == 0xC0 && vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C0_IBM(evpd.value);
- else if(evpd.page == 0xC1 && vendor.Trim() == "ibm")
+ else if (evpd.page == 0xC1 && vendor.Trim() == "ibm")
decoded = EVPD.PrettifyPage_C1_IBM(evpd.value);
- else if((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance")
+ else if ((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance")
decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value);
- else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 ||
- evpd.page == 0xC6) &&
- vendor.Trim() == "certance") decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value);
- else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 ||
- evpd.page == 0xC4 || evpd.page == 0xC5) &&
- vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value);
- else if(evpd.page == 0xDF && vendor.Trim() == "certance")
- decoded = EVPD.PrettifyPage_DF_Certance(evpd.value);
+ else if ((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 ||
+ evpd.page == 0xC6) &&
+ vendor.Trim() == "certance") decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value);
+ else if ((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 ||
+ evpd.page == 0xC4 || evpd.page == 0xC5) &&
+ vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value);
+ else if (evpd.page == 0xDF && vendor.Trim() == "certance")
+ decoded = EVPD.PrettifyPage_DF_Certance(evpd.value);
else decoded = "Undecoded";
- if(!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "
");
+ if (!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "
");
evpdPages.Add($"EVPD page {evpd.page:X2}h", decoded);
}
diff --git a/DiscImageChef.Server/App_Start/ScsiInquiry.cs b/DiscImageChef.Server/App_Start/ScsiInquiry.cs
index 5701e276..c481b89b 100644
--- a/DiscImageChef.Server/App_Start/ScsiInquiry.cs
+++ b/DiscImageChef.Server/App_Start/ScsiInquiry.cs
@@ -35,7 +35,7 @@ using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server
{
- static class ScsiInquiry
+ internal static class ScsiInquiry
{
///
/// Takes the SCSI INQUIRY part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
@@ -45,13 +45,13 @@ namespace DiscImageChef.Server
/// List of values
internal static IEnumerable Report(Inquiry.SCSIInquiry? inquiryNullable)
{
- List scsiOneValue = new List();
+ var scsiOneValue = new List();
- if(!inquiryNullable.HasValue) return scsiOneValue;
+ if (!inquiryNullable.HasValue) return scsiOneValue;
- Inquiry.SCSIInquiry inquiry = inquiryNullable.Value;
+ var inquiry = inquiryNullable.Value;
- switch((PeripheralQualifiers)inquiry.PeripheralQualifier)
+ switch ((PeripheralQualifiers) inquiry.PeripheralQualifier)
{
case PeripheralQualifiers.Supported:
scsiOneValue.Add("Device is connected and supported.");
@@ -70,7 +70,7 @@ namespace DiscImageChef.Server
break;
}
- switch((PeripheralDeviceTypes)inquiry.PeripheralDeviceType)
+ switch ((PeripheralDeviceTypes) inquiry.PeripheralDeviceType)
{
case PeripheralDeviceTypes.DirectAccess: //0x00,
scsiOneValue.Add("Direct-access device");
@@ -146,7 +146,7 @@ namespace DiscImageChef.Server
break;
}
- switch((ANSIVersions)inquiry.ANSIVersion)
+ switch ((ANSIVersions) inquiry.ANSIVersion)
{
case ANSIVersions.ANSINoVersion:
scsiOneValue.Add("Device does not claim to comply with any SCSI ANSI standard");
@@ -171,11 +171,12 @@ namespace DiscImageChef.Server
break;
default:
scsiOneValue
- .Add($"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})");
+ .Add(
+ $"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})");
break;
}
- switch((ECMAVersions)inquiry.ECMAVersion)
+ switch ((ECMAVersions) inquiry.ECMAVersion)
{
case ECMAVersions.ECMANoVersion:
scsiOneValue.Add("Device does not claim to comply with any SCSI ECMA standard");
@@ -185,11 +186,12 @@ namespace DiscImageChef.Server
break;
default:
scsiOneValue
- .Add($"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})");
+ .Add(
+ $"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})");
break;
}
- switch((ISOVersions)inquiry.ISOVersion)
+ switch ((ISOVersions) inquiry.ISOVersion)
{
case ISOVersions.ISONoVersion:
scsiOneValue.Add("Device does not claim to comply with any SCSI ISO/IEC standard");
@@ -199,38 +201,39 @@ namespace DiscImageChef.Server
break;
default:
scsiOneValue
- .Add($"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})");
+ .Add(
+ $"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})");
break;
}
- if(inquiry.RMB) scsiOneValue.Add("Device is removable");
- if(inquiry.AERC) scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability");
- if(inquiry.TrmTsk) scsiOneValue.Add("Device supports TERMINATE TASK command");
- if(inquiry.NormACA) scsiOneValue.Add("Device supports setting Normal ACA");
- if(inquiry.HiSup) scsiOneValue.Add("Device supports LUN hierarchical addressing");
- if(inquiry.SCCS) scsiOneValue.Add("Device contains an embedded storage array controller");
- if(inquiry.ACC) scsiOneValue.Add("Device contains an Access Control Coordinator");
- if(inquiry.ThreePC) scsiOneValue.Add("Device supports third-party copy commands");
- if(inquiry.Protect) scsiOneValue.Add("Device supports protection information");
- if(inquiry.BQue) scsiOneValue.Add("Device supports basic queueing");
- if(inquiry.EncServ) scsiOneValue.Add("Device contains an embedded enclosure services component");
- if(inquiry.MultiP) scsiOneValue.Add("Multi-port device");
- if(inquiry.MChngr) scsiOneValue.Add("Device contains or is attached to a medium changer");
- if(inquiry.ACKREQQ) scsiOneValue.Add("Device supports request and acknowledge handshakes");
- if(inquiry.Addr32) scsiOneValue.Add("Device supports 32-bit wide SCSI addresses");
- if(inquiry.Addr16) scsiOneValue.Add("Device supports 16-bit wide SCSI addresses");
- if(inquiry.RelAddr) scsiOneValue.Add("Device supports relative addressing");
- if(inquiry.WBus32) scsiOneValue.Add("Device supports 32-bit wide data transfers");
- if(inquiry.WBus16) scsiOneValue.Add("Device supports 16-bit wide data transfers");
- if(inquiry.Sync) scsiOneValue.Add("Device supports synchronous data transfer");
- if(inquiry.Linked) scsiOneValue.Add("Device supports linked commands");
- if(inquiry.TranDis) scsiOneValue.Add("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands");
- if(inquiry.QAS) scsiOneValue.Add("Device supports Quick Arbitration and Selection");
- if(inquiry.CmdQue) scsiOneValue.Add("Device supports TCQ queue");
- if(inquiry.IUS) scsiOneValue.Add("Device supports information unit transfers");
- if(inquiry.SftRe) scsiOneValue.Add("Device implements RESET as a soft reset");
+ if (inquiry.RMB) scsiOneValue.Add("Device is removable");
+ if (inquiry.AERC) scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability");
+ if (inquiry.TrmTsk) scsiOneValue.Add("Device supports TERMINATE TASK command");
+ if (inquiry.NormACA) scsiOneValue.Add("Device supports setting Normal ACA");
+ if (inquiry.HiSup) scsiOneValue.Add("Device supports LUN hierarchical addressing");
+ if (inquiry.SCCS) scsiOneValue.Add("Device contains an embedded storage array controller");
+ if (inquiry.ACC) scsiOneValue.Add("Device contains an Access Control Coordinator");
+ if (inquiry.ThreePC) scsiOneValue.Add("Device supports third-party copy commands");
+ if (inquiry.Protect) scsiOneValue.Add("Device supports protection information");
+ if (inquiry.BQue) scsiOneValue.Add("Device supports basic queueing");
+ if (inquiry.EncServ) scsiOneValue.Add("Device contains an embedded enclosure services component");
+ if (inquiry.MultiP) scsiOneValue.Add("Multi-port device");
+ if (inquiry.MChngr) scsiOneValue.Add("Device contains or is attached to a medium changer");
+ if (inquiry.ACKREQQ) scsiOneValue.Add("Device supports request and acknowledge handshakes");
+ if (inquiry.Addr32) scsiOneValue.Add("Device supports 32-bit wide SCSI addresses");
+ if (inquiry.Addr16) scsiOneValue.Add("Device supports 16-bit wide SCSI addresses");
+ if (inquiry.RelAddr) scsiOneValue.Add("Device supports relative addressing");
+ if (inquiry.WBus32) scsiOneValue.Add("Device supports 32-bit wide data transfers");
+ if (inquiry.WBus16) scsiOneValue.Add("Device supports 16-bit wide data transfers");
+ if (inquiry.Sync) scsiOneValue.Add("Device supports synchronous data transfer");
+ if (inquiry.Linked) scsiOneValue.Add("Device supports linked commands");
+ if (inquiry.TranDis) scsiOneValue.Add("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands");
+ if (inquiry.QAS) scsiOneValue.Add("Device supports Quick Arbitration and Selection");
+ if (inquiry.CmdQue) scsiOneValue.Add("Device supports TCQ queue");
+ if (inquiry.IUS) scsiOneValue.Add("Device supports information unit transfers");
+ if (inquiry.SftRe) scsiOneValue.Add("Device implements RESET as a soft reset");
- switch((TGPSValues)inquiry.TPGS)
+ switch ((TGPSValues) inquiry.TPGS)
{
case TGPSValues.NotSupported:
scsiOneValue.Add("Device does not support assymetrical access");
@@ -249,7 +252,7 @@ namespace DiscImageChef.Server
break;
}
- switch((SPIClocking)inquiry.Clocking)
+ switch ((SPIClocking) inquiry.Clocking)
{
case SPIClocking.ST:
scsiOneValue.Add("Device supports only ST clocking");
@@ -268,10 +271,10 @@ namespace DiscImageChef.Server
break;
}
- if(inquiry.VersionDescriptors == null) return scsiOneValue;
+ if (inquiry.VersionDescriptors == null) return scsiOneValue;
- foreach(ushort versionDescriptor in inquiry.VersionDescriptors)
- switch(versionDescriptor)
+ foreach (var versionDescriptor in inquiry.VersionDescriptors)
+ switch (versionDescriptor)
{
case 0xFFFF:
case 0x0000: break;
@@ -403,11 +406,12 @@ namespace DiscImageChef.Server
break;
case 0x01DD:
scsiOneValue
- .Add("Device complies with SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000");
+ .Add(
+ "Device complies with SES T10/1212 revision 08b w/ Amendment ANSI INCITS.305/AM1-2000");
break;
case 0x01DE:
scsiOneValue
- .Add("Device complies with SES ANSI INCITS 305-1998 w/ Amendment ANSI INCITS.305/AM1-2000");
+ .Add("Device complies with SES ANSI INCITS 305-1998 w/ Amendment ANSI INCITS.305/AM1-2000");
break;
case 0x01E0:
scsiOneValue.Add("Device complies with SCC-2 (no version claimed)");
@@ -744,7 +748,8 @@ namespace DiscImageChef.Server
break;
case 0x04E7:
scsiOneValue
- .Add("Device complies with MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI INCITS 468-2010/AM 1");
+ .Add(
+ "Device complies with MMC-6 ANSI INCITS 468-2010 + MMC-6/AM1 ANSI INCITS 468-2010/AM 1");
break;
case 0x0500:
scsiOneValue.Add("Device complies with ADC-3 (no version claimed)");
@@ -1033,7 +1038,8 @@ namespace DiscImageChef.Server
break;
case 0x0ABC:
scsiOneValue
- .Add("Device complies with SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998");
+ .Add(
+ "Device complies with SPI ANSI INCITS 253-1995 with SPI Amnd ANSI INCITS 253/AM1-1998");
break;
case 0x0AC0:
scsiOneValue.Add("Device complies with Fast-20 (no version claimed)");
@@ -1175,7 +1181,8 @@ namespace DiscImageChef.Server
break;
case 0x0C4F:
scsiOneValue
- .Add("Device complies with SAS-2.1 ANSI INCITS 478-2011 w/ Amnd 1 ANSI INCITS 478/AM1-2014");
+ .Add(
+ "Device complies with SAS-2.1 ANSI INCITS 478-2011 w/ Amnd 1 ANSI INCITS 478/AM1-2014");
break;
case 0x0C52:
scsiOneValue.Add("Device complies with SAS-2.1 ISO/IEC 14776-153");
@@ -1203,7 +1210,8 @@ namespace DiscImageChef.Server
break;
case 0x0D3C:
scsiOneValue
- .Add("Device complies with FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996");
+ .Add(
+ "Device complies with FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS 230/AM1-1996");
break;
case 0x0D40:
scsiOneValue.Add("Device complies with FC-AL (no version claimed)");
@@ -1276,7 +1284,7 @@ namespace DiscImageChef.Server
break;
case 0x0E03:
scsiOneValue
- .Add("Device complies with FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007");
+ .Add("Device complies with FC-FS-2 ANSI INCITS 242-2007 with AM1 ANSI INCITS 242/AM1-2007");
break;
case 0x0E20:
scsiOneValue.Add("Device complies with FC-LS (no version claimed)");
@@ -1334,7 +1342,8 @@ namespace DiscImageChef.Server
break;
case 0x0EA6:
scsiOneValue
- .Add("Device complies with FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007");
+ .Add(
+ "Device complies with FC 10GFC ANSI INCITS 364-2003 with AM1 ANSI INCITS 364/AM1-2007");
break;
case 0x0EC0:
scsiOneValue.Add("Device complies with FC-SP-2 (no version claimed)");
@@ -1515,22 +1524,23 @@ namespace DiscImageChef.Server
break;
case 0x1621:
scsiOneValue
- .Add("Device complies with ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)");
+ .Add("Device complies with ATA/ATAPI-8 ATA8-APT Parallel Transport (no version claimed)");
break;
case 0x1622:
scsiOneValue
- .Add("Device complies with ATA/ATAPI-8 ATA8-AST Serial Transport (no version claimed)");
+ .Add("Device complies with ATA/ATAPI-8 ATA8-AST Serial Transport (no version claimed)");
break;
case 0x1623:
scsiOneValue
- .Add("Device complies with ATA/ATAPI-8 ATA8-ACS ATA/ATAPI Command Set (no version claimed)");
+ .Add(
+ "Device complies with ATA/ATAPI-8 ATA8-ACS ATA/ATAPI Command Set (no version claimed)");
break;
case 0x1628:
scsiOneValue.Add("Device complies with ATA/ATAPI-8 ATA8-AAM ANSI INCITS 451-2008");
break;
case 0x162A:
scsiOneValue
- .Add("Device complies with ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/ Amendment 1");
+ .Add("Device complies with ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/ Amendment 1");
break;
case 0x1728:
scsiOneValue.Add("Device complies with Universal Serial Bus Specification, Revision 1.1");
@@ -1540,7 +1550,7 @@ namespace DiscImageChef.Server
break;
case 0x1730:
scsiOneValue
- .Add("Device complies with USB Mass Storage Class Bulk-Only Transport, Revision 1.0");
+ .Add("Device complies with USB Mass Storage Class Bulk-Only Transport, Revision 1.0");
break;
case 0x1740:
scsiOneValue.Add("Device complies with UAS (no version claimed)");
diff --git a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs
index b9e8fbb1..7b908898 100644
--- a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs
+++ b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs
@@ -46,93 +46,96 @@ namespace DiscImageChef.Server
/// List to put the values on
public static void Report(MmcFeatures ftr, ref List mmcOneValue)
{
- if(ftr.SupportsAACS && ftr.AACSVersion.HasValue)
+ if (ftr.SupportsAACS && ftr.AACSVersion.HasValue)
mmcOneValue.Add($"Drive supports AACS version {ftr.AACSVersion}");
- else if(ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS");
- if(ftr.AGIDs.HasValue) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
- if(ftr.CanGenerateBindingNonce)
+ else if (ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS");
+ if (ftr.AGIDs.HasValue) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
+ if (ftr.CanGenerateBindingNonce)
{
mmcOneValue.Add("Drive supports generating the binding nonce");
- if(ftr.BindingNonceBlocks.HasValue)
+ if (ftr.BindingNonceBlocks.HasValue)
mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce");
}
- if(ftr.BlocksPerReadableUnit > 1)
+ if (ftr.BlocksPerReadableUnit > 1)
mmcOneValue.Add($"{ftr.BlocksPerReadableUnit} logical blocks per media writable unit");
- if(ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs");
- if(ftr.BufferUnderrunFreeInSAO) mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode");
- if(ftr.BufferUnderrunFreeInTAO) mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode");
- if(ftr.CanAudioScan) mmcOneValue.Add("Drive supports the SCAN command");
- if(ftr.CanEject) mmcOneValue.Add("Drive can eject media");
- if(ftr.CanEraseSector) mmcOneValue.Add("Drive supports media that require erasing before writing");
- if(ftr.CanExpandBDRESpareArea) mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc");
- if(ftr.CanFormat) mmcOneValue.Add("Drive can format media into logical blocks");
- if(ftr.CanFormatBDREWithoutSpare) mmcOneValue.Add("Drive can format BD-RE with no spares allocated");
- if(ftr.CanFormatQCert) mmcOneValue.Add("Drive can format BD-RE discs with quick certification");
- if(ftr.CanFormatCert) mmcOneValue.Add("Drive can format BD-RE discs with full certification");
- if(ftr.CanFormatFRF) mmcOneValue.Add("Drive can fast re-format BD-RE discs");
- if(ftr.CanFormatRRM) mmcOneValue.Add("Drive can format BD-R discs with RRM format");
- if(ftr.CanLoad) mmcOneValue.Add("Drive can load media");
- if(ftr.CanMuteSeparateChannels) mmcOneValue.Add("Drive is able to mute channels separately");
- if(ftr.CanOverwriteSAOTrack) mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs");
- if(ftr.CanOverwriteTAOTrack) mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs");
- if(ftr.CanPlayCDAudio) mmcOneValue.Add("Drive has an analogue audio output");
- if(ftr.CanPseudoOverwriteBDR) mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode");
- if(ftr.CanReadAllDualR) mmcOneValue.Add("Drive can read DVD-R DL from all recording modes");
- if(ftr.CanReadAllDualRW) mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes");
- if(ftr.CanReadBD) mmcOneValue.Add("Drive can read BD-ROM");
- if(ftr.CanReadBDR) mmcOneValue.Add("Drive can read BD-R Ver.1");
- if(ftr.CanReadBDRE1) mmcOneValue.Add("Drive can read BD-RE Ver.1");
- if(ftr.CanReadBDRE2) mmcOneValue.Add("Drive can read BD-RE Ver.2");
- if(ftr.CanReadBDROM) mmcOneValue.Add("Drive can read BD-ROM Ver.1");
- if(ftr.CanReadBluBCA) mmcOneValue.Add("Drive can read BD's Burst Cutting Area");
- if(ftr.CanReadCD) mmcOneValue.Add("Drive can read CD-ROM");
- if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
+ if (ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs");
+ if (ftr.BufferUnderrunFreeInSAO)
+ mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode");
+ if (ftr.BufferUnderrunFreeInTAO) mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode");
+ if (ftr.CanAudioScan) mmcOneValue.Add("Drive supports the SCAN command");
+ if (ftr.CanEject) mmcOneValue.Add("Drive can eject media");
+ if (ftr.CanEraseSector) mmcOneValue.Add("Drive supports media that require erasing before writing");
+ if (ftr.CanExpandBDRESpareArea)
+ mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc");
+ if (ftr.CanFormat) mmcOneValue.Add("Drive can format media into logical blocks");
+ if (ftr.CanFormatBDREWithoutSpare) mmcOneValue.Add("Drive can format BD-RE with no spares allocated");
+ if (ftr.CanFormatQCert) mmcOneValue.Add("Drive can format BD-RE discs with quick certification");
+ if (ftr.CanFormatCert) mmcOneValue.Add("Drive can format BD-RE discs with full certification");
+ if (ftr.CanFormatFRF) mmcOneValue.Add("Drive can fast re-format BD-RE discs");
+ if (ftr.CanFormatRRM) mmcOneValue.Add("Drive can format BD-R discs with RRM format");
+ if (ftr.CanLoad) mmcOneValue.Add("Drive can load media");
+ if (ftr.CanMuteSeparateChannels) mmcOneValue.Add("Drive is able to mute channels separately");
+ if (ftr.CanOverwriteSAOTrack) mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs");
+ if (ftr.CanOverwriteTAOTrack) mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs");
+ if (ftr.CanPlayCDAudio) mmcOneValue.Add("Drive has an analogue audio output");
+ if (ftr.CanPseudoOverwriteBDR) mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode");
+ if (ftr.CanReadAllDualR) mmcOneValue.Add("Drive can read DVD-R DL from all recording modes");
+ if (ftr.CanReadAllDualRW) mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes");
+ if (ftr.CanReadBD) mmcOneValue.Add("Drive can read BD-ROM");
+ if (ftr.CanReadBDR) mmcOneValue.Add("Drive can read BD-R Ver.1");
+ if (ftr.CanReadBDRE1) mmcOneValue.Add("Drive can read BD-RE Ver.1");
+ if (ftr.CanReadBDRE2) mmcOneValue.Add("Drive can read BD-RE Ver.2");
+ if (ftr.CanReadBDROM) mmcOneValue.Add("Drive can read BD-ROM Ver.1");
+ if (ftr.CanReadBluBCA) mmcOneValue.Add("Drive can read BD's Burst Cutting Area");
+ if (ftr.CanReadCD) mmcOneValue.Add("Drive can read CD-ROM");
+ if (ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW");
- else if(ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
+ else if (ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write DVD+MRW");
- else if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW)
+ else if (ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW)
mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW");
- else if(ftr.CanWriteCDMRW) mmcOneValue.Add("Drive can read and write CD-MRW");
- else if(ftr.CanReadDVDPlusMRW) mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW");
- else if(ftr.CanReadCDMRW) mmcOneValue.Add("Drive can read CD-MRW");
- if(ftr.CanReadCPRM_MKB) mmcOneValue.Add("Drive supports reading Media Key Block of CPRM");
- if(ftr.CanReadDDCD) mmcOneValue.Add("Drive can read DDCDs");
- if(ftr.CanReadDVD) mmcOneValue.Add("Drive can read DVD");
- if(ftr.CanWriteDVDPlusRW) mmcOneValue.Add("Drive can read and write DVD+RW");
- else if(ftr.CanReadDVDPlusRW) mmcOneValue.Add("Drive can read DVD+RW");
- if(ftr.CanWriteDVDPlusR) mmcOneValue.Add("Drive can read and write DVD+R");
- else if(ftr.CanReadDVDPlusR) mmcOneValue.Add("Drive can read DVD+R");
- if(ftr.CanWriteDVDPlusRDL) mmcOneValue.Add("Drive can read and write DVD+R DL");
- else if(ftr.CanReadDVDPlusRDL) mmcOneValue.Add("Drive can read DVD+R DL");
- if(ftr.CanReadDriveAACSCertificate) mmcOneValue.Add("Drive supports reading the Drive Certificate");
- if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR && ftr.CanReadHDDVDRAM)
+ else if (ftr.CanWriteCDMRW) mmcOneValue.Add("Drive can read and write CD-MRW");
+ else if (ftr.CanReadDVDPlusMRW) mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW");
+ else if (ftr.CanReadCDMRW) mmcOneValue.Add("Drive can read CD-MRW");
+ if (ftr.CanReadCPRM_MKB) mmcOneValue.Add("Drive supports reading Media Key Block of CPRM");
+ if (ftr.CanReadDDCD) mmcOneValue.Add("Drive can read DDCDs");
+ if (ftr.CanReadDVD) mmcOneValue.Add("Drive can read DVD");
+ if (ftr.CanWriteDVDPlusRW) mmcOneValue.Add("Drive can read and write DVD+RW");
+ else if (ftr.CanReadDVDPlusRW) mmcOneValue.Add("Drive can read DVD+RW");
+ if (ftr.CanWriteDVDPlusR) mmcOneValue.Add("Drive can read and write DVD+R");
+ else if (ftr.CanReadDVDPlusR) mmcOneValue.Add("Drive can read DVD+R");
+ if (ftr.CanWriteDVDPlusRDL) mmcOneValue.Add("Drive can read and write DVD+R DL");
+ else if (ftr.CanReadDVDPlusRDL) mmcOneValue.Add("Drive can read DVD+R DL");
+ if (ftr.CanReadDriveAACSCertificate) mmcOneValue.Add("Drive supports reading the Drive Certificate");
+ if (ftr.CanReadHDDVD && ftr.CanReadHDDVDR && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM");
- else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR)
+ else if (ftr.CanReadHDDVD && ftr.CanReadHDDVDR)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R");
- else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDRAM)
+ else if (ftr.CanReadHDDVD && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM");
- else if(ftr.CanReadHDDVD) mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW");
- if(ftr.CanReadLeadInCDText) mmcOneValue.Add("Drive can return CD-Text from Lead-In");
- if(ftr.CanReadOldBDR) mmcOneValue.Add("Drive can read BD-R pre-1.0");
- if(ftr.CanReadOldBDRE) mmcOneValue.Add("Drive can read BD-RE pre-1.0");
- if(ftr.CanReadOldBDROM) mmcOneValue.Add("Drive can read BD-ROM pre-1.0");
- if(ftr.CanReadSpareAreaInformation) mmcOneValue.Add("Drive can return Spare Area Information");
- if(ftr.CanReportDriveSerial) mmcOneValue.Add("Drive is to report drive serial number");
- if(ftr.CanReportMediaSerial) mmcOneValue.Add("Drive is to read media serial number");
- if(ftr.CanTestWriteDDCDR) mmcOneValue.Add("Drive can do a test writing with DDCD-R");
- if(ftr.CanTestWriteDVD) mmcOneValue.Add("Drive can do a test writing with DVDs");
- if(ftr.CanTestWriteInSAO) mmcOneValue.Add("Drive can do a test writing in Session at Once Mode");
- if(ftr.CanTestWriteInTAO) mmcOneValue.Add("Drive can do a test writing in Track at Once Mode");
- if(ftr.CanUpgradeFirmware) mmcOneValue.Add("Drive supports Microcode Upgrade");
- if(ftr.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page");
- if(ftr.Locked) mmcOneValue.Add("Drive can lock media");
- if(ftr.LogicalBlockSize > 0) mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block");
- if(ftr.MultiRead)
- mmcOneValue.Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
+ else if (ftr.CanReadHDDVD) mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW");
+ if (ftr.CanReadLeadInCDText) mmcOneValue.Add("Drive can return CD-Text from Lead-In");
+ if (ftr.CanReadOldBDR) mmcOneValue.Add("Drive can read BD-R pre-1.0");
+ if (ftr.CanReadOldBDRE) mmcOneValue.Add("Drive can read BD-RE pre-1.0");
+ if (ftr.CanReadOldBDROM) mmcOneValue.Add("Drive can read BD-ROM pre-1.0");
+ if (ftr.CanReadSpareAreaInformation) mmcOneValue.Add("Drive can return Spare Area Information");
+ if (ftr.CanReportDriveSerial) mmcOneValue.Add("Drive is to report drive serial number");
+ if (ftr.CanReportMediaSerial) mmcOneValue.Add("Drive is to read media serial number");
+ if (ftr.CanTestWriteDDCDR) mmcOneValue.Add("Drive can do a test writing with DDCD-R");
+ if (ftr.CanTestWriteDVD) mmcOneValue.Add("Drive can do a test writing with DVDs");
+ if (ftr.CanTestWriteInSAO) mmcOneValue.Add("Drive can do a test writing in Session at Once Mode");
+ if (ftr.CanTestWriteInTAO) mmcOneValue.Add("Drive can do a test writing in Track at Once Mode");
+ if (ftr.CanUpgradeFirmware) mmcOneValue.Add("Drive supports Microcode Upgrade");
+ if (ftr.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page");
+ if (ftr.Locked) mmcOneValue.Add("Drive can lock media");
+ if (ftr.LogicalBlockSize > 0) mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block");
+ if (ftr.MultiRead)
+ mmcOneValue.Add(
+ "Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
- if(ftr.PhysicalInterfaceStandard.HasValue)
- switch(ftr.PhysicalInterfaceStandard)
+ if (ftr.PhysicalInterfaceStandard.HasValue)
+ switch (ftr.PhysicalInterfaceStandard)
{
case PhysicalInterfaces.Unspecified:
mmcOneValue.Add("Drive uses an unspecified physical interface");
@@ -166,86 +169,86 @@ namespace DiscImageChef.Server
break;
default:
mmcOneValue
- .Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}");
+ .Add($"Drive uses an unknown interface with code {(uint) ftr.PhysicalInterfaceStandard}");
break;
}
- if(ftr.PreventJumper) mmcOneValue.Add("Drive power ups locked");
- if(ftr.SupportsBusEncryption) mmcOneValue.Add("Drive supports bus encryption");
- if(ftr.CanWriteBD) mmcOneValue.Add("Drive can write BD-R or BD-RE");
- if(ftr.CanWriteBDR) mmcOneValue.Add("Drive can write BD-R Ver.1");
- if(ftr.CanWriteBDRE1) mmcOneValue.Add("Drive can write BD-RE Ver.1");
- if(ftr.CanWriteBDRE2) mmcOneValue.Add("Drive can write BD-RE Ver.2");
- if(ftr.CanWriteBusEncryptedBlocks) mmcOneValue.Add("Drive supports writing with bus encryption");
- if(ftr.CanWriteCDRW) mmcOneValue.Add("Drive can write CD-RW");
- if(ftr.CanWriteCDRWCAV) mmcOneValue.Add("Drive can write High-Speed CD-RW");
- if(ftr.CanWriteCDSAO && !ftr.CanWriteRaw)
+ if (ftr.PreventJumper) mmcOneValue.Add("Drive power ups locked");
+ if (ftr.SupportsBusEncryption) mmcOneValue.Add("Drive supports bus encryption");
+ if (ftr.CanWriteBD) mmcOneValue.Add("Drive can write BD-R or BD-RE");
+ if (ftr.CanWriteBDR) mmcOneValue.Add("Drive can write BD-R Ver.1");
+ if (ftr.CanWriteBDRE1) mmcOneValue.Add("Drive can write BD-RE Ver.1");
+ if (ftr.CanWriteBDRE2) mmcOneValue.Add("Drive can write BD-RE Ver.2");
+ if (ftr.CanWriteBusEncryptedBlocks) mmcOneValue.Add("Drive supports writing with bus encryption");
+ if (ftr.CanWriteCDRW) mmcOneValue.Add("Drive can write CD-RW");
+ if (ftr.CanWriteCDRWCAV) mmcOneValue.Add("Drive can write High-Speed CD-RW");
+ if (ftr.CanWriteCDSAO && !ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once Mode:");
- else if(!ftr.CanWriteCDSAO && ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in raw Mode:");
- else if(ftr.CanWriteCDSAO && ftr.CanWriteRaw)
+ else if (!ftr.CanWriteCDSAO && ftr.CanWriteRaw) mmcOneValue.Add("Drive can write CDs in raw Mode:");
+ else if (ftr.CanWriteCDSAO && ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once and in Raw Modes:");
- if(ftr.CanWriteCDTAO) mmcOneValue.Add("Drive can write CDs in Track at Once Mode:");
- if(ftr.CanWriteCSSManagedDVD) mmcOneValue.Add("Drive can write CSS managed DVDs");
- if(ftr.CanWriteDDCDR) mmcOneValue.Add("Drive supports writing DDCD-R");
- if(ftr.CanWriteDDCDRW) mmcOneValue.Add("Drive supports writing DDCD-RW");
- if(ftr.CanWriteDVDPlusRWDL) mmcOneValue.Add("Drive can read and write DVD+RW DL");
- else if(ftr.CanReadDVDPlusRWDL) mmcOneValue.Add("Drive can read DVD+RW DL");
- if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW && ftr.CanWriteDVDRDL)
+ if (ftr.CanWriteCDTAO) mmcOneValue.Add("Drive can write CDs in Track at Once Mode:");
+ if (ftr.CanWriteCSSManagedDVD) mmcOneValue.Add("Drive can write CSS managed DVDs");
+ if (ftr.CanWriteDDCDR) mmcOneValue.Add("Drive supports writing DDCD-R");
+ if (ftr.CanWriteDDCDRW) mmcOneValue.Add("Drive supports writing DDCD-RW");
+ if (ftr.CanWriteDVDPlusRWDL) mmcOneValue.Add("Drive can read and write DVD+RW DL");
+ else if (ftr.CanReadDVDPlusRWDL) mmcOneValue.Add("Drive can read DVD+RW DL");
+ if (ftr.CanWriteDVDR && ftr.CanWriteDVDRW && ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R, DVD-RW and DVD-R DL");
- else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRDL)
+ else if (ftr.CanWriteDVDR && ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R and DVD-R DL");
- else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW) mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW");
- else if(ftr.CanWriteDVDR) mmcOneValue.Add("Drive supports writing DVD-R");
- if(ftr.CanWriteHDDVDR && ftr.CanWriteHDDVDRAM)
+ else if (ftr.CanWriteDVDR && ftr.CanWriteDVDRW) mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW");
+ else if (ftr.CanWriteDVDR) mmcOneValue.Add("Drive supports writing DVD-R");
+ if (ftr.CanWriteHDDVDR && ftr.CanWriteHDDVDRAM)
mmcOneValue.Add("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM");
- else if(ftr.CanWriteHDDVDR) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R");
- else if(ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM");
+ else if (ftr.CanWriteHDDVDR) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R");
+ else if (ftr.CanWriteHDDVDRAM) mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM");
// TODO: Write HD DVD-RW
/*
else
mmcOneValue.Add("Drive can write HD DVD-RW");
*/
- if(ftr.CanWriteOldBDR) mmcOneValue.Add("Drive can write BD-R pre-1.0");
- if(ftr.CanWriteOldBDRE) mmcOneValue.Add("Drive can write BD-RE pre-1.0");
- if(ftr.CanWriteRWSubchannelInTAO)
+ if (ftr.CanWriteOldBDR) mmcOneValue.Add("Drive can write BD-R pre-1.0");
+ if (ftr.CanWriteOldBDRE) mmcOneValue.Add("Drive can write BD-RE pre-1.0");
+ if (ftr.CanWriteRWSubchannelInTAO)
{
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Track at Once Mode");
- if(ftr.CanWriteRawSubchannelInTAO)
+ if (ftr.CanWriteRawSubchannelInTAO)
mmcOneValue.Add("Drive accepts RAW R-W subchannel data in Track at Once Mode");
- if(ftr.CanWritePackedSubchannelInTAO)
+ if (ftr.CanWritePackedSubchannelInTAO)
mmcOneValue.Add("Drive accepts Packed R-W subchannel data in Track at Once Mode");
}
- if(ftr.CanWriteRWSubchannelInSAO)
+ if (ftr.CanWriteRWSubchannelInSAO)
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Session at Once Mode");
- if(ftr.CanWriteRaw && ftr.CanWriteRawMultiSession)
+ if (ftr.CanWriteRaw && ftr.CanWriteRawMultiSession)
mmcOneValue.Add("Drive can write multi-session CDs in raw mode");
- if(ftr.EmbeddedChanger)
+ if (ftr.EmbeddedChanger)
{
mmcOneValue.Add("Drive contains an embedded changer");
- if(ftr.ChangerIsSideChangeCapable) mmcOneValue.Add("Drive can change disc side");
- if(ftr.ChangerSupportsDiscPresent)
+ if (ftr.ChangerIsSideChangeCapable) mmcOneValue.Add("Drive can change disc side");
+ if (ftr.ChangerSupportsDiscPresent)
mmcOneValue.Add("Drive is able to report slots contents after a reset or change");
mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots");
}
- if(ftr.SupportsCSS && ftr.CSSVersion.HasValue)
+ if (ftr.SupportsCSS && ftr.CSSVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CSS/CPPM version {ftr.CSSVersion}");
- else if(ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM");
- if(ftr.SupportsCPRM && ftr.CPRMVersion.HasValue)
+ else if (ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM");
+ if (ftr.SupportsCPRM && ftr.CPRMVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}");
- else if(ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM");
- if(ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading");
- if(ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications");
- if(ftr.FirmwareDate.HasValue) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
- if(ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers");
- if(ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands");
- if(ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events");
+ else if (ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM");
+ if (ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading");
+ if (ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications");
+ if (ftr.FirmwareDate.HasValue) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
+ if (ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers");
+ if (ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands");
+ if (ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events");
- if(ftr.LoadingMechanismType.HasValue)
- switch(ftr.LoadingMechanismType)
+ if (ftr.LoadingMechanismType.HasValue)
+ switch (ftr.LoadingMechanismType)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
@@ -267,20 +270,20 @@ namespace DiscImageChef.Server
break;
}
- if(ftr.SupportsHybridDiscs) mmcOneValue.Add("Drive is able to access Hybrid discs");
- if(ftr.SupportsModePage1Ch)
+ if (ftr.SupportsHybridDiscs) mmcOneValue.Add("Drive is able to access Hybrid discs");
+ if (ftr.SupportsModePage1Ch)
mmcOneValue.Add("Drive supports the Informational Exceptions Control mode page 1Ch");
- if(ftr.SupportsOSSC)
+ if (ftr.SupportsOSSC)
mmcOneValue.Add("Drive supports the Trusted Computing Group Optical Security Subsystem Class");
- if(ftr.SupportsPWP) mmcOneValue.Add("Drive supports set/release of PWP status");
- if(ftr.SupportsSWPP) mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page");
- if(ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc");
- if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel");
- if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS");
- if(ftr.VolumeLevels.HasValue) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
- if(ftr.SupportsWriteProtectPAC)
+ if (ftr.SupportsPWP) mmcOneValue.Add("Drive supports set/release of PWP status");
+ if (ftr.SupportsSWPP) mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page");
+ if (ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc");
+ if (ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel");
+ if (ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS");
+ if (ftr.VolumeLevels.HasValue) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
+ if (ftr.SupportsWriteProtectPAC)
mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media");
- if(ftr.SupportsWriteInhibitDCB)
+ if (ftr.SupportsWriteInhibitDCB)
mmcOneValue.Add("Drive supports writing the Write Inhibit DCB on DVD+RW media");
mmcOneValue.Sort();
diff --git a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs
index 7c557828..8e41a954 100644
--- a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs
+++ b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs
@@ -46,20 +46,20 @@ namespace DiscImageChef.Server
/// List to put the values on
public static void Report(Modes.ModePage_2A mode, ref List mmcOneValue)
{
- if(mode.AudioPlay) mmcOneValue.Add("Drive can play audio");
- if(mode.Mode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
- if(mode.Mode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
- if(mode.MultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
+ if (mode.AudioPlay) mmcOneValue.Add("Drive can play audio");
+ if (mode.Mode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
+ if (mode.Mode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
+ if (mode.MultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
- if(mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio");
- if(mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss");
- if(mode.Subchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
- if(mode.DeinterlaveSubchannel) mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
- if(mode.C2Pointer) mmcOneValue.Add("Drive supports C2 pointers");
- if(mode.UPC) mmcOneValue.Add("Drive can read Media Catalogue Number");
- if(mode.ISRC) mmcOneValue.Add("Drive can read ISRC");
+ if (mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio");
+ if (mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss");
+ if (mode.Subchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
+ if (mode.DeinterlaveSubchannel) mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
+ if (mode.C2Pointer) mmcOneValue.Add("Drive supports C2 pointers");
+ if (mode.UPC) mmcOneValue.Add("Drive can read Media Catalogue Number");
+ if (mode.ISRC) mmcOneValue.Add("Drive can read ISRC");
- switch(mode.LoadingMechanism)
+ switch (mode.LoadingMechanism)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
@@ -81,89 +81,93 @@ namespace DiscImageChef.Server
break;
}
- if(mode.Lock) mmcOneValue.Add("Drive can lock media");
- if(mode.PreventJumper)
+ if (mode.Lock) mmcOneValue.Add("Drive can lock media");
+ if (mode.PreventJumper)
{
mmcOneValue.Add("Drive power ups locked");
mmcOneValue.Add(mode.LockState
- ? "Drive is locked, media cannot be ejected or inserted"
- : "Drive is not locked, media can be ejected and inserted");
+ ? "Drive is locked, media cannot be ejected or inserted"
+ : "Drive is not locked, media can be ejected and inserted");
}
else
+ {
mmcOneValue.Add(mode.LockState
- ? "Drive is locked, media cannot be ejected, but if empty, can be inserted"
- : "Drive is not locked, media can be ejected and inserted");
+ ? "Drive is locked, media cannot be ejected, but if empty, can be inserted"
+ : "Drive is not locked, media can be ejected and inserted");
+ }
- if(mode.Eject) mmcOneValue.Add("Drive can eject media");
+ if (mode.Eject) mmcOneValue.Add("Drive can eject media");
- if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently");
- if(mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently");
+ if (mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently");
+ if (mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently");
- if(mode.SupportedVolumeLevels > 0)
+ if (mode.SupportedVolumeLevels > 0)
mmcOneValue.Add($"Drive supports {mode.SupportedVolumeLevels} volume levels");
- if(mode.BufferSize > 0) mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer");
- if(mode.MaximumSpeed > 0)
+ if (mode.BufferSize > 0) mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer");
+ if (mode.MaximumSpeed > 0)
mmcOneValue.Add($"Drive's maximum reading speed is {mode.MaximumSpeed} Kbyte/sec.");
- if(mode.CurrentSpeed > 0)
+ if (mode.CurrentSpeed > 0)
mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec.");
- if(mode.ReadCDR)
+ if (mode.ReadCDR)
{
mmcOneValue.Add(mode.WriteCDR ? "Drive can read and write CD-R" : "Drive can read CD-R");
- if(mode.Method2) mmcOneValue.Add("Drive supports reading CD-R packet media");
+ if (mode.Method2) mmcOneValue.Add("Drive supports reading CD-R packet media");
}
- if(mode.ReadCDRW)
+ if (mode.ReadCDRW)
mmcOneValue.Add(mode.WriteCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW");
- if(mode.ReadDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
- if(mode.ReadDVDR)
+ if (mode.ReadDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
+ if (mode.ReadDVDR)
mmcOneValue.Add(mode.WriteDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R");
- if(mode.ReadDVDRAM)
+ if (mode.ReadDVDRAM)
mmcOneValue.Add(mode.WriteDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM");
- if(mode.Composite) mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
- if(mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
- if(mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
+ if (mode.Composite) mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
+ if (mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
+ if (mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
- if(mode.SDP) mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
- if(mode.CurrentWriteSpeedSelected > 0)
+ if (mode.SDP) mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
+ if (mode.CurrentWriteSpeedSelected > 0)
{
- if(mode.RotationControlSelected == 0)
+ if (mode.RotationControlSelected == 0)
mmcOneValue
- .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
- else if(mode.RotationControlSelected == 1)
+ .Add(
+ $"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
+ else if (mode.RotationControlSelected == 1)
mmcOneValue
- .Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
+ .Add(
+ $"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
}
else
{
- if(mode.MaxWriteSpeed > 0)
+ if (mode.MaxWriteSpeed > 0)
mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaxWriteSpeed} Kbyte/sec.");
- if(mode.CurrentWriteSpeed > 0)
+ if (mode.CurrentWriteSpeed > 0)
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec.");
}
- if(mode.WriteSpeedPerformanceDescriptors != null)
- foreach(Modes.ModePage_2A_WriteDescriptor descriptor in
+ if (mode.WriteSpeedPerformanceDescriptors != null)
+ foreach (var descriptor in
mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0))
- if(descriptor.RotationControl == 0)
+ if (descriptor.RotationControl == 0)
mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode");
- else if(descriptor.RotationControl == 1)
+ else if (descriptor.RotationControl == 1)
mmcOneValue
- .Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode");
+ .Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode");
- if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing");
+ if (mode.TestWrite) mmcOneValue.Add("Drive supports test writing");
- if(mode.ReadBarcode) mmcOneValue.Add("Drive can read barcode");
+ if (mode.ReadBarcode) mmcOneValue.Add("Drive can read barcode");
- if(mode.SCC) mmcOneValue.Add("Drive can read both sides of a disc");
- if(mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
+ if (mode.SCC) mmcOneValue.Add("Drive can read both sides of a disc");
+ if (mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
- if(mode.CMRSupported == 1) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
+ if (mode.CMRSupported == 1) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
- if(mode.BUF) mmcOneValue.Add("Drive supports buffer under-run free recording");
+ if (mode.BUF) mmcOneValue.Add("Drive supports buffer under-run free recording");
mmcOneValue.Sort();
mmcOneValue.Add("");
diff --git a/DiscImageChef.Server/App_Start/ScsiModeSense.cs b/DiscImageChef.Server/App_Start/ScsiModeSense.cs
index 3a512445..06cc4b4a 100644
--- a/DiscImageChef.Server/App_Start/ScsiModeSense.cs
+++ b/DiscImageChef.Server/App_Start/ScsiModeSense.cs
@@ -47,24 +47,25 @@ namespace DiscImageChef.Server
/// SCSI peripheral device type
/// List to put values on
/// List to put key=value pairs on
- public static void Report(ScsiMode modeSense, string vendor,
- PeripheralDeviceTypes deviceType,
- ref List scsiOneValue, ref Dictionary modePages)
+ public static void Report(ScsiMode modeSense, string vendor,
+ PeripheralDeviceTypes deviceType,
+ ref List scsiOneValue, ref Dictionary modePages)
{
- if(modeSense.MediumType.HasValue) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
- if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
- if(modeSense.BlockDescriptors != null)
- foreach(BlockDescriptor descriptor in modeSense.BlockDescriptors)
- if(descriptor.Blocks.HasValue && descriptor.BlockLength.HasValue)
+ if (modeSense.MediumType.HasValue) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
+ if (modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
+ if (modeSense.BlockDescriptors != null)
+ foreach (var descriptor in modeSense.BlockDescriptors)
+ if (descriptor.Blocks.HasValue && descriptor.BlockLength.HasValue)
scsiOneValue
- .Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each");
+ .Add(
+ $"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each");
else
scsiOneValue.Add($"Density code {descriptor.Density:X2}h");
- if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits");
- if(modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled");
- if(modeSense.BufferedMode.HasValue)
- switch(modeSense.BufferedMode)
+ if (modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits");
+ if (modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled");
+ if (modeSense.BufferedMode.HasValue)
+ switch (modeSense.BufferedMode)
{
case 0:
scsiOneValue.Add("Device writes directly to media");
@@ -80,35 +81,38 @@ namespace DiscImageChef.Server
break;
}
- if(modeSense.ModePages == null) return;
+ if (modeSense.ModePages == null) return;
- foreach(ScsiPage page in modeSense.ModePages)
- switch(page.page)
+ foreach (var page in modeSense.ModePages)
+ switch (page.page)
{
case 0x00:
{
- if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0)
+ if (deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_00_SFF(page.value));
else
modePages
- .Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
+ .Add(
+ page.subpage != 0
+ ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h"
+ : $"MODE page {page.page:X2}h",
"Unknown vendor mode page");
break;
}
case 0x01:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
- deviceType == PeripheralDeviceTypes.MultiMediaDevice
- ? Modes.PrettifyModePage_01_MMC(page.value)
- : Modes.PrettifyModePage_01(page.value));
+ deviceType == PeripheralDeviceTypes.MultiMediaDevice
+ ? Modes.PrettifyModePage_01_MMC(page.value)
+ : Modes.PrettifyModePage_01(page.value));
else goto default;
break;
}
case 0x02:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_02(page.value));
else goto default;
@@ -116,7 +120,7 @@ namespace DiscImageChef.Server
}
case 0x03:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_03(page.value));
else goto default;
@@ -124,7 +128,7 @@ namespace DiscImageChef.Server
}
case 0x04:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_04(page.value));
else goto default;
@@ -132,7 +136,7 @@ namespace DiscImageChef.Server
}
case 0x05:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_05(page.value));
else goto default;
@@ -140,7 +144,7 @@ namespace DiscImageChef.Server
}
case 0x06:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_06(page.value));
else goto default;
@@ -148,18 +152,18 @@ namespace DiscImageChef.Server
}
case 0x07:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
- deviceType == PeripheralDeviceTypes.MultiMediaDevice
- ? Modes.PrettifyModePage_07_MMC(page.value)
- : Modes.PrettifyModePage_07(page.value));
+ deviceType == PeripheralDeviceTypes.MultiMediaDevice
+ ? Modes.PrettifyModePage_07_MMC(page.value)
+ : Modes.PrettifyModePage_07(page.value));
else goto default;
break;
}
case 0x08:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_08(page.value));
else goto default;
@@ -167,18 +171,18 @@ namespace DiscImageChef.Server
}
case 0x0A:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A(page.value));
- else if(page.subpage == 1)
+ else if (page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
- Modes.PrettifyModePage_0A_S01(page.value));
+ Modes.PrettifyModePage_0A_S01(page.value));
else goto default;
break;
}
case 0x0B:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0B(page.value));
else goto default;
@@ -186,7 +190,7 @@ namespace DiscImageChef.Server
}
case 0x0D:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0D(page.value));
else goto default;
@@ -194,7 +198,7 @@ namespace DiscImageChef.Server
}
case 0x0E:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0E(page.value));
else goto default;
@@ -202,7 +206,7 @@ namespace DiscImageChef.Server
}
case 0x0F:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0F(page.value));
else goto default;
@@ -210,18 +214,18 @@ namespace DiscImageChef.Server
}
case 0x10:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
- deviceType == PeripheralDeviceTypes.SequentialAccess
- ? Modes.PrettifyModePage_10_SSC(page.value)
- : Modes.PrettifyModePage_10(page.value));
+ deviceType == PeripheralDeviceTypes.SequentialAccess
+ ? Modes.PrettifyModePage_10_SSC(page.value)
+ : Modes.PrettifyModePage_10(page.value));
else goto default;
break;
}
case 0x11:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_11(page.value));
else goto default;
@@ -231,7 +235,7 @@ namespace DiscImageChef.Server
case 0x13:
case 0x14:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_12_13_14(page.value));
else goto default;
@@ -239,18 +243,18 @@ namespace DiscImageChef.Server
}
case 0x1A:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A(page.value));
- else if(page.subpage == 1)
+ else if (page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
- Modes.PrettifyModePage_1A_S01(page.value));
+ Modes.PrettifyModePage_1A_S01(page.value));
else goto default;
break;
}
case 0x1B:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1B(page.value));
else goto default;
@@ -258,21 +262,21 @@ namespace DiscImageChef.Server
}
case 0x1C:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h",
- deviceType == PeripheralDeviceTypes.MultiMediaDevice
- ? Modes.PrettifyModePage_1C_SFF(page.value)
- : Modes.PrettifyModePage_1C(page.value));
- else if(page.subpage == 1)
+ deviceType == PeripheralDeviceTypes.MultiMediaDevice
+ ? Modes.PrettifyModePage_1C_SFF(page.value)
+ : Modes.PrettifyModePage_1C(page.value));
+ else if (page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
- Modes.PrettifyModePage_1C_S01(page.value));
+ Modes.PrettifyModePage_1C_S01(page.value));
else goto default;
break;
}
case 0x1D:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1D(page.value));
else goto default;
@@ -280,7 +284,7 @@ namespace DiscImageChef.Server
}
case 0x21:
{
- if(vendor == "CERTANCE")
+ if (vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_21(page.value));
else goto default;
@@ -288,7 +292,7 @@ namespace DiscImageChef.Server
}
case 0x22:
{
- if(vendor == "CERTANCE")
+ if (vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_22(page.value));
else goto default;
@@ -296,7 +300,7 @@ namespace DiscImageChef.Server
}
case 0x24:
{
- if(vendor == "IBM")
+ if (vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_24(page.value));
else goto default;
@@ -304,7 +308,7 @@ namespace DiscImageChef.Server
}
case 0x2A:
{
- if(page.subpage == 0)
+ if (page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_2A(page.value));
else goto default;
@@ -312,7 +316,7 @@ namespace DiscImageChef.Server
}
case 0x2F:
{
- if(vendor == "IBM")
+ if (vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_2F(page.value));
else goto default;
@@ -320,7 +324,7 @@ namespace DiscImageChef.Server
}
case 0x30:
{
- if(Modes.IsAppleModePage_30(page.value))
+ if (Modes.IsAppleModePage_30(page.value))
modePages.Add("MODE page 30h", "Drive identifies as an Apple OEM drive");
else goto default;
@@ -328,7 +332,7 @@ namespace DiscImageChef.Server
}
case 0x3B:
{
- if(vendor == "HP")
+ if (vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3B(page.value));
else goto default;
@@ -336,7 +340,7 @@ namespace DiscImageChef.Server
}
case 0x3C:
{
- if(vendor == "HP")
+ if (vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3C(page.value));
else goto default;
@@ -344,9 +348,9 @@ namespace DiscImageChef.Server
}
case 0x3D:
{
- if(vendor == "IBM")
+ if (vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_3D(page.value));
- else if(vendor == "HP")
+ else if (vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3D(page.value));
else goto default;
@@ -354,9 +358,9 @@ namespace DiscImageChef.Server
}
case 0x3E:
{
- if(vendor == "FUJITSU")
+ if (vendor == "FUJITSU")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyFujitsuModePage_3E(page.value));
- else if(vendor == "HP")
+ else if (vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3E(page.value));
else goto default;
@@ -364,16 +368,19 @@ namespace DiscImageChef.Server
}
default:
{
- modePages.Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
- "Unknown mode page");
+ modePages.Add(
+ page.subpage != 0
+ ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h"
+ : $"MODE page {page.page:X2}h",
+ "Unknown mode page");
}
break;
}
- Dictionary newModePages = new Dictionary();
- foreach(KeyValuePair kvp in modePages)
+ var newModePages = new Dictionary();
+ foreach (var kvp in modePages)
newModePages.Add(kvp.Key,
- string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "
"));
+ string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "
"));
modePages = newModePages;
}
diff --git a/DiscImageChef.Server/App_Start/SscTestedMedia.cs b/DiscImageChef.Server/App_Start/SscTestedMedia.cs
index 6b6b2eec..f783261b 100644
--- a/DiscImageChef.Server/App_Start/SscTestedMedia.cs
+++ b/DiscImageChef.Server/App_Start/SscTestedMedia.cs
@@ -44,24 +44,29 @@ namespace DiscImageChef.Server
/// List of tested media
public static void Report(IEnumerable testedMedia, ref List mediaOneValue)
{
- foreach(TestedSequentialMedia media in testedMedia)
+ foreach (var media in testedMedia)
{
- if(!string.IsNullOrWhiteSpace(media.MediumTypeName))
+ if (!string.IsNullOrWhiteSpace(media.MediumTypeName))
{
mediaOneValue.Add($"Information for medium named \"{media.MediumTypeName}\"");
- if(media.MediumType.HasValue) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
+ if (media.MediumType.HasValue) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
}
- else if(media.MediumType.HasValue)
+ else if (media.MediumType.HasValue)
+ {
mediaOneValue.Add($"Information for medium type {media.MediumType:X2}h");
- else mediaOneValue.Add("Information for unknown medium type");
+ }
+ else
+ {
+ mediaOneValue.Add("Information for unknown medium type");
+ }
- if(!string.IsNullOrWhiteSpace(media.Manufacturer))
+ if (!string.IsNullOrWhiteSpace(media.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}");
- if(!string.IsNullOrWhiteSpace(media.Model)) mediaOneValue.Add($"Medium model: {media.Model}");
+ if (!string.IsNullOrWhiteSpace(media.Model)) mediaOneValue.Add($"Medium model: {media.Model}");
- if(media.Density.HasValue) mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
- if(media.CanReadMediaSerial == true) mediaOneValue.Add("Drive can read medium serial number.");
- if(media.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium.");
+ if (media.Density.HasValue) mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
+ if (media.CanReadMediaSerial == true) mediaOneValue.Add("Drive can read medium serial number.");
+ if (media.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium.");
mediaOneValue.Add("");
}
diff --git a/DiscImageChef.Server/App_Start/StatsConverter.cs b/DiscImageChef.Server/App_Start/StatsConverter.cs
index da99fb37..1e140a86 100644
--- a/DiscImageChef.Server/App_Start/StatsConverter.cs
+++ b/DiscImageChef.Server/App_Start/StatsConverter.cs
@@ -41,51 +41,51 @@ namespace DiscImageChef.Server
{
public static void Convert(Stats newStats)
{
- DicServerContext ctx = new DicServerContext();
+ var ctx = new DicServerContext();
- if(newStats.Commands != null)
+ if (newStats.Commands != null)
{
- if(newStats.Commands.Analyze > 0)
+ if (newStats.Commands.Analyze > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "analyze");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Analyze, Name = "analyze"});
else existing.Count += newStats.Commands.Analyze;
}
- if(newStats.Commands.Benchmark > 0)
+ if (newStats.Commands.Benchmark > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "benchmark");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "benchmark");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Benchmark, Name = "benchmark"});
else existing.Count += newStats.Commands.Benchmark;
}
- if(newStats.Commands.Checksum > 0)
+ if (newStats.Commands.Checksum > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "checksum");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "checksum");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Checksum, Name = "checksum"});
else existing.Count += newStats.Commands.Checksum;
}
- if(newStats.Commands.Compare > 0)
+ if (newStats.Commands.Compare > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "compare");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "compare");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Compare, Name = "compare"});
else existing.Count += newStats.Commands.Compare;
}
- if(newStats.Commands.CreateSidecar > 0)
+ if (newStats.Commands.CreateSidecar > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.CreateSidecar, Name = "create-sidecar"
@@ -93,127 +93,127 @@ namespace DiscImageChef.Server
else existing.Count += newStats.Commands.CreateSidecar;
}
- if(newStats.Commands.Decode > 0)
+ if (newStats.Commands.Decode > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "decode");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "decode");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Decode, Name = "decode"});
else existing.Count += newStats.Commands.Decode;
}
- if(newStats.Commands.DeviceInfo > 0)
+ if (newStats.Commands.DeviceInfo > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-info");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-info");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceInfo, Name = "device-info"});
else existing.Count += newStats.Commands.DeviceInfo;
}
- if(newStats.Commands.DeviceReport > 0)
+ if (newStats.Commands.DeviceReport > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-report");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "device-report");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DeviceReport, Name = "device-report"});
else existing.Count += newStats.Commands.DeviceReport;
}
- if(newStats.Commands.DumpMedia > 0)
+ if (newStats.Commands.DumpMedia > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "dump-media");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "dump-media");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.DumpMedia, Name = "dump-media"});
else existing.Count += newStats.Commands.DumpMedia;
}
- if(newStats.Commands.Entropy > 0)
+ if (newStats.Commands.Entropy > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "entropy");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "entropy");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Entropy, Name = "entropy"});
else existing.Count += newStats.Commands.Entropy;
}
- if(newStats.Commands.Formats > 0)
+ if (newStats.Commands.Formats > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "formats");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "formats");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Formats, Name = "formats"});
else existing.Count += newStats.Commands.Formats;
}
- if(newStats.Commands.MediaInfo > 0)
+ if (newStats.Commands.MediaInfo > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-info");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-info");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.MediaInfo, Name = "media-info"});
else existing.Count += newStats.Commands.MediaInfo;
}
- if(newStats.Commands.MediaScan > 0)
+ if (newStats.Commands.MediaScan > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-scan");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "media-scan");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.MediaScan, Name = "media-scan"});
else existing.Count += newStats.Commands.MediaScan;
}
- if(newStats.Commands.PrintHex > 0)
+ if (newStats.Commands.PrintHex > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "printhex");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "printhex");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.PrintHex, Name = "printhex"});
else existing.Count += newStats.Commands.PrintHex;
}
- if(newStats.Commands.Verify > 0)
+ if (newStats.Commands.Verify > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "verify");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "verify");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.Verify, Name = "verify"});
else existing.Count += newStats.Commands.Verify;
}
- if(newStats.Commands.Ls > 0)
+ if (newStats.Commands.Ls > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "ls");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "ls");
- if(existing == null) ctx.Commands.Add(new Command {Count = newStats.Commands.Ls, Name = "ls"});
+ if (existing == null) ctx.Commands.Add(new Command {Count = newStats.Commands.Ls, Name = "ls"});
else existing.Count += newStats.Commands.Ls;
}
- if(newStats.Commands.ExtractFiles > 0)
+ if (newStats.Commands.ExtractFiles > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "extract-files");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "extract-files");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ExtractFiles, Name = "extract-files"});
else existing.Count += newStats.Commands.ExtractFiles;
}
- if(newStats.Commands.ListDevices > 0)
+ if (newStats.Commands.ListDevices > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-devices");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-devices");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ListDevices, Name = "list-devices"});
else existing.Count += newStats.Commands.ListDevices;
}
- if(newStats.Commands.ListEncodings > 0)
+ if (newStats.Commands.ListEncodings > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command
{
Count = newStats.Commands.ListEncodings, Name = "list-encodings"
@@ -221,139 +221,143 @@ namespace DiscImageChef.Server
else existing.Count += newStats.Commands.ListEncodings;
}
- if(newStats.Commands.ConvertImage > 0)
+ if (newStats.Commands.ConvertImage > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "convert-image");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "convert-image");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ConvertImage, Name = "convert-image"});
else existing.Count += newStats.Commands.ConvertImage;
}
- if(newStats.Commands.ImageInfo > 0)
+ if (newStats.Commands.ImageInfo > 0)
{
- Command existing = ctx.Commands.FirstOrDefault(c => c.Name == "image-info");
+ var existing = ctx.Commands.FirstOrDefault(c => c.Name == "image-info");
- if(existing == null)
+ if (existing == null)
ctx.Commands.Add(new Command {Count = newStats.Commands.ImageInfo, Name = "image-info"});
else existing.Count += newStats.Commands.ImageInfo;
}
}
- if(newStats.OperatingSystems != null)
- foreach(OsStats operatingSystem in newStats.OperatingSystems)
+ if (newStats.OperatingSystems != null)
+ {
+ foreach (var operatingSystem in newStats.OperatingSystems)
{
- if(string.IsNullOrWhiteSpace(operatingSystem.name) ||
- string.IsNullOrWhiteSpace(operatingSystem.version)) continue;
+ if (string.IsNullOrWhiteSpace(operatingSystem.name) ||
+ string.IsNullOrWhiteSpace(operatingSystem.version)) continue;
- OperatingSystem existing =
- ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
+ var existing =
+ ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
c.Version == operatingSystem.version);
- if(existing == null)
+ if (existing == null)
ctx.OperatingSystems.Add(new OperatingSystem
{
- Count = operatingSystem.Value,
- Name = operatingSystem.name,
+ Count = operatingSystem.Value,
+ Name = operatingSystem.name,
Version = operatingSystem.version
});
else existing.Count += operatingSystem.Value;
}
+ }
else
{
- OperatingSystem existing =
+ var existing =
ctx.OperatingSystems.FirstOrDefault(c => c.Name == "Linux" && c.Version == null);
- if(existing == null) ctx.OperatingSystems.Add(new OperatingSystem {Count = 1, Name = "Linux"});
+ if (existing == null) ctx.OperatingSystems.Add(new OperatingSystem {Count = 1, Name = "Linux"});
else existing.Count++;
}
- if(newStats.Versions != null)
- foreach(NameValueStats nvs in newStats.Versions)
+ if (newStats.Versions != null)
+ {
+ foreach (var nvs in newStats.Versions)
{
- if(string.IsNullOrWhiteSpace(nvs.name)) continue;
+ if (string.IsNullOrWhiteSpace(nvs.name)) continue;
- Version existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
+ var existing = ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
- if(existing == null) ctx.Versions.Add(new Version {Count = nvs.Value, Value = nvs.name});
+ if (existing == null) ctx.Versions.Add(new Version {Count = nvs.Value, Value = nvs.name});
else existing.Count += nvs.Value;
}
+ }
else
{
- Version existing = ctx.Versions.FirstOrDefault(c => c.Value == "previous");
+ var existing = ctx.Versions.FirstOrDefault(c => c.Value == "previous");
- if(existing == null) ctx.Versions.Add(new Version {Count = 1, Value = "previous"});
+ if (existing == null) ctx.Versions.Add(new Version {Count = 1, Value = "previous"});
else existing.Count++;
}
- if(newStats.Filesystems != null)
- foreach(NameValueStats nvs in newStats.Filesystems)
+ if (newStats.Filesystems != null)
+ foreach (var nvs in newStats.Filesystems)
{
- if(string.IsNullOrWhiteSpace(nvs.name)) continue;
+ if (string.IsNullOrWhiteSpace(nvs.name)) continue;
- Filesystem existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) ctx.Filesystems.Add(new Filesystem {Count = nvs.Value, Name = nvs.name});
+ if (existing == null) ctx.Filesystems.Add(new Filesystem {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
- if(newStats.Partitions != null)
- foreach(NameValueStats nvs in newStats.Partitions)
+ if (newStats.Partitions != null)
+ foreach (var nvs in newStats.Partitions)
{
- if(string.IsNullOrWhiteSpace(nvs.name)) continue;
+ if (string.IsNullOrWhiteSpace(nvs.name)) continue;
- Partition existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) ctx.Partitions.Add(new Partition {Count = nvs.Value, Name = nvs.name});
+ if (existing == null) ctx.Partitions.Add(new Partition {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
- if(newStats.MediaImages != null)
- foreach(NameValueStats nvs in newStats.MediaImages)
+ if (newStats.MediaImages != null)
+ foreach (var nvs in newStats.MediaImages)
{
- if(string.IsNullOrWhiteSpace(nvs.name)) continue;
+ if (string.IsNullOrWhiteSpace(nvs.name)) continue;
- MediaFormat existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) ctx.MediaFormats.Add(new MediaFormat {Count = nvs.Value, Name = nvs.name});
+ if (existing == null) ctx.MediaFormats.Add(new MediaFormat {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
- if(newStats.Filters != null)
- foreach(NameValueStats nvs in newStats.Filters)
+ if (newStats.Filters != null)
+ foreach (var nvs in newStats.Filters)
{
- if(string.IsNullOrWhiteSpace(nvs.name)) continue;
+ if (string.IsNullOrWhiteSpace(nvs.name)) continue;
- Filter existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) ctx.Filters.Add(new Filter {Count = nvs.Value, Name = nvs.name});
+ if (existing == null) ctx.Filters.Add(new Filter {Count = nvs.Value, Name = nvs.name});
else existing.Count += nvs.Value;
}
- if(newStats.Devices != null)
- foreach(DeviceStats device in newStats.Devices)
+ if (newStats.Devices != null)
+ foreach (var device in newStats.Devices)
{
- if(string.IsNullOrWhiteSpace(device.Model)) continue;
+ if (string.IsNullOrWhiteSpace(device.Model)) continue;
- if(!ctx.DeviceStats.Any(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer &&
- c.Model == device.Model && c.Revision == device.Revision))
+ if (!ctx.DeviceStats.Any(c => c.Bus == device.Bus && c.Manufacturer == device.Manufacturer &&
+ c.Model == device.Model && c.Revision == device.Revision))
ctx.DeviceStats.Add(new DeviceStat
{
- Bus = device.Bus,
+ Bus = device.Bus,
Manufacturer = device.Manufacturer,
- Model = device.Model,
- Revision = device.Revision
+ Model = device.Model,
+ Revision = device.Revision
});
}
- if(newStats.Medias != null)
- foreach(MediaStats media in newStats.Medias)
+ if (newStats.Medias != null)
+ foreach (var media in newStats.Medias)
{
- if(string.IsNullOrWhiteSpace(media.type)) continue;
+ if (string.IsNullOrWhiteSpace(media.type)) continue;
- Media existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
+ var existing = ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
- if(existing == null)
+ if (existing == null)
ctx.Medias.Add(new Media {Count = media.Value, Real = media.real, Type = media.type});
else existing.Count += media.Value;
}
diff --git a/DiscImageChef.Server/App_Start/TestedMedia.cs b/DiscImageChef.Server/App_Start/TestedMedia.cs
index 70ab174a..e57b8c4f 100644
--- a/DiscImageChef.Server/App_Start/TestedMedia.cs
+++ b/DiscImageChef.Server/App_Start/TestedMedia.cs
@@ -44,259 +44,282 @@ namespace DiscImageChef.Server.App_Start
/// List of tested media
public static void Report(List testedMedias, ref List mediaOneValue)
{
- foreach(CommonTypes.Metadata.TestedMedia testedMedia in testedMedias)
+ foreach (var testedMedia in testedMedias)
{
- if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
+ if (!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
{
mediaOneValue.Add($"Information for medium named \"{testedMedia.MediumTypeName}\"");
- if(testedMedia.MediumType != null)
+ if (testedMedia.MediumType != null)
mediaOneValue.Add($"Medium type code: {testedMedia.MediumType:X2}h");
}
- else if(testedMedia.MediumType != null)
+ else if (testedMedia.MediumType != null)
+ {
mediaOneValue.Add($"Information for medium type {testedMedia.MediumType:X2}h");
- else mediaOneValue.Add("Information for unknown medium type");
+ }
+ else
+ {
+ mediaOneValue.Add("Information for unknown medium type");
+ }
mediaOneValue.Add(testedMedia.MediaIsRecognized
- ? "Drive recognizes this medium."
- : "Drive does not recognize this medium.");
+ ? "Drive recognizes this medium."
+ : "Drive does not recognize this medium.");
- if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
+ if (!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}");
- if(!string.IsNullOrWhiteSpace(testedMedia.Model))
+ if (!string.IsNullOrWhiteSpace(testedMedia.Model))
mediaOneValue.Add($"Medium model: {testedMedia.Model}");
- if(testedMedia.Density != null) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
+ if (testedMedia.Density != null) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
- if(testedMedia.BlockSize != null)
+ if (testedMedia.BlockSize != null)
mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes");
- if(testedMedia.PhysicalBlockSize != null)
+ if (testedMedia.PhysicalBlockSize != null)
mediaOneValue.Add($"Physical sector size: {testedMedia.PhysicalBlockSize} bytes");
- if(testedMedia.LongBlockSize != null)
+ if (testedMedia.LongBlockSize != null)
mediaOneValue.Add($"READ LONG sector size: {testedMedia.LongBlockSize} bytes");
- if(testedMedia.Blocks != null && testedMedia.BlockSize != null)
+ if (testedMedia.Blocks != null && testedMedia.BlockSize != null)
{
mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each");
- if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000)
+ if (testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
- .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
- else if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000)
+ .Add(
+ $"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
+ else if (testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
- .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
+ .Add(
+ $"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
- .Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
+ .Add(
+ $"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
- if(testedMedia.CHS != null && testedMedia.CurrentCHS != null)
+ if (testedMedia.CHS != null && testedMedia.CurrentCHS != null)
{
- int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads *
+ var currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads *
testedMedia.CurrentCHS.Sectors;
mediaOneValue
- .Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current");
+ .Add(
+ $"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current");
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads} max., {testedMedia.CurrentCHS.Heads} current");
mediaOneValue
- .Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current");
+ .Add(
+ $"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current");
mediaOneValue
- .Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current");
+ .Add(
+ $"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current");
mediaOneValue
- .Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
+ .Add(
+ $"Medium size in CHS mode: {(ulong) currentSectors * testedMedia.BlockSize} bytes, {(ulong) currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
- else if(testedMedia.CHS != null)
+ else if (testedMedia.CHS != null)
{
- int currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors;
+ var currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors;
mediaOneValue.Add($"Cylinders: {testedMedia.CHS.Cylinders}");
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads}");
mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}");
mediaOneValue.Add($"Sectors addressable in CHS mode: {currentSectors}");
mediaOneValue
- .Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
+ .Add(
+ $"Medium size in CHS mode: {(ulong) currentSectors * testedMedia.BlockSize} bytes, {(ulong) currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
- if(testedMedia.LBASectors != null)
+ if (testedMedia.LBASectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}");
- if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
+ if ((ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
- .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
- else if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
+ .Add(
+ $"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
+ else if ((ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
- .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
+ .Add(
+ $"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
- .Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
+ .Add(
+ $"Medium size in 28-bit LBA mode: {(ulong) testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong) testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) ((ulong) testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
- if(testedMedia.LBA48Sectors != null)
+ if (testedMedia.LBA48Sectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}");
- if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
+ if (testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue
- .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
- else if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
+ .Add(
+ $"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
+ else if (testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
mediaOneValue
- .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
+ .Add(
+ $"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
mediaOneValue
- .Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
+ .Add(
+ $"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double) (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB");
}
- if(testedMedia.NominalRotationRate != null && testedMedia.NominalRotationRate != 0x0000 &&
- testedMedia.NominalRotationRate != 0xFFFF)
+ if (testedMedia.NominalRotationRate != null && testedMedia.NominalRotationRate != 0x0000 &&
+ testedMedia.NominalRotationRate != 0xFFFF)
mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001
- ? "Medium does not rotate."
- : $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
+ ? "Medium does not rotate."
+ : $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
- if(testedMedia.BlockSize != null &&
- testedMedia.PhysicalBlockSize != null &&
- testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value &&
- (testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
- (testedMedia.LogicalAlignment & 0x4000) == 0x4000)
+ if (testedMedia.BlockSize != null &&
+ testedMedia.PhysicalBlockSize != null &&
+ testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value &&
+ (testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
+ (testedMedia.LogicalAlignment & 0x4000) == 0x4000)
mediaOneValue
- .Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
+ .Add(
+ $"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
- if(testedMedia.SupportsReadSectors == true)
+ if (testedMedia.SupportsReadSectors == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium");
- if(testedMedia.SupportsReadRetry == true)
+ if (testedMedia.SupportsReadRetry == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in CHS mode with this medium");
- if(testedMedia.SupportsReadDma == true)
+ if (testedMedia.SupportsReadDma == true)
mediaOneValue.Add("Device can use the READ DMA command in CHS mode with this medium");
- if(testedMedia.SupportsReadDmaRetry == true)
+ if (testedMedia.SupportsReadDmaRetry == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in CHS mode with this medium");
- if(testedMedia.SupportsReadLong == true)
+ if (testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG command in CHS mode with this medium");
- if(testedMedia.SupportsReadLongRetry == true)
+ if (testedMedia.SupportsReadLongRetry == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in CHS mode with this medium");
- if(testedMedia.SupportsReadLba == true)
+ if (testedMedia.SupportsReadLba == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 28-bit LBA mode with this medium");
- if(testedMedia.SupportsReadRetryLba == true)
+ if (testedMedia.SupportsReadRetryLba == true)
mediaOneValue
- .Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium");
- if(testedMedia.SupportsReadDmaLba == true)
+ .Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium");
+ if (testedMedia.SupportsReadDmaLba == true)
mediaOneValue.Add("Device can use the READ DMA command in 28-bit LBA mode with this medium");
- if(testedMedia.SupportsReadDmaRetryLba == true)
+ if (testedMedia.SupportsReadDmaRetryLba == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in 28-bit LBA mode with this medium");
- if(testedMedia.SupportsReadLongLba == true)
+ if (testedMedia.SupportsReadLongLba == true)
mediaOneValue.Add("Device can use the READ LONG command in 28-bit LBA mode with this medium");
- if(testedMedia.SupportsReadLongRetryLba == true)
+ if (testedMedia.SupportsReadLongRetryLba == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in 28-bit LBA mode with this medium");
- if(testedMedia.SupportsReadLba48 == true)
+ if (testedMedia.SupportsReadLba48 == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 48-bit LBA mode with this medium");
- if(testedMedia.SupportsReadDmaLba48 == true)
+ if (testedMedia.SupportsReadDmaLba48 == true)
mediaOneValue.Add("Device can use the READ DMA command in 48-bit LBA mode with this medium");
- if(testedMedia.SupportsSeek == true)
+ if (testedMedia.SupportsSeek == true)
mediaOneValue.Add("Device can use the SEEK command in CHS mode with this medium");
- if(testedMedia.SupportsSeekLba == true)
+ if (testedMedia.SupportsSeekLba == true)
mediaOneValue.Add("Device can use the SEEK command in 28-bit LBA mode with this medium");
- if(testedMedia.SupportsReadCapacity == true)
+ if (testedMedia.SupportsReadCapacity == true)
mediaOneValue.Add("Device can use the READ CAPACITY (10) command with this medium");
- if(testedMedia.SupportsReadCapacity16 == true)
+ if (testedMedia.SupportsReadCapacity16 == true)
mediaOneValue.Add("Device can use the READ CAPACITY (16) command with this medium");
- if(testedMedia.SupportsRead6 == true)
+ if (testedMedia.SupportsRead6 == true)
mediaOneValue.Add("Device can use the READ (6) command with this medium");
- if(testedMedia.SupportsRead10 == true)
+ if (testedMedia.SupportsRead10 == true)
mediaOneValue.Add("Device can use the READ (10) command with this medium");
- if(testedMedia.SupportsRead12 == true)
+ if (testedMedia.SupportsRead12 == true)
mediaOneValue.Add("Device can use the READ (12) command with this medium");
- if(testedMedia.SupportsRead16 == true)
+ if (testedMedia.SupportsRead16 == true)
mediaOneValue.Add("Device can use the READ (16) command with this medium");
- if(testedMedia.SupportsReadLong == true)
+ if (testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG (10) command with this medium");
- if(testedMedia.SupportsReadLong16 == true)
+ if (testedMedia.SupportsReadLong16 == true)
mediaOneValue.Add("Device can use the READ LONG (16) command with this medium");
- if(testedMedia.SupportsReadCd == true)
+ if (testedMedia.SupportsReadCd == true)
mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium");
- if(testedMedia.SupportsReadCdMsf == true)
+ if (testedMedia.SupportsReadCdMsf == true)
mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium");
- if(testedMedia.SupportsReadCdRaw == true)
+ if (testedMedia.SupportsReadCdRaw == true)
mediaOneValue
- .Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector");
- if(testedMedia.SupportsReadCdMsfRaw == true)
+ .Add(
+ "Device can use the READ CD command with LBA addressing with this medium to read raw sector");
+ if (testedMedia.SupportsReadCdMsfRaw == true)
mediaOneValue
- .Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector");
+ .Add(
+ "Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector");
- if(testedMedia.SupportsHLDTSTReadRawDVD == true)
+ if (testedMedia.SupportsHLDTSTReadRawDVD == true)
mediaOneValue.Add("Device can use the HL-DT-ST vendor READ DVD (RAW) command with this medium");
- if(testedMedia.SupportsNECReadCDDA == true)
+ if (testedMedia.SupportsNECReadCDDA == true)
mediaOneValue.Add("Device can use the NEC vendor READ CD-DA command with this medium");
- if(testedMedia.SupportsPioneerReadCDDA == true)
+ if (testedMedia.SupportsPioneerReadCDDA == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA command with this medium");
- if(testedMedia.SupportsPioneerReadCDDAMSF == true)
+ if (testedMedia.SupportsPioneerReadCDDAMSF == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA MSF command with this medium");
- if(testedMedia.SupportsPlextorReadCDDA == true)
+ if (testedMedia.SupportsPlextorReadCDDA == true)
mediaOneValue.Add("Device can use the PLEXTOR vendor READ CD-DA command with this medium");
- if(testedMedia.SupportsPlextorReadRawDVD == true)
+ if (testedMedia.SupportsPlextorReadRawDVD == true)
mediaOneValue.Add("Device can use the PLEXOR vendor READ DVD (RAW) command with this medium");
- if(testedMedia.CanReadAACS == true)
+ if (testedMedia.CanReadAACS == true)
mediaOneValue.Add("Device can read the Advanced Access Content System from this medium");
- if(testedMedia.CanReadADIP == true)
+ if (testedMedia.CanReadADIP == true)
mediaOneValue.Add("Device can read the DVD ADress-In-Pregroove from this medium");
- if(testedMedia.CanReadATIP == true)
+ if (testedMedia.CanReadATIP == true)
mediaOneValue.Add("Device can read the CD Absolute-Time-In-Pregroove from this medium");
- if(testedMedia.CanReadBCA == true)
+ if (testedMedia.CanReadBCA == true)
mediaOneValue.Add("Device can read the Burst Cutting Area from this medium");
- if(testedMedia.CanReadC2Pointers == true)
+ if (testedMedia.CanReadC2Pointers == true)
mediaOneValue.Add("Device can report the C2 pointers when reading from this medium");
- if(testedMedia.CanReadCMI == true)
+ if (testedMedia.CanReadCMI == true)
mediaOneValue.Add("Device can read the Copyright Management Information from this medium");
- if(testedMedia.CanReadCorrectedSubchannel == true)
+ if (testedMedia.CanReadCorrectedSubchannel == true)
mediaOneValue.Add("Device can correct subchannels when reading from this medium");
- if(testedMedia.CanReadCorrectedSubchannelWithC2 == true)
+ if (testedMedia.CanReadCorrectedSubchannelWithC2 == true)
mediaOneValue
- .Add("Device can correct subchannels and report the C2 pointers when reading from this medium");
- if(testedMedia.CanReadDCB == true)
+ .Add("Device can correct subchannels and report the C2 pointers when reading from this medium");
+ if (testedMedia.CanReadDCB == true)
mediaOneValue.Add("Device can read the Disc Control Blocks from this medium");
- if(testedMedia.CanReadDDS == true)
+ if (testedMedia.CanReadDDS == true)
mediaOneValue.Add("Device can read the Disc Definition Structure from this medium");
- if(testedMedia.CanReadDMI == true)
+ if (testedMedia.CanReadDMI == true)
mediaOneValue.Add("Device can read the Disc Manufacurer Information from this medium");
- if(testedMedia.CanReadDiscInformation == true)
+ if (testedMedia.CanReadDiscInformation == true)
mediaOneValue.Add("Device can read the Disc Information from this medium");
- if(testedMedia.CanReadFullTOC == true)
+ if (testedMedia.CanReadFullTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium, without processing it");
- if(testedMedia.CanReadHDCMI == true)
+ if (testedMedia.CanReadHDCMI == true)
mediaOneValue.Add("Device can read the HD DVD Copyright Management Information from this medium");
- if(testedMedia.CanReadLayerCapacity == true)
+ if (testedMedia.CanReadLayerCapacity == true)
mediaOneValue.Add("Device can read the layer capacity from this medium");
- if(testedMedia.CanReadFirstTrackPreGap == true)
+ if (testedMedia.CanReadFirstTrackPreGap == true)
mediaOneValue.Add("Device can read the first track's pregap data");
- if(testedMedia.CanReadLeadIn == true) mediaOneValue.Add("Device can read the Lead-In from this medium");
- if(testedMedia.CanReadLeadOut == true)
+ if (testedMedia.CanReadLeadIn == true)
+ mediaOneValue.Add("Device can read the Lead-In from this medium");
+ if (testedMedia.CanReadLeadOut == true)
mediaOneValue.Add("Device can read the Lead-Out from this medium");
- if(testedMedia.CanReadMediaID == true)
+ if (testedMedia.CanReadMediaID == true)
mediaOneValue.Add("Device can read the Media ID from this medium");
- if(testedMedia.CanReadMediaSerial == true)
+ if (testedMedia.CanReadMediaSerial == true)
mediaOneValue.Add("Device can read the Media Serial Number from this medium");
- if(testedMedia.CanReadPAC == true) mediaOneValue.Add("Device can read the PAC from this medium");
- if(testedMedia.CanReadPFI == true)
+ if (testedMedia.CanReadPAC == true) mediaOneValue.Add("Device can read the PAC from this medium");
+ if (testedMedia.CanReadPFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from this medium");
- if(testedMedia.CanReadPMA == true)
+ if (testedMedia.CanReadPMA == true)
mediaOneValue.Add("Device can read the Power Management Area from this medium");
- if(testedMedia.CanReadPQSubchannel == true)
+ if (testedMedia.CanReadPQSubchannel == true)
mediaOneValue.Add("Device can read the P to Q subchannels from this medium");
- if(testedMedia.CanReadPQSubchannelWithC2 == true)
+ if (testedMedia.CanReadPQSubchannelWithC2 == true)
mediaOneValue
- .Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers");
- if(testedMedia.CanReadPRI == true)
+ .Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers");
+ if (testedMedia.CanReadPRI == true)
mediaOneValue.Add("Device can read the Pre-Recorded Information from this medium");
- if(testedMedia.CanReadRWSubchannel == true)
+ if (testedMedia.CanReadRWSubchannel == true)
mediaOneValue.Add("Device can read the R to W subchannels from this medium");
- if(testedMedia.CanReadRWSubchannelWithC2 == true)
+ if (testedMedia.CanReadRWSubchannelWithC2 == true)
mediaOneValue
- .Add("Device can read the R to W subchannels from this medium reporting the C2 pointers");
- if(testedMedia.CanReadRecordablePFI == true)
+ .Add("Device can read the R to W subchannels from this medium reporting the C2 pointers");
+ if (testedMedia.CanReadRecordablePFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from Lead-In from this medium");
- if(testedMedia.CanReadSpareAreaInformation == true)
+ if (testedMedia.CanReadSpareAreaInformation == true)
mediaOneValue.Add("Device can read the Spare Area Information from this medium");
- if(testedMedia.CanReadTOC == true)
+ if (testedMedia.CanReadTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium");
mediaOneValue.Add("");
diff --git a/DiscImageChef.Server/Controllers/HomeController.cs b/DiscImageChef.Server/Controllers/HomeController.cs
index edb25ba9..01d2cc46 100644
--- a/DiscImageChef.Server/Controllers/HomeController.cs
+++ b/DiscImageChef.Server/Controllers/HomeController.cs
@@ -41,7 +41,7 @@ namespace DiscImageChef.Server.Controllers
{
public class HomeController : Controller
{
- private IWebHostEnvironment _environment;
+ private readonly IWebHostEnvironment _environment;
public HomeController(IWebHostEnvironment environment)
{
@@ -52,10 +52,10 @@ namespace DiscImageChef.Server.Controllers
[Route("README")]
public ActionResult Index()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "README.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "README.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
@@ -70,10 +70,10 @@ namespace DiscImageChef.Server.Controllers
[Route("Changelog")]
public ActionResult Changelog()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "Changelog.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "Changelog.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
@@ -88,10 +88,10 @@ namespace DiscImageChef.Server.Controllers
[Route("CODE_OF_CONDUCT")]
public ActionResult CODE_OF_CONDUCT()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "CODE_OF_CONDUCT.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "CODE_OF_CONDUCT.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
@@ -106,10 +106,10 @@ namespace DiscImageChef.Server.Controllers
[Route("PULL_REQUEST_TEMPLATE")]
public ActionResult PULL_REQUEST_TEMPLATE()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "PULL_REQUEST_TEMPLATE.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "PULL_REQUEST_TEMPLATE.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
@@ -124,10 +124,10 @@ namespace DiscImageChef.Server.Controllers
[Route("ISSUE_TEMPLATE")]
public ActionResult ISSUE_TEMPLATE()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "ISSUE_TEMPLATE.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "ISSUE_TEMPLATE.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
@@ -142,10 +142,10 @@ namespace DiscImageChef.Server.Controllers
[Route("CONTRIBUTING")]
public ActionResult CONTRIBUTING()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "CONTRIBUTING.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "CONTRIBUTING.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")").Replace("(.github/", "(");
@@ -160,10 +160,10 @@ namespace DiscImageChef.Server.Controllers
[Route("DONATING")]
public ActionResult DONATING()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "DONATING.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "DONATING.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
@@ -178,10 +178,10 @@ namespace DiscImageChef.Server.Controllers
[Route("TODO")]
public ActionResult TODO()
{
- StreamReader sr =
+ var sr =
new StreamReader(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "docs", "TODO.md"));
- string mdcontent = sr.ReadToEnd();
+ "docs", "TODO.md"));
+ var mdcontent = sr.ReadToEnd();
sr.Close();
mdcontent = mdcontent.Replace(".md)", ")");
diff --git a/DiscImageChef.Server/Controllers/ReportController.cs b/DiscImageChef.Server/Controllers/ReportController.cs
index e06d95b3..51f5eb1d 100644
--- a/DiscImageChef.Server/Controllers/ReportController.cs
+++ b/DiscImageChef.Server/Controllers/ReportController.cs
@@ -39,97 +39,99 @@ using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Server.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
-using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
namespace DiscImageChef.Server.Controllers
{
public class ReportController : Controller
{
- private DicServerContext _ctx;
+ private readonly DicServerContext _ctx;
public ReportController(DicServerContext context)
{
_ctx = context;
}
- public ActionResult Index() => RedirectToAction("View", "Report", new RouteValueDictionary {{"id", 1}});
+ public ActionResult Index()
+ {
+ return RedirectToAction("View", "Report", new RouteValueDictionary {{"id", 1}});
+ }
public ActionResult View(int? id)
{
- if(id == null || id <= 0) return Content("Incorrect device report request");
+ if (id == null || id <= 0) return Content("Incorrect device report request");
try
{
- Device report = _ctx.Devices.FirstOrDefault(d => d.Id == id);
+ var report = _ctx.Devices.FirstOrDefault(d => d.Id == id);
- if(report is null) return Content("Cannot find requested report");
+ if (report is null) return Content("Cannot find requested report");
ViewBag.lblManufacturer = report.Manufacturer;
- ViewBag.lblModel = report.Model;
- ViewBag.lblRevision = report.Revision;
+ ViewBag.lblModel = report.Model;
+ ViewBag.lblRevision = report.Revision;
- if(report.USB != null)
+ if (report.USB != null)
{
- string usbVendorDescription = null;
+ string usbVendorDescription = null;
string usbProductDescription = null;
- UsbProduct dbProduct =
- _ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID &&
- p.Vendor != null &&
- p.Vendor.VendorId == report.USB.VendorID);
+ var dbProduct =
+ _ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID &&
+ p.Vendor != null &&
+ p.Vendor.VendorId == report.USB.VendorID);
- if(dbProduct is null)
+ if (dbProduct is null)
{
- UsbVendor dbVendor = _ctx.UsbVendors.FirstOrDefault(v => v.VendorId == report.USB.VendorID);
+ var dbVendor = _ctx.UsbVendors.FirstOrDefault(v => v.VendorId == report.USB.VendorID);
- if(!(dbVendor is null)) usbVendorDescription = dbVendor.Vendor;
+ if (!(dbVendor is null)) usbVendorDescription = dbVendor.Vendor;
}
else
{
usbProductDescription = dbProduct.Product;
- usbVendorDescription = dbProduct.Vendor.Vendor;
+ usbVendorDescription = dbProduct.Vendor.Vendor;
}
ViewBag.UsbItem = new Item
{
Manufacturer = report.USB.Manufacturer,
- Product = report.USB.Product,
+ Product = report.USB.Product,
VendorDescription =
usbVendorDescription != null
? $"0x{report.USB.VendorID:x4} ({usbVendorDescription})"
: $"0x{report.USB.VendorID:x4}",
ProductDescription = usbProductDescription != null
- ? $"0x{report.USB.ProductID:x4} ({usbProductDescription})"
- : $"0x{report.USB.ProductID:x4}"
+ ? $"0x{report.USB.ProductID:x4} ({usbProductDescription})"
+ : $"0x{report.USB.ProductID:x4}"
};
}
- if(report.FireWire != null)
+ if (report.FireWire != null)
ViewBag.FireWireItem = new Item
{
- Manufacturer = report.FireWire.Manufacturer,
- Product = report.FireWire.Product,
- VendorDescription = $"0x{report.FireWire.VendorID:x8}",
+ Manufacturer = report.FireWire.Manufacturer,
+ Product = report.FireWire.Product,
+ VendorDescription = $"0x{report.FireWire.VendorID:x8}",
ProductDescription = $"0x{report.FireWire.ProductID:x8}"
};
- if(report.PCMCIA != null)
+ if (report.PCMCIA != null)
{
ViewBag.PcmciaItem = new PcmciaItem
{
- Manufacturer = report.PCMCIA.Manufacturer,
- Product = report.PCMCIA.ProductName,
- VendorDescription = $"0x{report.PCMCIA.ManufacturerCode:x4}",
+ Manufacturer = report.PCMCIA.Manufacturer,
+ Product = report.PCMCIA.ProductName,
+ VendorDescription = $"0x{report.PCMCIA.ManufacturerCode:x4}",
ProductDescription = $"0x{report.PCMCIA.CardCode:x4}",
- Compliance = report.PCMCIA.Compliance
+ Compliance = report.PCMCIA.Compliance
};
- Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS);
- if(tuples != null)
+ var tuples = CIS.GetTuples(report.PCMCIA.CIS);
+ if (tuples != null)
{
- Dictionary decodedTuples = new Dictionary();
- foreach(Tuple tuple in tuples)
- switch(tuple.Code)
+ var decodedTuples = new Dictionary();
+ foreach (var tuple in tuples)
+ switch (tuple.Code)
{
case TupleCodes.CISTPL_NULL:
case TupleCodes.CISTPL_END:
@@ -137,20 +139,20 @@ namespace DiscImageChef.Server.Controllers
case TupleCodes.CISTPL_VERS_1: break;
case TupleCodes.CISTPL_DEVICEGEO:
case TupleCodes.CISTPL_DEVICEGEO_A:
- DeviceGeometryTuple geom = CIS.DecodeDeviceGeometryTuple(tuple.Data);
- if(geom?.Geometries != null)
- foreach(DeviceGeometry geometry in geom.Geometries)
+ var geom = CIS.DecodeDeviceGeometryTuple(tuple.Data);
+ if (geom?.Geometries != null)
+ foreach (var geometry in geom.Geometries)
{
decodedTuples.Add("Device width",
- $"{(1 << (geometry.CardInterface - 1)) * 8} bits");
+ $"{(1 << (geometry.CardInterface - 1)) * 8} bits");
decodedTuples.Add("Erase block",
- $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
+ $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Read block",
- $"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
+ $"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Write block",
- $"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
+ $"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Partition alignment",
- $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes");
+ $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes");
}
break;
@@ -191,44 +193,44 @@ namespace DiscImageChef.Server.Controllers
decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString());
break;
default:
- decodedTuples.Add("Unknown tuple ID", $"0x{(byte)tuple.Code:X2}");
+ decodedTuples.Add("Unknown tuple ID", $"0x{(byte) tuple.Code:X2}");
break;
}
- if(decodedTuples.Count > 0) ViewBag.repPcmciaTuples = decodedTuples;
+ if (decodedTuples.Count > 0) ViewBag.repPcmciaTuples = decodedTuples;
}
}
- bool removable = true;
+ var removable = true;
List testedMedia = null;
- bool ata = false;
- bool atapi = false;
- bool sscMedia = false;
+ var ata = false;
+ var atapi = false;
+ var sscMedia = false;
- if(report.ATA != null || report.ATAPI != null)
+ if (report.ATA != null || report.ATAPI != null)
{
ata = true;
- List ataOneValue = new List();
- Dictionary ataTwoValue = new Dictionary();
- CommonTypes.Metadata.Ata ataReport;
+ var ataOneValue = new List();
+ var ataTwoValue = new Dictionary();
+ CommonTypes.Metadata.Ata ataReport;
- if(report.ATAPI != null)
+ if (report.ATAPI != null)
{
ViewBag.AtaItem = "ATAPI";
- ataReport = report.ATAPI;
- atapi = true;
+ ataReport = report.ATAPI;
+ atapi = true;
}
else
{
ViewBag.AtaItem = "ATA";
- ataReport = report.ATA;
+ ataReport = report.ATA;
}
- bool cfa = report.CompactFlash;
+ var cfa = report.CompactFlash;
- if(atapi && !cfa) ViewBag.lblAtaDeviceType = "ATAPI device";
- else if(!atapi && cfa) ViewBag.lblAtaDeviceType = "CompactFlash device";
- else ViewBag.lblAtaDeviceType = "ATA device";
+ if (atapi && !cfa) ViewBag.lblAtaDeviceType = "ATAPI device";
+ else if (!atapi && cfa) ViewBag.lblAtaDeviceType = "CompactFlash device";
+ else ViewBag.lblAtaDeviceType = "ATA device";
Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia);
@@ -236,62 +238,62 @@ namespace DiscImageChef.Server.Controllers
ViewBag.repAtaTwo = ataTwoValue;
}
- if(report.SCSI != null)
+ if (report.SCSI != null)
{
- List scsiOneValue = new List();
- Dictionary modePages = new Dictionary();
- Dictionary evpdPages = new Dictionary();
+ var scsiOneValue = new List();
+ var modePages = new Dictionary();
+ var evpdPages = new Dictionary();
- string vendorId = StringHandlers.CToString(report.SCSI.Inquiry?.VendorIdentification);
- if(report.SCSI.Inquiry != null)
+ var vendorId = StringHandlers.CToString(report.SCSI.Inquiry?.VendorIdentification);
+ if (report.SCSI.Inquiry != null)
{
- Inquiry.SCSIInquiry inq = report.SCSI.Inquiry.Value;
+ var inq = report.SCSI.Inquiry.Value;
ViewBag.lblScsiVendor = VendorString.Prettify(vendorId) != vendorId
- ? $"{vendorId} ({VendorString.Prettify(vendorId)})"
- : vendorId;
- ViewBag.lblScsiProduct = StringHandlers.CToString(inq.ProductIdentification);
+ ? $"{vendorId} ({VendorString.Prettify(vendorId)})"
+ : vendorId;
+ ViewBag.lblScsiProduct = StringHandlers.CToString(inq.ProductIdentification);
ViewBag.lblScsiRevision = StringHandlers.CToString(inq.ProductRevisionLevel);
}
scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry));
- if(report.SCSI.SupportsModeSense6) scsiOneValue.Add("Device supports MODE SENSE (6)");
- if(report.SCSI.SupportsModeSense10) scsiOneValue.Add("Device supports MODE SENSE (10)");
- if(report.SCSI.SupportsModeSubpages) scsiOneValue.Add("Device supports MODE SENSE subpages");
+ if (report.SCSI.SupportsModeSense6) scsiOneValue.Add("Device supports MODE SENSE (6)");
+ if (report.SCSI.SupportsModeSense10) scsiOneValue.Add("Device supports MODE SENSE (10)");
+ if (report.SCSI.SupportsModeSubpages) scsiOneValue.Add("Device supports MODE SENSE subpages");
- if(report.SCSI.ModeSense != null)
+ if (report.SCSI.ModeSense != null)
{
- PeripheralDeviceTypes devType = PeripheralDeviceTypes.DirectAccess;
- if(report.SCSI.Inquiry != null)
- devType = (PeripheralDeviceTypes)report.SCSI.Inquiry.Value.PeripheralDeviceType;
+ var devType = PeripheralDeviceTypes.DirectAccess;
+ if (report.SCSI.Inquiry != null)
+ devType = (PeripheralDeviceTypes) report.SCSI.Inquiry.Value.PeripheralDeviceType;
ScsiModeSense.Report(report.SCSI.ModeSense, vendorId, devType, ref scsiOneValue, ref modePages);
}
- if(modePages.Count > 0) ViewBag.repModeSense = modePages;
+ if (modePages.Count > 0) ViewBag.repModeSense = modePages;
- if(report.SCSI.EVPDPages != null) ScsiEvpd.Report(report.SCSI.EVPDPages, vendorId, ref evpdPages);
+ if (report.SCSI.EVPDPages != null) ScsiEvpd.Report(report.SCSI.EVPDPages, vendorId, ref evpdPages);
- if(evpdPages.Count > 0) ViewBag.repEvpd = evpdPages;
+ if (evpdPages.Count > 0) ViewBag.repEvpd = evpdPages;
- if(report.SCSI.MultiMediaDevice != null)
+ if (report.SCSI.MultiMediaDevice != null)
{
testedMedia = report.SCSI.MultiMediaDevice.TestedMedia;
- if(report.SCSI.MultiMediaDevice.ModeSense2A != null)
+ if (report.SCSI.MultiMediaDevice.ModeSense2A != null)
{
- List mmcModeOneValue = new List();
+ var mmcModeOneValue = new List();
ScsiMmcMode.Report(report.SCSI.MultiMediaDevice.ModeSense2A, ref mmcModeOneValue);
- if(mmcModeOneValue.Count > 0) ViewBag.repScsiMmcMode = mmcModeOneValue;
+ if (mmcModeOneValue.Count > 0) ViewBag.repScsiMmcMode = mmcModeOneValue;
}
- if(report.SCSI.MultiMediaDevice.Features != null)
+ if (report.SCSI.MultiMediaDevice.Features != null)
{
- List mmcFeaturesOneValue = new List();
+ var mmcFeaturesOneValue = new List();
ScsiMmcFeatures.Report(report.SCSI.MultiMediaDevice.Features, ref mmcFeaturesOneValue);
- if(mmcFeaturesOneValue.Count > 0) ViewBag.repScsiMmcFeatures = mmcFeaturesOneValue;
+ if (mmcFeaturesOneValue.Count > 0) ViewBag.repScsiMmcFeatures = mmcFeaturesOneValue;
}
}
- else if(report.SCSI.SequentialDevice != null)
+ else if (report.SCSI.SequentialDevice != null)
{
ViewBag.divScsiSscVisible = true;
@@ -304,160 +306,167 @@ namespace DiscImageChef.Server.Controllers
ViewBag.lblScsiSscMinBlock =
report.SCSI.SequentialDevice.MinBlockLength?.ToString() ?? "Unspecified";
- if(report.SCSI.SequentialDevice.SupportedDensities != null)
+ if (report.SCSI.SequentialDevice.SupportedDensities != null)
ViewBag.repScsiSscDensities = report.SCSI.SequentialDevice.SupportedDensities;
- if(report.SCSI.SequentialDevice.SupportedMediaTypes != null)
+ if (report.SCSI.SequentialDevice.SupportedMediaTypes != null)
ViewBag.repScsiSscMedias = report.SCSI.SequentialDevice.SupportedMediaTypes;
- if(report.SCSI.SequentialDevice.TestedMedia != null)
+ if (report.SCSI.SequentialDevice.TestedMedia != null)
{
- List mediaOneValue = new List();
+ var mediaOneValue = new List();
SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue);
- if(mediaOneValue.Count > 0)
+ if (mediaOneValue.Count > 0)
{
- sscMedia = true;
+ sscMedia = true;
ViewBag.repTestedMedia = mediaOneValue;
}
}
}
- else if(report.SCSI.ReadCapabilities != null)
+ else if (report.SCSI.ReadCapabilities != null)
{
removable = false;
scsiOneValue.Add("");
- if(report.SCSI.ReadCapabilities.Blocks.HasValue &&
- report.SCSI.ReadCapabilities.BlockSize.HasValue)
+ if (report.SCSI.ReadCapabilities.Blocks.HasValue &&
+ report.SCSI.ReadCapabilities.BlockSize.HasValue)
{
scsiOneValue
- .Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each");
+ .Add(
+ $"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each");
- if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 /
- 1024 > 1000000)
+ if (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 /
+ 1024 > 1000000)
scsiOneValue
- .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
- else if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize /
- 1024 /
- 1024 > 1000)
+ .Add(
+ $"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double) (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
+ else if (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize /
+ 1024 /
+ 1024 > 1000)
scsiOneValue
- .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
+ .Add(
+ $"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double) (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
else
scsiOneValue
- .Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB");
+ .Add(
+ $"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double) (report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB");
}
- if(report.SCSI.ReadCapabilities.MediumType.HasValue)
+ if (report.SCSI.ReadCapabilities.MediumType.HasValue)
scsiOneValue.Add($"Medium type code: {report.SCSI.ReadCapabilities.MediumType:X2}h");
- if(report.SCSI.ReadCapabilities.Density.HasValue)
+ if (report.SCSI.ReadCapabilities.Density.HasValue)
scsiOneValue.Add($"Density code: {report.SCSI.ReadCapabilities.Density:X2}h");
- if((report.SCSI.ReadCapabilities.SupportsReadLong == true ||
- report.SCSI.ReadCapabilities.SupportsReadLong16 == true) &&
- report.SCSI.ReadCapabilities.LongBlockSize.HasValue)
+ if ((report.SCSI.ReadCapabilities.SupportsReadLong == true ||
+ report.SCSI.ReadCapabilities.SupportsReadLong16 == true) &&
+ report.SCSI.ReadCapabilities.LongBlockSize.HasValue)
scsiOneValue.Add($"Long block size: {report.SCSI.ReadCapabilities.LongBlockSize} bytes");
- if(report.SCSI.ReadCapabilities.SupportsReadCapacity == true)
+ if (report.SCSI.ReadCapabilities.SupportsReadCapacity == true)
scsiOneValue.Add("Device supports READ CAPACITY (10) command.");
- if(report.SCSI.ReadCapabilities.SupportsReadCapacity16 == true)
+ if (report.SCSI.ReadCapabilities.SupportsReadCapacity16 == true)
scsiOneValue.Add("Device supports READ CAPACITY (16) command.");
- if(report.SCSI.ReadCapabilities.SupportsRead6 == true)
+ if (report.SCSI.ReadCapabilities.SupportsRead6 == true)
scsiOneValue.Add("Device supports READ (6) command.");
- if(report.SCSI.ReadCapabilities.SupportsRead10 == true)
+ if (report.SCSI.ReadCapabilities.SupportsRead10 == true)
scsiOneValue.Add("Device supports READ (10) command.");
- if(report.SCSI.ReadCapabilities.SupportsRead12 == true)
+ if (report.SCSI.ReadCapabilities.SupportsRead12 == true)
scsiOneValue.Add("Device supports READ (12) command.");
- if(report.SCSI.ReadCapabilities.SupportsRead16 == true)
+ if (report.SCSI.ReadCapabilities.SupportsRead16 == true)
scsiOneValue.Add("Device supports READ (16) command.");
- if(report.SCSI.ReadCapabilities.SupportsReadLong == true)
+ if (report.SCSI.ReadCapabilities.SupportsReadLong == true)
scsiOneValue.Add("Device supports READ LONG (10) command.");
- if(report.SCSI.ReadCapabilities.SupportsReadLong16 == true)
+ if (report.SCSI.ReadCapabilities.SupportsReadLong16 == true)
scsiOneValue.Add("Device supports READ LONG (16) command.");
}
- else testedMedia = report.SCSI.RemovableMedias;
+ else
+ {
+ testedMedia = report.SCSI.RemovableMedias;
+ }
ViewBag.repScsi = scsiOneValue;
}
- if(report.MultiMediaCard != null)
+ if (report.MultiMediaCard != null)
{
- List mmcOneValue = new List();
+ var mmcOneValue = new List();
- if(report.MultiMediaCard.CID != null)
+ if (report.MultiMediaCard.CID != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
mmcOneValue.Add("");
}
- if(report.MultiMediaCard.CSD != null)
+ if (report.MultiMediaCard.CSD != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
mmcOneValue.Add("");
}
- if(report.MultiMediaCard.ExtendedCSD != null)
+ if (report.MultiMediaCard.ExtendedCSD != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
mmcOneValue.Add("");
}
- if(report.MultiMediaCard.OCR != null)
+ if (report.MultiMediaCard.OCR != null)
{
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
mmcOneValue.Add("");
}
ViewBag.repMMC = mmcOneValue;
}
- if(report.SecureDigital != null)
+ if (report.SecureDigital != null)
{
- List sdOneValue = new List();
+ var sdOneValue = new List();
- if(report.SecureDigital.CID != null)
+ if (report.SecureDigital.CID != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
sdOneValue.Add("");
}
- if(report.SecureDigital.CSD != null)
+ if (report.SecureDigital.CSD != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
sdOneValue.Add("");
}
- if(report.SecureDigital.SCR != null)
+ if (report.SecureDigital.SCR != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
sdOneValue.Add("");
}
- if(report.SecureDigital.OCR != null)
+ if (report.SecureDigital.OCR != null)
{
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR)
- .Replace("\n", "
"));
+ .Replace("\n", "
"));
sdOneValue.Add("");
}
ViewBag.repSD = sdOneValue;
}
- if(removable && !sscMedia && testedMedia != null)
+ if (removable && !sscMedia && testedMedia != null)
{
- List mediaOneValue = new List();
+ var mediaOneValue = new List();
App_Start.TestedMedia.Report(testedMedia, ref mediaOneValue);
- if(mediaOneValue.Count > 0) ViewBag.repTestedMedia = mediaOneValue;
+ if (mediaOneValue.Count > 0) ViewBag.repTestedMedia = mediaOneValue;
}
}
- catch(Exception)
+ catch (Exception)
{
- #if DEBUG
+#if DEBUG
throw;
- #endif
+#endif
return Content("Could not load device report");
}
diff --git a/DiscImageChef.Server/Controllers/StatsController.cs b/DiscImageChef.Server/Controllers/StatsController.cs
index 32a57530..29a6ca58 100644
--- a/DiscImageChef.Server/Controllers/StatsController.cs
+++ b/DiscImageChef.Server/Controllers/StatsController.cs
@@ -44,11 +44,7 @@ using DiscImageChef.Server.Models;
using Highsoft.Web.Mvc.Charts;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Hosting.Internal;
-using Filter = DiscImageChef.Server.Models.Filter;
-using OperatingSystem = DiscImageChef.Server.Models.OperatingSystem;
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
-using Version = DiscImageChef.Server.Models.Version;
namespace DiscImageChef.Server.Controllers
{
@@ -57,13 +53,13 @@ namespace DiscImageChef.Server.Controllers
///
public class StatsController : Controller
{
- DicServerContext ctx;
- List devices;
- List operatingSystems;
- List realMedia;
- List versions;
- List virtualMedia;
- private IWebHostEnvironment _environment;
+ private readonly IWebHostEnvironment _environment;
+ private readonly DicServerContext ctx;
+ private List devices;
+ private List operatingSystems;
+ private List realMedia;
+ private List versions;
+ private List virtualMedia;
public StatsController(IWebHostEnvironment environment, DicServerContext context)
{
@@ -77,118 +73,120 @@ namespace DiscImageChef.Server.Controllers
try
{
- if(
+ if (
System.IO.File
- .Exists(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "Statistics", "Statistics.xml")))
+ .Exists(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
+ "Statistics", "Statistics.xml")))
try
{
- Stats statistics = new Stats();
+ var statistics = new Stats();
- XmlSerializer xs = new XmlSerializer(statistics.GetType());
- FileStream fs =
- WaitForFile(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml"),
- FileMode.Open, FileAccess.Read, FileShare.Read);
- statistics = (Stats)xs.Deserialize(fs);
+ var xs = new XmlSerializer(statistics.GetType());
+ var fs =
+ WaitForFile(
+ Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
+ "Statistics", "Statistics.xml"),
+ FileMode.Open, FileAccess.Read, FileShare.Read);
+ statistics = (Stats) xs.Deserialize(fs);
fs.Close();
StatsConverter.Convert(statistics);
System.IO.File
- .Delete(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "Statistics", "Statistics.xml"));
+ .Delete(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
+ "Statistics", "Statistics.xml"));
}
- catch(XmlException)
+ catch (XmlException)
{
// Do nothing
}
- if(ctx.OperatingSystems.Any())
+ if (ctx.OperatingSystems.Any())
{
operatingSystems = new List();
- foreach(OperatingSystem nvs in ctx.OperatingSystems)
+ foreach (var nvs in ctx.OperatingSystems)
operatingSystems.Add(new NameValueStats
{
name =
- $"{DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), nvs.Name), nvs.Version)}{(string.IsNullOrEmpty(nvs.Version) ? "" : " ")}{nvs.Version}",
+ $"{DetectOS.GetPlatformName((PlatformID) Enum.Parse(typeof(PlatformID), nvs.Name), nvs.Version)}{(string.IsNullOrEmpty(nvs.Version) ? "" : " ")}{nvs.Version}",
Value = nvs.Count
});
ViewBag.repOperatingSystems = operatingSystems.OrderBy(os => os.name).ToList();
- List osPieData = new List();
+ var osPieData = new List();
decimal totalOsCount = ctx.OperatingSystems.Sum(o => o.Count);
- foreach(string os in ctx.OperatingSystems.Select(o => o.Name).Distinct().ToList())
+ foreach (var os in ctx.OperatingSystems.Select(o => o.Name).Distinct().ToList())
{
decimal osCount = ctx.OperatingSystems.Where(o => o.Name == os).Sum(o => o.Count);
osPieData.Add(new PieSeriesData
{
Name =
- DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID),
- os)),
- Y = (double?)(osCount / totalOsCount),
- Sliced = os == "Linux",
+ DetectOS.GetPlatformName((PlatformID) Enum.Parse(typeof(PlatformID),
+ os)),
+ Y = (double?) (osCount / totalOsCount),
+ Sliced = os == "Linux",
Selected = os == "Linux"
});
}
ViewData["osPieData"] = osPieData;
- List linuxPieData = new List();
+ var linuxPieData = new List();
decimal linuxCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString())
- .Sum(o => o.Count);
- foreach(OperatingSystem version in
+ .Sum(o => o.Count);
+ foreach (var version in
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Linux.ToString()))
linuxPieData.Add(new PieSeriesData
{
Name =
$"{DetectOS.GetPlatformName(PlatformID.Linux, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}",
- Y = (double?)(version.Count / linuxCount)
+ Y = (double?) (version.Count / linuxCount)
});
ViewData["linuxPieData"] = linuxPieData;
- List macosPieData = new List();
+ var macosPieData = new List();
decimal macosCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString())
- .Sum(o => o.Count);
- foreach(OperatingSystem version in
+ .Sum(o => o.Count);
+ foreach (var version in
ctx.OperatingSystems.Where(o => o.Name == PlatformID.MacOSX.ToString()))
macosPieData.Add(new PieSeriesData
{
Name =
$"{DetectOS.GetPlatformName(PlatformID.MacOSX, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}",
- Y = (double?)(version.Count / macosCount)
+ Y = (double?) (version.Count / macosCount)
});
ViewData["macosPieData"] = macosPieData;
- List windowsPieData = new List();
+ var windowsPieData = new List();
decimal windowsCount = ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString())
- .Sum(o => o.Count);
- foreach(OperatingSystem version in
+ .Sum(o => o.Count);
+ foreach (var version in
ctx.OperatingSystems.Where(o => o.Name == PlatformID.Win32NT.ToString()))
windowsPieData.Add(new PieSeriesData
{
Name =
$"{DetectOS.GetPlatformName(PlatformID.Win32NT, version.Version)}{(string.IsNullOrEmpty(version.Version) ? "" : " ")}{version.Version}",
- Y = (double?)(version.Count / windowsCount)
+ Y = (double?) (version.Count / windowsCount)
});
ViewData["windowsPieData"] = windowsPieData;
}
- if(ctx.Versions.Any())
+ if (ctx.Versions.Any())
{
versions = new List();
- foreach(Version nvs in ctx.Versions)
+ foreach (var nvs in ctx.Versions)
versions.Add(new NameValueStats
{
- name = nvs.Value == "previous" ? "Previous than 3.4.99.0" : nvs.Value,
+ name = nvs.Value == "previous" ? "Previous than 3.4.99.0" : nvs.Value,
Value = nvs.Count
});
@@ -202,210 +200,211 @@ namespace DiscImageChef.Server.Controllers
version.Value == "previous"
? "Previous than 3.4.99.0"
: version.Value,
- Y = (double?)(version.Count /
- totalVersionCount),
- Sliced = version.Value == "previous",
+ Y = (double?) (version.Count /
+ totalVersionCount),
+ Sliced = version.Value == "previous",
Selected = version.Value == "previous"
}).ToList();
}
- if(ctx.Commands.Any())
+ if (ctx.Commands.Any())
{
ViewBag.repCommands = ctx.Commands.OrderBy(c => c.Name).ToList();
decimal totalCommandCount = ctx.Commands.Sum(o => o.Count);
ViewData["commandsPieData"] = ctx
- .Commands.Select(command => new PieSeriesData
- {
- Name = command.Name,
- Y = (double?)(command.Count /
- totalCommandCount),
- Sliced = command.Name == "analyze",
- Selected = command.Name == "analyze"
- }).ToList();
+ .Commands.Select(command => new PieSeriesData
+ {
+ Name = command.Name,
+ Y = (double?) (command.Count /
+ totalCommandCount),
+ Sliced = command.Name == "analyze",
+ Selected = command.Name == "analyze"
+ }).ToList();
}
- if(ctx.Filters.Any())
+ if (ctx.Filters.Any())
{
ViewBag.repFilters = ctx.Filters.OrderBy(filter => filter.Name).ToList();
- List filtersPieData = new List();
+ var filtersPieData = new List();
decimal totalFiltersCount = ctx.Filters.Sum(o => o.Count);
- foreach(Filter filter in ctx.Filters.ToList())
+ foreach (var filter in ctx.Filters.ToList())
filtersPieData.Add(new PieSeriesData
{
- Name = filter.Name,
- Y = (double?)(filter.Count / totalFiltersCount),
- Sliced = filter.Name == "No filter",
+ Name = filter.Name,
+ Y = (double?) (filter.Count / totalFiltersCount),
+ Sliced = filter.Name == "No filter",
Selected = filter.Name == "No filter"
});
ViewData["filtersPieData"] = filtersPieData;
}
- if(ctx.MediaFormats.Any())
+ if (ctx.MediaFormats.Any())
{
ViewBag.repMediaImages = ctx.MediaFormats.OrderBy(filter => filter.Name).ToList();
- List formatsPieData = new List();
+ var formatsPieData = new List();
decimal totalFormatsCount = ctx.MediaFormats.Sum(o => o.Count);
- decimal top10FormatCount = 0;
+ decimal top10FormatCount = 0;
- foreach(MediaFormat format in ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10))
+ foreach (var format in ctx.MediaFormats.OrderByDescending(o => o.Count).Take(10))
{
top10FormatCount += format.Count;
formatsPieData.Add(new PieSeriesData
{
- Name = format.Name, Y = (double?)(format.Count / totalFormatsCount)
+ Name = format.Name, Y = (double?) (format.Count / totalFormatsCount)
});
}
formatsPieData.Add(new PieSeriesData
{
Name = "Other",
- Y = (double?)((totalFormatsCount - top10FormatCount) /
- totalFormatsCount),
- Sliced = true,
+ Y = (double?) ((totalFormatsCount - top10FormatCount) /
+ totalFormatsCount),
+ Sliced = true,
Selected = true
});
ViewData["formatsPieData"] = formatsPieData;
}
- if(ctx.Partitions.Any())
+ if (ctx.Partitions.Any())
{
ViewBag.repPartitions = ctx.Partitions.OrderBy(filter => filter.Name).ToList();
- List partitionsPieData = new List();
+ var partitionsPieData = new List();
decimal totalPartitionsCount = ctx.Partitions.Sum(o => o.Count);
- decimal top10PartitionCount = 0;
+ decimal top10PartitionCount = 0;
- foreach(Partition partition in ctx.Partitions.OrderByDescending(o => o.Count).Take(10))
+ foreach (var partition in ctx.Partitions.OrderByDescending(o => o.Count).Take(10))
{
top10PartitionCount += partition.Count;
partitionsPieData.Add(new PieSeriesData
{
Name = partition.Name,
- Y = (double?)(partition.Count / totalPartitionsCount)
+ Y = (double?) (partition.Count / totalPartitionsCount)
});
}
partitionsPieData.Add(new PieSeriesData
{
Name = "Other",
- Y = (double?)((totalPartitionsCount - top10PartitionCount) /
- totalPartitionsCount),
- Sliced = true,
+ Y = (double?) ((totalPartitionsCount - top10PartitionCount) /
+ totalPartitionsCount),
+ Sliced = true,
Selected = true
});
ViewData["partitionsPieData"] = partitionsPieData;
}
- if(ctx.Filesystems.Any())
+ if (ctx.Filesystems.Any())
{
ViewBag.repFilesystems = ctx.Filesystems.OrderBy(filter => filter.Name).ToList();
- List filesystemsPieData = new List();
+ var filesystemsPieData = new List();
decimal totalFilesystemsCount = ctx.Filesystems.Sum(o => o.Count);
- decimal top10FilesystemCount = 0;
+ decimal top10FilesystemCount = 0;
- foreach(Filesystem filesystem in ctx.Filesystems.OrderByDescending(o => o.Count).Take(10))
+ foreach (var filesystem in ctx.Filesystems.OrderByDescending(o => o.Count).Take(10))
{
top10FilesystemCount += filesystem.Count;
filesystemsPieData.Add(new PieSeriesData
{
Name = filesystem.Name,
- Y = (double?)(filesystem.Count / totalFilesystemsCount)
+ Y = (double?) (filesystem.Count / totalFilesystemsCount)
});
}
filesystemsPieData.Add(new PieSeriesData
{
Name = "Other",
- Y = (double?)((totalFilesystemsCount - top10FilesystemCount) /
- totalFilesystemsCount),
- Sliced = true,
+ Y = (double?) ((totalFilesystemsCount - top10FilesystemCount) /
+ totalFilesystemsCount),
+ Sliced = true,
Selected = true
});
ViewData["filesystemsPieData"] = filesystemsPieData;
}
- if(ctx.Medias.Any())
+ if (ctx.Medias.Any())
{
- realMedia = new List();
+ realMedia = new List();
virtualMedia = new List();
- foreach(Media nvs in ctx.Medias)
+ foreach (var nvs in ctx.Medias)
try
{
MediaType
- .MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.Type),
- out string type, out string subtype);
+ .MediaTypeToString(
+ (CommonTypes.MediaType) Enum.Parse(typeof(CommonTypes.MediaType), nvs.Type),
+ out var type, out var subtype);
- if(nvs.Real)
- realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Count});
+ if (nvs.Real)
+ realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Count});
else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Count});
}
catch
{
- if(nvs.Real)
- realMedia.Add(new MediaItem {Type = nvs.Type, SubType = null, Count = nvs.Count});
+ if (nvs.Real)
+ realMedia.Add(new MediaItem {Type = nvs.Type, SubType = null, Count = nvs.Count});
else virtualMedia.Add(new MediaItem {Type = nvs.Type, SubType = null, Count = nvs.Count});
}
- if(realMedia.Count > 0)
+ if (realMedia.Count > 0)
{
ViewBag.repRealMedia =
realMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList();
- List realMediaPieData = new List();
+ var realMediaPieData = new List();
decimal totalRealMediaCount = realMedia.Sum(o => o.Count);
decimal top10RealMediaCount = 0;
- foreach(MediaItem realMediaItem in realMedia.OrderByDescending(o => o.Count).Take(10))
+ foreach (var realMediaItem in realMedia.OrderByDescending(o => o.Count).Take(10))
{
top10RealMediaCount += realMediaItem.Count;
realMediaPieData.Add(new PieSeriesData
{
Name = $"{realMediaItem.Type} ({realMediaItem.SubType})",
- Y = (double?)(realMediaItem.Count / totalRealMediaCount)
+ Y = (double?) (realMediaItem.Count / totalRealMediaCount)
});
}
realMediaPieData.Add(new PieSeriesData
{
Name = "Other",
- Y = (double?)((totalRealMediaCount - top10RealMediaCount) /
- totalRealMediaCount),
- Sliced = true,
+ Y = (double?) ((totalRealMediaCount - top10RealMediaCount) /
+ totalRealMediaCount),
+ Sliced = true,
Selected = true
});
ViewData["realMediaPieData"] = realMediaPieData;
}
- if(virtualMedia.Count > 0)
+ if (virtualMedia.Count > 0)
{
ViewBag.repVirtualMedia =
virtualMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList();
- List virtualMediaPieData = new List();
+ var virtualMediaPieData = new List();
decimal totalVirtualMediaCount = virtualMedia.Sum(o => o.Count);
decimal top10VirtualMediaCount = 0;
- foreach(MediaItem virtualMediaItem in virtualMedia.OrderByDescending(o => o.Count).Take(10))
+ foreach (var virtualMediaItem in virtualMedia.OrderByDescending(o => o.Count).Take(10))
{
top10VirtualMediaCount += virtualMediaItem.Count;
@@ -413,8 +412,8 @@ namespace DiscImageChef.Server.Controllers
{
Name =
$"{virtualMediaItem.Type} ({virtualMediaItem.SubType})",
- Y = (double?)(virtualMediaItem.Count /
- totalVirtualMediaCount)
+ Y = (double?) (virtualMediaItem.Count /
+ totalVirtualMediaCount)
});
}
@@ -424,7 +423,7 @@ namespace DiscImageChef.Server.Controllers
Y = (double?)
((totalVirtualMediaCount - top10VirtualMediaCount) /
totalVirtualMediaCount),
- Sliced = true,
+ Sliced = true,
Selected = true
});
@@ -432,93 +431,100 @@ namespace DiscImageChef.Server.Controllers
}
}
- if(ctx.DeviceStats.Any())
+ if (ctx.DeviceStats.Any())
{
devices = new List();
- foreach(DeviceStat device in ctx.DeviceStats.ToList())
+ foreach (var device in ctx.DeviceStats.ToList())
{
string xmlFile;
- if(!string.IsNullOrWhiteSpace(device.Manufacturer) &&
- !string.IsNullOrWhiteSpace(device.Model) &&
- !string.IsNullOrWhiteSpace(device.Revision))
+ if (!string.IsNullOrWhiteSpace(device.Manufacturer) &&
+ !string.IsNullOrWhiteSpace(device.Model) &&
+ !string.IsNullOrWhiteSpace(device.Revision))
xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml";
- else if(!string.IsNullOrWhiteSpace(device.Manufacturer) &&
- !string.IsNullOrWhiteSpace(device.Model))
+ else if (!string.IsNullOrWhiteSpace(device.Manufacturer) &&
+ !string.IsNullOrWhiteSpace(device.Model))
xmlFile = device.Manufacturer + "_" + device.Model + ".xml";
- else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision))
- xmlFile = device.Model + "_" + device.Revision + ".xml";
- else xmlFile = device.Model + ".xml";
+ else if (!string.IsNullOrWhiteSpace(device.Model) &&
+ !string.IsNullOrWhiteSpace(device.Revision))
+ xmlFile = device.Model + "_" + device.Revision + ".xml";
+ else xmlFile = device.Model + ".xml";
xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
- if(System.IO.File.Exists(Path.Combine(_environment.ContentRootPath, "Reports", xmlFile)))
+ if (System.IO.File.Exists(Path.Combine(_environment.ContentRootPath, "Reports", xmlFile)))
{
- DeviceReport deviceReport = new DeviceReport();
+ var deviceReport = new DeviceReport();
- XmlSerializer xs = new XmlSerializer(deviceReport.GetType());
- FileStream fs =
- WaitForFile(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(), "Reports", xmlFile),
- FileMode.Open, FileAccess.Read, FileShare.Read);
- deviceReport = (DeviceReport)xs.Deserialize(fs);
+ var xs = new XmlSerializer(deviceReport.GetType());
+ var fs =
+ WaitForFile(
+ Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
+ "Reports", xmlFile),
+ FileMode.Open, FileAccess.Read, FileShare.Read);
+ deviceReport = (DeviceReport) xs.Deserialize(fs);
fs.Close();
- DeviceReportV2 deviceReportV2 = new DeviceReportV2(deviceReport);
+ var deviceReportV2 = new DeviceReportV2(deviceReport);
device.Report = ctx.Devices.Add(new Device(deviceReportV2)).Entity;
ctx.SaveChanges();
System.IO.File
- .Delete(Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "Reports", xmlFile));
+ .Delete(Path.Combine(
+ _environment.ContentRootPath ?? throw new InvalidOperationException(),
+ "Reports", xmlFile));
}
devices.Add(new DeviceItem
{
Manufacturer = device.Manufacturer,
- Model = device.Model,
- Revision = device.Revision,
- Bus = device.Bus,
+ Model = device.Model,
+ Revision = device.Revision,
+ Bus = device.Bus,
ReportId = device.Report != null && device.Report.Id != 0
- ? device.Report.Id
- : 0
+ ? device.Report.Id
+ : 0
});
}
ViewBag.repDevices = devices.OrderBy(device => device.Manufacturer).ThenBy(device => device.Model)
- .ThenBy(device => device.Revision).ThenBy(device => device.Bus)
- .ToList();
+ .ThenBy(device => device.Revision).ThenBy(device => device.Bus)
+ .ToList();
ViewData["devicesBusPieData"] = (from deviceBus in devices.Select(d => d.Bus).Distinct()
- let deviceBusCount = devices.Count(d => d.Bus == deviceBus)
- select new PieSeriesData
- {
- Name = deviceBus,
- Y = deviceBusCount / (double)devices.Count
- }).ToList();
+ let deviceBusCount = devices.Count(d => d.Bus == deviceBus)
+ select new PieSeriesData
+ {
+ Name = deviceBus,
+ Y = deviceBusCount / (double) devices.Count
+ }).ToList();
ViewData["devicesManufacturerPieData"] =
(from manufacturer in
- devices.Where(d => d.Manufacturer != null).Select(d => d.Manufacturer.ToLowerInvariant())
+ devices.Where(d => d.Manufacturer != null)
+ .Select(d => d.Manufacturer.ToLowerInvariant())
.Distinct()
- let manufacturerCount = devices.Count(d => d.Manufacturer?.ToLowerInvariant() == manufacturer)
- select new PieSeriesData {Name = manufacturer, Y = manufacturerCount / (double)devices.Count})
- .ToList();
+ let manufacturerCount =
+ devices.Count(d => d.Manufacturer?.ToLowerInvariant() == manufacturer)
+ select new PieSeriesData
+ {Name = manufacturer, Y = manufacturerCount / (double) devices.Count})
+ .ToList();
}
}
- catch(Exception)
+ catch (Exception)
{
- #if DEBUG
+#if DEBUG
throw;
- #endif
+#endif
return Content("Could not read statistics");
}
return View();
}
- static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
+ private static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
- for(int numTries = 0; numTries < 100; numTries++)
+ for (var numTries = 0; numTries < 100; numTries++)
{
FileStream fs = null;
try
@@ -526,7 +532,7 @@ namespace DiscImageChef.Server.Controllers
fs = new FileStream(fullPath, mode, access, share);
return fs;
}
- catch(IOException)
+ catch (IOException)
{
fs?.Dispose();
Thread.Sleep(50);
diff --git a/DiscImageChef.Server/Controllers/UpdateController.cs b/DiscImageChef.Server/Controllers/UpdateController.cs
index d23bf798..9f905bd9 100644
--- a/DiscImageChef.Server/Controllers/UpdateController.cs
+++ b/DiscImageChef.Server/Controllers/UpdateController.cs
@@ -30,13 +30,10 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
-using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
-using System.Net.Http;
-using System.Text;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Dto;
using DiscImageChef.Server.Models;
@@ -48,7 +45,7 @@ namespace DiscImageChef.Server.Controllers
{
public class UpdateController : Controller
{
- private DicServerContext _ctx;
+ private readonly DicServerContext _ctx;
public UpdateController(DicServerContext ctx)
{
@@ -63,40 +60,43 @@ namespace DiscImageChef.Server.Controllers
[HttpGet]
public ActionResult Update(long timestamp)
{
- SyncDto sync = new SyncDto();
- DateTime lastSync = DateHandlers.UnixToDateTime(timestamp);
+ var sync = new SyncDto();
+ var lastSync = DateHandlers.UnixToDateTime(timestamp);
sync.UsbVendors = new List();
- foreach(UsbVendor vendor in _ctx.UsbVendors.Where(v => v.ModifiedWhen > lastSync))
- sync.UsbVendors.Add(new UsbVendorDto {VendorId = (ushort)vendor.VendorId, Vendor = vendor.Vendor});
+ foreach (var vendor in _ctx.UsbVendors.Where(v => v.ModifiedWhen > lastSync))
+ sync.UsbVendors.Add(new UsbVendorDto {VendorId = (ushort) vendor.VendorId, Vendor = vendor.Vendor});
sync.UsbProducts = new List();
- foreach(UsbProduct product in _ctx.UsbProducts.Include(p => p.Vendor).Where(p => p.ModifiedWhen > lastSync))
+ foreach (var product in _ctx.UsbProducts.Include(p => p.Vendor).Where(p => p.ModifiedWhen > lastSync))
sync.UsbProducts.Add(new UsbProductDto
{
- Id = product.Id,
- Product = product.Product,
- ProductId = (ushort)product.ProductId,
- VendorId = (ushort)product.Vendor.VendorId
+ Id = product.Id,
+ Product = product.Product,
+ ProductId = (ushort) product.ProductId,
+ VendorId = (ushort) product.Vendor.VendorId
});
sync.Offsets = new List();
- foreach(CompactDiscOffset offset in _ctx.CdOffsets.Where(o => o.ModifiedWhen > lastSync))
+ foreach (var offset in _ctx.CdOffsets.Where(o => o.ModifiedWhen > lastSync))
sync.Offsets.Add(new CdOffsetDto(offset, offset.Id));
sync.Devices = new List();
- foreach(Device device in _ctx.Devices.Where(d => d.ModifiedWhen > lastSync).ToList())
+ foreach (var device in _ctx.Devices.Where(d => d.ModifiedWhen > lastSync).ToList())
sync.Devices.Add(new
- DeviceDto(JsonConvert.DeserializeObject(JsonConvert.SerializeObject(device, Formatting.None, new JsonSerializerSettings {ReferenceLoopHandling = ReferenceLoopHandling.Ignore})),
- device.Id, device.OptimalMultipleSectorsRead));
+ DeviceDto(
+ JsonConvert.DeserializeObject(JsonConvert.SerializeObject(device,
+ Formatting.None,
+ new JsonSerializerSettings {ReferenceLoopHandling = ReferenceLoopHandling.Ignore})),
+ device.Id, device.OptimalMultipleSectorsRead));
- JsonSerializer js = JsonSerializer.Create();
- StringWriter sw = new StringWriter();
+ var js = JsonSerializer.Create();
+ var sw = new StringWriter();
js.Serialize(sw, sync);
return new ContentResult
{
- StatusCode = (int)HttpStatusCode.OK,
+ StatusCode = (int) HttpStatusCode.OK,
Content = sw.ToString(),
ContentType = "application/json"
};
diff --git a/DiscImageChef.Server/Controllers/UploadReportController.cs b/DiscImageChef.Server/Controllers/UploadReportController.cs
index d0a76728..0f15d01b 100644
--- a/DiscImageChef.Server/Controllers/UploadReportController.cs
+++ b/DiscImageChef.Server/Controllers/UploadReportController.cs
@@ -34,19 +34,15 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Net;
-using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
-using System.Web;
using System.Xml.Serialization;
using Cinchoo.PGP;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Server.Models;
using MailKit.Net.Smtp;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Hosting.Internal;
using MimeKit;
using Newtonsoft.Json;
@@ -54,8 +50,8 @@ namespace DiscImageChef.Server.Controllers
{
public class UploadReportController : Controller
{
- private DicServerContext ctx;
- private IWebHostEnvironment _environment;
+ private readonly IWebHostEnvironment _environment;
+ private readonly DicServerContext ctx;
public UploadReportController(IWebHostEnvironment environment, DicServerContext _ctx)
{
@@ -71,53 +67,54 @@ namespace DiscImageChef.Server.Controllers
[HttpPost]
public async Task UploadReport()
{
- ContentResult response = new ContentResult {StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"};
+ var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"};
try
{
- DeviceReport newReport = new DeviceReport();
- HttpRequest request = HttpContext.Request;
+ var newReport = new DeviceReport();
+ var request = HttpContext.Request;
- XmlSerializer xs = new XmlSerializer(newReport.GetType());
- newReport = (DeviceReport) xs.Deserialize(new StringReader(await new StreamReader(request.Body).ReadToEndAsync()));
+ var xs = new XmlSerializer(newReport.GetType());
+ newReport = (DeviceReport) xs.Deserialize(
+ new StringReader(await new StreamReader(request.Body).ReadToEndAsync()));
- if(newReport == null)
+ if (newReport == null)
{
response.Content = "notstats";
return response;
}
- DeviceReportV2 reportV2 = new DeviceReportV2(newReport);
- StringWriter jsonSw = new StringWriter();
+ var reportV2 = new DeviceReportV2(newReport);
+ var jsonSw = new StringWriter();
jsonSw.Write(JsonConvert.SerializeObject(reportV2, Formatting.Indented,
- new JsonSerializerSettings
- {
- NullValueHandling = NullValueHandling.Ignore
- }));
- string reportV2String = jsonSw.ToString();
+ new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ }));
+ var reportV2String = jsonSw.ToString();
jsonSw.Close();
ctx.Reports.Add(new UploadedReport(reportV2));
ctx.SaveChanges();
- MemoryStream pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportV2String));
- MemoryStream pgpOut = new MemoryStream();
- ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt();
+ var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportV2String));
+ var pgpOut = new MemoryStream();
+ var pgp = new ChoPGPEncryptDecrypt();
pgp.Encrypt(pgpIn, pgpOut,
- Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "public.asc"), true);
+ Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
+ "public.asc"));
pgpOut.Position = 0;
- reportV2String = Encoding.UTF8.GetString(pgpOut.ToArray());
+ reportV2String = Encoding.UTF8.GetString(pgpOut.ToArray());
- MimeMessage message = new MimeMessage
+ var message = new MimeMessage
{
Subject = "New device report (old version)",
- Body = new TextPart("plain") {Text = reportV2String}
+ Body = new TextPart("plain") {Text = reportV2String}
};
- message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com"));
+ message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com"));
message.To.Add(new MailboxAddress("Natalia Portillo", "claunia@claunia.com"));
- using(SmtpClient client = new SmtpClient())
+ using (var client = new SmtpClient())
{
client.Connect("mail.claunia.com", 25, false);
client.Send(message);
@@ -130,9 +127,9 @@ namespace DiscImageChef.Server.Controllers
// ReSharper disable once RedundantCatchClause
catch
{
- #if DEBUG
- if(Debugger.IsAttached) throw;
- #endif
+#if DEBUG
+ if (Debugger.IsAttached) throw;
+#endif
response.Content = "error";
return response;
}
@@ -146,17 +143,17 @@ namespace DiscImageChef.Server.Controllers
[HttpPost]
public async Task UploadReportV2()
{
- ContentResult response = new ContentResult {StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"};
+ var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"};
try
{
- HttpRequest request = HttpContext.Request;
+ var request = HttpContext.Request;
- StreamReader sr = new StreamReader(request.Body);
- string reportJson = await sr.ReadToEndAsync();
- DeviceReportV2 newReport = JsonConvert.DeserializeObject(reportJson);
+ var sr = new StreamReader(request.Body);
+ var reportJson = await sr.ReadToEndAsync();
+ var newReport = JsonConvert.DeserializeObject(reportJson);
- if(newReport == null)
+ if (newReport == null)
{
response.Content = "notstats";
return response;
@@ -165,23 +162,23 @@ namespace DiscImageChef.Server.Controllers
ctx.Reports.Add(new UploadedReport(newReport));
ctx.SaveChanges();
- MemoryStream pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportJson));
- MemoryStream pgpOut = new MemoryStream();
- ChoPGPEncryptDecrypt pgp = new ChoPGPEncryptDecrypt();
+ var pgpIn = new MemoryStream(Encoding.UTF8.GetBytes(reportJson));
+ var pgpOut = new MemoryStream();
+ var pgp = new ChoPGPEncryptDecrypt();
pgp.Encrypt(pgpIn, pgpOut,
- Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
- "public.asc"), true);
+ Path.Combine(_environment.ContentRootPath ?? throw new InvalidOperationException(),
+ "public.asc"));
pgpOut.Position = 0;
- reportJson = Encoding.UTF8.GetString(pgpOut.ToArray());
+ reportJson = Encoding.UTF8.GetString(pgpOut.ToArray());
- MimeMessage message = new MimeMessage
+ var message = new MimeMessage
{
Subject = "New device report", Body = new TextPart("plain") {Text = reportJson}
};
- message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com"));
+ message.From.Add(new MailboxAddress("DiscImageChef", "dic@claunia.com"));
message.To.Add(new MailboxAddress("Natalia Portillo", "claunia@claunia.com"));
- using(SmtpClient client = new SmtpClient())
+ using (var client = new SmtpClient())
{
client.Connect("mail.claunia.com", 25, false);
client.Send(message);
@@ -194,10 +191,10 @@ namespace DiscImageChef.Server.Controllers
// ReSharper disable once RedundantCatchClause
catch
{
- #if DEBUG
- if(Debugger.IsAttached) throw;
- #endif
- response.Content ="error";
+#if DEBUG
+ if (Debugger.IsAttached) throw;
+#endif
+ response.Content = "error";
return response;
}
}
diff --git a/DiscImageChef.Server/Controllers/UploadStatsController.cs b/DiscImageChef.Server/Controllers/UploadStatsController.cs
index 5a370105..f780a936 100644
--- a/DiscImageChef.Server/Controllers/UploadStatsController.cs
+++ b/DiscImageChef.Server/Controllers/UploadStatsController.cs
@@ -35,16 +35,12 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
-using System.Net.Http;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using System.Web;
using System.Xml.Serialization;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Server.Models;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using OperatingSystem = DiscImageChef.Server.Models.OperatingSystem;
@@ -54,7 +50,7 @@ namespace DiscImageChef.Server.Controllers
{
public class UploadStatsController : Controller
{
- DicServerContext _ctx;
+ private readonly DicServerContext _ctx;
private IWebHostEnvironment _environment;
public UploadStatsController(IWebHostEnvironment environment, DicServerContext ctx)
@@ -62,6 +58,7 @@ namespace DiscImageChef.Server.Controllers
_environment = environment;
_ctx = ctx;
}
+
///
/// Receives statistics from DiscImageChef.Core, processes them and adds them to a server-side global statistics XML
///
@@ -70,17 +67,18 @@ namespace DiscImageChef.Server.Controllers
[HttpPost]
public async Task UploadStats()
{
- ContentResult response = new ContentResult {StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"};
+ var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"};
try
{
- Stats newStats = new Stats();
- HttpRequest request = HttpContext.Request;
+ var newStats = new Stats();
+ var request = HttpContext.Request;
- XmlSerializer xs = new XmlSerializer(newStats.GetType());
- newStats = (Stats) xs.Deserialize(new StringReader(await new StreamReader(request.Body).ReadToEndAsync()));
+ var xs = new XmlSerializer(newStats.GetType());
+ newStats = (Stats) xs.Deserialize(
+ new StringReader(await new StreamReader(request.Body).ReadToEndAsync()));
- if(newStats == null)
+ if (newStats == null)
{
response.Content = "notstats";
return response;
@@ -91,11 +89,11 @@ namespace DiscImageChef.Server.Controllers
response.Content = "ok";
return response;
}
- catch(Exception ex)
+ catch (Exception ex)
{
- #if DEBUG
- if(Debugger.IsAttached) throw;
- #endif
+#if DEBUG
+ if (Debugger.IsAttached) throw;
+#endif
response.Content = "error";
return response;
}
@@ -109,119 +107,120 @@ namespace DiscImageChef.Server.Controllers
[HttpPost]
public async Task UploadStatsV2()
{
- ContentResult response = new ContentResult {StatusCode = (int)HttpStatusCode.OK, ContentType = "text/plain"};
+ var response = new ContentResult {StatusCode = (int) HttpStatusCode.OK, ContentType = "text/plain"};
try
{
- HttpRequest request = HttpContext.Request;
+ var request = HttpContext.Request;
- StreamReader sr = new StreamReader(request.Body);
+ var sr = new StreamReader(request.Body);
var statsString = await sr.ReadToEndAsync();
- StatsDto newstats = JsonConvert.DeserializeObject(statsString);
+ var newstats = JsonConvert.DeserializeObject(statsString);
- if(newstats == null)
+ if (newstats == null)
{
response.Content = "notstats";
return response;
}
- if(newstats.Commands != null)
- foreach(NameValueStats nvs in newstats.Commands)
+ if (newstats.Commands != null)
+ foreach (var nvs in newstats.Commands)
{
- Command existing = _ctx.Commands.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = _ctx.Commands.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) _ctx.Commands.Add(new Command {Name = nvs.name, Count = nvs.Value});
+ if (existing == null) _ctx.Commands.Add(new Command {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
- if(newstats.Versions != null)
- foreach(NameValueStats nvs in newstats.Versions)
+ if (newstats.Versions != null)
+ foreach (var nvs in newstats.Versions)
{
- Version existing = _ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
+ var existing = _ctx.Versions.FirstOrDefault(c => c.Value == nvs.name);
- if(existing == null) _ctx.Versions.Add(new Version {Value = nvs.name, Count = nvs.Value});
+ if (existing == null) _ctx.Versions.Add(new Version {Value = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
- if(newstats.Filesystems != null)
- foreach(NameValueStats nvs in newstats.Filesystems)
+ if (newstats.Filesystems != null)
+ foreach (var nvs in newstats.Filesystems)
{
- Filesystem existing = _ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = _ctx.Filesystems.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) _ctx.Filesystems.Add(new Filesystem {Name = nvs.name, Count = nvs.Value});
+ if (existing == null) _ctx.Filesystems.Add(new Filesystem {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
- if(newstats.Partitions != null)
- foreach(NameValueStats nvs in newstats.Partitions)
+ if (newstats.Partitions != null)
+ foreach (var nvs in newstats.Partitions)
{
- Partition existing = _ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = _ctx.Partitions.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) _ctx.Partitions.Add(new Partition {Name = nvs.name, Count = nvs.Value});
+ if (existing == null) _ctx.Partitions.Add(new Partition {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
- if(newstats.MediaFormats != null)
- foreach(NameValueStats nvs in newstats.MediaFormats)
+ if (newstats.MediaFormats != null)
+ foreach (var nvs in newstats.MediaFormats)
{
- MediaFormat existing = _ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = _ctx.MediaFormats.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) _ctx.MediaFormats.Add(new MediaFormat {Name = nvs.name, Count = nvs.Value});
+ if (existing == null)
+ _ctx.MediaFormats.Add(new MediaFormat {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
- if(newstats.Filters != null)
- foreach(NameValueStats nvs in newstats.Filters)
+ if (newstats.Filters != null)
+ foreach (var nvs in newstats.Filters)
{
- Filter existing = _ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
+ var existing = _ctx.Filters.FirstOrDefault(c => c.Name == nvs.name);
- if(existing == null) _ctx.Filters.Add(new Filter {Name = nvs.name, Count = nvs.Value});
+ if (existing == null) _ctx.Filters.Add(new Filter {Name = nvs.name, Count = nvs.Value});
else existing.Count += nvs.Value;
}
- if(newstats.OperatingSystems != null)
- foreach(OsStats operatingSystem in newstats.OperatingSystems)
+ if (newstats.OperatingSystems != null)
+ foreach (var operatingSystem in newstats.OperatingSystems)
{
- OperatingSystem existing =
- _ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
- c.Version == operatingSystem.version);
+ var existing =
+ _ctx.OperatingSystems.FirstOrDefault(c => c.Name == operatingSystem.name &&
+ c.Version == operatingSystem.version);
- if(existing == null)
+ if (existing == null)
_ctx.OperatingSystems.Add(new OperatingSystem
{
- Name = operatingSystem.name,
+ Name = operatingSystem.name,
Version = operatingSystem.version,
- Count = operatingSystem.Value
+ Count = operatingSystem.Value
});
else existing.Count += operatingSystem.Value;
}
- if(newstats.Medias != null)
- foreach(MediaStats media in newstats.Medias)
+ if (newstats.Medias != null)
+ foreach (var media in newstats.Medias)
{
- Media existing = _ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
+ var existing = _ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real);
- if(existing == null)
+ if (existing == null)
_ctx.Medias.Add(new Media {Type = media.type, Real = media.real, Count = media.Value});
else existing.Count += media.Value;
}
- if(newstats.Devices != null)
- foreach(DeviceStats device in newstats.Devices)
+ if (newstats.Devices != null)
+ foreach (var device in newstats.Devices)
{
- DeviceStat existing =
- _ctx.DeviceStats.FirstOrDefault(c => c.Bus == device.Bus &&
- c.Manufacturer == device.Manufacturer &&
- c.Model == device.Model &&
- c.Revision == device.Revision);
+ var existing =
+ _ctx.DeviceStats.FirstOrDefault(c => c.Bus == device.Bus &&
+ c.Manufacturer == device.Manufacturer &&
+ c.Model == device.Model &&
+ c.Revision == device.Revision);
- if(existing == null)
+ if (existing == null)
_ctx.DeviceStats.Add(new DeviceStat
{
- Bus = device.Bus,
+ Bus = device.Bus,
Manufacturer = device.Manufacturer,
- Model = device.Model,
- Revision = device.Revision
+ Model = device.Model,
+ Revision = device.Revision
});
}
@@ -233,17 +232,17 @@ namespace DiscImageChef.Server.Controllers
// ReSharper disable once RedundantCatchClause
catch
{
- #if DEBUG
- if(Debugger.IsAttached) throw;
- #endif
+#if DEBUG
+ if (Debugger.IsAttached) throw;
+#endif
response.Content = "error";
return response;
}
}
- FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
+ private FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
- for(int numTries = 0; numTries < 100; numTries++)
+ for (var numTries = 0; numTries < 100; numTries++)
{
FileStream fs = null;
try
@@ -251,9 +250,9 @@ namespace DiscImageChef.Server.Controllers
fs = new FileStream(fullPath, mode, access, share);
return fs;
}
- catch(IOException)
+ catch (IOException)
{
- if(fs != null) fs.Dispose();
+ if (fs != null) fs.Dispose();
Thread.Sleep(50);
}
}
diff --git a/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs b/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs
index ba536db9..ed8c583c 100644
--- a/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs
+++ b/DiscImageChef.Server/Migrations/20191102132240_InitialMigration.cs
@@ -10,6 +10,7 @@ namespace DiscImageChef.Server.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
#region Check for old tables
+
var AtasExists = DicServerContext.TableExists("Atas");
var BlockDescriptorsExists = DicServerContext.TableExists("BlockDescriptors");
var ChsExists = DicServerContext.TableExists("Chs");
@@ -43,10 +44,12 @@ namespace DiscImageChef.Server.Migrations
var UsbVendorsExists = DicServerContext.TableExists("UsbVendors");
var VersionsExists = DicServerContext.TableExists("Versions");
var EFExists = DicServerContext.TableExists("__MigrationHistory");
+
#endregion
#region Drop old restrictions
- if(AtasExists)
+
+ if (AtasExists)
migrationBuilder.DropForeignKey("FK_Atas_TestedMedias_ReadCapabilities_Id", "Atas");
if (BlockDescriptorsExists)
migrationBuilder.DropForeignKey("FK_BlockDescriptors_ScsiModes_ScsiMode_Id", "BlockDescriptors");
@@ -74,6 +77,7 @@ namespace DiscImageChef.Server.Migrations
migrationBuilder.DropForeignKey(
"FK_Devices_Usbs_USB_Id", "Devices");
}
+
if (DeviceStatsExists)
migrationBuilder.DropForeignKey(
"FK_DeviceStats_Devices_Report_Id", "DeviceStats");
@@ -83,123 +87,128 @@ namespace DiscImageChef.Server.Migrations
if (ScsiPagesExists)
{
migrationBuilder.DropForeignKey(
- "FK_ScsiPages_ScsiModes_ScsiMode_Id","ScsiPages");
+ "FK_ScsiPages_ScsiModes_ScsiMode_Id", "ScsiPages");
migrationBuilder.DropForeignKey(
- "FK_ScsiPages_Scsis_Scsi_Id","ScsiPages");
+ "FK_ScsiPages_Scsis_Scsi_Id", "ScsiPages");
}
+
if (ScsisExists)
{
migrationBuilder.DropForeignKey(
- "FK_Scsis_Mmcs_MultiMediaDevice_Id","Scsis");
+ "FK_Scsis_Mmcs_MultiMediaDevice_Id", "Scsis");
migrationBuilder.DropForeignKey(
- "FK_Scsis_ScsiModes_ModeSense_Id","Scsis");
+ "FK_Scsis_ScsiModes_ModeSense_Id", "Scsis");
migrationBuilder.DropForeignKey(
- "FK_Scsis_Sscs_SequentialDevice_Id","Scsis");
+ "FK_Scsis_Sscs_SequentialDevice_Id", "Scsis");
migrationBuilder.DropForeignKey(
- "FK_Scsis_TestedMedias_ReadCapabilities_Id","Scsis");
+ "FK_Scsis_TestedMedias_ReadCapabilities_Id", "Scsis");
}
+
if (SscSupportedMediasExists)
{
migrationBuilder.DropForeignKey(
- "FK_a812ec60296b45bcb3d245a5c6d01d73","SscSupportedMedias");
+ "FK_a812ec60296b45bcb3d245a5c6d01d73", "SscSupportedMedias");
migrationBuilder.DropForeignKey(
- "FK_SscSupportedMedias_Sscs_Ssc_Id","SscSupportedMedias");
+ "FK_SscSupportedMedias_Sscs_Ssc_Id", "SscSupportedMedias");
}
+
if (SupportedDensitiesExists)
{
migrationBuilder.DropForeignKey(
- "FK_783f1b3552774280af1caf44fb27e285","SupportedDensities");
+ "FK_783f1b3552774280af1caf44fb27e285", "SupportedDensities");
migrationBuilder.DropForeignKey(
- "FK_SupportedDensities_Sscs_Ssc_Id","SupportedDensities");
+ "FK_SupportedDensities_Sscs_Ssc_Id", "SupportedDensities");
}
+
if (TestedMediasExists)
{
migrationBuilder.DropForeignKey(
- "FK_TestedMedias_Atas_Ata_Id","TestedMedias");
+ "FK_TestedMedias_Atas_Ata_Id", "TestedMedias");
migrationBuilder.DropForeignKey(
- "FK_TestedMedias_Chs_CHS_Id","TestedMedias");
+ "FK_TestedMedias_Chs_CHS_Id", "TestedMedias");
migrationBuilder.DropForeignKey(
- "FK_TestedMedias_Chs_CurrentCHS_Id","TestedMedias");
+ "FK_TestedMedias_Chs_CurrentCHS_Id", "TestedMedias");
migrationBuilder.DropForeignKey(
- "FK_TestedMedias_Mmcs_Mmc_Id","TestedMedias");
+ "FK_TestedMedias_Mmcs_Mmc_Id", "TestedMedias");
migrationBuilder.DropForeignKey(
- "FK_TestedMedias_Scsis_Scsi_Id","TestedMedias");
+ "FK_TestedMedias_Scsis_Scsi_Id", "TestedMedias");
}
+
if (TestedSequentialMediasExists)
migrationBuilder.DropForeignKey(
- "FK_TestedSequentialMedias_Sscs_Ssc_Id","TestedSequentialMedias");
+ "FK_TestedSequentialMedias_Sscs_Ssc_Id", "TestedSequentialMedias");
if (UploadedReportsExists)
{
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_Atas_ATA_Id","UploadedReports");
+ "FK_UploadedReports_Atas_ATA_Id", "UploadedReports");
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_Atas_ATAPI_Id","UploadedReports");
+ "FK_UploadedReports_Atas_ATAPI_Id", "UploadedReports");
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_FireWires_FireWire_Id","UploadedReports");
+ "FK_UploadedReports_FireWires_FireWire_Id", "UploadedReports");
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_MmcSds_MultiMediaCard_Id","UploadedReports");
+ "FK_UploadedReports_MmcSds_MultiMediaCard_Id", "UploadedReports");
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_MmcSds_SecureDigital_Id","UploadedReports");
+ "FK_UploadedReports_MmcSds_SecureDigital_Id", "UploadedReports");
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_Pcmcias_PCMCIA_Id","UploadedReports");
+ "FK_UploadedReports_Pcmcias_PCMCIA_Id", "UploadedReports");
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_Scsis_SCSI_Id","UploadedReports");
+ "FK_UploadedReports_Scsis_SCSI_Id", "UploadedReports");
migrationBuilder.DropForeignKey(
- "FK_UploadedReports_Usbs_USB_Id","UploadedReports");
+ "FK_UploadedReports_Usbs_USB_Id", "UploadedReports");
}
+
if (UsbProductsExists)
migrationBuilder.DropForeignKey(
- "FK_UsbProducts_UsbVendors_VendorId","UsbProducts");
+ "FK_UsbProducts_UsbVendors_VendorId", "UsbProducts");
+
#endregion
#region TABLE: CdOffsets
+
migrationBuilder.CreateTable(
- name: "CdOffsets",
- columns: table => new
+ "CdOffsets",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Manufacturer = table.Column(nullable: true),
Model = table.Column(nullable: true),
- Offset = table.Column(nullable: false),
- Submissions = table.Column(nullable: false),
- Agreement = table.Column(nullable: false),
- AddedWhen = table.Column(nullable: false),
- ModifiedWhen = table.Column(nullable: false)
+ Offset = table.Column(),
+ Submissions = table.Column(),
+ Agreement = table.Column(),
+ AddedWhen = table.Column(),
+ ModifiedWhen = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_CdOffsets", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_CdOffsets", x => x.Id); });
if (CompactDiscOffsetsExists)
{
- migrationBuilder.Sql("INSERT INTO CdOffsets (Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen) SELECT Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen FROM CompactDiscOffsets");
+ migrationBuilder.Sql(
+ "INSERT INTO CdOffsets (Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen) SELECT Id, Manufacturer, Model, Offset, Submissions, Agreement, AddedWhen, ModifiedWhen FROM CompactDiscOffsets");
migrationBuilder.DropTable("CompactDiscOffsets");
}
+
#endregion
#region TABLE: Chs
+
if (ChsExists)
- migrationBuilder.RenameTable(name: "Chs", newName: "Chs_old");
+ migrationBuilder.RenameTable("Chs", newName: "Chs_old");
migrationBuilder.CreateTable(
- name: "Chs",
- columns: table => new
+ "Chs",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- Cylinders = table.Column(nullable: false),
- Heads = table.Column(nullable: false),
- Sectors = table.Column(nullable: false),
- CylindersSql = table.Column(nullable: false),
- HeadsSql = table.Column(nullable: false),
- SectorsSql = table.Column(nullable: false)
+ Cylinders = table.Column(),
+ Heads = table.Column(),
+ Sectors = table.Column(),
+ CylindersSql = table.Column(),
+ HeadsSql = table.Column(),
+ SectorsSql = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_Chs", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_Chs", x => x.Id); });
if (ChsExists)
{
@@ -207,25 +216,24 @@ namespace DiscImageChef.Server.Migrations
"INSERT INTO Chs (Id, Cylinders, Heads, Sectors, CylindersSql, HeadsSql, SectorsSql) SELECT Id, CylindersSql AS Cylinders, HeadsSql AS Heads, SectorsSql AS Sectors, CylindersSql, HeadsSql, SectorsSql FROM Chs_old");
migrationBuilder.DropTable("Chs_old");
}
+
#endregion
#region TABLE: Commands
+
if (CommandsExists)
- migrationBuilder.RenameTable(name: "Commands", newName: "Commands_old");
+ migrationBuilder.RenameTable("Commands", newName: "Commands_old");
migrationBuilder.CreateTable(
- name: "Commands",
- columns: table => new
+ "Commands",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column(nullable: true),
- Count = table.Column(nullable: false)
+ Count = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_Commands", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_Commands", x => x.Id); });
if (CommandsExists)
{
@@ -233,25 +241,24 @@ namespace DiscImageChef.Server.Migrations
"INSERT INTO Commands (Id, Name, Count) SELECT Id, Name, Count FROM Commands_old");
migrationBuilder.DropTable("Commands_old");
}
+
#endregion
#region TABLE: Filesystems
+
if (FilesystemsExists)
- migrationBuilder.RenameTable(name: "Filesystems", newName: "Filesystems_old");
+ migrationBuilder.RenameTable("Filesystems", newName: "Filesystems_old");
migrationBuilder.CreateTable(
- name: "Filesystems",
- columns: table => new
+ "Filesystems",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column(nullable: true),
- Count = table.Column(nullable: false)
+ Count = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_Filesystems", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_Filesystems", x => x.Id); });
if (FilesystemsExists)
{
@@ -259,25 +266,24 @@ namespace DiscImageChef.Server.Migrations
"INSERT INTO Filesystems (Id, Name, Count) SELECT Id, Name, Count FROM Filesystems_old");
migrationBuilder.DropTable("Filesystems_old");
}
+
#endregion
#region TABLE: Filters
+
if (FiltersExists)
- migrationBuilder.RenameTable(name: "Filters", newName: "Filters_old");
+ migrationBuilder.RenameTable("Filters", newName: "Filters_old");
migrationBuilder.CreateTable(
- name: "Filters",
- columns: table => new
+ "Filters",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column(nullable: true),
- Count = table.Column(nullable: false)
+ Count = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_Filters", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_Filters", x => x.Id); });
if (FiltersExists)
{
@@ -285,27 +291,26 @@ namespace DiscImageChef.Server.Migrations
"INSERT INTO Filters (Id, Name, Count) SELECT Id, Name, Count FROM Filters_old");
migrationBuilder.DropTable("Filters_old");
}
+
#endregion
#region TABLE: FireWire
+
migrationBuilder.CreateTable(
- name: "FireWire",
- columns: table => new
+ "FireWire",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
- VendorID = table.Column(nullable: false),
- ProductID = table.Column(nullable: false),
+ VendorID = table.Column(),
+ ProductID = table.Column(),
Manufacturer = table.Column(nullable: true),
Product = table.Column(nullable: true),
- RemovableMedia = table.Column(nullable: false),
- VendorIDSql = table.Column(nullable: false),
- ProductIDSql = table.Column(nullable: false)
+ RemovableMedia = table.Column(),
+ VendorIDSql = table.Column(),
+ ProductIDSql = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_FireWire", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_FireWire", x => x.Id); });
if (FireWiresExists)
{
@@ -313,25 +318,24 @@ namespace DiscImageChef.Server.Migrations
"INSERT INTO FireWire (Id, VendorID, ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql) SELECT Id, VendorIDSql AS VendorID, ProductIDSql AS ProductID, Manufacturer, Product, RemovableMedia, VendorIDSql, ProductIDSql FROM FireWires");
migrationBuilder.DropTable("FireWires");
}
+
#endregion
#region TABLE: MediaFormats
+
if (MediaFormatsExists)
- migrationBuilder.RenameTable(name: "MediaFormats", newName: "MediaFormats_old");
+ migrationBuilder.RenameTable("MediaFormats", newName: "MediaFormats_old");
migrationBuilder.CreateTable(
- name: "MediaFormats",
- columns: table => new
+ "MediaFormats",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column(nullable: true),
- Count = table.Column(nullable: false)
+ Count = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_MediaFormats", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_MediaFormats", x => x.Id); });
if (MediaFormatsExists)
{
@@ -339,23 +343,22 @@ namespace DiscImageChef.Server.Migrations
"INSERT INTO MediaFormats (Id, Name, Count) SELECT Id, Name, Count FROM MediaFormats_old");
migrationBuilder.DropTable("MediaFormats_old");
}
+
#endregion
#region TABLE: Medias
+
migrationBuilder.CreateTable(
- name: "Medias",
- columns: table => new
+ "Medias",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Type = table.Column(nullable: true),
- Real = table.Column(nullable: false),
- Count = table.Column(nullable: false)
+ Real = table.Column(),
+ Count = table.Column()
},
- constraints: table =>
- {
- table.PrimaryKey("PK_Medias", x => x.Id);
- });
+ constraints: table => { table.PrimaryKey("PK_Medias", x => x.Id); });
if (MediaExists)
{
@@ -363,140 +366,142 @@ namespace DiscImageChef.Server.Migrations
"INSERT INTO Medias (`Id`, `Type`, `Real`, `Count`) SELECT `Id`, `Type`, `Real`, `Count` FROM Media");
migrationBuilder.DropTable("Media");
}
+
#endregion
#region TABLE: MmcFeatures
+
if (MmcFeaturesExists)
- migrationBuilder.RenameTable(name: "MmcFeatures", newName: "MmcFeatures_old");
+ migrationBuilder.RenameTable("MmcFeatures", newName: "MmcFeatures_old");
migrationBuilder.CreateTable(
- name: "MmcFeatures",
- columns: table => new
+ "MmcFeatures",
+ table => new
{
- Id = table.Column(nullable: false)
+ Id = table.Column()
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
AACSVersion = table.Column(nullable: true),
AGIDs = table.Column(nullable: true),
BindingNonceBlocks = table.Column(nullable: true),
BlocksPerReadableUnit = table.Column(nullable: true),
- BufferUnderrunFreeInDVD = table.Column(nullable: false),
- BufferUnderrunFreeInSAO = table.Column(nullable: false),
- BufferUnderrunFreeInTAO = table.Column(nullable: false),
- CanAudioScan = table.Column(nullable: false),
- CanEject = table.Column(nullable: false),
- CanEraseSector = table.Column(nullable: false),
- CanExpandBDRESpareArea = table.Column(nullable: false),
- CanFormat = table.Column(nullable: false),
- CanFormatBDREWithoutSpare = table.Column(nullable: false),
- CanFormatCert = table.Column(nullable: false),
- CanFormatFRF = table.Column(nullable: false),
- CanFormatQCert = table.Column(nullable: false),
- CanFormatRRM = table.Column(nullable: false),
- CanGenerateBindingNonce = table.Column(nullable: false),
- CanLoad = table.Column(nullable: false),
- CanMuteSeparateChannels = table.Column(nullable: false),
- CanOverwriteSAOTrack = table.Column(nullable: false),
- CanOverwriteTAOTrack = table.Column(nullable: false),
- CanPlayCDAudio = table.Column(nullable: false),
- CanPseudoOverwriteBDR = table.Column(nullable: false),
- CanReadAllDualR = table.Column(nullable: false),
- CanReadAllDualRW = table.Column(nullable: false),
- CanReadBD = table.Column(nullable: false),
- CanReadBDR = table.Column(nullable: false),
- CanReadBDRE1 = table.Column(nullable: false),
- CanReadBDRE2 = table.Column(nullable: false),
- CanReadBDROM = table.Column(nullable: false),
- CanReadBluBCA = table.Column(nullable: false),
- CanReadCD = table.Column(nullable: false),
- CanReadCDMRW = table.Column(nullable: false),
- CanReadCPRM_MKB = table.Column(nullable: false),
- CanReadDDCD = table.Column(nullable: false),
- CanReadDVD = table.Column(nullable: false),
- CanReadDVDPlusMRW = table.Column(nullable: false),
- CanReadDVDPlusR = table.Column(nullable: false),
- CanReadDVDPlusRDL = table.Column(nullable: false),
- CanReadDVDPlusRW = table.Column(nullable: false),
- CanReadDVDPlusRWDL = table.Column(nullable: false),
- CanReadDriveAACSCertificate = table.Column(nullable: false),
- CanReadHDDVD = table.Column(nullable: false),
- CanReadHDDVDR = table.Column(nullable: false),
- CanReadHDDVDRAM = table.Column(nullable: false),
- CanReadLeadInCDText = table.Column(nullable: false),
- CanReadOldBDR = table.Column(nullable: false),
- CanReadOldBDRE = table.Column(nullable: false),
- CanReadOldBDROM = table.Column(nullable: false),
- CanReadSpareAreaInformation = table.Column(nullable: false),
- CanReportDriveSerial = table.Column(nullable: false),
- CanReportMediaSerial = table.Column(nullable: false),
- CanTestWriteDDCDR = table.Column(nullable: false),
- CanTestWriteDVD = table.Column(nullable: false),
- CanTestWriteInSAO = table.Column(nullable: false),
- CanTestWriteInTAO = table.Column(nullable: false),
- CanUpgradeFirmware = table.Column(nullable: false),
- CanWriteBD = table.Column(nullable: false),
- CanWriteBDR = table.Column(nullable: false),
- CanWriteBDRE1 = table.Column(nullable: false),
- CanWriteBDRE2 = table.Column(nullable: false),
- CanWriteBusEncryptedBlocks = table.Column(nullable: false),
- CanWriteCDMRW = table.Column(nullable: false),
- CanWriteCDRW = table.Column(nullable: false),
- CanWriteCDRWCAV = table.Column(nullable: false),
- CanWriteCDSAO = table.Column(nullable: false),
- CanWriteCDTAO = table.Column(nullable: false),
- CanWriteCSSManagedDVD = table.Column(nullable: false),
- CanWriteDDCDR = table.Column(nullable: false),
- CanWriteDDCDRW = table.Column(nullable: false),
- CanWriteDVDPlusMRW = table.Column(nullable: false),
- CanWriteDVDPlusR = table.Column(nullable: false),
- CanWriteDVDPlusRDL = table.Column(nullable: false),
- CanWriteDVDPlusRW = table.Column(nullable: false),
- CanWriteDVDPlusRWDL = table.Column(nullable: false),
- CanWriteDVDR = table.Column(nullable: false),
- CanWriteDVDRDL = table.Column(nullable: false),
- CanWriteDVDRW = table.Column(nullable: false),
- CanWriteHDDVDR = table.Column(nullable: false),
- CanWriteHDDVDRAM = table.Column(nullable: false),
- CanWriteOldBDR = table.Column(nullable: false),
- CanWriteOldBDRE = table.Column(nullable: false),
- CanWritePackedSubchannelInTAO = table.Column(nullable: false),
- CanWriteRWSubchannelInSAO = table.Column(nullable: false),
- CanWriteRWSubchannelInTAO = table.Column(nullable: false),
- CanWriteRaw = table.Column(nullable: false),
- CanWriteRawMultiSession = table.Column(nullable: false),
- CanWriteRawSubchannelInTAO = table.Column(nullable: false),
- ChangerIsSideChangeCapable = table.Column(nullable: false),
- ChangerSlots = table.Column(nullable: false),
- ChangerSupportsDiscPresent = table.Column(nullable: false),
+ BufferUnderrunFreeInDVD = table.Column(),
+ BufferUnderrunFreeInSAO = table.Column(),
+ BufferUnderrunFreeInTAO = table.Column(),
+ CanAudioScan = table.Column(),
+ CanEject = table.Column(),
+ CanEraseSector = table.Column(),
+ CanExpandBDRESpareArea = table.Column(),
+ CanFormat = table.Column(),
+ CanFormatBDREWithoutSpare = table.Column(),
+ CanFormatCert = table.Column(),
+ CanFormatFRF = table.Column(),
+ CanFormatQCert = table.Column(),
+ CanFormatRRM = table.Column(),
+ CanGenerateBindingNonce = table.Column(),
+ CanLoad = table.Column(),
+ CanMuteSeparateChannels = table.Column(),
+ CanOverwriteSAOTrack = table.Column(),
+ CanOverwriteTAOTrack = table.Column(),
+ CanPlayCDAudio = table.Column(),
+ CanPseudoOverwriteBDR = table.Column(),
+ CanReadAllDualR = table.Column(),
+ CanReadAllDualRW = table.Column(),
+ CanReadBD = table.Column(),
+ CanReadBDR = table.Column