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

View File

@@ -262,8 +262,8 @@ namespace DiscImageChef.Server.App_Start
if(inquiry.VersionDescriptors == null) return scsiOneValue;
foreach(ushort VersionDescriptor in inquiry.VersionDescriptors)
switch(VersionDescriptor)
foreach(ushort versionDescriptor in inquiry.VersionDescriptors)
switch(versionDescriptor)
{
case 0xFFFF:
case 0x0000: break;
@@ -928,7 +928,7 @@ namespace DiscImageChef.Server.App_Start
case 0x097D:
case 0x097E:
case 0x097F:
scsiOneValue.Add($"Device complies with iSCSI revision {VersionDescriptor & 0x1F}");
scsiOneValue.Add($"Device complies with iSCSI revision {versionDescriptor & 0x1F}");
break;
case 0x0980:
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");
break;
default:
scsiOneValue.Add($"Device complies with unknown standard code 0x{VersionDescriptor:X4}");
scsiOneValue.Add($"Device complies with unknown standard code 0x{versionDescriptor:X4}");
break;
}

View File

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

View File

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

View File

@@ -37,7 +37,7 @@ namespace DiscImageChef.Server.App_Start
{
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)
{

View File

@@ -37,7 +37,7 @@ namespace DiscImageChef.Server.App_Start
{
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)
{
@@ -51,8 +51,9 @@ namespace DiscImageChef.Server.App_Start
mediaOneValue.Add($"<i>Information for medium type {testedMedia.MediumType:X2}h</i>");
else mediaOneValue.Add("<i>Information for unknown medium type</i>");
if(testedMedia.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium.");
else mediaOneValue.Add("Drive does not recognize this medium.");
mediaOneValue.Add(testedMedia.MediaIsRecognized
? "Drive recognizes this medium."
: "Drive does not recognize this medium.");
if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}");
@@ -126,8 +127,9 @@ namespace DiscImageChef.Server.App_Start
if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF)
if(testedMedia.NominalRotationRate == 0x0001) mediaOneValue.Add("Medium does not rotate.");
else mediaOneValue.Add($"Medium rotates at {testedMedia.NominalRotationRate} rpm");
mediaOneValue.Add(testedMedia.NominalRotationRate == 0x0001
? "Medium does not rotate."
: $"Medium rotates at {testedMedia.NominalRotationRate} rpm");
if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified &&
testedMedia.BlockSize != testedMedia.PhysicalBlockSize &&

View File

@@ -1,4 +1,5 @@
<%@ Page Language="C#" %>
<%@ Register TagPrefix="velyo" Namespace="Velyo.AspNet.Markdown" Assembly="Velyo.AspNet.Markdown" %>
<%--
// /***************************************************************************
// The Disc Image Chef
@@ -36,7 +37,7 @@
<html>
<meta charset="UTF-8">
<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>
</head>
<body id="body" runat="server">

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
<%@ Page Language="C#" %>
<%@ Register TagPrefix="velyo" Namespace="Velyo.AspNet.Markdown" Assembly="Velyo.AspNet.Markdown" %>
<%--
// /***************************************************************************
// The Disc Image Chef
@@ -36,7 +37,7 @@
<html>
<meta charset="UTF-8">
<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>
</head>
<body id="body" runat="server">

View File

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

View File

@@ -36,7 +36,7 @@
<html>
<meta charset="UTF-8">
<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>
</head>
<body id="body" runat="server">

View File

@@ -118,9 +118,9 @@ namespace DiscImageChef.Server
{
versions = new List<NameValueStats>();
foreach(NameValueStats nvs in statistics.Versions)
if(nvs.name == "previous")
versions.Add(new NameValueStats {name = "Previous than 3.4.99.0", Value = nvs.Value});
else versions.Add(nvs);
versions.Add(nvs.name == "previous"
? new NameValueStats {name = "Previous than 3.4.99.0", Value = nvs.Value}
: nvs);
repVersions.DataSource = versions.OrderBy(ver => ver.name).ToList();
repVersions.DataBind();
@@ -185,12 +185,9 @@ namespace DiscImageChef.Server
virtualMedia = new List<MediaItem>();
foreach(MediaStats nvs in statistics.Medias)
{
string type;
string subtype;
MediaType
.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});
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++)
{
@@ -295,7 +292,7 @@ namespace DiscImageChef.Server
}
catch(IOException)
{
if(fs != null) fs.Dispose();
fs?.Dispose();
Thread.Sleep(50);
}
}

View File

@@ -1,4 +1,5 @@
<%@ Page Language="C#" %>
<%@ Register TagPrefix="velyo" Namespace="Velyo.AspNet.Markdown" Assembly="Velyo.AspNet.Markdown" %>
<%--
// /***************************************************************************
// The Disc Image Chef
@@ -36,7 +37,7 @@
<html>
<meta charset="UTF-8">
<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>
</head>
<body id="body" runat="server">

View File

@@ -36,7 +36,7 @@
<html>
<meta charset="UTF-8">
<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>
</head>
<body id="content" runat="server">

View File

@@ -102,10 +102,8 @@ namespace DiscImageChef.Server
if(report.USB != null)
{
string usbVendorDescription;
string usbProductDescription;
GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out usbVendorDescription,
out usbProductDescription);
GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out string usbVendorDescription,
out string usbProductDescription);
lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer);
lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product);
@@ -149,7 +147,7 @@ namespace DiscImageChef.Server
case TupleCodes.CISTPL_DEVICEGEO_A:
DeviceGeometryTuple geom =
CIS.DecodeDeviceGeometryTuple(tuple.Data);
if(geom != null && geom.Geometries != null)
if(geom?.Geometries != null)
foreach(DeviceGeometry geometry in geom.Geometries)
{
decodedTuples.Add("Device width",
@@ -259,11 +257,8 @@ namespace DiscImageChef.Server
Dictionary<string, string> modePages = new Dictionary<string, string>();
Dictionary<string, string> evpdPages = new Dictionary<string, string>();
if(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;
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;
@@ -330,17 +325,11 @@ namespace DiscImageChef.Server
{
divScsiSsc.Visible = true;
if(report.SCSI.SequentialDevice.BlockSizeGranularitySpecified)
lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularity.ToString();
else lblScsiSscGranularity.Text = "Unspecified";
lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularitySpecified ? report.SCSI.SequentialDevice.BlockSizeGranularity.ToString() : "Unspecified";
if(report.SCSI.SequentialDevice.MaxBlockLengthSpecified)
lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLength.ToString();
else lblScsiSscMaxBlock.Text = "Unspecified";
lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLengthSpecified ? report.SCSI.SequentialDevice.MaxBlockLength.ToString() : "Unspecified";
if(report.SCSI.SequentialDevice.MinBlockLengthSpecified)
lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLength.ToString();
else lblScsiSscMinBlock.Text = "Unspecified";
lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLengthSpecified ? report.SCSI.SequentialDevice.MinBlockLength.ToString() : "Unspecified";
if(report.SCSI.SequentialDevice.SupportedDensities != null)
{
@@ -530,39 +519,38 @@ namespace DiscImageChef.Server
StreamReader tocStream =
new StreamReader(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "usb.ids"));
string _line;
bool inManufacturer = false;
ushort number;
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)
{
// 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;
productDescription = _line.Substring(7);
productDescription = line.Substring(7);
return;
}
// 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; }
if(number != vendor) continue;
vendorDescription = _line.Substring(6);
vendorDescription = line.Substring(6);
inManufacturer = true;
}
}