REFACTOR: Final cleanup of DiscImageChef.Server.

This commit is contained in:
2017-12-24 03:23:06 +00:00
parent 3f628cd3c9
commit 9b8771cce3
20 changed files with 316 additions and 280 deletions

View File

@@ -40,7 +40,8 @@ namespace DiscImageChef.Server.App_Start
public static class Ata public static class Ata
{ {
/// <summary> /// <summary>
/// Takes the ATA part of a device report and prints it as a list of values and another list of key=value pairs to be sequenced by ASP.NET in the rendering /// Takes the ATA part of a device report and prints it as a list of values and another list of key=value pairs to be
/// sequenced by ASP.NET in the rendering
/// </summary> /// </summary>
/// <param name="ataReport">ATA part of a device report</param> /// <param name="ataReport">ATA part of a device report</param>
/// <param name="cfa"><c>true</c> if compact flash device</param> /// <param name="cfa"><c>true</c> if compact flash device</param>
@@ -435,7 +436,8 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("ATAPI Unknown or no device type"); ataOneValue.Add("ATAPI Unknown or no device type");
break; break;
default: default:
ataOneValue.Add($"ATAPI Unknown device type field value 0x{((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8:X2}"); ataOneValue
.Add($"ATAPI Unknown device type field value 0x{((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8:X2}");
break; break;
} }
@@ -452,7 +454,8 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("Device shall set DRQ within 50 µs of receiving PACKET"); ataOneValue.Add("Device shall set DRQ within 50 µs of receiving PACKET");
break; break;
default: default:
ataOneValue.Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataReport.GeneralConfiguration & 0x60) >> 5}"); ataOneValue
.Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataReport.GeneralConfiguration & 0x60) >> 5}");
break; break;
} }
@@ -466,7 +469,8 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("ATAPI device uses 16 byte command packet"); ataOneValue.Add("ATAPI device uses 16 byte command packet");
break; break;
default: default:
ataOneValue.Add($"Unknown ATAPI packet size code {(ushort)ataReport.GeneralConfiguration & 0x03}"); ataOneValue
.Add($"Unknown ATAPI packet size code {(ushort)ataReport.GeneralConfiguration & 0x03}");
break; break;
} }
} }
@@ -535,7 +539,8 @@ namespace DiscImageChef.Server.App_Start
.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; break;
default: default:
ataOneValue.Add($"Unknown device specific configuration 0x{(ushort)ataReport.SpecificConfiguration:X4}"); ataOneValue
.Add($"Unknown device specific configuration 0x{(ushort)ataReport.SpecificConfiguration:X4}");
break; break;
} }
@@ -545,16 +550,20 @@ namespace DiscImageChef.Server.App_Start
switch(ataReport.BufferType) switch(ataReport.BufferType)
{ {
case 1: case 1:
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer"); ataOneValue
.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer");
break; break;
case 2: case 2:
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer"); ataOneValue
.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer");
break; break;
case 3: case 3:
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching"); ataOneValue
.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching");
break; break;
default: default:
ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataReport.BufferType} buffer"); ataOneValue
.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataReport.BufferType} buffer");
break; break;
} }
@@ -805,7 +814,8 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.PacketBusRelease != 0) if(ataReport.PacketBusRelease != 0)
ataOneValue.Add($"{ataReport.PacketBusRelease} ns. typical to release bus from receipt of PACKET"); ataOneValue.Add($"{ataReport.PacketBusRelease} ns. typical to release bus from receipt of PACKET");
if(ataReport.ServiceBusyClear != 0) if(ataReport.ServiceBusyClear != 0)
ataOneValue.Add($"{ataReport.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE"); ataOneValue
.Add($"{ataReport.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE");
} }
if(ataReport.TransportMajorVersionSpecified && ((ataReport.TransportMajorVersion & 0xF000) >> 12 == 0x1 || if(ataReport.TransportMajorVersionSpecified && ((ataReport.TransportMajorVersion & 0xF000) >> 12 == 0x1 ||
@@ -813,25 +823,28 @@ namespace DiscImageChef.Server.App_Start
{ {
if(!ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear)) if(!ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear))
{ {
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen1Speed)) ataOneValue.Add("SATA 1.5Gb/s is supported"); if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen1Speed))
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen2Speed)) ataOneValue.Add("SATA 3.0Gb/s is supported"); ataOneValue.Add("SATA 1.5Gb/s is supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen3Speed)) ataOneValue.Add("SATA 6.0Gb/s is supported"); if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen2Speed))
ataOneValue.Add("SATA 3.0Gb/s is supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen3Speed))
ataOneValue.Add("SATA 6.0Gb/s is supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.PowerReceipt)) if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.PowerReceipt))
ataOneValue ataOneValue.Add("Receipt of host initiated power management requests is supported");
.Add("Receipt of host initiated power management requests is supported"); if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.PHYEventCounter))
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.PHYEventCounter)) ataOneValue.Add("PHY Event counters are supported"); ataOneValue.Add("PHY Event counters are supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.HostSlumbTrans)) if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.HostSlumbTrans))
ataOneValue ataOneValue.Add("Supports host automatic partial to slumber transitions is supported");
.Add("Supports host automatic partial to slumber transitions is supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.DevSlumbTrans)) if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.DevSlumbTrans))
ataOneValue ataOneValue.Add("Supports device automatic partial to slumber transitions is supported");
.Add("Supports device automatic partial to slumber transitions is supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ))
{ {
ataOneValue.Add("NCQ is supported"); ataOneValue.Add("NCQ is supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQPriority)) ataOneValue.Add("NCQ priority is supported"); if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQPriority))
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.UnloadNCQ)) ataOneValue.Add("Unload is supported with outstanding NCQ commands"); ataOneValue.Add("NCQ priority is supported");
if(ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.UnloadNCQ))
ataOneValue.Add("Unload is supported with outstanding NCQ commands");
} }
} }
@@ -842,16 +855,18 @@ namespace DiscImageChef.Server.App_Start
!ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) && !ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) &&
ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) ataReport.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ))
{ {
if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQMgmt)) ataOneValue.Add("NCQ queue management is supported"); if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQMgmt))
if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQStream)) ataOneValue.Add("NCQ streaming is supported"); ataOneValue.Add("NCQ queue management is supported");
if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQStream))
ataOneValue.Add("NCQ streaming is supported");
} }
if(ataReport.SATACapabilities2Specified && atapi) if(ataReport.SATACapabilities2Specified && atapi)
{ {
if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.HostEnvDetect)) ataOneValue.Add("ATAPI device supports host environment detection"); if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.HostEnvDetect))
ataOneValue.Add("ATAPI device supports host environment detection");
if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.DevAttSlimline)) if(ataReport.SATACapabilities2.HasFlag(SATACapabilitiesBit2.DevAttSlimline))
ataOneValue ataOneValue.Add("ATAPI device supports attention on slimline connected devices");
.Add("ATAPI device supports attention on slimline connected devices");
} }
} }
} }
@@ -999,7 +1014,8 @@ namespace DiscImageChef.Server.App_Start
ataReport.EnabledCommandSet2Specified) ataReport.EnabledCommandSet2Specified)
ataOneValue.Add("Address Offset Reserved Area Boot is supported and enabled"); ataOneValue.Add("Address Offset Reserved Area Boot is supported and enabled");
else ataOneValue.Add("Address Offset Reserved Area Boot is supported"); else ataOneValue.Add("Address Offset Reserved Area Boot is supported");
if(ataReport.CommandSet2.HasFlag(CommandSetBit2.SetFeaturesRequired)) ataOneValue.Add("SET FEATURES is required before spin-up"); if(ataReport.CommandSet2.HasFlag(CommandSetBit2.SetFeaturesRequired))
ataOneValue.Add("SET FEATURES is required before spin-up");
if(ataReport.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) if(ataReport.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby))
if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby) && if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby) &&
ataReport.EnabledCommandSet2Specified) ataReport.EnabledCommandSet2Specified)
@@ -1059,8 +1075,10 @@ namespace DiscImageChef.Server.App_Start
ataReport.EnabledCommandSet3Specified) ataReport.EnabledCommandSet3Specified)
ataOneValue.Add("IDLE IMMEDIATE with UNLOAD FEATURE is supported and enabled"); ataOneValue.Add("IDLE IMMEDIATE with UNLOAD FEATURE is supported and enabled");
else ataOneValue.Add("IDLE IMMEDIATE with UNLOAD FEATURE is supported"); else ataOneValue.Add("IDLE IMMEDIATE with UNLOAD FEATURE is supported");
if(ataReport.CommandSet3.HasFlag(CommandSetBit3.WriteURG)) ataOneValue.Add("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT"); if(ataReport.CommandSet3.HasFlag(CommandSetBit3.WriteURG))
if(ataReport.CommandSet3.HasFlag(CommandSetBit3.ReadURG)) ataOneValue.Add("URG bit is supported in READ STREAM DMA EXT and READ STREAM EXT"); ataOneValue.Add("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT");
if(ataReport.CommandSet3.HasFlag(CommandSetBit3.ReadURG))
ataOneValue.Add("URG bit is supported in READ STREAM DMA EXT and READ STREAM EXT");
if(ataReport.CommandSet3.HasFlag(CommandSetBit3.WWN)) ataOneValue.Add("Device has a World Wide Name"); if(ataReport.CommandSet3.HasFlag(CommandSetBit3.WWN)) ataOneValue.Add("Device has a World Wide Name");
if(ataReport.CommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) if(ataReport.CommandSet3.HasFlag(CommandSetBit3.FUAWriteQ))
if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ) && if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ) &&
@@ -1161,24 +1179,35 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.CommandSet5Specified) if(ataReport.CommandSet5Specified)
{ {
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.DeviceConfDMA)) ataOneValue.Add("DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.DeviceConfDMA))
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ReadBufferDMA)) ataOneValue.Add("READ BUFFER DMA is supported"); ataOneValue.Add("DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.WriteBufferDMA)) ataOneValue.Add("WRITE BUFFER DMA is supported"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ReadBufferDMA))
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.DownloadMicroCodeDMA)) ataOneValue.Add("DOWNLOAD MICROCODE DMA is supported"); ataOneValue.Add("READ BUFFER DMA is supported");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.SetMaxDMA)) ataOneValue.Add("SET PASSWORD DMA and SET UNLOCK DMA are supported"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.WriteBufferDMA))
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.Ata28)) ataOneValue.Add("Not all 28-bit commands are supported"); ataOneValue.Add("WRITE BUFFER DMA is supported");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.DownloadMicroCodeDMA))
ataOneValue.Add("DOWNLOAD MICROCODE DMA is supported");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.SetMaxDMA))
ataOneValue.Add("SET PASSWORD DMA and SET UNLOCK DMA are supported");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.Ata28))
ataOneValue.Add("Not all 28-bit commands are supported");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.CFast)) ataOneValue.Add("Device follows CFast specification"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.CFast))
ataOneValue.Add("Device follows CFast specification");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.IEEE1667)) ataOneValue.Add("Device follows IEEE-1667"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.IEEE1667)) ataOneValue.Add("Device follows IEEE-1667");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.DeterministicTrim)) if(ataReport.CommandSet5.HasFlag(CommandSetBit5.DeterministicTrim))
{ {
ataOneValue.Add("Read after TRIM is deterministic"); ataOneValue.Add("Read after TRIM is deterministic");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ReadZeroTrim)) ataOneValue.Add("Read after TRIM returns empty data"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ReadZeroTrim))
ataOneValue.Add("Read after TRIM returns empty data");
} }
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.LongPhysSectorAligError)) ataOneValue.Add("Device supports Long Physical Sector Alignment Error Reporting Control"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.LongPhysSectorAligError))
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.Encrypted)) ataOneValue.Add("Device encrypts all user data"); ataOneValue.Add("Device supports Long Physical Sector Alignment Error Reporting Control");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.AllCacheNV)) ataOneValue.Add("Device's write cache is non-volatile"); if(ataReport.CommandSet5.HasFlag(CommandSetBit5.Encrypted))
ataOneValue.Add("Device encrypts all user data");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.AllCacheNV))
ataOneValue.Add("Device's write cache is non-volatile");
if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ZonedBit0) || if(ataReport.CommandSet5.HasFlag(CommandSetBit5.ZonedBit0) ||
ataReport.CommandSet5.HasFlag(CommandSetBit5.ZonedBit1)) ataOneValue.Add("Device is zoned"); ataReport.CommandSet5.HasFlag(CommandSetBit5.ZonedBit1)) ataOneValue.Add("Device is zoned");
} }
@@ -1255,13 +1284,17 @@ namespace DiscImageChef.Server.App_Start
ataReport.EnabledSATAFeaturesSpecified) ataReport.EnabledSATAFeaturesSpecified)
ataOneValue.Add("Software Settings Preservation is supported"); ataOneValue.Add("Software Settings Preservation is supported");
else ataOneValue.Add("Software Settings Preservation is supported"); else ataOneValue.Add("Software Settings Preservation is supported");
if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense)) ataOneValue.Add("NCQ Autosense is supported"); if(ataReport.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense))
if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.EnabledSlumber)) ataOneValue.Add("Automatic Partial to Slumber transitions are enabled"); ataOneValue.Add("NCQ Autosense is supported");
if(ataReport.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.EnabledSlumber))
ataOneValue.Add("Automatic Partial to Slumber transitions are enabled");
} }
} }
if((ataReport.RemovableStatusSet & 0x03) > 0) ataOneValue.Add("Removable Media Status Notification feature set is supported"); if((ataReport.RemovableStatusSet & 0x03) > 0)
ataOneValue.Add("Removable Media Status Notification feature set is supported");
if(ataReport.FreeFallSensitivity != 0x00 && ataReport.FreeFallSensitivity != 0xFF) ataOneValue.Add($"Free-fall sensitivity set to {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)) if(ataReport.DataSetMgmtSpecified && ataReport.DataSetMgmt.HasFlag(DataSetMgmtBit.Trim))
ataOneValue.Add("TRIM is supported"); ataOneValue.Add("TRIM is supported");
@@ -1297,7 +1330,8 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add($"{ataReport.SecurityEraseTime * 2} minutes to complete secure erase"); ataOneValue.Add($"{ataReport.SecurityEraseTime * 2} minutes to complete secure erase");
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced))
ataOneValue.Add($"{ataReport.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase"); ataOneValue
.Add($"{ataReport.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase");
ataOneValue.Add($"Master password revision code: {ataReport.MasterPasswordRevisionCode}"); ataOneValue.Add($"Master password revision code: {ataReport.MasterPasswordRevisionCode}");
} }
@@ -1365,7 +1399,8 @@ namespace DiscImageChef.Server.App_Start
logicalsectorsize = ataReport.ReadCapabilities.BlockSize; logicalsectorsize = ataReport.ReadCapabilities.BlockSize;
} }
if(ataReport.ReadCapabilities.PhysicalBlockSizeSpecified) if(ataReport.ReadCapabilities.PhysicalBlockSizeSpecified)
ataTwoValue.Add("Physical sector size", $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes"); ataTwoValue.Add("Physical sector size",
$"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes");
if(ataReport.ReadCapabilities.LongBlockSizeSpecified) if(ataReport.ReadCapabilities.LongBlockSizeSpecified)
ataTwoValue.Add("READ LONG sector size", $"{ataReport.ReadCapabilities.LongBlockSize} bytes"); ataTwoValue.Add("READ LONG sector size", $"{ataReport.ReadCapabilities.LongBlockSize} bytes");
@@ -1374,7 +1409,8 @@ namespace DiscImageChef.Server.App_Start
ataReport.ReadCapabilities.BlockSize != ataReport.ReadCapabilities.PhysicalBlockSize && ataReport.ReadCapabilities.BlockSize != ataReport.ReadCapabilities.PhysicalBlockSize &&
(ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 && (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 &&
(ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000) (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000)
ataOneValue.Add($"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector"); ataOneValue
.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)
{ {
@@ -1413,8 +1449,7 @@ namespace DiscImageChef.Server.App_Start
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", 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"); $"{(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 > else if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000)
1000)
ataTwoValue.Add("Device size in 28-bit LBA mode", 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 else

View File

@@ -39,7 +39,8 @@ namespace DiscImageChef.Server.App_Start
public static class ScsiEvpd public static class ScsiEvpd
{ {
/// <summary> /// <summary>
/// Takes the SCSI EVPD part of a device report and prints it as a list key=value pairs to be sequenced by ASP.NET in the rendering /// Takes the SCSI EVPD part of a device report and prints it as a list key=value pairs to be sequenced by ASP.NET in
/// the rendering
/// </summary> /// </summary>
/// <param name="pages">EVPD pages</param> /// <param name="pages">EVPD pages</param>
/// <param name="vendor">SCSI vendor string</param> /// <param name="vendor">SCSI vendor string</param>
@@ -65,16 +66,13 @@ namespace DiscImageChef.Server.App_Start
decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value); 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); 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);
decoded = EVPD.PrettifyPage_C0_IBM(evpd.value); else if(evpd.page == 0xC1 && vendor.Trim() == "ibm") decoded = EVPD.PrettifyPage_C1_IBM(evpd.value);
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); decoded = EVPD.PrettifyPage_C0_C1_Certance(evpd.value);
else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 || else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 ||
evpd.page == 0xC6) && evpd.page == 0xC6) &&
vendor.Trim() == "certance") vendor.Trim() == "certance") decoded = EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value);
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 || else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 ||
evpd.page == 0xC4 || evpd.page == 0xC5) && evpd.page == 0xC4 || evpd.page == 0xC5) &&
vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value); vendor.Trim() == "hp") decoded = EVPD.PrettifyPage_C0_to_C5_HP(evpd.value);

View File

@@ -39,7 +39,8 @@ namespace DiscImageChef.Server.App_Start
static class ScsiInquiry static class ScsiInquiry
{ {
/// <summary> /// <summary>
/// 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 rendering /// 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
/// rendering
/// </summary> /// </summary>
/// <param name="inquiry">INQUIRY part of the report</param> /// <param name="inquiry">INQUIRY part of the report</param>
/// <returns>List of values</returns> /// <returns>List of values</returns>
@@ -1026,8 +1027,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device complies with SPI ANSI INCITS 253-1995"); scsiOneValue.Add("Device complies with SPI ANSI INCITS 253-1995");
break; break;
case 0x0ABB: case 0x0ABB:
scsiOneValue scsiOneValue.Add("Device complies with SPI T10/0855-D revision 15a with SPI Amnd revision 3a");
.Add("Device complies with SPI T10/0855-D revision 15a with SPI Amnd revision 3a");
break; break;
case 0x0ABC: case 0x0ABC:
scsiOneValue scsiOneValue
@@ -1216,8 +1216,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device complies with FC-AL-2 T11/1133-D revision 7.0"); scsiOneValue.Add("Device complies with FC-AL-2 T11/1133-D revision 7.0");
break; break;
case 0x0D63: case 0x0D63:
scsiOneValue scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with AM1-2003 & AM2-2006");
.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with AM1-2003 & AM2-2006");
break; break;
case 0x0D64: case 0x0D64:
scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with Amnd 2 AM2-2006"); scsiOneValue.Add("Device complies with FC-AL-2 ANSI INCITS 332-1999 with Amnd 2 AM2-2006");
@@ -1620,8 +1619,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device complies with SPL ANSI INCITS 476-2011"); scsiOneValue.Add("Device complies with SPL ANSI INCITS 476-2011");
break; break;
case 0x20A8: case 0x20A8:
scsiOneValue scsiOneValue.Add("Device complies with SPL ANSI INCITS 476-2011 + SPL AM1 INCITS 476/AM1 2012");
.Add("Device complies with SPL ANSI INCITS 476-2011 + SPL AM1 INCITS 476/AM1 2012");
break; break;
case 0x20AA: case 0x20AA:
scsiOneValue.Add("Device complies with SPL ISO/IEC 14776-261:2012"); scsiOneValue.Add("Device complies with SPL ISO/IEC 14776-261:2012");

View File

@@ -39,7 +39,8 @@ namespace DiscImageChef.Server.App_Start
public static class ScsiMmcFeatures public static class ScsiMmcFeatures
{ {
/// <summary> /// <summary>
/// Takes the MMC FEATURES part of a device report and prints it as a list of values to be sequenced by ASP.NET in the rendering /// Takes the MMC FEATURES part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
/// rendering
/// </summary> /// </summary>
/// <param name="ftr">FEATURES part of the report</param> /// <param name="ftr">FEATURES part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param> /// <param name="mmcOneValue">List to put the values on</param>
@@ -125,8 +126,7 @@ namespace DiscImageChef.Server.App_Start
if(ftr.CanUpgradeFirmware) mmcOneValue.Add("Drive supports Microcode Upgrade"); 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.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page");
if(ftr.Locked) mmcOneValue.Add("Drive can lock media"); if(ftr.Locked) mmcOneValue.Add("Drive can lock media");
if(ftr.LogicalBlockSize > 0) if(ftr.LogicalBlockSize > 0) mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block");
mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block");
if(ftr.MultiRead) if(ftr.MultiRead)
mmcOneValue.Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification"); mmcOneValue.Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
@@ -233,8 +233,7 @@ namespace DiscImageChef.Server.App_Start
else if(ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM"); 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.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.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications");
if(ftr.FirmwareDateSpecified) if(ftr.FirmwareDateSpecified) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
if(ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers"); 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.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.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events");
@@ -271,8 +270,7 @@ namespace DiscImageChef.Server.App_Start
if(ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc"); if(ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc");
if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel"); if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel");
if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS"); if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS");
if(ftr.VolumeLevelsSpecified) if(ftr.VolumeLevelsSpecified) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
if(ftr.SupportsWriteProtectPAC) if(ftr.SupportsWriteProtectPAC)
mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media"); mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media");
if(ftr.SupportsWriteInhibitDCB) if(ftr.SupportsWriteInhibitDCB)

View File

@@ -40,7 +40,8 @@ namespace DiscImageChef.Server.App_Start
public static class ScsiMmcMode public static class ScsiMmcMode
{ {
/// <summary> /// <summary>
/// Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET in the rendering /// Takes the MODE PAGE 2Ah part of a device report and prints it as a list of values to be sequenced by ASP.NET in the
/// rendering
/// </summary> /// </summary>
/// <param name="mode">MODE PAGE 2Ah part of the report</param> /// <param name="mode">MODE PAGE 2Ah part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param> /// <param name="mmcOneValue">List to put the values on</param>
@@ -91,11 +92,9 @@ namespace DiscImageChef.Server.App_Start
: "Drive is not locked, media can be ejected and inserted"); : "Drive is not locked, media can be ejected and inserted");
} }
else else
{
mmcOneValue.Add(mode.LockStatus mmcOneValue.Add(mode.LockStatus
? "Drive is locked, media cannot be ejected, but if empty, can be inserted" ? "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 not locked, media can be ejected and inserted");
}
if(mode.CanEject) mmcOneValue.Add("Drive can eject media"); if(mode.CanEject) mmcOneValue.Add("Drive can eject media");
if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently"); if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently");
@@ -134,9 +133,11 @@ namespace DiscImageChef.Server.App_Start
if(mode.CurrentWriteSpeedSelected > 0) 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"); mmcOneValue
.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode");
else if(mode.RotationControlSelected == 1) else if(mode.RotationControlSelected == 1)
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode"); mmcOneValue
.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode");
} }
else else
{ {
@@ -147,7 +148,9 @@ namespace DiscImageChef.Server.App_Start
} }
if(mode.WriteSpeedPerformanceDescriptors != null) if(mode.WriteSpeedPerformanceDescriptors != null)
foreach(Modes.ModePage_2A_WriteDescriptor descriptor in mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0)) if(descriptor.RotationControl == 0) foreach(Modes.ModePage_2A_WriteDescriptor descriptor in
mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0))
if(descriptor.RotationControl == 0)
mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode"); mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode");
else if(descriptor.RotationControl == 1) else if(descriptor.RotationControl == 1)
mmcOneValue mmcOneValue

View File

@@ -39,7 +39,8 @@ namespace DiscImageChef.Server.App_Start
public static class ScsiModeSense public static class ScsiModeSense
{ {
/// <summary> /// <summary>
/// Takes the MODE PAGEs part of a device report and prints it as a list of values and another list of key=value pairs to be sequenced by ASP.NET in the rendering /// Takes the MODE PAGEs part of a device report and prints it as a list of values and another list of key=value pairs
/// to be sequenced by ASP.NET in the rendering
/// </summary> /// </summary>
/// <param name="modeSense">MODE PAGEs part of a device report</param> /// <param name="modeSense">MODE PAGEs part of a device report</param>
/// <param name="vendor">SCSI vendor string</param> /// <param name="vendor">SCSI vendor string</param>
@@ -49,13 +50,13 @@ namespace DiscImageChef.Server.App_Start
public static void Report(modeType modeSense, string vendor, PeripheralDeviceTypes deviceType, public static void Report(modeType modeSense, string vendor, PeripheralDeviceTypes deviceType,
ref List<string> scsiOneValue, ref Dictionary<string, string> modePages) ref List<string> scsiOneValue, ref Dictionary<string, string> modePages)
{ {
if(modeSense.MediumTypeSpecified) if(modeSense.MediumTypeSpecified) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected."); if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
if(modeSense.BlockDescriptors != null) if(modeSense.BlockDescriptors != null)
foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors) foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors)
if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified) if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified)
scsiOneValue.Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each"); 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"); else scsiOneValue.Add($"Density code {descriptor.Density:X2}h");
if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits"); if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits");
@@ -85,14 +86,11 @@ namespace DiscImageChef.Server.App_Start
case 0x00: case 0x00:
{ {
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0) if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_00_SFF(page.value));
Modes.PrettifyModePage_00_SFF(page.value));
else else
{
modePages 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"); "Unknown vendor mode page");
}
break; break;
} }
case 0x01: case 0x01:
@@ -109,8 +107,7 @@ namespace DiscImageChef.Server.App_Start
case 0x02: case 0x02:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_02(page.value));
Modes.PrettifyModePage_02(page.value));
else goto default; else goto default;
break; break;
@@ -118,8 +115,7 @@ namespace DiscImageChef.Server.App_Start
case 0x03: case 0x03:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_03(page.value));
Modes.PrettifyModePage_03(page.value));
else goto default; else goto default;
break; break;
@@ -127,8 +123,7 @@ namespace DiscImageChef.Server.App_Start
case 0x04: case 0x04:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_04(page.value));
Modes.PrettifyModePage_04(page.value));
else goto default; else goto default;
break; break;
@@ -136,8 +131,7 @@ namespace DiscImageChef.Server.App_Start
case 0x05: case 0x05:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_05(page.value));
Modes.PrettifyModePage_05(page.value));
else goto default; else goto default;
break; break;
@@ -145,8 +139,7 @@ namespace DiscImageChef.Server.App_Start
case 0x06: case 0x06:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_06(page.value));
Modes.PrettifyModePage_06(page.value));
else goto default; else goto default;
break; break;
@@ -165,8 +158,7 @@ namespace DiscImageChef.Server.App_Start
case 0x08: case 0x08:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_08(page.value));
Modes.PrettifyModePage_08(page.value));
else goto default; else goto default;
break; break;
@@ -174,11 +166,9 @@ namespace DiscImageChef.Server.App_Start
case 0x0A: case 0x0A:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A(page.value));
Modes.PrettifyModePage_0A(page.value));
else if(page.subpage == 1) else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A_S01(page.value));
Modes.PrettifyModePage_0A_S01(page.value));
else goto default; else goto default;
break; break;
@@ -186,8 +176,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0B: case 0x0B:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0B(page.value));
Modes.PrettifyModePage_0B(page.value));
else goto default; else goto default;
break; break;
@@ -195,8 +184,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0D: case 0x0D:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0D(page.value));
Modes.PrettifyModePage_0D(page.value));
else goto default; else goto default;
break; break;
@@ -204,8 +192,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0E: case 0x0E:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0E(page.value));
Modes.PrettifyModePage_0E(page.value));
else goto default; else goto default;
break; break;
@@ -213,8 +200,7 @@ namespace DiscImageChef.Server.App_Start
case 0x0F: case 0x0F:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0F(page.value));
Modes.PrettifyModePage_0F(page.value));
else goto default; else goto default;
break; break;
@@ -233,8 +219,7 @@ namespace DiscImageChef.Server.App_Start
case 0x11: case 0x11:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_11(page.value));
Modes.PrettifyModePage_11(page.value));
else goto default; else goto default;
break; break;
@@ -244,8 +229,7 @@ namespace DiscImageChef.Server.App_Start
case 0x14: case 0x14:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_12_13_14(page.value));
Modes.PrettifyModePage_12_13_14(page.value));
else goto default; else goto default;
break; break;
@@ -253,11 +237,9 @@ namespace DiscImageChef.Server.App_Start
case 0x1A: case 0x1A:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A(page.value));
Modes.PrettifyModePage_1A(page.value));
else if(page.subpage == 1) else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A_S01(page.value));
Modes.PrettifyModePage_1A_S01(page.value));
else goto default; else goto default;
break; break;
@@ -265,8 +247,7 @@ namespace DiscImageChef.Server.App_Start
case 0x1B: case 0x1B:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1B(page.value));
Modes.PrettifyModePage_1B(page.value));
else goto default; else goto default;
break; break;
@@ -279,8 +260,7 @@ namespace DiscImageChef.Server.App_Start
? Modes.PrettifyModePage_1C_SFF(page.value) ? Modes.PrettifyModePage_1C_SFF(page.value)
: Modes.PrettifyModePage_1C(page.value)); : Modes.PrettifyModePage_1C(page.value));
else if(page.subpage == 1) else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1C_S01(page.value));
Modes.PrettifyModePage_1C_S01(page.value));
else goto default; else goto default;
break; break;
@@ -288,8 +268,7 @@ namespace DiscImageChef.Server.App_Start
case 0x1D: case 0x1D:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1D(page.value));
Modes.PrettifyModePage_1D(page.value));
else goto default; else goto default;
break; break;
@@ -297,8 +276,7 @@ namespace DiscImageChef.Server.App_Start
case 0x21: case 0x21:
{ {
if(vendor == "CERTANCE") if(vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_21(page.value));
Modes.PrettifyCertanceModePage_21(page.value));
else goto default; else goto default;
break; break;
@@ -306,8 +284,7 @@ namespace DiscImageChef.Server.App_Start
case 0x22: case 0x22:
{ {
if(vendor == "CERTANCE") if(vendor == "CERTANCE")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_22(page.value));
Modes.PrettifyCertanceModePage_22(page.value));
else goto default; else goto default;
break; break;
@@ -315,8 +292,7 @@ namespace DiscImageChef.Server.App_Start
case 0x24: case 0x24:
{ {
if(vendor == "IBM") if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_24(page.value));
Modes.PrettifyIBMModePage_24(page.value));
else goto default; else goto default;
break; break;
@@ -324,8 +300,7 @@ namespace DiscImageChef.Server.App_Start
case 0x2A: case 0x2A:
{ {
if(page.subpage == 0) if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_2A(page.value));
Modes.PrettifyModePage_2A(page.value));
else goto default; else goto default;
break; break;
@@ -333,8 +308,7 @@ namespace DiscImageChef.Server.App_Start
case 0x2F: case 0x2F:
{ {
if(vendor == "IBM") if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_2F(page.value));
Modes.PrettifyIBMModePage_2F(page.value));
else goto default; else goto default;
break; break;
@@ -350,8 +324,7 @@ namespace DiscImageChef.Server.App_Start
case 0x3B: case 0x3B:
{ {
if(vendor == "HP") if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3B(page.value));
Modes.PrettifyHPModePage_3B(page.value));
else goto default; else goto default;
break; break;
@@ -359,8 +332,7 @@ namespace DiscImageChef.Server.App_Start
case 0x3C: case 0x3C:
{ {
if(vendor == "HP") if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3C(page.value));
Modes.PrettifyHPModePage_3C(page.value));
else goto default; else goto default;
break; break;
@@ -368,11 +340,9 @@ namespace DiscImageChef.Server.App_Start
case 0x3D: case 0x3D:
{ {
if(vendor == "IBM") if(vendor == "IBM")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_3D(page.value));
Modes.PrettifyIBMModePage_3D(page.value));
else if(vendor == "HP") else if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3D(page.value));
Modes.PrettifyHPModePage_3D(page.value));
else goto default; else goto default;
break; break;
@@ -380,11 +350,9 @@ namespace DiscImageChef.Server.App_Start
case 0x3E: case 0x3E:
{ {
if(vendor == "FUJITSU") if(vendor == "FUJITSU")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyFujitsuModePage_3E(page.value));
Modes.PrettifyFujitsuModePage_3E(page.value));
else if(vendor == "HP") else if(vendor == "HP")
modePages.Add($"MODE page {page.page:X2}h", modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3E(page.value));
Modes.PrettifyHPModePage_3E(page.value));
else goto default; else goto default;
break; break;

View File

@@ -38,7 +38,7 @@ namespace DiscImageChef.Server.App_Start
public static class SscTestedMedia public static class SscTestedMedia
{ {
/// <summary> /// <summary>
/// Takes the tested media from SCSI Streaming devices of a device report and prints it as a list of values /// Takes the tested media from SCSI Streaming devices of a device report and prints it as a list of values
/// </summary> /// </summary>
/// <param name="mediaOneValue">List to put values on</param> /// <param name="mediaOneValue">List to put values on</param>
/// <param name="testedMedia">List of tested media</param> /// <param name="testedMedia">List of tested media</param>
@@ -49,8 +49,7 @@ namespace DiscImageChef.Server.App_Start
if(!string.IsNullOrWhiteSpace(media.MediumTypeName)) if(!string.IsNullOrWhiteSpace(media.MediumTypeName))
{ {
mediaOneValue.Add($"<i>Information for medium named \"{media.MediumTypeName}\"</i>"); mediaOneValue.Add($"<i>Information for medium named \"{media.MediumTypeName}\"</i>");
if(media.MediumTypeSpecified) if(media.MediumTypeSpecified) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
} }
else if(media.MediumTypeSpecified) else if(media.MediumTypeSpecified)
mediaOneValue.Add($"<i>Information for medium type {media.MediumType:X2}h</i>"); mediaOneValue.Add($"<i>Information for medium type {media.MediumType:X2}h</i>");
@@ -58,11 +57,9 @@ namespace DiscImageChef.Server.App_Start
if(!string.IsNullOrWhiteSpace(media.Manufacturer)) if(!string.IsNullOrWhiteSpace(media.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}"); mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}");
if(!string.IsNullOrWhiteSpace(media.Model)) if(!string.IsNullOrWhiteSpace(media.Model)) mediaOneValue.Add($"Medium model: {media.Model}");
mediaOneValue.Add($"Medium model: {media.Model}");
if(media.DensitySpecified) if(media.DensitySpecified) mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
if(media.CanReadMediaSerial) mediaOneValue.Add("Drive can read medium serial number."); if(media.CanReadMediaSerial) mediaOneValue.Add("Drive can read medium serial number.");
if(media.MediaIsRecognized) mediaOneValue.Add("DiscImageChef recognizes this medium."); if(media.MediaIsRecognized) mediaOneValue.Add("DiscImageChef recognizes this medium.");

View File

@@ -38,7 +38,7 @@ namespace DiscImageChef.Server.App_Start
public static class TestedMedia public static class TestedMedia
{ {
/// <summary> /// <summary>
/// Takes the tested media from a device report and prints it as a list of values /// Takes the tested media from a device report and prints it as a list of values
/// </summary> /// </summary>
/// <param name="ata"><c>true</c> if device report is from an ATA device</param> /// <param name="ata"><c>true</c> if device report is from an ATA device</param>
/// <param name="mediaOneValue">List to put values on</param> /// <param name="mediaOneValue">List to put values on</param>
@@ -65,8 +65,7 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"Medium manufactured by: {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}"); mediaOneValue.Add($"Medium model: {testedMedia.Model}");
if(testedMedia.DensitySpecified) if(testedMedia.DensitySpecified) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
if(testedMedia.BlockSizeSpecified) if(testedMedia.BlockSizeSpecified)
mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes"); mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes");
@@ -80,22 +79,29 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each"); 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"); 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) 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"); 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 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"); 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) if(testedMedia.CHS != null && testedMedia.CurrentCHS != null)
{ {
int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads *
testedMedia.CurrentCHS.Sectors; testedMedia.CurrentCHS.Sectors;
mediaOneValue.Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current"); mediaOneValue
.Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current");
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads} max., {testedMedia.CurrentCHS.Heads} 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
mediaOneValue.Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current"); .Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} 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"); 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) else if(testedMedia.CHS != null)
{ {
@@ -104,7 +110,8 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads}"); mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads}");
mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}"); mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}");
mediaOneValue.Add($"Sectors addressable in CHS mode: {currentSectors}"); 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"); 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) if(testedMedia.LBASectorsSpecified)
@@ -112,11 +119,14 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}"); 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"); 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) 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"); 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 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"); 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) if(testedMedia.LBA48SectorsSpecified)
@@ -124,11 +134,14 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}"); 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"); 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) 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"); 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 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"); 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 && if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 &&
@@ -141,7 +154,8 @@ namespace DiscImageChef.Server.App_Start
testedMedia.BlockSize != testedMedia.PhysicalBlockSize && testedMedia.BlockSize != testedMedia.PhysicalBlockSize &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 && (testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000) (testedMedia.LogicalAlignment & 0x4000) == 0x4000)
mediaOneValue.Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector"); mediaOneValue
.Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
if(testedMedia.SupportsRead && ata) if(testedMedia.SupportsRead && ata)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium"); mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium");

View File

@@ -43,7 +43,9 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-111466173-1'); gtag('config', 'UA-111466173-1');

View File

@@ -46,7 +46,7 @@ namespace DiscImageChef.Server.Controllers
public class UploadReportController : ApiController public class UploadReportController : ApiController
{ {
/// <summary> /// <summary>
/// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server /// Receives a report from DiscImageChef.Core, verifies it's in the correct format and stores it on the server
/// </summary> /// </summary>
/// <returns>HTTP response</returns> /// <returns>HTTP response</returns>
[Route("api/uploadreport")] [Route("api/uploadreport")]
@@ -71,11 +71,13 @@ namespace DiscImageChef.Server.Controllers
Random rng = new Random(); Random rng = new Random();
string filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; string filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename))) filename = while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
$"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; "Upload", filename)))
filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
FileStream newFile = FileStream newFile =
new FileStream(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename), new
FileStream(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename),
FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None); FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
xs.Serialize(newFile, newReport); xs.Serialize(newFile, newReport);
newFile.Close(); newFile.Close();

View File

@@ -49,7 +49,7 @@ namespace DiscImageChef.Server.Controllers
public class UploadStatsController : ApiController public class UploadStatsController : ApiController
{ {
/// <summary> /// <summary>
/// Receives statistics from DiscImageChef.Core, processes them and adds them to a server-side global statistics XML /// Receives statistics from DiscImageChef.Core, processes them and adds them to a server-side global statistics XML
/// </summary> /// </summary>
/// <returns>HTTP response</returns> /// <returns>HTTP response</returns>
[Route("api/uploadstats")] [Route("api/uploadstats")]
@@ -119,7 +119,10 @@ namespace DiscImageChef.Server.Controllers
OsStats removeNvs = null; OsStats removeNvs = null;
OsStats addNvs = null; OsStats addNvs = null;
foreach(OsStats oldNvs in oldStats.OperatingSystems.Where(oldNvs => oldNvs.name == newNvs.name && oldNvs.version == newNvs.version)) { foreach(OsStats oldNvs in
oldStats.OperatingSystems.Where(oldNvs => oldNvs.name == newNvs.name &&
oldNvs.version == newNvs.version))
{
addNvs = new OsStats addNvs = new OsStats
{ {
name = oldNvs.name, name = oldNvs.name,
@@ -140,14 +143,14 @@ namespace DiscImageChef.Server.Controllers
else else
{ {
if(oldStats.OperatingSystems == null) if(oldStats.OperatingSystems == null)
oldStats.OperatingSystems = oldStats.OperatingSystems = new List<OsStats> {new OsStats {name = "Linux", Value = 1}};
new List<OsStats> {new OsStats {name = "Linux", Value = 1}};
else else
{ {
OsStats removeNvs = null; OsStats removeNvs = null;
OsStats addNvs = null; OsStats addNvs = null;
foreach(OsStats oldNvs in oldStats.OperatingSystems.Where(oldNvs => oldNvs.name == "Linux")) { foreach(OsStats oldNvs in oldStats.OperatingSystems.Where(oldNvs => oldNvs.name == "Linux"))
{
addNvs = new OsStats addNvs = new OsStats
{ {
name = oldNvs.name, name = oldNvs.name,
@@ -175,12 +178,10 @@ namespace DiscImageChef.Server.Controllers
NameValueStats removeNvs = null; NameValueStats removeNvs = null;
NameValueStats addNvs = null; NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Versions.Where(oldNvs => oldNvs.name == newNvs.name)) { foreach(NameValueStats oldNvs in
addNvs = new NameValueStats oldStats.Versions.Where(oldNvs => oldNvs.name == newNvs.name))
{ {
name = oldNvs.name, addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + newNvs.Value};
Value = oldNvs.Value + newNvs.Value
};
removeNvs = oldNvs; removeNvs = oldNvs;
break; break;
} }
@@ -196,16 +197,14 @@ namespace DiscImageChef.Server.Controllers
{ {
if(oldStats.Versions == null) if(oldStats.Versions == null)
oldStats.Versions = oldStats.Versions =
new List<NameValueStats> new List<NameValueStats> {new NameValueStats {name = "previous", Value = 1}};
{
new NameValueStats {name = "previous", Value = 1}
};
else else
{ {
NameValueStats removeNvs = null; NameValueStats removeNvs = null;
NameValueStats addNvs = null; NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Versions.Where(oldNvs => oldNvs.name == "previous")) { foreach(NameValueStats oldNvs in oldStats.Versions.Where(oldNvs => oldNvs.name == "previous"))
{
addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + 1}; addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + 1};
removeNvs = oldNvs; removeNvs = oldNvs;
break; break;
@@ -228,12 +227,10 @@ namespace DiscImageChef.Server.Controllers
NameValueStats removeNvs = null; NameValueStats removeNvs = null;
NameValueStats addNvs = null; NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Filesystems.Where(oldNvs => oldNvs.name == newNvs.name)) { foreach(NameValueStats oldNvs in
addNvs = new NameValueStats oldStats.Filesystems.Where(oldNvs => oldNvs.name == newNvs.name))
{ {
name = oldNvs.name, addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + newNvs.Value};
Value = oldNvs.Value + newNvs.Value
};
removeNvs = oldNvs; removeNvs = oldNvs;
break; break;
} }
@@ -254,12 +251,10 @@ namespace DiscImageChef.Server.Controllers
NameValueStats removeNvs = null; NameValueStats removeNvs = null;
NameValueStats addNvs = null; NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Partitions.Where(oldNvs => oldNvs.name == newNvs.name)) { foreach(NameValueStats oldNvs in
addNvs = new NameValueStats oldStats.Partitions.Where(oldNvs => oldNvs.name == newNvs.name))
{ {
name = oldNvs.name, addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + newNvs.Value};
Value = oldNvs.Value + newNvs.Value
};
removeNvs = oldNvs; removeNvs = oldNvs;
break; break;
} }
@@ -280,12 +275,10 @@ namespace DiscImageChef.Server.Controllers
NameValueStats removeNvs = null; NameValueStats removeNvs = null;
NameValueStats addNvs = null; NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.MediaImages.Where(oldNvs => oldNvs.name == newNvs.name)) { foreach(NameValueStats oldNvs in
addNvs = new NameValueStats oldStats.MediaImages.Where(oldNvs => oldNvs.name == newNvs.name))
{ {
name = oldNvs.name, addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + newNvs.Value};
Value = oldNvs.Value + newNvs.Value
};
removeNvs = oldNvs; removeNvs = oldNvs;
break; break;
} }
@@ -306,12 +299,10 @@ namespace DiscImageChef.Server.Controllers
NameValueStats removeNvs = null; NameValueStats removeNvs = null;
NameValueStats addNvs = null; NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Filters.Where(oldNvs => oldNvs.name == newNvs.name)) { foreach(NameValueStats oldNvs in
addNvs = new NameValueStats oldStats.Filters.Where(oldNvs => oldNvs.name == newNvs.name))
{ {
name = oldNvs.name, addNvs = new NameValueStats {name = oldNvs.name, Value = oldNvs.Value + newNvs.Value};
Value = oldNvs.Value + newNvs.Value
};
removeNvs = oldNvs; removeNvs = oldNvs;
break; break;
} }
@@ -336,7 +327,7 @@ namespace DiscImageChef.Server.Controllers
oldDev.Revision == newDev.Revision && oldDev.Revision == newDev.Revision &&
oldDev.Bus == newDev.Bus) oldDev.Bus == newDev.Bus)
where !found where !found
select newDev) { oldStats.Devices.Add(newDev); } select newDev) oldStats.Devices.Add(newDev);
if(newStats.Medias != null) if(newStats.Medias != null)
if(oldStats.Medias == null) oldStats.Medias = newStats.Medias; if(oldStats.Medias == null) oldStats.Medias = newStats.Medias;
@@ -346,7 +337,10 @@ namespace DiscImageChef.Server.Controllers
MediaStats removeMstat = null; MediaStats removeMstat = null;
MediaStats addMstat = null; MediaStats addMstat = null;
foreach(MediaStats oldMstat in oldStats.Medias.Where(oldMstat => oldMstat.real == newMstat.real && oldMstat.type == newMstat.type)) { foreach(MediaStats oldMstat in
oldStats.Medias.Where(oldMstat => oldMstat.real == newMstat.real &&
oldMstat.type == newMstat.type))
{
addMstat = new MediaStats addMstat = new MediaStats
{ {
real = oldMstat.real, real = oldMstat.real,
@@ -419,13 +413,11 @@ namespace DiscImageChef.Server.Controllers
Random rng = new Random(); Random rng = new Random();
string filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; string filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Statistics", while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Statistics", filename)))
filename)))
filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml";
FileStream backup = FileStream backup =
new new FileStream(Path.Combine(HostingEnvironment.MapPath("~"), "Statistics", filename),
FileStream(Path.Combine(HostingEnvironment.MapPath("~"), "Statistics", filename),
FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None); FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
fs.Seek(0, SeekOrigin.Begin); fs.Seek(0, SeekOrigin.Begin);
fs.CopyTo(backup); fs.CopyTo(backup);

View File

@@ -43,7 +43,9 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-111466173-1'); gtag('config', 'UA-111466173-1');

View File

@@ -1,5 +1,4 @@
<%@ Page Language="C#" Inherits="DiscImageChef.Server.Default" %> <%@ Page Language="C#" Inherits="DiscImageChef.Server.Default" %>
<%@ Register TagPrefix="velyo" Namespace="Velyo.AspNet.Markdown" Assembly="Velyo.AspNet.Markdown" %>
<%-- <%--
// /*************************************************************************** // /***************************************************************************
// The Disc Image Chef // The Disc Image Chef
@@ -43,14 +42,17 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-111466173-1'); gtag('config', 'UA-111466173-1');
</script> </script>
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">
<h1 align="center">Welcome to <i> <h1 align="center">
Welcome to <i>
<a href="http://github.com/claunia/discimagechef" target="_blank">DiscImageChef</a> <a href="http://github.com/claunia/discimagechef" target="_blank">DiscImageChef</a>
</i> Server version <asp:Label id="lblVersion" runat="server"/> </i> Server version <asp:Label id="lblVersion" runat="server"/>
</h1> </h1>

View File

@@ -40,7 +40,7 @@ using Velyo.AspNet.Markdown;
namespace DiscImageChef.Server namespace DiscImageChef.Server
{ {
/// <summary> /// <summary>
/// Renders the README.md file /// Renders the README.md file
/// </summary> /// </summary>
public partial class Default : Page public partial class Default : Page
{ {
@@ -48,7 +48,8 @@ namespace DiscImageChef.Server
{ {
MarkdownContent mkdown = new MarkdownContent(); MarkdownContent mkdown = new MarkdownContent();
StreamReader sr = StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "docs", "README.md")); new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"docs", "README.md"));
string mdcontent = sr.ReadToEnd(); string mdcontent = sr.ReadToEnd();
sr.Close(); sr.Close();

View File

@@ -26,6 +26,7 @@
<IISExpressWindowsAuthentication /> <IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode /> <IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile /> <UseGlobalApplicationHostFile />
<LangVersion>7.1</LangVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -173,7 +174,7 @@
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp" /> <TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp" />
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" NewLineForMembersInObjectInit="False" NewLineForMembersInAnonymousTypes="False" NewLineForClausesInQuery="False" SpaceAfterControlFlowStatementKeyword="False" scope="text/x-csharp" /> <CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" NewLineForMembersInObjectInit="False" NewLineForMembersInAnonymousTypes="False" NewLineForClausesInQuery="False" SpaceAfterControlFlowStatementKeyword="False" scope="text/x-csharp" />
<ChangeLogPolicy VcsIntegration="Enabled" UpdateMode="ProjectRoot"> <ChangeLogPolicy VcsIntegration="Enabled" UpdateMode="ProjectRoot">
<MessageStyle Header="${Date:yyyy-MM-dd} ${AuthorName} &lt;${AuthorEmail}&gt;&#xA;&#xA;" Indent="&#x9;" FirstFilePrefix="* " FileSeparator=":&#xA;* " LastFilePostfix=": " LineAlign="0" InterMessageLines="1" IncludeDirectoryPaths="False" Wrap="True" /> <MessageStyle Header="${Date:yyyy-MM-dd} ${AuthorName} &lt;${AuthorEmail}&gt;&#xA;&#xA;" Indent=" " FirstFilePrefix="* " FileSeparator=":&#xA;* " LastFilePostfix=": " LineAlign="0" InterMessageLines="1" IncludeDirectoryPaths="False" Wrap="True" />
<inheritsSet /> <inheritsSet />
<inheritsScope /> <inheritsScope />
</ChangeLogPolicy> </ChangeLogPolicy>

View File

@@ -42,14 +42,17 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-111466173-1'); gtag('config', 'UA-111466173-1');
</script> </script>
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">
<h1 align="center">Welcome to <i> <h1 align="center">
Welcome to <i>
<a href="http://github.com/claunia/discimagechef" target="_blank">DiscImageChef</a> <a href="http://github.com/claunia/discimagechef" target="_blank">DiscImageChef</a>
</i> Server version <asp:Label id="lblVersion" runat="server"/> </i> Server version <asp:Label id="lblVersion" runat="server"/>
</h1> </h1>
@@ -60,7 +63,8 @@
<asp:Repeater id="repOperatingSystems" runat="server"> <asp:Repeater id="repOperatingSystems" runat="server">
<ItemTemplate> <ItemTemplate>
<tr> <tr>
<td>DiscImageChef has run on <i> <td>
DiscImageChef has run on <i>
<asp:Label runat="server" Text='<%# Eval("name") %>'/> <asp:Label runat="server" Text='<%# Eval("name") %>'/>
</i> <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times. </i> <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times.
</td> </td>
@@ -75,7 +79,8 @@
<asp:Repeater id="repVersions" runat="server"> <asp:Repeater id="repVersions" runat="server">
<ItemTemplate> <ItemTemplate>
<tr> <tr>
<td>DiscImageChef version <i> <td>
DiscImageChef version <i>
<asp:Label runat="server" Text='<%# Eval("name") %>'/> <asp:Label runat="server" Text='<%# Eval("name") %>'/>
</i> has been used <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times. </i> has been used <asp:Label runat="server" Text='<%# Eval("Value") %>'/> times.
</td> </td>

View File

@@ -47,32 +47,17 @@ using PlatformID = DiscImageChef.Interop.PlatformID;
namespace DiscImageChef.Server namespace DiscImageChef.Server
{ {
/// <summary> /// <summary>
/// Renders a page with statistics, list of media type, devices, etc /// Renders a page with statistics, list of media type, devices, etc
/// </summary> /// </summary>
public partial class Statistics : Page public partial class Statistics : Page
{ {
class MediaItem List<DeviceItem> devices;
{ List<NameValueStats> operatingSystems;
public string Type { get; set; } List<MediaItem> realMedia;
public string SubType { get; set; }
public long Count { get; set; }
}
class DeviceItem
{
public string Manufacturer { get; set; }
public string Model { get; set; }
public string Revision { get; set; }
public string Bus { get; set; }
public string ReportLink { get; set; }
}
Stats statistics; Stats statistics;
List<MediaItem> realMedia;
List<MediaItem> virtualMedia;
List<NameValueStats> operatingSystems;
List<DeviceItem> devices;
List<NameValueStats> versions; List<NameValueStats> versions;
List<MediaItem> virtualMedia;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
@@ -80,8 +65,8 @@ namespace DiscImageChef.Server
try try
{ {
if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Statistics.xml"))) "Statistics", "Statistics.xml")))
{ {
#if DEBUG #if DEBUG
content.InnerHtml = content.InnerHtml =
@@ -253,8 +238,7 @@ namespace DiscImageChef.Server
xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_'); xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Reports", if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Reports", xmlFile))) url = null;
xmlFile))) url = null;
devices.Add(new DeviceItem devices.Add(new DeviceItem
{ {
@@ -262,8 +246,7 @@ namespace DiscImageChef.Server
Model = device.Model, Model = device.Model,
Revision = device.Revision, Revision = device.Revision,
Bus = device.Bus, Bus = device.Bus,
ReportLink = ReportLink = url == null ? "No" : $"<a href=\"{url}\" target=\"_blank\">Yes</a>"
url == null ? "No" : $"<a href=\"{url}\" target=\"_blank\">Yes</a>"
}); });
} }
@@ -302,5 +285,21 @@ namespace DiscImageChef.Server
return null; return null;
} }
class MediaItem
{
public string Type { get; set; }
public string SubType { get; set; }
public long Count { get; set; }
}
class DeviceItem
{
public string Manufacturer { get; set; }
public string Model { get; set; }
public string Revision { get; set; }
public string Bus { get; set; }
public string ReportLink { get; set; }
}
} }
} }

View File

@@ -43,7 +43,9 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-111466173-1'); gtag('config', 'UA-111466173-1');

View File

@@ -42,7 +42,9 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-111466173-1"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date()); gtag('js', new Date());
gtag('config', 'UA-111466173-1'); gtag('config', 'UA-111466173-1');

View File

@@ -47,7 +47,7 @@ using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
namespace DiscImageChef.Server namespace DiscImageChef.Server
{ {
/// <summary> /// <summary>
/// Renders the specified report from the server /// Renders the specified report from the server
/// </summary> /// </summary>
public partial class ViewReport : Page public partial class ViewReport : Page
{ {
@@ -85,7 +85,8 @@ namespace DiscImageChef.Server
else if(!string.IsNullOrWhiteSpace(model)) xmlFile = model + ".xml"; else if(!string.IsNullOrWhiteSpace(model)) xmlFile = model + ".xml";
if(xmlFile == null || if(xmlFile == null ||
!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Reports", xmlFile))) !File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Reports", xmlFile)))
{ {
content.InnerHtml = "<b>Could not find the specified report</b>"; content.InnerHtml = "<b>Could not find the specified report</b>";
return; return;
@@ -98,8 +99,9 @@ namespace DiscImageChef.Server
DeviceReport report = new DeviceReport(); DeviceReport report = new DeviceReport();
XmlSerializer xs = new XmlSerializer(report.GetType()); XmlSerializer xs = new XmlSerializer(report.GetType());
StreamReader sr = StreamReader sr =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Reports", new
xmlFile)); StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Reports", xmlFile));
report = (DeviceReport)xs.Deserialize(sr); report = (DeviceReport)xs.Deserialize(sr);
sr.Close(); sr.Close();
@@ -148,8 +150,7 @@ namespace DiscImageChef.Server
case TupleCodes.CISTPL_VERS_1: break; case TupleCodes.CISTPL_VERS_1: break;
case TupleCodes.CISTPL_DEVICEGEO: case TupleCodes.CISTPL_DEVICEGEO:
case TupleCodes.CISTPL_DEVICEGEO_A: case TupleCodes.CISTPL_DEVICEGEO_A:
DeviceGeometryTuple geom = DeviceGeometryTuple geom = CIS.DecodeDeviceGeometryTuple(tuple.Data);
CIS.DecodeDeviceGeometryTuple(tuple.Data);
if(geom?.Geometries != null) if(geom?.Geometries != null)
foreach(DeviceGeometry geometry in geom.Geometries) foreach(DeviceGeometry geometry in geom.Geometries)
{ {
@@ -260,8 +261,11 @@ namespace DiscImageChef.Server
Dictionary<string, string> modePages = new Dictionary<string, string>(); Dictionary<string, string> modePages = new Dictionary<string, string>();
Dictionary<string, string> evpdPages = new Dictionary<string, string>(); Dictionary<string, string> evpdPages = new Dictionary<string, string>();
lblScsiVendor.Text = VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) != lblScsiVendor.Text =
report.SCSI.Inquiry.VendorIdentification ? $"{report.SCSI.Inquiry.VendorIdentification} ({VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)})" : report.SCSI.Inquiry.VendorIdentification; VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) !=
report.SCSI.Inquiry.VendorIdentification
? $"{report.SCSI.Inquiry.VendorIdentification} ({VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)})"
: report.SCSI.Inquiry.VendorIdentification;
lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification; lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification;
lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel; lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel;
@@ -328,11 +332,17 @@ namespace DiscImageChef.Server
{ {
divScsiSsc.Visible = true; divScsiSsc.Visible = true;
lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularitySpecified ? report.SCSI.SequentialDevice.BlockSizeGranularity.ToString() : "Unspecified"; lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularitySpecified
? report.SCSI.SequentialDevice.BlockSizeGranularity.ToString()
: "Unspecified";
lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLengthSpecified ? report.SCSI.SequentialDevice.MaxBlockLength.ToString() : "Unspecified"; lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLengthSpecified
? report.SCSI.SequentialDevice.MaxBlockLength.ToString()
: "Unspecified";
lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLengthSpecified ? report.SCSI.SequentialDevice.MinBlockLength.ToString() : "Unspecified"; lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLengthSpecified
? report.SCSI.SequentialDevice.MinBlockLength.ToString()
: "Unspecified";
if(report.SCSI.SequentialDevice.SupportedDensities != null) if(report.SCSI.SequentialDevice.SupportedDensities != null)
{ {
@@ -370,17 +380,20 @@ namespace DiscImageChef.Server
if(report.SCSI.ReadCapabilities.BlocksSpecified && if(report.SCSI.ReadCapabilities.BlocksSpecified &&
report.SCSI.ReadCapabilities.BlockSizeSpecified) report.SCSI.ReadCapabilities.BlockSizeSpecified)
{ {
scsiOneValue.Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each"); 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 / if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 /
1024 > 1000000) 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"); scsiOneValue
else if( .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");
report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 / else if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize /
1024 > 1000) 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"); 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 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"); 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) if(report.SCSI.ReadCapabilities.MediumTypeSpecified)
@@ -518,10 +531,12 @@ namespace DiscImageChef.Server
vendorDescription = null; vendorDescription = null;
productDescription = null; productDescription = null;
if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "usb.ids"))) return; if(!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"usb.ids"))) return;
StreamReader tocStream = StreamReader tocStream =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "usb.ids")); new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"usb.ids"));
bool inManufacturer = false; bool inManufacturer = false;
while(tocStream.Peek() >= 0) while(tocStream.Peek() >= 0)