View reports from server database.

This commit is contained in:
2018-12-24 04:14:04 +00:00
parent 91f48b54a8
commit b38c0d48fc
11 changed files with 975 additions and 1130 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -34,7 +34,7 @@ using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server.App_Start
namespace DiscImageChef.Server
{
public static class ScsiEvpd
{
@@ -45,9 +45,9 @@ namespace DiscImageChef.Server.App_Start
/// <param name="pages">EVPD pages</param>
/// <param name="vendor">SCSI vendor string</param>
/// <param name="evpdPages">List to put the key=value pairs on</param>
public static void Report(pageType[] pages, string vendor, ref Dictionary<string, string> evpdPages)
public static void Report(IEnumerable<ScsiPage> pages, string vendor, ref Dictionary<string, string> evpdPages)
{
foreach(pageType evpd in pages)
foreach(ScsiPage evpd in pages)
{
string decoded;
if(evpd.page >= 0x01 && evpd.page <= 0x7F) decoded = EVPD.DecodeASCIIPage(evpd.value);

View File

@@ -31,10 +31,9 @@
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server.App_Start
namespace DiscImageChef.Server
{
static class ScsiInquiry
{
@@ -42,13 +41,17 @@ namespace DiscImageChef.Server.App_Start
/// 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>
/// <param name="inquiry">INQUIRY part of the report</param>
/// <param name="inquiryNullable">INQUIRY part of the report</param>
/// <returns>List of values</returns>
internal static List<string> Report(scsiInquiryType inquiry)
internal static IEnumerable<string> Report(Inquiry.SCSIInquiry? inquiryNullable)
{
List<string> scsiOneValue = new List<string>();
switch(inquiry.PeripheralQualifier)
if(!inquiryNullable.HasValue) return scsiOneValue;
Inquiry.SCSIInquiry inquiry = inquiryNullable.Value;
switch((PeripheralQualifiers)inquiry.PeripheralQualifier)
{
case PeripheralQualifiers.Supported:
scsiOneValue.Add("Device is connected and supported.");
@@ -67,7 +70,7 @@ namespace DiscImageChef.Server.App_Start
break;
}
switch(inquiry.PeripheralDeviceType)
switch((PeripheralDeviceTypes)inquiry.PeripheralDeviceType)
{
case PeripheralDeviceTypes.DirectAccess: //0x00,
scsiOneValue.Add("Direct-access device");
@@ -200,35 +203,34 @@ namespace DiscImageChef.Server.App_Start
break;
}
if(inquiry.Removable) scsiOneValue.Add("Device is removable");
if(inquiry.AERCSupported) scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability");
if(inquiry.TerminateTaskSupported) scsiOneValue.Add("Device supports TERMINATE TASK command");
if(inquiry.NormalACA) scsiOneValue.Add("Device supports setting Normal ACA");
if(inquiry.HierarchicalLUN) scsiOneValue.Add("Device supports LUN hierarchical addressing");
if(inquiry.StorageArrayController) scsiOneValue.Add("Device contains an embedded storage array controller");
if(inquiry.AccessControlCoordinator) scsiOneValue.Add("Device contains an Access Control Coordinator");
if(inquiry.ThirdPartyCopy) scsiOneValue.Add("Device supports third-party copy commands");
if(inquiry.Protection) scsiOneValue.Add("Device supports protection information");
if(inquiry.BasicQueueing) scsiOneValue.Add("Device supports basic queueing");
if(inquiry.EnclosureServices) scsiOneValue.Add("Device contains an embedded enclosure services component");
if(inquiry.MultiPortDevice) scsiOneValue.Add("Multi-port device");
if(inquiry.MediumChanger) scsiOneValue.Add("Device contains or is attached to a medium changer");
if(inquiry.ACKRequests) scsiOneValue.Add("Device supports request and acknowledge handshakes");
if(inquiry.Address32) scsiOneValue.Add("Device supports 32-bit wide SCSI addresses");
if(inquiry.Address16) scsiOneValue.Add("Device supports 16-bit wide SCSI addresses");
if(inquiry.RelativeAddressing) scsiOneValue.Add("Device supports relative addressing");
if(inquiry.WideBus32) scsiOneValue.Add("Device supports 32-bit wide data transfers");
if(inquiry.WideBus16) scsiOneValue.Add("Device supports 16-bit wide data transfers");
if(inquiry.SyncTransfer) scsiOneValue.Add("Device supports synchronous data transfer");
if(inquiry.LinkedCommands) scsiOneValue.Add("Device supports linked commands");
if(inquiry.TranferDisable)
scsiOneValue.Add("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands");
if(inquiry.RMB) scsiOneValue.Add("Device is removable");
if(inquiry.AERC) scsiOneValue.Add("Device supports Asynchronous Event Reporting Capability");
if(inquiry.TrmTsk) scsiOneValue.Add("Device supports TERMINATE TASK command");
if(inquiry.NormACA) scsiOneValue.Add("Device supports setting Normal ACA");
if(inquiry.HiSup) scsiOneValue.Add("Device supports LUN hierarchical addressing");
if(inquiry.SCCS) scsiOneValue.Add("Device contains an embedded storage array controller");
if(inquiry.ACC) scsiOneValue.Add("Device contains an Access Control Coordinator");
if(inquiry.ThreePC) scsiOneValue.Add("Device supports third-party copy commands");
if(inquiry.Protect) scsiOneValue.Add("Device supports protection information");
if(inquiry.BQue) scsiOneValue.Add("Device supports basic queueing");
if(inquiry.EncServ) scsiOneValue.Add("Device contains an embedded enclosure services component");
if(inquiry.MultiP) scsiOneValue.Add("Multi-port device");
if(inquiry.MChngr) scsiOneValue.Add("Device contains or is attached to a medium changer");
if(inquiry.ACKREQQ) scsiOneValue.Add("Device supports request and acknowledge handshakes");
if(inquiry.Addr32) scsiOneValue.Add("Device supports 32-bit wide SCSI addresses");
if(inquiry.Addr16) scsiOneValue.Add("Device supports 16-bit wide SCSI addresses");
if(inquiry.RelAddr) scsiOneValue.Add("Device supports relative addressing");
if(inquiry.WBus32) scsiOneValue.Add("Device supports 32-bit wide data transfers");
if(inquiry.WBus16) scsiOneValue.Add("Device supports 16-bit wide data transfers");
if(inquiry.Sync) scsiOneValue.Add("Device supports synchronous data transfer");
if(inquiry.Linked) scsiOneValue.Add("Device supports linked commands");
if(inquiry.TranDis) scsiOneValue.Add("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands");
if(inquiry.QAS) scsiOneValue.Add("Device supports Quick Arbitration and Selection");
if(inquiry.TaggedCommandQueue) scsiOneValue.Add("Device supports TCQ queue");
if(inquiry.CmdQue) scsiOneValue.Add("Device supports TCQ queue");
if(inquiry.IUS) scsiOneValue.Add("Device supports information unit transfers");
if(inquiry.SoftReset) scsiOneValue.Add("Device implements RESET as a soft reset");
if(inquiry.SftRe) scsiOneValue.Add("Device implements RESET as a soft reset");
switch(inquiry.AsymmetricalLUNAccess)
switch((TGPSValues)inquiry.TPGS)
{
case TGPSValues.NotSupported:
scsiOneValue.Add("Device does not support assymetrical access");
@@ -243,11 +245,11 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device supports implicit and explicit assymetrical access");
break;
default:
scsiOneValue.Add($"Unknown value in TPGS field 0x{inquiry.AsymmetricalLUNAccess:X2}");
scsiOneValue.Add($"Unknown value in TPGS field 0x{inquiry.TPGS:X2}");
break;
}
switch(inquiry.SPIClocking)
switch((SPIClocking)inquiry.Clocking)
{
case SPIClocking.ST:
scsiOneValue.Add("Device supports only ST clocking");
@@ -262,7 +264,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device supports ST and DT clocking");
break;
default:
scsiOneValue.Add($"Unknown value in SPI clocking field 0x{inquiry.SPIClocking:X2}");
scsiOneValue.Add($"Unknown value in SPI clocking field 0x{inquiry.Clocking:X2}");
break;
}

View File

@@ -34,7 +34,7 @@ using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI.MMC;
namespace DiscImageChef.Server.App_Start
namespace DiscImageChef.Server
{
public static class ScsiMmcFeatures
{
@@ -44,16 +44,16 @@ namespace DiscImageChef.Server.App_Start
/// </summary>
/// <param name="ftr">FEATURES part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param>
public static void Report(mmcFeaturesType ftr, ref List<string> mmcOneValue)
public static void Report(MmcFeatures ftr, ref List<string> mmcOneValue)
{
if(ftr.SupportsAACS && ftr.AACSVersionSpecified)
if(ftr.SupportsAACS && ftr.AACSVersion.HasValue)
mmcOneValue.Add($"Drive supports AACS version {ftr.AACSVersion}");
else if(ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS");
if(ftr.AGIDsSpecified) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
if(ftr.AGIDs.HasValue) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently");
if(ftr.CanGenerateBindingNonce)
{
mmcOneValue.Add("Drive supports generating the binding nonce");
if(ftr.BindingNonceBlocksSpecified)
if(ftr.BindingNonceBlocks.HasValue)
mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce");
}
@@ -131,6 +131,7 @@ namespace DiscImageChef.Server.App_Start
if(ftr.MultiRead)
mmcOneValue.Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
if(ftr.PhysicalInterfaceStandard.HasValue)
switch(ftr.PhysicalInterfaceStandard)
{
case PhysicalInterfaces.Unspecified:
@@ -164,7 +165,8 @@ namespace DiscImageChef.Server.App_Start
mmcOneValue.Add("Drive uses a vendor unique interface");
break;
default:
mmcOneValue.Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}");
mmcOneValue
.Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}");
break;
}
@@ -229,19 +231,20 @@ namespace DiscImageChef.Server.App_Start
mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots");
}
if(ftr.SupportsCSS && ftr.CSSVersionSpecified)
if(ftr.SupportsCSS && ftr.CSSVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CSS/CPPM version {ftr.CSSVersion}");
else if(ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM");
if(ftr.SupportsCPRM && ftr.CPRMVersionSpecified)
if(ftr.SupportsCPRM && ftr.CPRMVersion.HasValue)
mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}");
else if(ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM");
if(ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading");
if(ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications");
if(ftr.FirmwareDateSpecified) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
if(ftr.FirmwareDate.HasValue) mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}");
if(ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers");
if(ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands");
if(ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events");
if(ftr.LoadingMechanismType.HasValue)
switch(ftr.LoadingMechanismType)
{
case 0:
@@ -274,7 +277,7 @@ namespace DiscImageChef.Server.App_Start
if(ftr.SupportsSecurDisc) mmcOneValue.Add("Drive supports SecurDisc");
if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel");
if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS");
if(ftr.VolumeLevelsSpecified) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
if(ftr.VolumeLevels.HasValue) mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels");
if(ftr.SupportsWriteProtectPAC)
mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media");
if(ftr.SupportsWriteInhibitDCB)

View File

@@ -32,10 +32,9 @@
using System.Collections.Generic;
using System.Linq;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server.App_Start
namespace DiscImageChef.Server
{
public static class ScsiMmcMode
{
@@ -45,23 +44,22 @@ namespace DiscImageChef.Server.App_Start
/// </summary>
/// <param name="mode">MODE PAGE 2Ah part of the report</param>
/// <param name="mmcOneValue">List to put the values on</param>
public static void Report(mmcModeType mode, ref List<string> mmcOneValue)
public static void Report(Modes.ModePage_2A mode, ref List<string> mmcOneValue)
{
if(mode.PlaysAudio) mmcOneValue.Add("Drive can play audio");
if(mode.ReadsMode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
if(mode.ReadsMode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
if(mode.SupportsMultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
if(mode.AudioPlay) mmcOneValue.Add("Drive can play audio");
if(mode.Mode2Form1) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 1 format");
if(mode.Mode2Form2) mmcOneValue.Add("Drive can read sectors in Mode 2 Form 2 format");
if(mode.MultiSession) mmcOneValue.Add("Drive supports multi-session discs and/or Photo-CD");
if(mode.CDDACommand) mmcOneValue.Add("Drive can read digital audio");
if(mode.AccurateCDDA) mmcOneValue.Add("Drive can continue from streaming loss");
if(mode.ReadsSubchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
if(mode.ReadsDeinterlavedSubchannel)
mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
if(mode.ReturnsC2Pointers) mmcOneValue.Add("Drive supports C2 pointers");
if(mode.ReadsUPC) mmcOneValue.Add("Drive can read Media Catalogue Number");
if(mode.ReadsISRC) mmcOneValue.Add("Drive can read ISRC");
if(mode.Subchannel) mmcOneValue.Add("Drive can read uncorrected and interleaved R-W subchannels");
if(mode.DeinterlaveSubchannel) mmcOneValue.Add("Drive can read, deinterleave and correct R-W subchannels");
if(mode.C2Pointer) mmcOneValue.Add("Drive supports C2 pointers");
if(mode.UPC) mmcOneValue.Add("Drive can read Media Catalogue Number");
if(mode.ISRC) mmcOneValue.Add("Drive can read ISRC");
switch(mode.LoadingMechanismType)
switch(mode.LoadingMechanism)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
@@ -79,24 +77,24 @@ namespace DiscImageChef.Server.App_Start
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanismType}");
mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanism}");
break;
}
if(mode.CanLockMedia) mmcOneValue.Add("Drive can lock media");
if(mode.PreventJumperStatus)
if(mode.Lock) mmcOneValue.Add("Drive can lock media");
if(mode.PreventJumper)
{
mmcOneValue.Add("Drive power ups locked");
mmcOneValue.Add(mode.LockStatus
mmcOneValue.Add(mode.LockState
? "Drive is locked, media cannot be ejected or inserted"
: "Drive is not locked, media can be ejected and inserted");
}
else
mmcOneValue.Add(mode.LockStatus
mmcOneValue.Add(mode.LockState
? "Drive is locked, media cannot be ejected, but if empty, can be inserted"
: "Drive is not locked, media can be ejected and inserted");
if(mode.CanEject) mmcOneValue.Add("Drive can eject media");
if(mode.Eject) mmcOneValue.Add("Drive can eject media");
if(mode.SeparateChannelMute) mmcOneValue.Add("Each channel can be muted independently");
if(mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently");
@@ -109,28 +107,27 @@ namespace DiscImageChef.Server.App_Start
if(mode.CurrentSpeed > 0)
mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec.");
if(mode.ReadsCDR)
if(mode.ReadCDR)
{
mmcOneValue.Add(mode.WritesCDR ? "Drive can read and write CD-R" : "Drive can read CD-R");
mmcOneValue.Add(mode.WriteCDR ? "Drive can read and write CD-R" : "Drive can read CD-R");
if(mode.ReadsPacketCDR) mmcOneValue.Add("Drive supports reading CD-R packet media");
if(mode.Method2) mmcOneValue.Add("Drive supports reading CD-R packet media");
}
if(mode.ReadsCDRW)
mmcOneValue.Add(mode.WritesCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW");
if(mode.ReadCDRW)
mmcOneValue.Add(mode.WriteCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW");
if(mode.ReadsDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
if(mode.ReadsDVDR)
mmcOneValue.Add(mode.WritesDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R");
if(mode.ReadsDVDRAM)
mmcOneValue.Add(mode.WritesDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM");
if(mode.ReadDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
if(mode.ReadDVDR)
mmcOneValue.Add(mode.WriteDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R");
if(mode.ReadDVDRAM)
mmcOneValue.Add(mode.WriteDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM");
if(mode.CompositeAudioVideo) mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
if(mode.Composite) mmcOneValue.Add("Drive can deliver a composite audio and video data stream");
if(mode.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
if(mode.DigitalPort2) mmcOneValue.Add("Drive supports IEC-958 digital output on port 2");
if(mode.DeterministicSlotChanger)
mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
if(mode.SDP) mmcOneValue.Add("Drive contains a changer that can report the exact contents of the slots");
if(mode.CurrentWriteSpeedSelected > 0)
{
if(mode.RotationControlSelected == 0)
@@ -142,8 +139,8 @@ namespace DiscImageChef.Server.App_Start
}
else
{
if(mode.MaximumWriteSpeed > 0)
mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaximumWriteSpeed} Kbyte/sec.");
if(mode.MaxWriteSpeed > 0)
mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaxWriteSpeed} Kbyte/sec.");
if(mode.CurrentWriteSpeed > 0)
mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec.");
}
@@ -159,14 +156,14 @@ namespace DiscImageChef.Server.App_Start
if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing");
if(mode.ReadsBarcode) mmcOneValue.Add("Drive can read barcode");
if(mode.ReadBarcode) mmcOneValue.Add("Drive can read barcode");
if(mode.ReadsBothSides) mmcOneValue.Add("Drive can read both sides of a disc");
if(mode.SCC) mmcOneValue.Add("Drive can read both sides of a disc");
if(mode.LeadInPW) mmcOneValue.Add("Drive an read raw R-W subchannel from the Lead-In");
if(mode.CSSandCPPMSupported) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
if(mode.CMRSupported == 1) mmcOneValue.Add("Drive supports DVD CSS and/or DVD CPPM");
if(mode.BufferUnderRunProtection) mmcOneValue.Add("Drive supports buffer under-run free recording");
if(mode.BUF) mmcOneValue.Add("Drive supports buffer under-run free recording");
mmcOneValue.Sort();
mmcOneValue.Add("");

View File

@@ -34,7 +34,7 @@ using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server.App_Start
namespace DiscImageChef.Server
{
public static class ScsiModeSense
{
@@ -47,15 +47,15 @@ namespace DiscImageChef.Server.App_Start
/// <param name="deviceType">SCSI peripheral device type</param>
/// <param name="scsiOneValue">List to put values on</param>
/// <param name="modePages">List to put key=value pairs on</param>
public static void Report(modeType modeSense, string vendor,
public static void Report(ScsiMode modeSense, string vendor,
PeripheralDeviceTypes deviceType,
ref List<string> scsiOneValue, ref Dictionary<string, string> modePages)
{
if(modeSense.MediumTypeSpecified) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
if(modeSense.MediumType.HasValue) scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h");
if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
if(modeSense.BlockDescriptors != null)
foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors)
if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified)
foreach(BlockDescriptor descriptor in modeSense.BlockDescriptors)
if(descriptor.Blocks.HasValue && descriptor.BlockLength.HasValue)
scsiOneValue
.Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each");
else
@@ -63,7 +63,7 @@ namespace DiscImageChef.Server.App_Start
if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits");
if(modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled");
if(modeSense.BufferedModeSpecified)
if(modeSense.BufferedMode.HasValue)
switch(modeSense.BufferedMode)
{
case 0:
@@ -82,7 +82,7 @@ namespace DiscImageChef.Server.App_Start
if(modeSense.ModePages == null) return;
foreach(modePageType page in modeSense.ModePages)
foreach(ScsiPage page in modeSense.ModePages)
switch(page.page)
{
case 0x00:
@@ -170,7 +170,8 @@ namespace DiscImageChef.Server.App_Start
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A(page.value));
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A_S01(page.value));
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_0A_S01(page.value));
else goto default;
break;
@@ -241,7 +242,8 @@ namespace DiscImageChef.Server.App_Start
if(page.subpage == 0)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A(page.value));
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A_S01(page.value));
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_1A_S01(page.value));
else goto default;
break;
@@ -262,7 +264,8 @@ namespace DiscImageChef.Server.App_Start
? Modes.PrettifyModePage_1C_SFF(page.value)
: Modes.PrettifyModePage_1C(page.value));
else if(page.subpage == 1)
modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1C_S01(page.value));
modePages.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
Modes.PrettifyModePage_1C_S01(page.value));
else goto default;
break;
@@ -369,10 +372,8 @@ namespace DiscImageChef.Server.App_Start
Dictionary<string, string> newModePages = new Dictionary<string, string>();
foreach(KeyValuePair<string, string> kvp in modePages)
if(string.IsNullOrWhiteSpace(kvp.Value))
newModePages.Add(kvp.Key, "Undecoded");
else
newModePages.Add(kvp.Key, kvp.Value.Replace("\n", "<br/>"));
newModePages.Add(kvp.Key,
string.IsNullOrWhiteSpace(kvp.Value) ? "Undecoded" : kvp.Value.Replace("\n", "<br/>"));
modePages = newModePages;
}

View File

@@ -33,7 +33,7 @@
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
namespace DiscImageChef.Server.App_Start
namespace DiscImageChef.Server
{
public static class SscTestedMedia
{
@@ -42,16 +42,16 @@ namespace DiscImageChef.Server.App_Start
/// </summary>
/// <param name="mediaOneValue">List to put values on</param>
/// <param name="testedMedia">List of tested media</param>
public static void Report(IEnumerable<SequentialMedia> testedMedia, ref List<string> mediaOneValue)
public static void Report(IEnumerable<TestedSequentialMedia> testedMedia, ref List<string> mediaOneValue)
{
foreach(SequentialMedia media in testedMedia)
foreach(TestedSequentialMedia media in testedMedia)
{
if(!string.IsNullOrWhiteSpace(media.MediumTypeName))
{
mediaOneValue.Add($"<i>Information for medium named \"{media.MediumTypeName}\"</i>");
if(media.MediumTypeSpecified) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
if(media.MediumType.HasValue) mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h");
}
else if(media.MediumTypeSpecified)
else if(media.MediumType.HasValue)
mediaOneValue.Add($"<i>Information for medium type {media.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>");
@@ -59,9 +59,9 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}");
if(!string.IsNullOrWhiteSpace(media.Model)) mediaOneValue.Add($"Medium model: {media.Model}");
if(media.DensitySpecified) mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
if(media.CanReadMediaSerial) mediaOneValue.Add("Drive can read medium serial number.");
if(media.MediaIsRecognized) mediaOneValue.Add("DiscImageChef recognizes this medium.");
if(media.Density.HasValue) mediaOneValue.Add($"Medium has density code {media.Density:X2}h");
if(media.CanReadMediaSerial == true) mediaOneValue.Add("Drive can read medium serial number.");
if(media.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium.");
mediaOneValue.Add("");
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Metadata;
namespace DiscImageChef.Server.App_Start
{
@@ -43,17 +42,17 @@ namespace DiscImageChef.Server.App_Start
/// <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="testedMedias">List of tested media</param>
public static void Report(IEnumerable<testedMediaType> testedMedias, bool ata, ref List<string> mediaOneValue)
public static void Report(List<CommonTypes.Metadata.TestedMedia> testedMedias, ref List<string> mediaOneValue)
{
foreach(testedMediaType testedMedia in testedMedias)
foreach(CommonTypes.Metadata.TestedMedia testedMedia in testedMedias)
{
if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
{
mediaOneValue.Add($"<i>Information for medium named \"{testedMedia.MediumTypeName}\"</i>");
if(testedMedia.MediumTypeSpecified)
if(testedMedia.MediumType != null)
mediaOneValue.Add($"Medium type code: {testedMedia.MediumType:X2}h");
}
else if(testedMedia.MediumTypeSpecified)
else if(testedMedia.MediumType != null)
mediaOneValue.Add($"<i>Information for medium type {testedMedia.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>");
@@ -65,16 +64,16 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}");
if(!string.IsNullOrWhiteSpace(testedMedia.Model))
mediaOneValue.Add($"Medium model: {testedMedia.Model}");
if(testedMedia.DensitySpecified) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
if(testedMedia.Density != null) mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h");
if(testedMedia.BlockSizeSpecified)
if(testedMedia.BlockSize != null)
mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes");
if(testedMedia.PhysicalBlockSizeSpecified)
if(testedMedia.PhysicalBlockSize != null)
mediaOneValue.Add($"Physical sector size: {testedMedia.PhysicalBlockSize} bytes");
if(testedMedia.LongBlockSizeSpecified)
if(testedMedia.LongBlockSize != null)
mediaOneValue.Add($"READ LONG sector size: {testedMedia.LongBlockSize} bytes");
if(testedMedia.BlocksSpecified && testedMedia.BlockSizeSpecified)
if(testedMedia.Blocks != null && testedMedia.BlockSize != null)
{
mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each");
@@ -114,7 +113,7 @@ namespace DiscImageChef.Server.App_Start
.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.LBASectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}");
@@ -129,7 +128,7 @@ namespace DiscImageChef.Server.App_Start
.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.LBA48Sectors != null)
{
mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}");
@@ -144,155 +143,161 @@ namespace DiscImageChef.Server.App_Start
.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.NominalRotationRate != null && testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF)
mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001
? "Medium does not rotate."
: $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
if(testedMedia.BlockSizeSpecified &&
testedMedia.PhysicalBlockSizeSpecified &&
testedMedia.BlockSize != testedMedia.PhysicalBlockSize &&
if(testedMedia.BlockSize != null &&
testedMedia.PhysicalBlockSize != null &&
testedMedia.BlockSize.Value != testedMedia.PhysicalBlockSize.Value &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000)
mediaOneValue
.Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector");
if(testedMedia.SupportsRead && ata)
if(testedMedia.SupportsReadSectors == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium");
if(testedMedia.SupportsReadRetry)
if(testedMedia.SupportsReadRetry == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadDma)
if(testedMedia.SupportsReadDma == true)
mediaOneValue.Add("Device can use the READ DMA command in CHS mode with this medium");
if(testedMedia.SupportsReadDmaRetry)
if(testedMedia.SupportsReadDmaRetry == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadLong && ata)
if(testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG command in CHS mode with this medium");
if(testedMedia.SupportsReadLongRetry)
if(testedMedia.SupportsReadLongRetry == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadLba)
if(testedMedia.SupportsReadLba == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadRetryLba)
if(testedMedia.SupportsReadRetryLba == true)
mediaOneValue
.Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaLba)
if(testedMedia.SupportsReadDmaLba == true)
mediaOneValue.Add("Device can use the READ DMA command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaRetryLba)
if(testedMedia.SupportsReadDmaRetryLba == true)
mediaOneValue.Add("Device can use the READ DMA RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLongLba)
if(testedMedia.SupportsReadLongLba == true)
mediaOneValue.Add("Device can use the READ LONG command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLongRetryLba)
if(testedMedia.SupportsReadLongRetryLba == true)
mediaOneValue.Add("Device can use the READ LONG RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLba48)
if(testedMedia.SupportsReadLba48 == true)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 48-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaLba48)
if(testedMedia.SupportsReadDmaLba48 == true)
mediaOneValue.Add("Device can use the READ DMA command in 48-bit LBA mode with this medium");
if(testedMedia.SupportsSeek)
if(testedMedia.SupportsSeek == true)
mediaOneValue.Add("Device can use the SEEK command in CHS mode with this medium");
if(testedMedia.SupportsSeekLba)
if(testedMedia.SupportsSeekLba == true)
mediaOneValue.Add("Device can use the SEEK command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadCapacity)
if(testedMedia.SupportsReadCapacity == true)
mediaOneValue.Add("Device can use the READ CAPACITY (10) command with this medium");
if(testedMedia.SupportsReadCapacity16)
if(testedMedia.SupportsReadCapacity16 == true)
mediaOneValue.Add("Device can use the READ CAPACITY (16) command with this medium");
if(testedMedia.SupportsRead && !ata)
if(testedMedia.SupportsRead6 == true)
mediaOneValue.Add("Device can use the READ (6) command with this medium");
if(testedMedia.SupportsRead10)
if(testedMedia.SupportsRead10 == true)
mediaOneValue.Add("Device can use the READ (10) command with this medium");
if(testedMedia.SupportsRead12)
if(testedMedia.SupportsRead12 == true)
mediaOneValue.Add("Device can use the READ (12) command with this medium");
if(testedMedia.SupportsRead16)
if(testedMedia.SupportsRead16 == true)
mediaOneValue.Add("Device can use the READ (16) command with this medium");
if(testedMedia.SupportsReadLong && !ata)
if(testedMedia.SupportsReadLong == true)
mediaOneValue.Add("Device can use the READ LONG (10) command with this medium");
if(testedMedia.SupportsReadLong16)
if(testedMedia.SupportsReadLong16 == true)
mediaOneValue.Add("Device can use the READ LONG (16) command with this medium");
if(testedMedia.SupportsReadCd)
if(testedMedia.SupportsReadCd == true)
mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium");
if(testedMedia.SupportsReadCdMsf)
if(testedMedia.SupportsReadCdMsf == true)
mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium");
if(testedMedia.SupportsReadCdRaw)
if(testedMedia.SupportsReadCdRaw == true)
mediaOneValue
.Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector");
if(testedMedia.SupportsReadCdMsfRaw)
if(testedMedia.SupportsReadCdMsfRaw == true)
mediaOneValue
.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector");
if(testedMedia.SupportsHLDTSTReadRawDVD)
if(testedMedia.SupportsHLDTSTReadRawDVD == true)
mediaOneValue.Add("Device can use the HL-DT-ST vendor READ DVD (RAW) command with this medium");
if(testedMedia.SupportsNECReadCDDA)
if(testedMedia.SupportsNECReadCDDA == true)
mediaOneValue.Add("Device can use the NEC vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPioneerReadCDDA)
if(testedMedia.SupportsPioneerReadCDDA == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPioneerReadCDDAMSF)
if(testedMedia.SupportsPioneerReadCDDAMSF == true)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA MSF command with this medium");
if(testedMedia.SupportsPlextorReadCDDA)
if(testedMedia.SupportsPlextorReadCDDA == true)
mediaOneValue.Add("Device can use the PLEXTOR vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPlextorReadRawDVD)
if(testedMedia.SupportsPlextorReadRawDVD == true)
mediaOneValue.Add("Device can use the PLEXOR vendor READ DVD (RAW) command with this medium");
if(testedMedia.CanReadAACS)
if(testedMedia.CanReadAACS == true)
mediaOneValue.Add("Device can read the Advanced Access Content System from this medium");
if(testedMedia.CanReadADIP)
if(testedMedia.CanReadADIP == true)
mediaOneValue.Add("Device can read the DVD ADress-In-Pregroove from this medium");
if(testedMedia.CanReadATIP)
if(testedMedia.CanReadATIP == true)
mediaOneValue.Add("Device can read the CD Absolute-Time-In-Pregroove from this medium");
if(testedMedia.CanReadBCA) mediaOneValue.Add("Device can read the Burst Cutting Area from this medium");
if(testedMedia.CanReadC2Pointers)
if(testedMedia.CanReadBCA == true)
mediaOneValue.Add("Device can read the Burst Cutting Area from this medium");
if(testedMedia.CanReadC2Pointers == true)
mediaOneValue.Add("Device can report the C2 pointers when reading from this medium");
if(testedMedia.CanReadCMI)
if(testedMedia.CanReadCMI == true)
mediaOneValue.Add("Device can read the Copyright Management Information from this medium");
if(testedMedia.CanReadCorrectedSubchannel)
if(testedMedia.CanReadCorrectedSubchannel == true)
mediaOneValue.Add("Device can correct subchannels when reading from this medium");
if(testedMedia.CanReadCorrectedSubchannelWithC2)
if(testedMedia.CanReadCorrectedSubchannelWithC2 == true)
mediaOneValue
.Add("Device can correct subchannels and report the C2 pointers when reading from this medium");
if(testedMedia.CanReadDCB)
if(testedMedia.CanReadDCB == true)
mediaOneValue.Add("Device can read the Disc Control Blocks from this medium");
if(testedMedia.CanReadDDS)
if(testedMedia.CanReadDDS == true)
mediaOneValue.Add("Device can read the Disc Definition Structure from this medium");
if(testedMedia.CanReadDMI)
if(testedMedia.CanReadDMI == true)
mediaOneValue.Add("Device can read the Disc Manufacurer Information from this medium");
if(testedMedia.CanReadDiscInformation)
if(testedMedia.CanReadDiscInformation == true)
mediaOneValue.Add("Device can read the Disc Information from this medium");
if(testedMedia.CanReadFullTOC)
if(testedMedia.CanReadFullTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium, without processing it");
if(testedMedia.CanReadHDCMI)
if(testedMedia.CanReadHDCMI == true)
mediaOneValue.Add("Device can read the HD DVD Copyright Management Information from this medium");
if(testedMedia.CanReadLayerCapacity)
if(testedMedia.CanReadLayerCapacity == true)
mediaOneValue.Add("Device can read the layer capacity from this medium");
if(testedMedia.CanReadLeadIn) mediaOneValue.Add("Device can read the Lead-In from this medium");
if(testedMedia.CanReadLeadOut) mediaOneValue.Add("Device can read the Lead-Out from this medium");
if(testedMedia.CanReadMediaID) mediaOneValue.Add("Device can read the Media ID from this medium");
if(testedMedia.CanReadMediaSerial)
if(testedMedia.CanReadFirstTrackPreGap == true)
mediaOneValue.Add("Device can read the first track's pregap data");
if(testedMedia.CanReadLeadIn == true) mediaOneValue.Add("Device can read the Lead-In from this medium");
if(testedMedia.CanReadLeadOut == true)
mediaOneValue.Add("Device can read the Lead-Out from this medium");
if(testedMedia.CanReadMediaID == true)
mediaOneValue.Add("Device can read the Media ID from this medium");
if(testedMedia.CanReadMediaSerial == true)
mediaOneValue.Add("Device can read the Media Serial Number from this medium");
if(testedMedia.CanReadPAC) mediaOneValue.Add("Device can read the PAC from this medium");
if(testedMedia.CanReadPFI)
if(testedMedia.CanReadPAC == true) mediaOneValue.Add("Device can read the PAC from this medium");
if(testedMedia.CanReadPFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from this medium");
if(testedMedia.CanReadPMA)
if(testedMedia.CanReadPMA == true)
mediaOneValue.Add("Device can read the Power Management Area from this medium");
if(testedMedia.CanReadPQSubchannel)
if(testedMedia.CanReadPQSubchannel == true)
mediaOneValue.Add("Device can read the P to Q subchannels from this medium");
if(testedMedia.CanReadPQSubchannelWithC2)
if(testedMedia.CanReadPQSubchannelWithC2 == true)
mediaOneValue
.Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadPRI)
if(testedMedia.CanReadPRI == true)
mediaOneValue.Add("Device can read the Pre-Recorded Information from this medium");
if(testedMedia.CanReadRWSubchannel)
if(testedMedia.CanReadRWSubchannel == true)
mediaOneValue.Add("Device can read the R to W subchannels from this medium");
if(testedMedia.CanReadRWSubchannelWithC2)
if(testedMedia.CanReadRWSubchannelWithC2 == true)
mediaOneValue
.Add("Device can read the R to W subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadRecordablePFI)
if(testedMedia.CanReadRecordablePFI == true)
mediaOneValue.Add("Device can read the Physical Format Information from Lead-In from this medium");
if(testedMedia.CanReadSpareAreaInformation)
if(testedMedia.CanReadSpareAreaInformation == true)
mediaOneValue.Add("Device can read the Spare Area Information from this medium");
if(testedMedia.CanReadTOC) mediaOneValue.Add("Device can read the Table of Contents from this medium");
if(testedMedia.CanReadTOC == true)
mediaOneValue.Add("Device can read the Table of Contents from this medium");
mediaOneValue.Add("");
}

View File

@@ -295,6 +295,10 @@
<Project>{0beb3088-b634-4289-ae17-cdf2d25d00d5}</Project>
<Name>DiscImageChef.Decoders</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Helpers\DiscImageChef.Helpers.csproj">
<Project>{f8bdf57b-1571-4cd0-84b3-b422088d359a}</Project>
<Name>DiscImageChef.Helpers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\201812201613369_InitialMigration.resx">

View File

@@ -33,17 +33,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.Web.UI;
using System.Xml.Serialization;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Server.App_Start;
using Ata = DiscImageChef.Server.App_Start.Ata;
using TestedMedia = DiscImageChef.Server.App_Start.TestedMedia;
using DiscImageChef.Server.Models;
using TestedMedia = DiscImageChef.CommonTypes.Metadata.TestedMedia;
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
namespace DiscImageChef.Server
@@ -57,56 +55,24 @@ namespace DiscImageChef.Server
{
try
{
string manufacturer = Request.QueryString["manufacturer"];
string model = Request.QueryString["model"];
string revision = Request.QueryString["revision"];
// Strip non-ascii, strip slashes and question marks
if(manufacturer != null)
manufacturer = Encoding
.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII,
Encoding.UTF8.GetBytes(manufacturer)))
.Replace('/', '_').Replace('\\', '_').Replace('?', '_');
if(model != null)
model = Encoding
.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII,
Encoding.UTF8.GetBytes(model))).Replace('/', '_')
.Replace('\\', '_').Replace('?', '_');
if(revision != null)
revision = Encoding
.ASCII.GetString(Encoding.Convert(Encoding.UTF8, Encoding.ASCII,
Encoding.UTF8.GetBytes(revision))).Replace('/', '_')
.Replace('\\', '_').Replace('?', '_');
string xmlFile = null;
if(!string.IsNullOrWhiteSpace(manufacturer) && !string.IsNullOrWhiteSpace(model) &&
!string.IsNullOrWhiteSpace(revision)) xmlFile = manufacturer + "_" + model + "_" + revision + ".xml";
else if(!string.IsNullOrWhiteSpace(manufacturer) && !string.IsNullOrWhiteSpace(model))
xmlFile = manufacturer + "_" + model + ".xml";
else if(!string.IsNullOrWhiteSpace(model) && !string.IsNullOrWhiteSpace(revision))
xmlFile = model + "_" + revision + ".xml";
else if(!string.IsNullOrWhiteSpace(model)) xmlFile = model + ".xml";
if(xmlFile == null ||
!File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Reports", xmlFile)))
if(!int.TryParse(Request.QueryString["id"], out int id) || id <= 0)
{
content.InnerHtml = "<b>Could not find the specified report</b>";
content.InnerHtml = "<b>Incorrect device report request</b>";
return;
}
lblManufacturer.Text = Request.QueryString["manufacturer"];
lblModel.Text = Request.QueryString["model"];
lblRevision.Text = Request.QueryString["revision"];
DicServerContext ctx = new DicServerContext();
Device report = ctx.Devices.FirstOrDefault(d => d.Id == id);
DeviceReport report = new DeviceReport();
XmlSerializer xs = new XmlSerializer(report.GetType());
StreamReader sr =
new
StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(),
"Reports", xmlFile));
report = (DeviceReport)xs.Deserialize(sr);
sr.Close();
if(report is null)
{
content.InnerHtml = "<b>Cannot find requested report</b>";
return;
}
lblManufacturer.Text = report.Manufacturer;
lblModel.Text = report.Model;
lblRevision.Text = report.Revision;
if(report.USB != null)
{
@@ -223,7 +189,7 @@ namespace DiscImageChef.Server
else divPcmcia.Visible = false;
bool removable = true;
testedMediaType[] testedMedia = null;
List<TestedMedia> testedMedia = null;
bool ata = false;
bool atapi = false;
bool sscMedia = false;
@@ -233,7 +199,7 @@ namespace DiscImageChef.Server
ata = true;
List<string> ataOneValue = new List<string>();
Dictionary<string, string> ataTwoValue = new Dictionary<string, string>();
ataType ataReport;
CommonTypes.Metadata.Ata ataReport;
if(report.ATAPI != null)
{
@@ -243,7 +209,7 @@ namespace DiscImageChef.Server
}
else ataReport = report.ATA;
bool cfa = report.CompactFlashSpecified && report.CompactFlash;
bool cfa = report.CompactFlash;
if(atapi && !cfa) lblAtaDeviceType.Text = "ATAPI device";
else if(!atapi && cfa) lblAtaDeviceType.Text = "CompactFlash device";
@@ -264,13 +230,16 @@ namespace DiscImageChef.Server
Dictionary<string, string> modePages = new Dictionary<string, string>();
Dictionary<string, string> evpdPages = new Dictionary<string, string>();
lblScsiVendor.Text =
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;
lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel;
string vendorId = StringHandlers.CToString(report.SCSI.Inquiry?.VendorIdentification);
if(report.SCSI.Inquiry != null)
{
Inquiry.SCSIInquiry inq = report.SCSI.Inquiry.Value;
lblScsiVendor.Text = VendorString.Prettify(vendorId) != vendorId
? $"{vendorId} ({VendorString.Prettify(vendorId)})"
: vendorId;
lblScsiProduct.Text = StringHandlers.CToString(inq.ProductIdentification);
lblScsiRevision.Text = StringHandlers.CToString(inq.ProductRevisionLevel);
}
scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry));
@@ -279,8 +248,12 @@ namespace DiscImageChef.Server
if(report.SCSI.SupportsModeSubpages) scsiOneValue.Add("Device supports MODE SENSE subpages");
if(report.SCSI.ModeSense != null)
ScsiModeSense.Report(report.SCSI.ModeSense, report.SCSI.Inquiry.VendorIdentification,
report.SCSI.Inquiry.PeripheralDeviceType, ref scsiOneValue, ref modePages);
{
PeripheralDeviceTypes devType = PeripheralDeviceTypes.DirectAccess;
if(report.SCSI.Inquiry != null)
devType = (PeripheralDeviceTypes)report.SCSI.Inquiry.Value.PeripheralDeviceType;
ScsiModeSense.Report(report.SCSI.ModeSense, vendorId, devType, ref scsiOneValue, ref modePages);
}
if(modePages.Count > 0)
{
@@ -289,8 +262,7 @@ namespace DiscImageChef.Server
}
else divScsiModeSense.Visible = false;
if(report.SCSI.EVPDPages != null)
ScsiEvpd.Report(report.SCSI.EVPDPages, report.SCSI.Inquiry.VendorIdentification, ref evpdPages);
if(report.SCSI.EVPDPages != null) ScsiEvpd.Report(report.SCSI.EVPDPages, vendorId, ref evpdPages);
if(evpdPages.Count > 0)
{
@@ -335,17 +307,14 @@ namespace DiscImageChef.Server
{
divScsiSsc.Visible = true;
lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularitySpecified
? report.SCSI.SequentialDevice.BlockSizeGranularity.ToString()
: "Unspecified";
lblScsiSscGranularity.Text =
report.SCSI.SequentialDevice.BlockSizeGranularity?.ToString() ?? "Unspecified";
lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLengthSpecified
? report.SCSI.SequentialDevice.MaxBlockLength.ToString()
: "Unspecified";
lblScsiSscMaxBlock.Text =
report.SCSI.SequentialDevice.MaxBlockLength?.ToString() ?? "Unspecified";
lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLengthSpecified
? report.SCSI.SequentialDevice.MinBlockLength.ToString()
: "Unspecified";
lblScsiSscMinBlock.Text =
report.SCSI.SequentialDevice.MinBlockLength?.ToString() ?? "Unspecified";
if(report.SCSI.SequentialDevice.SupportedDensities != null)
{
@@ -380,8 +349,8 @@ namespace DiscImageChef.Server
removable = false;
scsiOneValue.Add("");
if(report.SCSI.ReadCapabilities.BlocksSpecified &&
report.SCSI.ReadCapabilities.BlockSizeSpecified)
if(report.SCSI.ReadCapabilities.Blocks.HasValue &&
report.SCSI.ReadCapabilities.BlockSize.HasValue)
{
scsiOneValue
.Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each");
@@ -400,29 +369,29 @@ namespace DiscImageChef.Server
.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.MediumType.HasValue)
scsiOneValue.Add($"Medium type code: {report.SCSI.ReadCapabilities.MediumType:X2}h");
if(report.SCSI.ReadCapabilities.DensitySpecified)
if(report.SCSI.ReadCapabilities.Density.HasValue)
scsiOneValue.Add($"Density code: {report.SCSI.ReadCapabilities.Density:X2}h");
if((report.SCSI.ReadCapabilities.SupportsReadLong ||
report.SCSI.ReadCapabilities.SupportsReadLong16) &&
report.SCSI.ReadCapabilities.LongBlockSizeSpecified)
if((report.SCSI.ReadCapabilities.SupportsReadLong == true ||
report.SCSI.ReadCapabilities.SupportsReadLong16 == true) &&
report.SCSI.ReadCapabilities.LongBlockSize.HasValue)
scsiOneValue.Add($"Long block size: {report.SCSI.ReadCapabilities.LongBlockSize} bytes");
if(report.SCSI.ReadCapabilities.SupportsReadCapacity)
if(report.SCSI.ReadCapabilities.SupportsReadCapacity == true)
scsiOneValue.Add("Device supports READ CAPACITY (10) command.");
if(report.SCSI.ReadCapabilities.SupportsReadCapacity16)
if(report.SCSI.ReadCapabilities.SupportsReadCapacity16 == true)
scsiOneValue.Add("Device supports READ CAPACITY (16) command.");
if(report.SCSI.ReadCapabilities.SupportsRead)
if(report.SCSI.ReadCapabilities.SupportsRead6 == true)
scsiOneValue.Add("Device supports READ (6) command.");
if(report.SCSI.ReadCapabilities.SupportsRead10)
if(report.SCSI.ReadCapabilities.SupportsRead10 == true)
scsiOneValue.Add("Device supports READ (10) command.");
if(report.SCSI.ReadCapabilities.SupportsRead12)
if(report.SCSI.ReadCapabilities.SupportsRead12 == true)
scsiOneValue.Add("Device supports READ (12) command.");
if(report.SCSI.ReadCapabilities.SupportsRead16)
if(report.SCSI.ReadCapabilities.SupportsRead16 == true)
scsiOneValue.Add("Device supports READ (16) command.");
if(report.SCSI.ReadCapabilities.SupportsReadLong)
if(report.SCSI.ReadCapabilities.SupportsReadLong == true)
scsiOneValue.Add("Device supports READ LONG (10) command.");
if(report.SCSI.ReadCapabilities.SupportsReadLong16)
if(report.SCSI.ReadCapabilities.SupportsReadLong16 == true)
scsiOneValue.Add("Device supports READ LONG (16) command.");
}
else testedMedia = report.SCSI.RemovableMedias;
@@ -509,7 +478,7 @@ namespace DiscImageChef.Server
if(removable && !sscMedia && testedMedia != null)
{
List<string> mediaOneValue = new List<string>();
TestedMedia.Report(testedMedia, ata, ref mediaOneValue);
App_Start.TestedMedia.Report(testedMedia, ref mediaOneValue);
if(mediaOneValue.Count > 0)
{
divTestedMedia.Visible = true;

View File

@@ -177,4 +177,6 @@
&lt;/TypePattern&gt;&#xD;
&lt;/Patterns&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ATAPI/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ATAPI/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=EVPD/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Portillo/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>