REFACTOR: Use string interpolation expression.

This commit is contained in:
2017-12-21 17:58:51 +00:00
parent a895700757
commit 4e6e8f340a
182 changed files with 766 additions and 1256 deletions

View File

@@ -320,7 +320,7 @@ namespace DiscImageChef.Server.App_Start
tmpString = "ACS-3 Revision 4";
break;
default:
tmpString = string.Format("Unknown ATA revision 0x{0:X4}", ataReport.MinorVersion);
tmpString = $"Unknown ATA revision 0x{ataReport.MinorVersion:X4}";
break;
}
@@ -352,7 +352,7 @@ namespace DiscImageChef.Server.App_Start
break;
default:
ataTwoValue.Add("Unknown transport type",
string.Format("0x{0:X1}", (ataReport.TransportMajorVersion & 0xF000) >> 12));
$"0x{(ataReport.TransportMajorVersion & 0xF000) >> 12:X1}");
break;
}
}
@@ -426,8 +426,7 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("ATAPI Unknown or no device type");
break;
default:
ataOneValue.Add(string.Format("ATAPI Unknown device type field value 0x{0:X2}",
((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8));
ataOneValue.Add($"ATAPI Unknown device type field value 0x{((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8:X2}");
break;
}
@@ -444,8 +443,7 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("Device shall set DRQ within 50 µs of receiving PACKET");
break;
default:
ataOneValue.Add(string.Format("Unknown ATAPI DRQ behaviour code {0}",
((ushort)ataReport.GeneralConfiguration & 0x60) >> 5));
ataOneValue.Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataReport.GeneralConfiguration & 0x60) >> 5}");
break;
}
@@ -459,8 +457,7 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("ATAPI device uses 16 byte command packet");
break;
default:
ataOneValue.Add(string.Format("Unknown ATAPI packet size code {0}",
(ushort)ataReport.GeneralConfiguration & 0x03));
ataOneValue.Add($"Unknown ATAPI packet size code {(ushort)ataReport.GeneralConfiguration & 0x03}");
break;
}
}
@@ -529,8 +526,7 @@ namespace DiscImageChef.Server.App_Start
.Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete.");
break;
default:
ataOneValue.Add(string.Format("Unknown device specific configuration 0x{0:X4}",
(ushort)ataReport.SpecificConfiguration));
ataOneValue.Add($"Unknown device specific configuration 0x{(ushort)ataReport.SpecificConfiguration:X4}");
break;
}
@@ -540,21 +536,16 @@ namespace DiscImageChef.Server.App_Start
switch(ataReport.BufferType)
{
case 1:
ataOneValue.Add(string.Format("{0} KiB of single ported single sector buffer",
ataReport.BufferSize * logicalsectorsize / 1024));
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer");
break;
case 2:
ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer",
ataReport.BufferSize * logicalsectorsize / 1024));
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer");
break;
case 3:
ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer with read caching",
ataReport.BufferSize * logicalsectorsize / 1024));
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching");
break;
default:
ataOneValue.Add(string.Format("{0} KiB of unknown type {1} buffer",
ataReport.BufferSize * logicalsectorsize / 1024,
ataReport.BufferType));
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataReport.BufferType} buffer");
break;
}
@@ -570,8 +561,7 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) ataOneValue.Add("DMA is supported");
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) ||
ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0))
ataOneValue.Add(string.Format("Long Physical Alignment setting is {0}",
(ushort)ataReport.Capabilities & 0x03));
ataOneValue.Add($"Long Physical Alignment setting is {(ushort)ataReport.Capabilities & 0x03}");
if(atapi)
{
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.InterleavedDMA))
@@ -595,10 +585,8 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.MultipleValid))
{
ataOneValue
.Add(string.Format("A maximum of {0} sectors can be transferred per interrupt on READ/WRITE MULTIPLE",
ataReport.MultipleSectorNumber));
ataOneValue.Add(string.Format("Device supports setting a maximum of {0} sectors",
ataReport.MultipleMaxSectors));
.Add($"A maximum of {ataReport.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE");
ataOneValue.Add($"Device supports setting a maximum of {ataReport.MultipleMaxSectors} sectors");
}
if(ata1 && ataReport.TrustedComputingSpecified)
@@ -608,9 +596,9 @@ namespace DiscImageChef.Server.App_Start
if(minatalevel <= 3)
{
if(ataReport.PIOTransferTimingModeSpecified)
ataTwoValue.Add("PIO timing mode", string.Format("{0}", ataReport.PIOTransferTimingMode));
ataTwoValue.Add("PIO timing mode", $"{ataReport.PIOTransferTimingMode}");
if(ataReport.DMATransferTimingModeSpecified)
ataTwoValue.Add("DMA timing mode", string.Format("{0}", ataReport.DMATransferTimingMode));
ataTwoValue.Add("DMA timing mode", $"{ataReport.DMATransferTimingMode}");
}
if(ataReport.APIOSupportedSpecified)
@@ -792,25 +780,23 @@ namespace DiscImageChef.Server.App_Start
}
if(ataReport.MinMDMACycleTime != 0 && ataReport.RecommendedMDMACycleTime != 0)
ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in MDMA, " + "{1} ns. recommended",
ataReport.MinMDMACycleTime, ataReport.RecommendedMDMACycleTime));
ataOneValue.Add($"At minimum {ataReport.MinMDMACycleTime} ns. transfer cycle time per word in MDMA, " +
$"{ataReport.RecommendedMDMACycleTime} ns. recommended");
if(ataReport.MinPIOCycleTimeNoFlow != 0)
ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + "without flow control",
ataReport.MinPIOCycleTimeNoFlow));
ataOneValue.Add($"At minimum {ataReport.MinPIOCycleTimeNoFlow} ns. transfer cycle time per word in PIO, " +
"without flow control");
if(ataReport.MinPIOCycleTimeFlow != 0)
ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + "with IORDY flow control",
ataReport.MinPIOCycleTimeFlow));
ataOneValue.Add($"At minimum {ataReport.MinPIOCycleTimeFlow} ns. transfer cycle time per word in PIO, " +
"with IORDY flow control");
if(ataReport.MaxQueueDepth != 0) ataOneValue.Add(string.Format("{0} depth of queue maximum", ataReport.MaxQueueDepth + 1));
if(ataReport.MaxQueueDepth != 0) ataOneValue.Add($"{ataReport.MaxQueueDepth + 1} depth of queue maximum");
if(atapi)
{
if(ataReport.PacketBusRelease != 0)
ataOneValue.Add(string.Format("{0} ns. typical to release bus from receipt of PACKET",
ataReport.PacketBusRelease));
ataOneValue.Add($"{ataReport.PacketBusRelease} ns. typical to release bus from receipt of PACKET");
if(ataReport.ServiceBusyClear != 0)
ataOneValue.Add(string.Format("{0} ns. typical to clear BSY bit from receipt of SERVICE",
ataReport.ServiceBusyClear));
ataOneValue.Add($"{ataReport.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE");
}
if(ataReport.TransportMajorVersionSpecified && ((ataReport.TransportMajorVersion & 0xF000) >> 12 == 0x1 ||
@@ -862,8 +848,7 @@ namespace DiscImageChef.Server.App_Start
}
if(ataReport.InterseekDelay != 0x0000 && ataReport.InterseekDelay != 0xFFFF)
ataOneValue.Add(string.Format("{0} microseconds of interseek delay for ISO-7779 accoustic testing",
ataReport.InterseekDelay));
ataOneValue.Add($"{ataReport.InterseekDelay} microseconds of interseek delay for ISO-7779 accoustic testing");
if((ushort)ataReport.DeviceFormFactor != 0x0000 && (ushort)ataReport.DeviceFormFactor != 0xFFFF)
switch(ataReport.DeviceFormFactor)
@@ -884,14 +869,13 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("Device nominal size is smaller than 1.8\"");
break;
default:
ataOneValue.Add(string.Format("Device nominal size field value {0} is unknown",
ataReport.DeviceFormFactor));
ataOneValue.Add($"Device nominal size field value {ataReport.DeviceFormFactor} is unknown");
break;
}
if(atapi)
if(ataReport.ATAPIByteCount > 0)
ataOneValue.Add(string.Format("{0} bytes count limit for ATAPI", ataReport.ATAPIByteCount));
ataOneValue.Add($"{ataReport.ATAPIByteCount} bytes count limit for ATAPI");
if(cfa)
if((ataReport.CFAPowerMode & 0x8000) == 0x8000)
@@ -902,8 +886,7 @@ namespace DiscImageChef.Server.App_Start
if((ataReport.CFAPowerMode & 0x1000) == 0x1000)
ataOneValue.Add("CompactFlash power mode 1 is disabled");
ataOneValue.Add(string.Format("CompactFlash device uses a maximum of {0} mA",
ataReport.CFAPowerMode & 0x0FFF));
ataOneValue.Add($"CompactFlash device uses a maximum of {ataReport.CFAPowerMode & 0x0FFF} mA");
}
if(ataReport.CommandSetSpecified || ataReport.CommandSet2Specified || ataReport.CommandSet3Specified ||
@@ -995,8 +978,7 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.AAM) && ataReport.EnabledCommandSet2Specified
)
ataOneValue
.Add(string.Format("Automatic Acoustic Management is supported and enabled with value {0} (vendor recommends {1}",
ataReport.CurrentAAM, ataReport.RecommendedAAM));
.Add($"Automatic Acoustic Management is supported and enabled with value {ataReport.CurrentAAM} (vendor recommends {ataReport.RecommendedAAM}");
else ataOneValue.Add("Automatic Acoustic Management is supported");
if(ataReport.CommandSet2.HasFlag(CommandSetBit2.SetMax))
if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax) &&
@@ -1023,8 +1005,7 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.APM) && ataReport.EnabledCommandSet2Specified
)
ataOneValue
.Add(string.Format("Advanced Power Management is supported and enabled with value {0}",
ataReport.CurrentAPM));
.Add($"Advanced Power Management is supported and enabled with value {ataReport.CurrentAPM}");
else ataOneValue.Add("Advanced Power Management is supported");
if(ataReport.CommandSet2.HasFlag(CommandSetBit2.CompactFlash))
if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash) &&
@@ -1148,12 +1129,10 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified
) ataOneValue.Add("Write/Read/Verify is supported and enabled");
else ataOneValue.Add("Write/Read/Verify is supported");
ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 2",
ataReport.WRVSectorCountMode2));
ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 3",
ataReport.WRVSectorCountMode3));
ataOneValue.Add($"{ataReport.WRVSectorCountMode2} sectors for Write/Read/Verify mode 2");
ataOneValue.Add($"{ataReport.WRVSectorCountMode3} sectors for Write/Read/Verify mode 3");
if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified
) ataOneValue.Add(string.Format("Current Write/Read/Verify mode: {0}", ataReport.WRVMode));
) ataOneValue.Add($"Current Write/Read/Verify mode: {ataReport.WRVMode}");
}
if(ataReport.CommandSet4.HasFlag(CommandSetBit4.DT1825))
if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825) &&
@@ -1273,13 +1252,12 @@ namespace DiscImageChef.Server.App_Start
}
if((ataReport.RemovableStatusSet & 0x03) > 0) ataOneValue.Add("Removable Media Status Notification feature set is supported");
if(ataReport.FreeFallSensitivity != 0x00 && ataReport.FreeFallSensitivity != 0xFF) ataOneValue.Add(string.Format("Free-fall sensitivity set to {0}", ataReport.FreeFallSensitivity));
if(ataReport.FreeFallSensitivity != 0x00 && ataReport.FreeFallSensitivity != 0xFF) ataOneValue.Add($"Free-fall sensitivity set to {ataReport.FreeFallSensitivity}");
if(ataReport.DataSetMgmtSpecified && ataReport.DataSetMgmt.HasFlag(DataSetMgmtBit.Trim))
ataOneValue.Add("TRIM is supported");
if(ataReport.DataSetMgmtSizeSpecified && ataReport.DataSetMgmtSize > 0)
ataOneValue.Add(string.Format("DATA SET MANAGEMENT can receive a maximum of {0} blocks of 512 bytes",
ataReport.DataSetMgmtSize));
ataOneValue.Add($"DATA SET MANAGEMENT can receive a maximum of {ataReport.DataSetMgmtSize} blocks of 512 bytes");
if(ataReport.SecurityStatusSpecified && ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Supported))
{
@@ -1308,13 +1286,11 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced))
ataOneValue.Add("Supports enhanced security erase");
ataOneValue.Add(string.Format("{0} minutes to complete secure erase", ataReport.SecurityEraseTime * 2));
ataOneValue.Add($"{ataReport.SecurityEraseTime * 2} minutes to complete secure erase");
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced))
ataOneValue.Add(string.Format("{0} minutes to complete enhanced secure erase",
ataReport.EnhancedSecurityEraseTime * 2));
ataOneValue.Add($"{ataReport.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase");
ataOneValue.Add(string.Format("Master password revision code: {0}",
ataReport.MasterPasswordRevisionCode));
ataOneValue.Add($"Master password revision code: {ataReport.MasterPasswordRevisionCode}");
}
if(ataReport.CommandSet3Specified && ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) &&
@@ -1322,14 +1298,11 @@ namespace DiscImageChef.Server.App_Start
ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming))
{
ataOneValue.Add("<i>Streaming:</i>");
ataOneValue.Add(string.Format("Minimum request size is {0}", ataReport.StreamMinReqSize));
ataOneValue.Add(string.Format("Streaming transfer time in PIO is {0}",
ataReport.StreamTransferTimePIO));
ataOneValue.Add(string.Format("Streaming transfer time in DMA is {0}",
ataReport.StreamTransferTimeDMA));
ataOneValue.Add(string.Format("Streaming access latency is {0}", ataReport.StreamAccessLatency));
ataOneValue.Add(string.Format("Streaming performance granularity is {0}",
ataReport.StreamPerformanceGranularity));
ataOneValue.Add($"Minimum request size is {ataReport.StreamMinReqSize}");
ataOneValue.Add($"Streaming transfer time in PIO is {ataReport.StreamTransferTimePIO}");
ataOneValue.Add($"Streaming transfer time in DMA is {ataReport.StreamTransferTimeDMA}");
ataOneValue.Add($"Streaming access latency is {ataReport.StreamAccessLatency}");
ataOneValue.Add($"Streaming performance granularity is {ataReport.StreamPerformanceGranularity}");
}
if(ataReport.SCTCommandTransportSpecified &&
@@ -1351,17 +1324,16 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.NVCacheCapsSpecified && (ataReport.NVCacheCaps & 0x0010) == 0x0010)
{
ataOneValue.Add("<i>Non-Volatile Cache:</i>");
ataOneValue.Add(string.Format("Version {0}", (ataReport.NVCacheCaps & 0xF000) >> 12));
ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0xF000) >> 12}");
if((ataReport.NVCacheCaps & 0x0001) == 0x0001)
{
if((ataReport.NVCacheCaps & 0x0002) == 0x0002)
ataOneValue.Add("Power mode feature set is supported and enabled");
else ataOneValue.Add("Power mode feature set is supported");
ataOneValue.Add(string.Format("Version {0}", (ataReport.NVCacheCaps & 0x0F00) >> 8));
ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0x0F00) >> 8}");
}
ataOneValue.Add(string.Format("Non-Volatile Cache is {0} bytes",
ataReport.NVCacheSize * logicalsectorsize));
ataOneValue.Add($"Non-Volatile Cache is {ataReport.NVCacheSize * logicalsectorsize} bytes");
}
if(ataReport.ReadCapabilities != null)
@@ -1375,31 +1347,26 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.ReadCapabilities.NominalRotationRate == 0x0001)
ataOneValue.Add("Device does not rotate.");
else
ataOneValue.Add(string.Format("Device rotates at {0} rpm",
ataReport.ReadCapabilities.NominalRotationRate));
ataOneValue.Add($"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm");
if(!atapi)
{
if(ataReport.ReadCapabilities.BlockSizeSpecified)
{
ataTwoValue.Add("Logical sector size",
string.Format("{0} bytes", ataReport.ReadCapabilities.BlockSize));
ataTwoValue.Add("Logical sector size", $"{ataReport.ReadCapabilities.BlockSize} bytes");
logicalsectorsize = ataReport.ReadCapabilities.BlockSize;
}
if(ataReport.ReadCapabilities.PhysicalBlockSizeSpecified)
ataTwoValue.Add("Physical sector size",
string.Format("{0} bytes", ataReport.ReadCapabilities.PhysicalBlockSize));
ataTwoValue.Add("Physical sector size", $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes");
if(ataReport.ReadCapabilities.LongBlockSizeSpecified)
ataTwoValue.Add("READ LONG sector size",
string.Format("{0} bytes", ataReport.ReadCapabilities.LongBlockSize));
ataTwoValue.Add("READ LONG sector size", $"{ataReport.ReadCapabilities.LongBlockSize} bytes");
if(ataReport.ReadCapabilities.BlockSizeSpecified &&
ataReport.ReadCapabilities.PhysicalBlockSizeSpecified &&
ataReport.ReadCapabilities.BlockSize != ataReport.ReadCapabilities.PhysicalBlockSize &&
(ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 &&
(ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000)
ataOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector",
ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF));
ataOneValue.Add($"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector");
if(ataReport.ReadCapabilities.CHS != null && ataReport.ReadCapabilities.CurrentCHS != null)
{
@@ -1407,118 +1374,70 @@ namespace DiscImageChef.Server.App_Start
ataReport.ReadCapabilities.CurrentCHS.Heads *
ataReport.ReadCapabilities.CurrentCHS.Sectors;
ataTwoValue.Add("Cylinders",
string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Cylinders,
ataReport.ReadCapabilities.CurrentCHS.Cylinders));
$"{ataReport.ReadCapabilities.CHS.Cylinders} max., {ataReport.ReadCapabilities.CurrentCHS.Cylinders} current");
ataTwoValue.Add("Heads",
string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Heads,
ataReport.ReadCapabilities.CurrentCHS.Heads));
$"{ataReport.ReadCapabilities.CHS.Heads} max., {ataReport.ReadCapabilities.CurrentCHS.Heads} current");
ataTwoValue.Add("Sectors per track",
string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Sectors,
ataReport.ReadCapabilities.CurrentCHS.Sectors));
$"{ataReport.ReadCapabilities.CHS.Sectors} max., {ataReport.ReadCapabilities.CurrentCHS.Sectors} current");
ataTwoValue.Add("Sectors addressable in CHS mode",
string.Format("{0} max., {1} current",
ataReport.ReadCapabilities.CHS.Cylinders *
ataReport.ReadCapabilities.CHS.Heads *
ataReport.ReadCapabilities.CHS.Sectors, currentSectors));
$"{ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors} max., {currentSectors} current");
ataTwoValue.Add("Device size in CHS mode",
string.Format("{0} bytes, {1} Mb, {2:F2} MiB",
(ulong)currentSectors * logicalsectorsize,
(ulong)currentSectors * logicalsectorsize / 1000 / 1000,
(double)((ulong)currentSectors * logicalsectorsize) / 1024 /
1024));
$"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
}
else if(ataReport.ReadCapabilities.CHS != null)
{
int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders *
ataReport.ReadCapabilities.CHS.Heads *
ataReport.ReadCapabilities.CHS.Sectors;
ataTwoValue.Add("Cylinders", string.Format("{0}", ataReport.ReadCapabilities.CHS.Cylinders));
ataTwoValue.Add("Heads", string.Format("{0}", ataReport.ReadCapabilities.CHS.Heads));
ataTwoValue.Add("Sectors per track",
string.Format("{0}", ataReport.ReadCapabilities.CHS.Sectors));
ataTwoValue.Add("Sectors addressable in CHS mode", string.Format("{0}", currentSectors));
ataTwoValue.Add("Cylinders", $"{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",
string.Format("{0} bytes, {1} Mb, {2:F2} MiB",
(ulong)currentSectors * logicalsectorsize,
(ulong)currentSectors * logicalsectorsize / 1000 / 1000,
(double)((ulong)currentSectors * logicalsectorsize) / 1024 /
1024));
$"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB");
}
if(ataReport.ReadCapabilities.LBASectorsSpecified)
{
ataTwoValue.Add("Sectors addressable in sectors in 28-bit LBA mode",
string.Format("{0}", ataReport.ReadCapabilities.LBASectors));
$"{ataReport.ReadCapabilities.LBASectors}");
if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000000)
ataTwoValue.Add("Device size in 28-bit LBA mode",
string.Format("{0} bytes, {1} Tb, {2:F2} TiB",
(ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize,
(ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize / 1000 / 1000 / 1000 / 1000,
(double)((ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize) / 1024 / 1024 / 1024 / 1024));
$"{(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",
string.Format("{0} bytes, {1} Gb, {2:F2} GiB",
(ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize,
(ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize / 1000 / 1000 / 1000,
(double)((ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize) / 1024 / 1024 / 1024));
$"{(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",
string.Format("{0} bytes, {1} Mb, {2:F2} MiB",
(ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize,
(ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize / 1000 / 1000,
(double)((ulong)ataReport.ReadCapabilities.LBASectors *
logicalsectorsize) / 1024 / 1024));
$"{(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.LBA48SectorsSpecified)
{
ataTwoValue.Add("Sectors addressable in sectors in 48-bit LBA mode",
string.Format("{0}", ataReport.ReadCapabilities.LBA48Sectors));
$"{ataReport.ReadCapabilities.LBA48Sectors}");
if(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000000)
ataTwoValue.Add("Device size in 48-bit LBA mode",
string.Format("{0} bytes, {1} Tb, {2:F2} TiB",
ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize,
ataReport.ReadCapabilities.LBA48Sectors *
logicalsectorsize / 1000 / 1000 / 1000 / 1000,
(double)(ataReport.ReadCapabilities.LBA48Sectors *
logicalsectorsize) / 1024 / 1024 / 1024 / 1024));
$"{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",
string.Format("{0} bytes, {1} Gb, {2:F2} GiB",
ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize,
ataReport.ReadCapabilities.LBA48Sectors *
logicalsectorsize / 1000 / 1000 / 1000,
(double)(ataReport.ReadCapabilities.LBA48Sectors *
logicalsectorsize) / 1024 / 1024 / 1024));
$"{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",
string.Format("{0} bytes, {1} Mb, {2:F2} MiB",
ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize,
ataReport.ReadCapabilities.LBA48Sectors *
logicalsectorsize / 1000 / 1000,
(double)(ataReport.ReadCapabilities.LBA48Sectors *
logicalsectorsize) / 1024 / 1024));
$"{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(ataReport.ReadCapabilities.UnformattedBPT > 0)
ataTwoValue.Add("Bytes per unformatted track",
string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPT));
$"{ataReport.ReadCapabilities.UnformattedBPT}");
if(ataReport.ReadCapabilities.UnformattedBPS > 0)
ataTwoValue.Add("Bytes per unformatted sector",
string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPS));
$"{ataReport.ReadCapabilities.UnformattedBPS}");
}
}

View File

@@ -53,8 +53,7 @@ namespace DiscImageChef.Server.App_Start
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 = string.Format("TapeAlert Supported Flags Bitmap: 0x{0:X16}<br/>",
EVPD.DecodePageB2(evpd.value));
decoded = $"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}<br/>";
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);
@@ -79,7 +78,7 @@ namespace DiscImageChef.Server.App_Start
if(!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "<br/>");
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), decoded);
evpdPages.Add($"EVPD page {evpd.page:X2}h", decoded);
}
}
}

View File

@@ -57,8 +57,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device is connected but unsupported.");
break;
default:
scsiOneValue.Add(string.Format("Vendor value {0} set in Peripheral Qualifier field.",
inquiry.PeripheralQualifier));
scsiOneValue.Add($"Vendor value {inquiry.PeripheralQualifier} set in Peripheral Qualifier field.");
break;
}
@@ -134,8 +133,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Unknown or no device type");
break;
default:
scsiOneValue.Add(string.Format("Unknown device type field value 0x{0:X2}",
inquiry.PeripheralDeviceType));
scsiOneValue.Add($"Unknown device type field value 0x{inquiry.PeripheralDeviceType:X2}");
break;
}
@@ -164,8 +162,7 @@ namespace DiscImageChef.Server.App_Start
break;
default:
scsiOneValue
.Add(string.Format("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})",
inquiry.ANSIVersion));
.Add($"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})");
break;
}
@@ -179,8 +176,7 @@ namespace DiscImageChef.Server.App_Start
break;
default:
scsiOneValue
.Add(string.Format("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})",
inquiry.ECMAVersion));
.Add($"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})");
break;
}
@@ -194,8 +190,7 @@ namespace DiscImageChef.Server.App_Start
break;
default:
scsiOneValue
.Add(string.Format("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})",
inquiry.ISOVersion));
.Add($"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})");
break;
}
@@ -242,8 +237,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device supports implicit and explicit assymetrical access");
break;
default:
scsiOneValue.Add(string.Format("Unknown value in TPGS field 0x{0:X2}",
inquiry.AsymmetricalLUNAccess));
scsiOneValue.Add($"Unknown value in TPGS field 0x{inquiry.AsymmetricalLUNAccess:X2}");
break;
}
@@ -262,8 +256,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device supports ST and DT clocking");
break;
default:
scsiOneValue.Add(string.Format("Unknown value in SPI clocking field 0x{0:X2}",
inquiry.SPIClocking));
scsiOneValue.Add($"Unknown value in SPI clocking field 0x{inquiry.SPIClocking:X2}");
break;
}
@@ -935,8 +928,7 @@ namespace DiscImageChef.Server.App_Start
case 0x097D:
case 0x097E:
case 0x097F:
scsiOneValue.Add(string.Format("Device complies with iSCSI revision {0}",
VersionDescriptor & 0x1F));
scsiOneValue.Add($"Device complies with iSCSI revision {VersionDescriptor & 0x1F}");
break;
case 0x0980:
scsiOneValue.Add("Device complies with SBP-3 (no version claimed)");
@@ -1696,8 +1688,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device complies with IEEE 1667-2009");
break;
default:
scsiOneValue.Add(string.Format("Device complies with unknown standard code 0x{0:X4}",
VersionDescriptor));
scsiOneValue.Add($"Device complies with unknown standard code 0x{VersionDescriptor:X4}");
break;
}

View File

@@ -41,18 +41,17 @@ namespace DiscImageChef.Server.App_Start
public static void Report(mmcFeaturesType ftr, ref List<string> mmcOneValue)
{
if(ftr.SupportsAACS && ftr.AACSVersionSpecified)
mmcOneValue.Add(string.Format("Drive supports AACS version {0}", ftr.AACSVersion));
mmcOneValue.Add($"Drive supports AACS version {ftr.AACSVersion}");
else if(ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS");
if(ftr.AGIDsSpecified) mmcOneValue.Add(string.Format("Drive supports {0} AGIDs concurrently", ftr.AGIDs));
if(ftr.AGIDsSpecified) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
if(ftr.CanGenerateBindingNonce)
{
mmcOneValue.Add("Drive supports generating the binding nonce");
if(ftr.BindingNonceBlocksSpecified)
mmcOneValue.Add(string.Format("{0} media blocks are required for the binding nonce",
ftr.BindingNonceBlocks));
mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce");
}
if(ftr.BlocksPerReadableUnit > 1)
mmcOneValue.Add(string.Format("{0} logical blocks per media writable unit", ftr.BlocksPerReadableUnit));
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");
@@ -122,7 +121,7 @@ namespace DiscImageChef.Server.App_Start
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(string.Format("{0} bytes per logical block", ftr.LogicalBlockSize));
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");
@@ -159,8 +158,7 @@ namespace DiscImageChef.Server.App_Start
mmcOneValue.Add("Drive uses a vendor unique interface");
break;
default:
mmcOneValue.Add(string.Format("Drive uses an unknown interface with code {0}",
(uint)ftr.PhysicalInterfaceStandard));
mmcOneValue.Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}");
break;
}
@@ -220,18 +218,18 @@ namespace DiscImageChef.Server.App_Start
if(ftr.ChangerSupportsDiscPresent)
mmcOneValue.Add("Drive is able to report slots contents after a reset or change");
mmcOneValue.Add(string.Format("Drive has {0} slots", ftr.ChangerSlots + 1));
mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots");
}
if(ftr.SupportsCSS && ftr.CSSVersionSpecified)
mmcOneValue.Add(string.Format("Drive supports DVD CSS/CPPM version {0}", ftr.CSSVersion));
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.CPRMVersionSpecified)
mmcOneValue.Add(string.Format("Drive supports DVD CPPM version {0}", ftr.CPRMVersion));
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.FirmwareDateSpecified)
mmcOneValue.Add(string.Format("Drive firmware is dated {0}", ftr.FirmwareDate));
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");
@@ -254,8 +252,7 @@ namespace DiscImageChef.Server.App_Start
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}",
ftr.LoadingMechanismType));
mmcOneValue.Add($"Drive uses unknown loading mechanism type {ftr.LoadingMechanismType}");
break;
}
@@ -270,7 +267,7 @@ namespace DiscImageChef.Server.App_Start
if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel");
if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS");
if(ftr.VolumeLevelsSpecified)
mmcOneValue.Add(string.Format("Drive has {0} volume levels", ftr.VolumeLevels + 1));
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)

View File

@@ -73,8 +73,7 @@ namespace DiscImageChef.Server.App_Start
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}",
mode.LoadingMechanismType));
mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanismType}");
break;
}
@@ -97,12 +96,12 @@ namespace DiscImageChef.Server.App_Start
if(mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently");
if(mode.SupportedVolumeLevels > 0)
mmcOneValue.Add(string.Format("Drive supports {0} volume levels", mode.SupportedVolumeLevels));
if(mode.BufferSize > 0) mmcOneValue.Add(string.Format("Drive has {0} Kbyte of buffer", mode.BufferSize));
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)
mmcOneValue.Add(string.Format("Drive's maximum reading speed is {0} Kbyte/sec.", mode.MaximumSpeed));
mmcOneValue.Add($"Drive's maximum reading speed is {mode.MaximumSpeed} Kbyte/sec.");
if(mode.CurrentSpeed > 0)
mmcOneValue.Add(string.Format("Drive's current reading speed is {0} Kbyte/sec.", mode.CurrentSpeed));
mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec.");
if(mode.ReadsCDR)
{
@@ -133,30 +132,24 @@ namespace DiscImageChef.Server.App_Start
if(mode.CurrentWriteSpeedSelected > 0)
{
if(mode.RotationControlSelected == 0)
mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in CLV mode",
mode.CurrentWriteSpeedSelected));
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
else if(mode.RotationControlSelected == 1)
mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in pure CAV mode",
mode.CurrentWriteSpeedSelected));
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
}
else
{
if(mode.MaximumWriteSpeed > 0)
mmcOneValue.Add(string.Format("Drive's maximum writing speed is {0} Kbyte/sec.",
mode.MaximumWriteSpeed));
mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaximumWriteSpeed} Kbyte/sec.");
if(mode.CurrentWriteSpeed > 0)
mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec.",
mode.CurrentWriteSpeed));
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec.");
}
if(mode.WriteSpeedPerformanceDescriptors != null)
foreach(Modes.ModePage_2A_WriteDescriptor descriptor in mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0)) if(descriptor.RotationControl == 0)
mmcOneValue.Add(string.Format("Drive supports writing at {0} Kbyte/sec. in CLV mode",
descriptor.WriteSpeed));
mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode");
else if(descriptor.RotationControl == 1)
mmcOneValue
.Add(string.Format("Drive supports writing at is {0} Kbyte/sec. in pure CAV mode",
descriptor.WriteSpeed));
.Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode");
if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing");

View File

@@ -42,14 +42,13 @@ namespace DiscImageChef.Server.App_Start
ref List<string> scsiOneValue, ref Dictionary<string, string> modePages)
{
if(modeSense.MediumTypeSpecified)
scsiOneValue.Add(string.Format("Medium type is {0:X2}h", modeSense.MediumType));
scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
if(modeSense.BlockDescriptors != null)
foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors)
if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified)
scsiOneValue.Add(string.Format("Density code {0:X2}h has {1} blocks of {2} bytes each",
descriptor.Density, descriptor.Blocks, descriptor.BlockLength));
else scsiOneValue.Add(string.Format("Density code {0:X2}h", descriptor.Density));
scsiOneValue.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");
@@ -66,7 +65,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device uses a write cache but doesn't return until cache is flushed");
break;
default:
scsiOneValue.Add(string.Format("Unknown buffered mode code 0x{0:X2}", modeSense.BufferedMode));
scsiOneValue.Add($"Unknown buffered mode code 0x{modeSense.BufferedMode:X2}");
break;
}
@@ -78,16 +77,16 @@ namespace DiscImageChef.Server.App_Start
case 0x00:
{
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_00_SFF(page.value));
else
{
if(page.subpage != 0)
modePages
.Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage),
.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
"Unknown vendor mode page");
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
"Unknown vendor mode page");
}
break;
@@ -96,10 +95,10 @@ namespace DiscImageChef.Server.App_Start
{
if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_01_MMC(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_01(page.value));
else goto default;
@@ -108,7 +107,7 @@ namespace DiscImageChef.Server.App_Start
case 0x02:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_02(page.value));
else goto default;
@@ -117,7 +116,7 @@ namespace DiscImageChef.Server.App_Start
case 0x03:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_03(page.value));
else goto default;
@@ -126,7 +125,7 @@ namespace DiscImageChef.Server.App_Start
case 0x04:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_04(page.value));
else goto default;
@@ -135,7 +134,7 @@ namespace DiscImageChef.Server.App_Start
case 0x05:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_05(page.value));
else goto default;
@@ -144,7 +143,7 @@ namespace DiscImageChef.Server.App_Start
case 0x06:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_06(page.value));
else goto default;
@@ -154,10 +153,10 @@ namespace DiscImageChef.Server.App_Start
{
if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_07_MMC(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_07(page.value));
else goto default;
@@ -166,7 +165,7 @@ namespace DiscImageChef.Server.App_Start
case 0x08:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_08(page.value));
else goto default;
@@ -175,10 +174,10 @@ namespace DiscImageChef.Server.App_Start
case 0x0A:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_0A(page.value));
else if(page.subpage == 1)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_0A_S01(page.value));
else goto default;
@@ -187,7 +186,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0B:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_0B(page.value));
else goto default;
@@ -196,7 +195,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0D:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_0D(page.value));
else goto default;
@@ -205,7 +204,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0E:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_0E(page.value));
else goto default;
@@ -214,7 +213,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0F:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_0F(page.value));
else goto default;
@@ -224,10 +223,10 @@ namespace DiscImageChef.Server.App_Start
{
if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_10_SSC(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_10(page.value));
else goto default;
@@ -236,7 +235,7 @@ namespace DiscImageChef.Server.App_Start
case 0x11:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_11(page.value));
else goto default;
@@ -247,7 +246,7 @@ namespace DiscImageChef.Server.App_Start
case 0x14:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_12_13_14(page.value));
else goto default;
@@ -256,10 +255,10 @@ namespace DiscImageChef.Server.App_Start
case 0x1A:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_1A(page.value));
else if(page.subpage == 1)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_1A_S01(page.value));
else goto default;
@@ -268,7 +267,7 @@ namespace DiscImageChef.Server.App_Start
case 0x1B:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_1B(page.value));
else goto default;
@@ -278,13 +277,13 @@ namespace DiscImageChef.Server.App_Start
{
if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_1C_SFF(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_1C(page.value));
else if(page.subpage == 1)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_1C_S01(page.value));
else goto default;
@@ -293,7 +292,7 @@ namespace DiscImageChef.Server.App_Start
case 0x1D:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_1D(page.value));
else goto default;
@@ -302,7 +301,7 @@ namespace DiscImageChef.Server.App_Start
case 0x21:
{
if(vendor == "CERTANCE")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyCertanceModePage_21(page.value));
else goto default;
@@ -311,7 +310,7 @@ namespace DiscImageChef.Server.App_Start
case 0x22:
{
if(vendor == "CERTANCE")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyCertanceModePage_22(page.value));
else goto default;
@@ -320,7 +319,7 @@ namespace DiscImageChef.Server.App_Start
case 0x24:
{
if(vendor == "IBM")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyIBMModePage_24(page.value));
else goto default;
@@ -329,7 +328,7 @@ namespace DiscImageChef.Server.App_Start
case 0x2A:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_2A(page.value));
else goto default;
@@ -338,7 +337,7 @@ namespace DiscImageChef.Server.App_Start
case 0x2F:
{
if(vendor == "IBM")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyIBMModePage_2F(page.value));
else goto default;
@@ -355,7 +354,7 @@ namespace DiscImageChef.Server.App_Start
case 0x3B:
{
if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyHPModePage_3B(page.value));
else goto default;
@@ -364,7 +363,7 @@ namespace DiscImageChef.Server.App_Start
case 0x3C:
{
if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyHPModePage_3C(page.value));
else goto default;
@@ -373,10 +372,10 @@ namespace DiscImageChef.Server.App_Start
case 0x3D:
{
if(vendor == "IBM")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyIBMModePage_3D(page.value));
else if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyHPModePage_3D(page.value));
else goto default;
@@ -385,10 +384,10 @@ namespace DiscImageChef.Server.App_Start
case 0x3E:
{
if(vendor == "FUJITSU")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyFujitsuModePage_3E(page.value));
else if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyHPModePage_3E(page.value));
else goto default;
@@ -398,9 +397,9 @@ namespace DiscImageChef.Server.App_Start
{
if(page.subpage != 0)
modePages
.Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage),
.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
"Unknown mode page");
else modePages.Add(string.Format("MODE page {0:X2}h", page.page), "Unknown mode page");
else modePages.Add($"MODE page {page.page:X2}h", "Unknown mode page");
}
break;
}

View File

@@ -43,22 +43,21 @@ namespace DiscImageChef.Server.App_Start
{
if(!string.IsNullOrWhiteSpace(media.MediumTypeName))
{
mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>",
media.MediumTypeName));
mediaOneValue.Add($"<i>Information for medium named \"{media.MediumTypeName}\"</i>");
if(media.MediumTypeSpecified)
mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", media.MediumType));
mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
}
else if(media.MediumTypeSpecified)
mediaOneValue.Add(string.Format("<i>Information for medium type {0:X2}h</i>", media.MediumType));
mediaOneValue.Add($"<i>Information for medium type {media.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>");
if(!string.IsNullOrWhiteSpace(media.Manufacturer))
mediaOneValue.Add(string.Format("Medium manufactured by: {0}", media.Manufacturer));
mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}");
if(!string.IsNullOrWhiteSpace(media.Model))
mediaOneValue.Add(string.Format("Medium model: {0}", media.Model));
mediaOneValue.Add($"Medium model: {media.Model}");
if(media.DensitySpecified)
mediaOneValue.Add(string.Format("Medium has density code {0:X2}h", media.Density));
mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
if(media.CanReadMediaSerial) mediaOneValue.Add("Drive can read medium serial number.");
if(media.MediaIsRecognized) mediaOneValue.Add("DiscImageChef recognizes this medium.");

View File

@@ -43,160 +43,97 @@ namespace DiscImageChef.Server.App_Start
{
if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
{
mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>",
testedMedia.MediumTypeName));
mediaOneValue.Add($"<i>Information for medium named \"{testedMedia.MediumTypeName}\"</i>");
if(testedMedia.MediumTypeSpecified)
mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", testedMedia.MediumType));
mediaOneValue.Add($"Medium type code: {testedMedia.MediumType:X2}h");
}
else if(testedMedia.MediumTypeSpecified)
mediaOneValue.Add(string.Format("<i>Information for medium type {0:X2}h</i>",
testedMedia.MediumType));
mediaOneValue.Add($"<i>Information for medium type {testedMedia.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>");
if(testedMedia.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium.");
else mediaOneValue.Add("Drive does not recognize this medium.");
if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
mediaOneValue.Add(string.Format("Medium manufactured by: {0}", testedMedia.Manufacturer));
mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}");
if(!string.IsNullOrWhiteSpace(testedMedia.Model))
mediaOneValue.Add(string.Format("Medium model: {0}", testedMedia.Model));
mediaOneValue.Add($"Medium model: {testedMedia.Model}");
if(testedMedia.DensitySpecified)
mediaOneValue.Add(string.Format("Density code: {0:X2}h", testedMedia.Density));
mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
if(testedMedia.BlockSizeSpecified)
mediaOneValue.Add(string.Format("Logical sector size: {0} bytes", testedMedia.BlockSize));
mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes");
if(testedMedia.PhysicalBlockSizeSpecified)
mediaOneValue.Add(string.Format("Physical sector size: {0} bytes", testedMedia.PhysicalBlockSize));
mediaOneValue.Add($"Physical sector size: {testedMedia.PhysicalBlockSize} bytes");
if(testedMedia.LongBlockSizeSpecified)
mediaOneValue.Add(string.Format("READ LONG sector size: {0} bytes", testedMedia.LongBlockSize));
mediaOneValue.Add($"READ LONG sector size: {testedMedia.LongBlockSize} bytes");
if(testedMedia.BlocksSpecified && testedMedia.BlockSizeSpecified)
{
mediaOneValue.Add(string.Format("Medium has {0} blocks of {1} bytes each", testedMedia.Blocks,
testedMedia.BlockSize));
mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each");
if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Tb, {2:F2} TiB",
testedMedia.Blocks * testedMedia.BlockSize,
testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 /
1000 / 1000,
(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 /
1024 / 1024 / 1024));
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)
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Gb, {2:F2} GiB",
testedMedia.Blocks * testedMedia.BlockSize,
testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 /
1000,
(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 /
1024 / 1024));
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");
else
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Mb, {2:F2} MiB",
testedMedia.Blocks * testedMedia.BlockSize,
testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000,
(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 /
1024));
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");
}
if(testedMedia.CHS != null && testedMedia.CurrentCHS != null)
{
int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads *
testedMedia.CurrentCHS.Sectors;
mediaOneValue.Add(string.Format("Cylinders: {0} max., {1} current", testedMedia.CHS.Cylinders,
testedMedia.CurrentCHS.Cylinders));
mediaOneValue.Add(string.Format("Heads: {0} max., {1} current", testedMedia.CHS.Heads,
testedMedia.CurrentCHS.Heads));
mediaOneValue.Add(string.Format("Sectors per track: {0} max., {1} current", testedMedia.CHS.Sectors,
testedMedia.CurrentCHS.Sectors));
mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0} max., {1} current",
testedMedia.CHS.Cylinders * testedMedia.CHS.Heads *
testedMedia.CHS.Sectors, currentSectors));
mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB",
(ulong)currentSectors * testedMedia.BlockSize,
(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000,
(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 /
1024));
mediaOneValue.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");
mediaOneValue.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");
}
else if(testedMedia.CHS != null)
{
int currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors;
mediaOneValue.Add(string.Format("Cylinders: {0}", testedMedia.CHS.Cylinders));
mediaOneValue.Add(string.Format("Heads: {0}", testedMedia.CHS.Heads));
mediaOneValue.Add(string.Format("Sectors per track: {0}", testedMedia.CHS.Sectors));
mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0}", currentSectors));
mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB",
(ulong)currentSectors * testedMedia.BlockSize,
(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000,
(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 /
1024));
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");
}
if(testedMedia.LBASectorsSpecified)
{
mediaOneValue.Add(string.Format("Sectors addressable in sectors in 28-bit LBA mode: {0}",
testedMedia.LBASectors));
mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}");
if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB",
(ulong)testedMedia.LBASectors * testedMedia.BlockSize,
(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 /
1000 / 1000 / 1000,
(double)((ulong)testedMedia.LBASectors *
testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024));
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)
mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB",
(ulong)testedMedia.LBASectors * testedMedia.BlockSize,
(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 /
1000 / 1000,
(double)((ulong)testedMedia.LBASectors *
testedMedia.BlockSize) / 1024 / 1024 / 1024));
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");
else
mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB",
(ulong)testedMedia.LBASectors * testedMedia.BlockSize,
(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 /
1000,
(double)((ulong)testedMedia.LBASectors *
testedMedia.BlockSize) / 1024 / 1024));
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");
}
if(testedMedia.LBA48SectorsSpecified)
{
mediaOneValue.Add(string.Format("Sectors addressable in sectors in 48-bit LBA mode: {0}",
testedMedia.LBA48Sectors));
mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}");
if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB",
testedMedia.LBA48Sectors * testedMedia.BlockSize,
testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 /
1000 / 1000 / 1000,
(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) /
1024 / 1024 / 1024 / 1024));
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)
mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB",
testedMedia.LBA48Sectors * testedMedia.BlockSize,
testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 /
1000 / 1000,
(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) /
1024 / 1024 / 1024));
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");
else
mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB",
testedMedia.LBA48Sectors * testedMedia.BlockSize,
testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 /
1000,
(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) /
1024 / 1024));
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");
}
if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF)
if(testedMedia.NominalRotationRate == 0x0001) mediaOneValue.Add("Medium does not rotate.");
else mediaOneValue.Add(string.Format("Medium rotates at {0} rpm", testedMedia.NominalRotationRate));
else mediaOneValue.Add($"Medium rotates at {testedMedia.NominalRotationRate} rpm");
if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified &&
testedMedia.BlockSize != testedMedia.PhysicalBlockSize &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000)
mediaOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector",
testedMedia.LogicalAlignment & 0x3FFF));
mediaOneValue.Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
if(testedMedia.SupportsRead && ata)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium");

View File

@@ -67,8 +67,9 @@ namespace DiscImageChef.Server.Controllers
}
Random rng = new Random();
string filename = string.Format("NewReport_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next());
while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename))) filename = string.Format("NewReport_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next());
string filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename))) filename =
$"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
FileStream newFile =
new FileStream(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename),

View File

@@ -415,11 +415,10 @@ namespace DiscImageChef.Server.Controllers
.ThenBy(device => device.Bus).ToList();
Random rng = new Random();
string filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow,
rng.Next());
string filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Statistics",
filename)))
filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next());
filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
FileStream backup =
new

View File

@@ -81,9 +81,8 @@ namespace DiscImageChef.Server
"Statistics.xml")))
{
#if DEBUG
content.InnerHtml = string.Format("<b>Sorry, cannot load data file \"{0}\"</b>",
Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Statistics", "Statistics.xml"));
content.InnerHtml =
$"<b>Sorry, cannot load data file \"{Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml")}\"</b>";
#else
content.InnerHtml = "<b>Sorry, cannot load data file</b>";
#endif
@@ -105,11 +104,8 @@ namespace DiscImageChef.Server
foreach(OsStats nvs in statistics.OperatingSystems)
operatingSystems.Add(new NameValueStats
{
name = string.Format("{0}{1}{2}",
DetectOS
.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), nvs.name),
nvs.version),
string.IsNullOrEmpty(nvs.version) ? "" : " ", nvs.version),
name =
$"{DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), nvs.name), nvs.version)}{(string.IsNullOrEmpty(nvs.version) ? "" : " ")}{nvs.version}",
Value = nvs.Value
});
@@ -233,30 +229,26 @@ namespace DiscImageChef.Server
!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision))
{
xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml";
url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}&revision={2}",
HttpUtility.UrlPathEncode(device.Manufacturer),
HttpUtility.UrlPathEncode(device.Model),
HttpUtility.UrlPathEncode(device.Revision));
url =
$"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}";
}
else if(!string.IsNullOrWhiteSpace(device.Manufacturer) &&
!string.IsNullOrWhiteSpace(device.Model))
{
xmlFile = device.Manufacturer + "_" + device.Model + ".xml";
url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}",
HttpUtility.UrlPathEncode(device.Manufacturer),
HttpUtility.UrlPathEncode(device.Model));
url =
$"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}";
}
else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision))
{
xmlFile = device.Model + "_" + device.Revision + ".xml";
url = string.Format("ViewReport.aspx?model={0}&revision={1}",
HttpUtility.UrlPathEncode(device.Model),
HttpUtility.UrlPathEncode(device.Revision));
url =
$"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}";
}
else
{
xmlFile = device.Model + ".xml";
url = string.Format("ViewReport.aspx?model={0}", HttpUtility.UrlPathEncode(device.Model));
url = $"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}";
}
xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
@@ -271,7 +263,7 @@ namespace DiscImageChef.Server
Revision = device.Revision,
Bus = device.Bus,
ReportLink =
url == null ? "No" : string.Format("<a href=\"{0}\" target=\"_blank\">Yes</a>", url)
url == null ? "No" : $"<a href=\"{url}\" target=\"_blank\">Yes</a>"
});
}

View File

@@ -109,14 +109,12 @@ namespace DiscImageChef.Server
lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer);
lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product);
lblUsbVendor.Text = string.Format("0x{0:x4}", report.USB.VendorID);
lblUsbVendor.Text = $"0x{report.USB.VendorID:x4}";
if(usbVendorDescription != null)
lblUsbVendorDescription.Text =
string.Format("({0})", HttpUtility.HtmlEncode(usbVendorDescription));
lblUsbProductId.Text = string.Format("0x{0:x4}", report.USB.ProductID);
lblUsbVendorDescription.Text = $"({HttpUtility.HtmlEncode(usbVendorDescription)})";
lblUsbProductId.Text = $"0x{report.USB.ProductID:x4}";
if(usbProductDescription != null)
lblUsbProductDescription.Text =
string.Format("({0})", HttpUtility.HtmlEncode(usbProductDescription));
lblUsbProductDescription.Text = $"({HttpUtility.HtmlEncode(usbProductDescription)})";
}
else divUsb.Visible = false;
@@ -124,8 +122,8 @@ namespace DiscImageChef.Server
{
lblFirewireManufacturer.Text = HttpUtility.HtmlEncode(report.FireWire.Manufacturer);
lblFirewireProduct.Text = HttpUtility.HtmlEncode(report.FireWire.Product);
lblFirewireVendor.Text = string.Format("0x{0:x8}", report.FireWire.VendorID);
lblFirewireProductId.Text = string.Format("0x{0:x8}", report.FireWire.ProductID);
lblFirewireVendor.Text = $"0x{report.FireWire.VendorID:x8}";
lblFirewireProductId.Text = $"0x{report.FireWire.ProductID:x8}";
}
else divFirewire.Visible = false;
@@ -133,8 +131,8 @@ namespace DiscImageChef.Server
{
lblPcmciaManufacturer.Text = HttpUtility.HtmlEncode(report.PCMCIA.Manufacturer);
lblPcmciaProduct.Text = HttpUtility.HtmlEncode(report.PCMCIA.ProductName);
lblPcmciaManufacturerCode.Text = string.Format("0x{0:x4}", report.PCMCIA.ManufacturerCode);
lblPcmciaCardCode.Text = string.Format("0x{0:x4}", report.PCMCIA.CardCode);
lblPcmciaManufacturerCode.Text = $"0x{report.PCMCIA.ManufacturerCode:x4}";
lblPcmciaCardCode.Text = $"0x{report.PCMCIA.CardCode:x4}";
lblPcmciaCompliance.Text = HttpUtility.HtmlEncode(report.PCMCIA.Compliance);
Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS);
if(tuples != null)
@@ -155,25 +153,15 @@ namespace DiscImageChef.Server
foreach(DeviceGeometry geometry in geom.Geometries)
{
decodedTuples.Add("Device width",
string.Format("{0} bits",
(1 << (geometry.CardInterface - 1)) * 8));
$"{(1 << (geometry.CardInterface - 1)) * 8} bits");
decodedTuples.Add("Erase block",
string.Format("{0} bytes",
(1 << (geometry.EraseBlockSize - 1)) *
(1 << (geometry.Interleaving - 1))));
$"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Read block",
string.Format("{0} bytes",
(1 << (geometry.ReadBlockSize - 1)) *
(1 << (geometry.Interleaving - 1))));
$"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Write block",
string.Format("{0} bytes",
(1 << (geometry.WriteBlockSize - 1)) *
(1 << (geometry.Interleaving - 1))));
$"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
decodedTuples.Add("Partition alignment",
string.Format("{0} bytes",
(1 << (geometry.EraseBlockSize - 1)) *
(1 << (geometry.Interleaving - 1)) *
(1 << (geometry.Partitions - 1))));
$"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes");
}
break;
@@ -214,7 +202,7 @@ namespace DiscImageChef.Server
decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString());
break;
default:
decodedTuples.Add("Unknown tuple ID", string.Format("0x{0:X2}", (byte)tuple.Code));
decodedTuples.Add("Unknown tuple ID", $"0x{(byte)tuple.Code:X2}");
break;
}
@@ -273,9 +261,8 @@ namespace DiscImageChef.Server
if(VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) !=
report.SCSI.Inquiry.VendorIdentification)
lblScsiVendor.Text = string.Format("{0} ({1})", report.SCSI.Inquiry.VendorIdentification,
VendorString.Prettify(report.SCSI.Inquiry
.VendorIdentification));
lblScsiVendor.Text =
$"{report.SCSI.Inquiry.VendorIdentification} ({VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)})";
else lblScsiVendor.Text = report.SCSI.Inquiry.VendorIdentification;
lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification;
lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel;
@@ -391,55 +378,27 @@ namespace DiscImageChef.Server
if(report.SCSI.ReadCapabilities.BlocksSpecified &&
report.SCSI.ReadCapabilities.BlockSizeSpecified)
{
scsiOneValue.Add(string.Format("Device has {0} blocks of {1} bytes each",
report.SCSI.ReadCapabilities.Blocks,
report.SCSI.ReadCapabilities.BlockSize));
scsiOneValue.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)
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Tb, {2:F2} TiB",
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize,
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 /
1000 / 1000,
(double)(report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
1024 / 1024 / 1024));
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)
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Gb, {2:F2} GiB",
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize,
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 /
1000,
(double)(report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
1024 / 1024));
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");
else
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Mb, {2:F2} MiB",
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize,
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000,
(double)(report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
1024));
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");
}
if(report.SCSI.ReadCapabilities.MediumTypeSpecified)
scsiOneValue.Add(string.Format("Medium type code: {0:X2}h",
report.SCSI.ReadCapabilities.MediumType));
scsiOneValue.Add($"Medium type code: {report.SCSI.ReadCapabilities.MediumType:X2}h");
if(report.SCSI.ReadCapabilities.DensitySpecified)
scsiOneValue.Add(string.Format("Density code: {0:X2}h",
report.SCSI.ReadCapabilities.Density));
scsiOneValue.Add($"Density code: {report.SCSI.ReadCapabilities.Density:X2}h");
if((report.SCSI.ReadCapabilities.SupportsReadLong ||
report.SCSI.ReadCapabilities.SupportsReadLong16) &&
report.SCSI.ReadCapabilities.LongBlockSizeSpecified)
scsiOneValue.Add(string.Format("Long block size: {0} bytes",
report.SCSI.ReadCapabilities.LongBlockSize));
scsiOneValue.Add($"Long block size: {report.SCSI.ReadCapabilities.LongBlockSize} bytes");
if(report.SCSI.ReadCapabilities.SupportsReadCapacity)
scsiOneValue.Add("Device supports READ CAPACITY (10) command.");
if(report.SCSI.ReadCapabilities.SupportsReadCapacity16)