REFACTOR: Use preferred braces style.

This commit is contained in:
2017-12-21 00:44:33 +00:00
parent e9443388ee
commit bce69c9161
171 changed files with 5 additions and 1412 deletions

View File

@@ -268,9 +268,7 @@ namespace DiscImageChef.Server.App_Start
}
if(inquiry.VersionDescriptors != null)
{
foreach(ushort VersionDescriptor in inquiry.VersionDescriptors)
{
switch(VersionDescriptor)
{
case 0xFFFF:
@@ -1701,8 +1699,6 @@ namespace DiscImageChef.Server.App_Start
VersionDescriptor));
break;
}
}
}
return scsiOneValue;
}

View File

@@ -111,22 +111,16 @@ namespace DiscImageChef.Server.App_Start
}
if(mode.ReadsCDRW)
{
if(mode.WritesCDRW) mmcOneValue.Add("Drive can read and write CD-RW");
else mmcOneValue.Add("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");
}
if(mode.ReadsDVDRAM)
{
if(mode.WritesDVDRAM) mmcOneValue.Add("Drive can read and write 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.DigitalPort1) mmcOneValue.Add("Drive supports IEC-958 digital output on port 1");
@@ -154,12 +148,9 @@ namespace DiscImageChef.Server.App_Start
}
if(mode.WriteSpeedPerformanceDescriptors != null)
{
foreach(Decoders.SCSI.Modes.ModePage_2A_WriteDescriptor descriptor in
mode.WriteSpeedPerformanceDescriptors)
{
if(descriptor.WriteSpeed > 0)
{
if(descriptor.RotationControl == 0)
mmcOneValue.Add(string.Format("Drive supports writing at {0} Kbyte/sec. in CLV mode",
descriptor.WriteSpeed));
@@ -167,9 +158,6 @@ namespace DiscImageChef.Server.App_Start
mmcOneValue
.Add(string.Format("Drive supports writing at is {0} Kbyte/sec. in pure CAV mode",
descriptor.WriteSpeed));
}
}
}
if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing");

View File

@@ -45,20 +45,15 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add(string.Format("Medium type is {0:X2}h", modeSense.MediumType));
if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected.");
if(modeSense.BlockDescriptors != null)
{
foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors)
{
if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified)
scsiOneValue.Add(string.Format("Density code {0:X2}h has {1} blocks of {2} bytes each",
descriptor.Density, descriptor.Blocks, descriptor.BlockLength));
else scsiOneValue.Add(string.Format("Density code {0:X2}h", descriptor.Density));
}
}
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)
{
switch(modeSense.BufferedMode)
{
case 0:
@@ -74,12 +69,10 @@ namespace DiscImageChef.Server.App_Start
scsiOneValue.Add(string.Format("Unknown buffered mode code 0x{0:X2}", modeSense.BufferedMode));
break;
}
}
if(modeSense.ModePages != null)
{
foreach(modePageType page in modeSense.ModePages)
{
switch(page.page)
{
case 0x00:
@@ -102,14 +95,12 @@ namespace DiscImageChef.Server.App_Start
case 0x01:
{
if(page.subpage == 0)
{
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_01_MMC(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_01(page.value));
}
else goto default;
break;
@@ -162,14 +153,12 @@ namespace DiscImageChef.Server.App_Start
case 0x07:
{
if(page.subpage == 0)
{
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_07_MMC(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_07(page.value));
}
else goto default;
break;
@@ -234,14 +223,12 @@ namespace DiscImageChef.Server.App_Start
case 0x10:
{
if(page.subpage == 0)
{
if(deviceType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_10_SSC(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_10(page.value));
}
else goto default;
break;
@@ -290,14 +277,12 @@ namespace DiscImageChef.Server.App_Start
case 0x1C:
{
if(page.subpage == 0)
{
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_1C_SFF(page.value));
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_1C(page.value));
}
else if(page.subpage == 1)
modePages.Add(string.Format("MODE page {0:X2}h", page.page),
Modes.PrettifyModePage_1C_S01(page.value));
@@ -419,14 +404,11 @@ namespace DiscImageChef.Server.App_Start
}
break;
}
}
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/>"));
}
modePages = newModePages;
}

View File

@@ -76,31 +76,25 @@ namespace DiscImageChef.Server.App_Start
testedMedia.BlockSize));
if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000)
{
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Tb, {2:F2} TiB",
testedMedia.Blocks * testedMedia.BlockSize,
testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 /
1000 / 1000,
(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 /
1024 / 1024 / 1024));
}
else if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000)
{
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Gb, {2:F2} GiB",
testedMedia.Blocks * testedMedia.BlockSize,
testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 /
1000,
(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 /
1024 / 1024));
}
else
{
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Mb, {2:F2} MiB",
testedMedia.Blocks * testedMedia.BlockSize,
testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000,
(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 /
1024));
}
}
if(testedMedia.CHS != null && testedMedia.CurrentCHS != null)
@@ -142,32 +136,26 @@ namespace DiscImageChef.Server.App_Start
testedMedia.LBASectors));
if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
{
mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB",
(ulong)testedMedia.LBASectors * testedMedia.BlockSize,
(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 /
1000 / 1000 / 1000,
(double)((ulong)testedMedia.LBASectors *
testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024));
}
else if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
{
mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB",
(ulong)testedMedia.LBASectors * testedMedia.BlockSize,
(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 /
1000 / 1000,
(double)((ulong)testedMedia.LBASectors *
testedMedia.BlockSize) / 1024 / 1024 / 1024));
}
else
{
mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB",
(ulong)testedMedia.LBASectors * testedMedia.BlockSize,
(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 /
1000,
(double)((ulong)testedMedia.LBASectors *
testedMedia.BlockSize) / 1024 / 1024));
}
}
if(testedMedia.LBA48SectorsSpecified)
@@ -176,49 +164,39 @@ namespace DiscImageChef.Server.App_Start
testedMedia.LBA48Sectors));
if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000)
{
mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB",
testedMedia.LBA48Sectors * testedMedia.BlockSize,
testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 /
1000 / 1000 / 1000,
(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) /
1024 / 1024 / 1024 / 1024));
}
else if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000)
{
mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB",
testedMedia.LBA48Sectors * testedMedia.BlockSize,
testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 /
1000 / 1000,
(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) /
1024 / 1024 / 1024));
}
else
{
mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB",
testedMedia.LBA48Sectors * testedMedia.BlockSize,
testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 /
1000,
(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) /
1024 / 1024));
}
}
if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 &&
testedMedia.NominalRotationRate != 0xFFFF)
{
if(testedMedia.NominalRotationRate == 0x0001) mediaOneValue.Add("Medium does not rotate.");
else mediaOneValue.Add(string.Format("Medium rotates at {0} rpm", testedMedia.NominalRotationRate));
}
if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified &&
testedMedia.BlockSize != testedMedia.PhysicalBlockSize &&
(testedMedia.LogicalAlignment & 0x8000) == 0x0000 &&
(testedMedia.LogicalAlignment & 0x4000) == 0x4000)
{
mediaOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector",
testedMedia.LogicalAlignment & 0x3FFF));
}
if(testedMedia.SupportsRead && ata)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium");

View File

@@ -98,7 +98,6 @@ namespace DiscImageChef.Server
{
operatingSystems = new List<NameValueStats>();
foreach(OsStats nvs in statistics.OperatingSystems)
{
operatingSystems.Add(new NameValueStats
{
name = string.Format("{0}{1}{2}",
@@ -108,7 +107,6 @@ namespace DiscImageChef.Server
string.IsNullOrEmpty(nvs.version) ? "" : " ", nvs.version),
Value = nvs.Value
});
}
repOperatingSystems.DataSource = operatingSystems.OrderBy(os => os.name).ToList();
repOperatingSystems.DataBind();
@@ -119,11 +117,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);
}
repVersions.DataSource = versions.OrderBy(ver => ver.name).ToList();
repVersions.DataBind();

View File

@@ -54,25 +54,19 @@ namespace DiscImageChef.Server
// 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) &&
@@ -113,16 +107,12 @@ namespace DiscImageChef.Server
lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product);
lblUsbVendor.Text = string.Format("0x{0:x4}", report.USB.VendorID);
if(usbVendorDescription != null)
{
lblUsbVendorDescription.Text =
string.Format("({0})", HttpUtility.HtmlEncode(usbVendorDescription));
}
lblUsbProductId.Text = string.Format("0x{0:x4}", report.USB.ProductID);
if(usbProductDescription != null)
{
lblUsbProductDescription.Text =
string.Format("({0})", HttpUtility.HtmlEncode(usbProductDescription));
}
}
else divUsb.Visible = false;
@@ -147,7 +137,6 @@ namespace DiscImageChef.Server
{
Dictionary<string, string> decodedTuples = new Dictionary<string, string>();
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
{
switch(tuple.Code)
{
case Decoders.PCMCIA.TupleCodes.CISTPL_NULL:
@@ -159,7 +148,6 @@ namespace DiscImageChef.Server
Decoders.PCMCIA.DeviceGeometryTuple geom =
Decoders.PCMCIA.CIS.DecodeDeviceGeometryTuple(tuple.Data);
if(geom != null && geom.Geometries != null)
{
foreach(Decoders.PCMCIA.DeviceGeometry geometry in geom.Geometries)
{
decodedTuples.Add("Device width",
@@ -183,7 +171,6 @@ namespace DiscImageChef.Server
(1 << (geometry.Interleaving - 1)) *
(1 << (geometry.Partitions - 1))));
}
}
break;
case Decoders.PCMCIA.TupleCodes.CISTPL_ALTSTR:
@@ -226,7 +213,6 @@ namespace DiscImageChef.Server
decodedTuples.Add("Unknown tuple ID", string.Format("0x{0:X2}", (byte)tuple.Code));
break;
}
}
if(decodedTuples.Count > 0)
{
@@ -283,11 +269,9 @@ namespace DiscImageChef.Server
if(VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) !=
report.SCSI.Inquiry.VendorIdentification)
{
lblScsiVendor.Text = string.Format("{0} ({1})", report.SCSI.Inquiry.VendorIdentification,
VendorString.Prettify(report.SCSI.Inquiry
.VendorIdentification));
}
else lblScsiVendor.Text = report.SCSI.Inquiry.VendorIdentification;
lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification;
lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel;
@@ -299,10 +283,8 @@ 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);
}
if(modePages.Count > 0)
{
@@ -411,7 +393,6 @@ namespace DiscImageChef.Server
if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 /
1024 > 1000000)
{
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Tb, {2:F2} TiB",
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize,
@@ -421,11 +402,9 @@ namespace DiscImageChef.Server
(double)(report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
1024 / 1024 / 1024));
}
else if(
report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 /
1024 > 1000)
{
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Gb, {2:F2} GiB",
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize,
@@ -435,9 +414,7 @@ namespace DiscImageChef.Server
(double)(report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
1024 / 1024));
}
else
{
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Mb, {2:F2} MiB",
report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize,
@@ -446,26 +423,19 @@ namespace DiscImageChef.Server
(double)(report.SCSI.ReadCapabilities.Blocks *
report.SCSI.ReadCapabilities.BlockSize) / 1024 /
1024));
}
}
if(report.SCSI.ReadCapabilities.MediumTypeSpecified)
{
scsiOneValue.Add(string.Format("Medium type code: {0:X2}h",
report.SCSI.ReadCapabilities.MediumType));
}
if(report.SCSI.ReadCapabilities.DensitySpecified)
{
scsiOneValue.Add(string.Format("Density code: {0:X2}h",
report.SCSI.ReadCapabilities.Density));
}
if((report.SCSI.ReadCapabilities.SupportsReadLong ||
report.SCSI.ReadCapabilities.SupportsReadLong16) &&
report.SCSI.ReadCapabilities.LongBlockSizeSpecified)
{
scsiOneValue.Add(string.Format("Long block size: {0} bytes",
report.SCSI.ReadCapabilities.LongBlockSize));
}
if(report.SCSI.ReadCapabilities.SupportsReadCapacity)
scsiOneValue.Add("Device supports READ CAPACITY (10) command.");
if(report.SCSI.ReadCapabilities.SupportsReadCapacity16)