REFACTOR: All refactor in DiscImageChef.Server.

This commit is contained in:
2017-12-22 18:17:36 +00:00
parent fabb50584e
commit 10d767af73
16 changed files with 110 additions and 141 deletions

View File

@@ -43,7 +43,6 @@ namespace DiscImageChef.Server.App_Start
ref List<string> ataOneValue, ref Dictionary<string, string> ataTwoValue, ref List<string> ataOneValue, ref Dictionary<string, string> ataTwoValue,
ref testedMediaType[] testedMedia) ref testedMediaType[] testedMedia)
{ {
string tmpString;
uint logicalsectorsize = 0; uint logicalsectorsize = 0;
if(ataReport.ModelSpecified && !string.IsNullOrEmpty(ataReport.Model)) if(ataReport.ModelSpecified && !string.IsNullOrEmpty(ataReport.Model))
@@ -104,7 +103,7 @@ namespace DiscImageChef.Server.App_Start
int maxatalevel = 0; int maxatalevel = 0;
int minatalevel = 255; int minatalevel = 255;
tmpString = ""; string tmpString = "";
if(ata1) if(ata1)
{ {
tmpString += "ATA-1 "; tmpString += "ATA-1 ";
@@ -555,9 +554,9 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.StandardStanbyTimer)) if(ataReport.Capabilities.HasFlag(CapabilitiesBit.StandardStanbyTimer))
ataOneValue.Add("Standby time values are standard"); ataOneValue.Add("Standby time values are standard");
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.IORDY)) if(ataReport.Capabilities.HasFlag(CapabilitiesBit.IORDY))
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)) ataOneValue.Add(ataReport.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)
ataOneValue.Add("IORDY is supported and can be disabled"); ? "IORDY is supported and can be disabled"
else ataOneValue.Add("IORDY is supported"); : "IORDY is supported");
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) ataOneValue.Add("DMA is supported"); if(ataReport.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) ataOneValue.Add("DMA is supported");
if(ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) || if(ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) ||
ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0)) ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0))
@@ -1073,13 +1072,13 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add("Streaming feature set is supported and enabled"); ataOneValue.Add("Streaming feature set is supported and enabled");
else ataOneValue.Add("Streaming feature set is supported"); else ataOneValue.Add("Streaming feature set is supported");
if(ataReport.CommandSet3.HasFlag(CommandSetBit3.MCPT) && ataReport.EnabledCommandSet3Specified) if(ataReport.CommandSet3.HasFlag(CommandSetBit3.MCPT) && ataReport.EnabledCommandSet3Specified)
if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)) ataOneValue.Add(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)
ataOneValue.Add("Media Card Pass Through command set is supported and enabled"); ? "Media Card Pass Through command set is supported and enabled"
else ataOneValue.Add("Media Card Pass Through command set is supported"); : "Media Card Pass Through command set is supported");
if(ataReport.CommandSet3.HasFlag(CommandSetBit3.MediaSerial) && ataReport.EnabledCommandSet3Specified) if(ataReport.CommandSet3.HasFlag(CommandSetBit3.MediaSerial) && ataReport.EnabledCommandSet3Specified)
if(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) ataOneValue.Add(ataReport.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)
ataOneValue.Add("Media Serial is supported and valid"); ? "Media Serial is supported and valid"
else ataOneValue.Add("Media Serial is supported"); : "Media Serial is supported");
} }
if(ataReport.CommandSet4Specified && ataReport.CommandSet4.HasFlag(CommandSetBit4.MustBeSet) && if(ataReport.CommandSet4Specified && ataReport.CommandSet4.HasFlag(CommandSetBit4.MustBeSet) &&
@@ -1178,9 +1177,9 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.Sanitize)) if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.Sanitize))
{ {
ataOneValue.Add("Sanitize feature set is supported"); ataOneValue.Add("Sanitize feature set is supported");
if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeCommands)) ataOneValue.Add(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeCommands)
ataOneValue.Add("Sanitize commands are specified by ACS-3 or higher"); ? "Sanitize commands are specified by ACS-3 or higher"
else ataOneValue.Add("Sanitize commands are specified by ACS-2"); : "Sanitize commands are specified by ACS-2");
if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeAntifreeze)) if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeAntifreeze))
ataOneValue.Add("SANITIZE ANTIFREEZE LOCK EXT is supported"); ataOneValue.Add("SANITIZE ANTIFREEZE LOCK EXT is supported");
@@ -1265,21 +1264,21 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enabled)) if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enabled))
{ {
ataOneValue.Add("Security is enabled"); ataOneValue.Add("Security is enabled");
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Locked)) ataOneValue.Add(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Locked)
ataOneValue.Add("Security is locked"); ? "Security is locked"
else ataOneValue.Add("Security is not locked"); : "Security is not locked");
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Frozen)) ataOneValue.Add(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Frozen)
ataOneValue.Add("Security is frozen"); ? "Security is frozen"
else ataOneValue.Add("Security is not frozen"); : "Security is not frozen");
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Expired)) ataOneValue.Add(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Expired)
ataOneValue.Add("Security count has expired"); ? "Security count has expired"
else ataOneValue.Add("Security count has notexpired"); : "Security count has notexpired");
if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Maximum)) ataOneValue.Add(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Maximum)
ataOneValue.Add("Security level is maximum"); ? "Security level is maximum"
else ataOneValue.Add("Security level is high"); : "Security level is high");
} }
else ataOneValue.Add("Security is not enabled"); else ataOneValue.Add("Security is not enabled");
@@ -1327,9 +1326,9 @@ namespace DiscImageChef.Server.App_Start
ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0xF000) >> 12}"); ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0xF000) >> 12}");
if((ataReport.NVCacheCaps & 0x0001) == 0x0001) if((ataReport.NVCacheCaps & 0x0001) == 0x0001)
{ {
if((ataReport.NVCacheCaps & 0x0002) == 0x0002) ataOneValue.Add((ataReport.NVCacheCaps & 0x0002) == 0x0002
ataOneValue.Add("Power mode feature set is supported and enabled"); ? "Power mode feature set is supported and enabled"
else ataOneValue.Add("Power mode feature set is supported"); : "Power mode feature set is supported");
ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0x0F00) >> 8}"); ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0x0F00) >> 8}");
} }
@@ -1344,10 +1343,9 @@ namespace DiscImageChef.Server.App_Start
if(ataReport.ReadCapabilities.NominalRotationRateSpecified && if(ataReport.ReadCapabilities.NominalRotationRateSpecified &&
ataReport.ReadCapabilities.NominalRotationRate != 0x0000 && ataReport.ReadCapabilities.NominalRotationRate != 0x0000 &&
ataReport.ReadCapabilities.NominalRotationRate != 0xFFFF) ataReport.ReadCapabilities.NominalRotationRate != 0xFFFF)
if(ataReport.ReadCapabilities.NominalRotationRate == 0x0001) ataOneValue.Add(ataReport.ReadCapabilities.NominalRotationRate == 0x0001
ataOneValue.Add("Device does not rotate."); ? "Device does not rotate."
else : $"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm");
ataOneValue.Add($"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm");
if(!atapi) if(!atapi)
{ {

View File

@@ -262,8 +262,8 @@ namespace DiscImageChef.Server.App_Start
if(inquiry.VersionDescriptors == null) return scsiOneValue; if(inquiry.VersionDescriptors == null) return scsiOneValue;
foreach(ushort VersionDescriptor in inquiry.VersionDescriptors) foreach(ushort versionDescriptor in inquiry.VersionDescriptors)
switch(VersionDescriptor) switch(versionDescriptor)
{ {
case 0xFFFF: case 0xFFFF:
case 0x0000: break; case 0x0000: break;
@@ -928,7 +928,7 @@ namespace DiscImageChef.Server.App_Start
case 0x097D: case 0x097D:
case 0x097E: case 0x097E:
case 0x097F: case 0x097F:
scsiOneValue.Add($"Device complies with iSCSI revision {VersionDescriptor & 0x1F}"); scsiOneValue.Add($"Device complies with iSCSI revision {versionDescriptor & 0x1F}");
break; break;
case 0x0980: case 0x0980:
scsiOneValue.Add("Device complies with SBP-3 (no version claimed)"); scsiOneValue.Add("Device complies with SBP-3 (no version claimed)");
@@ -1688,7 +1688,7 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add("Device complies with IEEE 1667-2009"); scsiOneValue.Add("Device complies with IEEE 1667-2009");
break; break;
default: default:
scsiOneValue.Add($"Device complies with unknown standard code 0x{VersionDescriptor:X4}"); scsiOneValue.Add($"Device complies with unknown standard code 0x{versionDescriptor:X4}");
break; break;
} }

View File

@@ -81,14 +81,15 @@ namespace DiscImageChef.Server.App_Start
if(mode.PreventJumperStatus) if(mode.PreventJumperStatus)
{ {
mmcOneValue.Add("Drive power ups locked"); mmcOneValue.Add("Drive power ups locked");
if(mode.LockStatus) mmcOneValue.Add("Drive is locked, media cannot be ejected or inserted"); mmcOneValue.Add(mode.LockStatus
else mmcOneValue.Add("Drive is not locked, media can be ejected and inserted"); ? "Drive is locked, media cannot be ejected or inserted"
: "Drive is not locked, media can be ejected and inserted");
} }
else else
{ {
if(mode.LockStatus) mmcOneValue.Add(mode.LockStatus
mmcOneValue.Add("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"
else mmcOneValue.Add("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");
@@ -105,23 +106,19 @@ namespace DiscImageChef.Server.App_Start
if(mode.ReadsCDR) if(mode.ReadsCDR)
{ {
if(mode.WritesCDR) mmcOneValue.Add("Drive can read and write CD-R"); mmcOneValue.Add(mode.WritesCDR ? "Drive can read and write CD-R" : "Drive can read CD-R");
else mmcOneValue.Add("Drive can read CD-R");
if(mode.ReadsPacketCDR) mmcOneValue.Add("Drive supports reading CD-R packet media"); if(mode.ReadsPacketCDR) mmcOneValue.Add("Drive supports reading CD-R packet media");
} }
if(mode.ReadsCDRW) if(mode.ReadsCDRW)
if(mode.WritesCDRW) mmcOneValue.Add("Drive can read and write CD-RW"); mmcOneValue.Add(mode.WritesCDRW ? "Drive can read and write CD-RW" : "Drive can read CD-RW");
else mmcOneValue.Add("Drive can read CD-RW");
if(mode.ReadsDVDROM) mmcOneValue.Add("Drive can read DVD-ROM"); if(mode.ReadsDVDROM) mmcOneValue.Add("Drive can read DVD-ROM");
if(mode.ReadsDVDR) if(mode.ReadsDVDR)
if(mode.WritesDVDR) mmcOneValue.Add("Drive can read and write DVD-R"); mmcOneValue.Add(mode.WritesDVDR ? "Drive can read and write DVD-R" : "Drive can read DVD-R");
else mmcOneValue.Add("Drive can read DVD-R");
if(mode.ReadsDVDRAM) if(mode.ReadsDVDRAM)
if(mode.WritesDVDRAM) mmcOneValue.Add("Drive can read and write DVD-RAM"); mmcOneValue.Add(mode.WritesDVDRAM ? "Drive can read and write DVD-RAM" : "Drive can read DVD-RAM");
else mmcOneValue.Add("Drive can read DVD-RAM");
if(mode.CompositeAudioVideo) mmcOneValue.Add("Drive can deliver a composite audio and video data stream"); if(mode.CompositeAudioVideo) 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.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");

View File

@@ -81,25 +81,19 @@ namespace DiscImageChef.Server.App_Start
Modes.PrettifyModePage_00_SFF(page.value)); Modes.PrettifyModePage_00_SFF(page.value));
else else
{ {
if(page.subpage != 0) modePages
modePages .Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h", "Unknown vendor mode page");
"Unknown vendor mode page");
else
modePages.Add($"MODE page {page.page:X2}h",
"Unknown vendor mode page");
} }
break; break;
} }
case 0x01: case 0x01:
{ {
if(page.subpage == 0) if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) modePages.Add($"MODE page {page.page:X2}h",
modePages.Add($"MODE page {page.page:X2}h", deviceType == PeripheralDeviceTypes.MultiMediaDevice
Modes.PrettifyModePage_01_MMC(page.value)); ? Modes.PrettifyModePage_01_MMC(page.value)
else : Modes.PrettifyModePage_01(page.value));
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_01(page.value));
else goto default; else goto default;
break; break;
@@ -152,12 +146,10 @@ namespace DiscImageChef.Server.App_Start
case 0x07: case 0x07:
{ {
if(page.subpage == 0) if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) modePages.Add($"MODE page {page.page:X2}h",
modePages.Add($"MODE page {page.page:X2}h", deviceType == PeripheralDeviceTypes.MultiMediaDevice
Modes.PrettifyModePage_07_MMC(page.value)); ? Modes.PrettifyModePage_07_MMC(page.value)
else : Modes.PrettifyModePage_07(page.value));
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_07(page.value));
else goto default; else goto default;
break; break;
@@ -222,12 +214,10 @@ namespace DiscImageChef.Server.App_Start
case 0x10: case 0x10:
{ {
if(page.subpage == 0) if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.SequentialAccess) modePages.Add($"MODE page {page.page:X2}h",
modePages.Add($"MODE page {page.page:X2}h", deviceType == PeripheralDeviceTypes.SequentialAccess
Modes.PrettifyModePage_10_SSC(page.value)); ? Modes.PrettifyModePage_10_SSC(page.value)
else : Modes.PrettifyModePage_10(page.value));
modePages.Add($"MODE page {page.page:X2}h",
Modes.PrettifyModePage_10(page.value));
else goto default; else goto default;
break; break;
@@ -276,12 +266,10 @@ namespace DiscImageChef.Server.App_Start
case 0x1C: case 0x1C:
{ {
if(page.subpage == 0) if(page.subpage == 0)
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) modePages.Add($"MODE page {page.page:X2}h",
modePages.Add($"MODE page {page.page:X2}h", deviceType == PeripheralDeviceTypes.MultiMediaDevice
Modes.PrettifyModePage_1C_SFF(page.value)); ? Modes.PrettifyModePage_1C_SFF(page.value)
else : Modes.PrettifyModePage_1C(page.value));
modePages.Add($"MODE page {page.page:X2}h",
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));
@@ -395,11 +383,8 @@ namespace DiscImageChef.Server.App_Start
} }
default: default:
{ {
if(page.subpage != 0) modePages.Add(page.subpage != 0 ? $"MODE page {page.page:X2}h subpage {page.subpage:X2}h" : $"MODE page {page.page:X2}h",
modePages "Unknown mode page");
.Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h",
"Unknown mode page");
else modePages.Add($"MODE page {page.page:X2}h", "Unknown mode page");
} }
break; break;
} }

View File

@@ -37,7 +37,7 @@ namespace DiscImageChef.Server.App_Start
{ {
public static class SscTestedMedia public static class SscTestedMedia
{ {
public static void Report(SequentialMedia[] testedMedia, ref List<string> mediaOneValue) public static void Report(IEnumerable<SequentialMedia> testedMedia, ref List<string> mediaOneValue)
{ {
foreach(SequentialMedia media in testedMedia) foreach(SequentialMedia media in testedMedia)
{ {

View File

@@ -37,7 +37,7 @@ namespace DiscImageChef.Server.App_Start
{ {
public static class TestedMedia public static class TestedMedia
{ {
public static void Report(testedMediaType[] testedMedias, bool ata, ref List<string> mediaOneValue) public static void Report(IEnumerable<testedMediaType> testedMedias, bool ata, ref List<string> mediaOneValue)
{ {
foreach(testedMediaType testedMedia in testedMedias) foreach(testedMediaType testedMedia in testedMedias)
{ {
@@ -51,8 +51,9 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"<i>Information for medium type {testedMedia.MediumType:X2}h</i>"); mediaOneValue.Add($"<i>Information for medium type {testedMedia.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>"); else mediaOneValue.Add("<i>Information for unknown medium type</i>");
if(testedMedia.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium."); mediaOneValue.Add(testedMedia.MediaIsRecognized
else mediaOneValue.Add("Drive does not recognize this medium."); ? "Drive recognizes this medium."
: "Drive does not recognize this medium.");
if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer)) if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}"); mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}");
@@ -126,8 +127,9 @@ namespace DiscImageChef.Server.App_Start
if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 && if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF) testedMedia.NominalRotationRate != 0xFFFF)
if(testedMedia.NominalRotationRate == 0x0001) mediaOneValue.Add("Medium does not rotate."); mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001
else mediaOneValue.Add($"Medium rotates at {testedMedia.NominalRotationRate} rpm"); ? "Medium does not rotate."
: $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified && if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified &&
testedMedia.BlockSize != testedMedia.PhysicalBlockSize && testedMedia.BlockSize != testedMedia.PhysicalBlockSize &&

View File

@@ -1,4 +1,5 @@
<%@ Page Language="C#" %> <%@ Page Language="C#" %>
<%@ Register TagPrefix="velyo" Namespace="Velyo.AspNet.Markdown" Assembly="Velyo.AspNet.Markdown" %>
<%-- <%--
// /*************************************************************************** // /***************************************************************************
// The Disc Image Chef // The Disc Image Chef
@@ -36,7 +37,7 @@
<html> <html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<head runat="server"> <head runat="server">
<link href='dos.css' rel='stylesheet' type='text/css'/> <link href="dos.css" rel="stylesheet" type="text/css"/>
<title>DiscImageChef's TODO</title> <title>DiscImageChef's TODO</title>
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">

View File

@@ -49,8 +49,7 @@ namespace DiscImageChef.Server.Controllers
[HttpPost] [HttpPost]
public HttpResponseMessage UploadReport() public HttpResponseMessage UploadReport()
{ {
HttpResponseMessage response = new HttpResponseMessage(); HttpResponseMessage response = new HttpResponseMessage {StatusCode = HttpStatusCode.OK};
response.StatusCode = HttpStatusCode.OK;
try try
{ {

View File

@@ -52,8 +52,7 @@ namespace DiscImageChef.Server.Controllers
[HttpPost] [HttpPost]
public HttpResponseMessage UploadStats() public HttpResponseMessage UploadStats()
{ {
HttpResponseMessage response = new HttpResponseMessage(); HttpResponseMessage response = new HttpResponseMessage {StatusCode = HttpStatusCode.OK};
response.StatusCode = HttpStatusCode.OK;
try try
{ {

View File

@@ -1,4 +1,5 @@
<%@ Page Language="C#" %> <%@ Page Language="C#" %>
<%@ Register TagPrefix="velyo" Namespace="Velyo.AspNet.Markdown" Assembly="Velyo.AspNet.Markdown" %>
<%-- <%--
// /*************************************************************************** // /***************************************************************************
// The Disc Image Chef // The Disc Image Chef
@@ -36,7 +37,7 @@
<html> <html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<head runat="server"> <head runat="server">
<link href='dos.css' rel='stylesheet' type='text/css'/> <link href="dos.css" rel="stylesheet" type="text/css"/>
<title>DiscImageChef's TODO</title> <title>DiscImageChef's TODO</title>
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">

View File

@@ -1,4 +1,5 @@
<%@ 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
@@ -36,7 +37,7 @@
<html> <html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<head runat="server"> <head runat="server">
<link href='dos.css' rel='stylesheet' type='text/css'/> <link href="dos.css" rel="stylesheet" type="text/css"/>
<title>DiscImageChef</title> <title>DiscImageChef</title>
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">

View File

@@ -36,7 +36,7 @@
<html> <html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<head runat="server"> <head runat="server">
<link href='dos.css' rel='stylesheet' type='text/css'/> <link href="dos.css" rel="stylesheet" type="text/css"/>
<title>DiscImageChef Statistics</title> <title>DiscImageChef Statistics</title>
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">

View File

@@ -118,9 +118,9 @@ namespace DiscImageChef.Server
{ {
versions = new List<NameValueStats>(); versions = new List<NameValueStats>();
foreach(NameValueStats nvs in statistics.Versions) foreach(NameValueStats nvs in statistics.Versions)
if(nvs.name == "previous") versions.Add(nvs.name == "previous"
versions.Add(new NameValueStats {name = "Previous than 3.4.99.0", Value = nvs.Value}); ? new NameValueStats {name = "Previous than 3.4.99.0", Value = nvs.Value}
else versions.Add(nvs); : nvs);
repVersions.DataSource = versions.OrderBy(ver => ver.name).ToList(); repVersions.DataSource = versions.OrderBy(ver => ver.name).ToList();
repVersions.DataBind(); repVersions.DataBind();
@@ -185,12 +185,9 @@ namespace DiscImageChef.Server
virtualMedia = new List<MediaItem>(); virtualMedia = new List<MediaItem>();
foreach(MediaStats nvs in statistics.Medias) foreach(MediaStats nvs in statistics.Medias)
{ {
string type;
string subtype;
MediaType MediaType
.MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.type), .MediaTypeToString((CommonTypes.MediaType)Enum.Parse(typeof(CommonTypes.MediaType), nvs.type),
out type, out subtype); out string type, out string subtype);
if(nvs.real) realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value}); if(nvs.real) realMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value});
else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value}); else virtualMedia.Add(new MediaItem {Type = type, SubType = subtype, Count = nvs.Value});
@@ -283,7 +280,7 @@ namespace DiscImageChef.Server
} }
} }
FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share) static FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{ {
for(int numTries = 0; numTries < 100; numTries++) for(int numTries = 0; numTries < 100; numTries++)
{ {
@@ -295,7 +292,7 @@ namespace DiscImageChef.Server
} }
catch(IOException) catch(IOException)
{ {
if(fs != null) fs.Dispose(); fs?.Dispose();
Thread.Sleep(50); Thread.Sleep(50);
} }
} }

View File

@@ -1,4 +1,5 @@
<%@ Page Language="C#" %> <%@ Page Language="C#" %>
<%@ Register TagPrefix="velyo" Namespace="Velyo.AspNet.Markdown" Assembly="Velyo.AspNet.Markdown" %>
<%-- <%--
// /*************************************************************************** // /***************************************************************************
// The Disc Image Chef // The Disc Image Chef
@@ -36,7 +37,7 @@
<html> <html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<head runat="server"> <head runat="server">
<link href='dos.css' rel='stylesheet' type='text/css'/> <link href="dos.css" rel="stylesheet" type="text/css"/>
<title>DiscImageChef's TODO</title> <title>DiscImageChef's TODO</title>
</head> </head>
<body id="body" runat="server"> <body id="body" runat="server">

View File

@@ -36,7 +36,7 @@
<html> <html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<head runat="server"> <head runat="server">
<link href='dos.css' rel='stylesheet' type='text/css'/> <link href="dos.css" rel="stylesheet" type="text/css"/>
<title>DiscImageChef Device Report</title> <title>DiscImageChef Device Report</title>
</head> </head>
<body id="content" runat="server"> <body id="content" runat="server">

View File

@@ -102,10 +102,8 @@ namespace DiscImageChef.Server
if(report.USB != null) if(report.USB != null)
{ {
string usbVendorDescription; GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out string usbVendorDescription,
string usbProductDescription; out string usbProductDescription);
GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out usbVendorDescription,
out usbProductDescription);
lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer); lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer);
lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product); lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product);
@@ -149,7 +147,7 @@ namespace DiscImageChef.Server
case TupleCodes.CISTPL_DEVICEGEO_A: case TupleCodes.CISTPL_DEVICEGEO_A:
DeviceGeometryTuple geom = DeviceGeometryTuple geom =
CIS.DecodeDeviceGeometryTuple(tuple.Data); CIS.DecodeDeviceGeometryTuple(tuple.Data);
if(geom != null && geom.Geometries != null) if(geom?.Geometries != null)
foreach(DeviceGeometry geometry in geom.Geometries) foreach(DeviceGeometry geometry in geom.Geometries)
{ {
decodedTuples.Add("Device width", decodedTuples.Add("Device width",
@@ -259,11 +257,8 @@ 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>();
if(VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) != lblScsiVendor.Text = VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) !=
report.SCSI.Inquiry.VendorIdentification) report.SCSI.Inquiry.VendorIdentification ? $"{report.SCSI.Inquiry.VendorIdentification} ({VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)})" : report.SCSI.Inquiry.VendorIdentification;
lblScsiVendor.Text =
$"{report.SCSI.Inquiry.VendorIdentification} ({VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)})";
else lblScsiVendor.Text = report.SCSI.Inquiry.VendorIdentification;
lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification; lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification;
lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel; lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel;
@@ -330,17 +325,11 @@ namespace DiscImageChef.Server
{ {
divScsiSsc.Visible = true; divScsiSsc.Visible = true;
if(report.SCSI.SequentialDevice.BlockSizeGranularitySpecified) lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularitySpecified ? report.SCSI.SequentialDevice.BlockSizeGranularity.ToString() : "Unspecified";
lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularity.ToString();
else lblScsiSscGranularity.Text = "Unspecified";
if(report.SCSI.SequentialDevice.MaxBlockLengthSpecified) lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLengthSpecified ? report.SCSI.SequentialDevice.MaxBlockLength.ToString() : "Unspecified";
lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLength.ToString();
else lblScsiSscMaxBlock.Text = "Unspecified";
if(report.SCSI.SequentialDevice.MinBlockLengthSpecified) lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLengthSpecified ? report.SCSI.SequentialDevice.MinBlockLength.ToString() : "Unspecified";
lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLength.ToString();
else lblScsiSscMinBlock.Text = "Unspecified";
if(report.SCSI.SequentialDevice.SupportedDensities != null) if(report.SCSI.SequentialDevice.SupportedDensities != null)
{ {
@@ -530,39 +519,38 @@ namespace DiscImageChef.Server
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"));
string _line;
bool inManufacturer = false; bool inManufacturer = false;
ushort number;
while(tocStream.Peek() >= 0) while(tocStream.Peek() >= 0)
{ {
_line = tocStream.ReadLine(); string line = tocStream.ReadLine();
if(_line == null) break; if(line == null) break;
if(_line.Length == 0 || _line[0] == '#') continue; if(line.Length == 0 || line[0] == '#') continue;
ushort number;
if(inManufacturer) if(inManufacturer)
{ {
// Finished with the manufacturer // Finished with the manufacturer
if(_line[0] != '\t') return; if(line[0] != '\t') return;
number = Convert.ToUInt16(_line.Substring(1, 4), 16); number = Convert.ToUInt16(line.Substring(1, 4), 16);
if(number != product) continue; if(number != product) continue;
productDescription = _line.Substring(7); productDescription = line.Substring(7);
return; return;
} }
// Skip products // Skip products
if(_line[0] == '\t') continue; if(line[0] == '\t') continue;
try { number = Convert.ToUInt16(_line.Substring(0, 4), 16); } try { number = Convert.ToUInt16(line.Substring(0, 4), 16); }
catch(FormatException) { continue; } catch(FormatException) { continue; }
if(number != vendor) continue; if(number != vendor) continue;
vendorDescription = _line.Substring(6); vendorDescription = line.Substring(6);
inManufacturer = true; inManufacturer = true;
} }
} }