Files
Aaru.Server/DiscImageChef.Server/Controllers/ReportController.cs

537 lines
25 KiB
C#
Raw Normal View History

2019-11-02 01:40:41 +00:00
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ReportController.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : DiscImageChef Server.
//
// --[ Description ] ----------------------------------------------------------
//
// Fetches reports from database for Razor views.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Server.Models;
2019-11-02 21:01:25 +00:00
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
2019-11-02 23:52:33 +00:00
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
2019-11-02 01:40:41 +00:00
namespace DiscImageChef.Server.Controllers
{
public class ReportController : Controller
{
2019-11-02 23:52:33 +00:00
readonly DicServerContext _ctx;
2019-11-02 21:01:25 +00:00
2019-11-02 23:52:33 +00:00
public ReportController(DicServerContext context) => _ctx = context;
2019-11-02 21:01:25 +00:00
2019-11-02 23:52:33 +00:00
public ActionResult Index() => RedirectToAction("View", "Report", new RouteValueDictionary
2019-11-02 21:37:09 +00:00
{
2019-11-02 23:52:33 +00:00
{
"id", 1
}
});
2019-11-02 01:40:41 +00:00
public ActionResult View(int? id)
{
2019-11-02 23:52:33 +00:00
if(id == null ||
id <= 0)
return Content("Incorrect device report request");
2019-11-02 01:40:41 +00:00
try
{
2019-11-02 23:52:33 +00:00
Device report = _ctx.Devices.FirstOrDefault(d => d.Id == id);
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report is null)
return Content("Cannot find requested report");
2019-11-02 01:40:41 +00:00
ViewBag.lblManufacturer = report.Manufacturer;
2019-11-02 23:52:33 +00:00
ViewBag.lblModel = report.Model;
ViewBag.lblRevision = report.Revision;
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.USB != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
string usbVendorDescription = null;
2019-11-02 01:40:41 +00:00
string usbProductDescription = null;
2019-11-02 23:52:33 +00:00
UsbProduct dbProduct =
_ctx.UsbProducts.FirstOrDefault(p => p.ProductId == report.USB.ProductID &&
p.Vendor != null &&
2019-11-02 21:37:09 +00:00
p.Vendor.VendorId == report.USB.VendorID);
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(dbProduct is null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
UsbVendor dbVendor = _ctx.UsbVendors.FirstOrDefault(v => v.VendorId == report.USB.VendorID);
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(!(dbVendor is null))
usbVendorDescription = dbVendor.Vendor;
2019-11-02 01:40:41 +00:00
}
else
{
usbProductDescription = dbProduct.Product;
2019-11-02 23:52:33 +00:00
usbVendorDescription = dbProduct.Vendor.Vendor;
2019-11-02 01:40:41 +00:00
}
ViewBag.UsbItem = new Item
{
2019-11-02 23:52:33 +00:00
Manufacturer = report.USB.Manufacturer, Product = report.USB.Product,
VendorDescription = usbVendorDescription != null
? $"0x{report.USB.VendorID:x4} ({usbVendorDescription})"
: $"0x{report.USB.VendorID:x4}",
2019-11-02 01:40:41 +00:00
ProductDescription = usbProductDescription != null
2019-11-02 23:52:33 +00:00
? $"0x{report.USB.ProductID:x4} ({usbProductDescription})"
: $"0x{report.USB.ProductID:x4}"
2019-11-02 01:40:41 +00:00
};
}
2019-11-02 23:52:33 +00:00
if(report.FireWire != null)
2019-11-02 01:40:41 +00:00
ViewBag.FireWireItem = new Item
{
2019-11-02 23:52:33 +00:00
Manufacturer = report.FireWire.Manufacturer, Product = report.FireWire.Product,
VendorDescription = $"0x{report.FireWire.VendorID:x8}",
2019-11-02 01:40:41 +00:00
ProductDescription = $"0x{report.FireWire.ProductID:x8}"
};
2019-11-02 23:52:33 +00:00
if(report.PCMCIA != null)
2019-11-02 01:40:41 +00:00
{
ViewBag.PcmciaItem = new PcmciaItem
{
2019-11-02 23:52:33 +00:00
Manufacturer = report.PCMCIA.Manufacturer, Product = report.PCMCIA.ProductName,
VendorDescription = $"0x{report.PCMCIA.ManufacturerCode:x4}",
ProductDescription = $"0x{report.PCMCIA.CardCode:x4}", Compliance = report.PCMCIA.Compliance
2019-11-02 01:40:41 +00:00
};
2019-11-02 23:52:33 +00:00
Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS);
if(tuples != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
Dictionary<string, string> decodedTuples = new Dictionary<string, string>();
foreach(Tuple tuple in tuples)
switch(tuple.Code)
2019-11-02 01:40:41 +00:00
{
case TupleCodes.CISTPL_NULL:
case TupleCodes.CISTPL_END:
case TupleCodes.CISTPL_MANFID:
case TupleCodes.CISTPL_VERS_1: break;
case TupleCodes.CISTPL_DEVICEGEO:
case TupleCodes.CISTPL_DEVICEGEO_A:
2019-11-02 23:52:33 +00:00
DeviceGeometryTuple geom = CIS.DecodeDeviceGeometryTuple(tuple.Data);
if(geom?.Geometries != null)
foreach(DeviceGeometry geometry in geom.Geometries)
2019-11-02 01:40:41 +00:00
{
decodedTuples.Add("Device width",
2019-11-02 23:52:33 +00:00
$"{(1 << (geometry.CardInterface - 1)) * 8} bits");
2019-11-02 01:40:41 +00:00
decodedTuples.Add("Erase block",
2019-11-02 23:52:33 +00:00
$"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
2019-11-02 01:40:41 +00:00
decodedTuples.Add("Read block",
2019-11-02 23:52:33 +00:00
$"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
2019-11-02 01:40:41 +00:00
decodedTuples.Add("Write block",
2019-11-02 23:52:33 +00:00
$"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes");
2019-11-02 01:40:41 +00:00
decodedTuples.Add("Partition alignment",
2019-11-02 23:52:33 +00:00
$"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes");
2019-11-02 01:40:41 +00:00
}
break;
case TupleCodes.CISTPL_ALTSTR:
case TupleCodes.CISTPL_BAR:
case TupleCodes.CISTPL_BATTERY:
case TupleCodes.CISTPL_BYTEORDER:
case TupleCodes.CISTPL_CFTABLE_ENTRY:
case TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
case TupleCodes.CISTPL_CHECKSUM:
case TupleCodes.CISTPL_CONFIG:
case TupleCodes.CISTPL_CONFIG_CB:
case TupleCodes.CISTPL_DATE:
case TupleCodes.CISTPL_DEVICE:
case TupleCodes.CISTPL_DEVICE_A:
case TupleCodes.CISTPL_DEVICE_OA:
case TupleCodes.CISTPL_DEVICE_OC:
case TupleCodes.CISTPL_EXTDEVIC:
case TupleCodes.CISTPL_FORMAT:
case TupleCodes.CISTPL_FORMAT_A:
case TupleCodes.CISTPL_FUNCE:
case TupleCodes.CISTPL_FUNCID:
case TupleCodes.CISTPL_GEOMETRY:
case TupleCodes.CISTPL_INDIRECT:
case TupleCodes.CISTPL_JEDEC_A:
case TupleCodes.CISTPL_JEDEC_C:
case TupleCodes.CISTPL_LINKTARGET:
case TupleCodes.CISTPL_LONGLINK_A:
case TupleCodes.CISTPL_LONGLINK_C:
case TupleCodes.CISTPL_LONGLINK_CB:
case TupleCodes.CISTPL_LONGLINK_MFC:
case TupleCodes.CISTPL_NO_LINK:
case TupleCodes.CISTPL_ORG:
case TupleCodes.CISTPL_PWR_MGMNT:
case TupleCodes.CISTPL_SPCL:
case TupleCodes.CISTPL_SWIL:
case TupleCodes.CISTPL_VERS_2:
decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString());
2019-11-02 23:52:33 +00:00
2019-11-02 01:40:41 +00:00
break;
default:
2019-11-02 23:52:33 +00:00
decodedTuples.Add("Unknown tuple ID", $"0x{(byte)tuple.Code:X2}");
2019-11-02 01:40:41 +00:00
break;
}
2019-11-02 23:52:33 +00:00
if(decodedTuples.Count > 0)
ViewBag.repPcmciaTuples = decodedTuples;
2019-11-02 01:40:41 +00:00
}
}
2019-11-02 23:52:33 +00:00
bool removable = true;
2019-11-02 01:40:41 +00:00
List<TestedMedia> testedMedia = null;
2019-11-02 23:52:33 +00:00
bool ata = false;
bool atapi = false;
bool sscMedia = false;
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.ATA != null ||
report.ATAPI != null)
2019-11-02 01:40:41 +00:00
{
ata = true;
2019-11-02 23:52:33 +00:00
List<string> ataOneValue = new List<string>();
Dictionary<string, string> ataTwoValue = new Dictionary<string, string>();
CommonTypes.Metadata.Ata ataReport;
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.ATAPI != null)
2019-11-02 01:40:41 +00:00
{
ViewBag.AtaItem = "ATAPI";
2019-11-02 23:52:33 +00:00
ataReport = report.ATAPI;
atapi = true;
2019-11-02 01:40:41 +00:00
}
else
{
ViewBag.AtaItem = "ATA";
2019-11-02 23:52:33 +00:00
ataReport = report.ATA;
2019-11-02 01:40:41 +00:00
}
2019-11-02 23:52:33 +00:00
bool cfa = report.CompactFlash;
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(atapi && !cfa)
ViewBag.lblAtaDeviceType = "ATAPI device";
else if(!atapi && cfa)
ViewBag.lblAtaDeviceType = "CompactFlash device";
else
ViewBag.lblAtaDeviceType = "ATA device";
2019-11-02 01:40:41 +00:00
Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia);
ViewBag.repAtaOne = ataOneValue;
ViewBag.repAtaTwo = ataTwoValue;
}
2019-11-02 23:52:33 +00:00
if(report.SCSI != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
List<string> scsiOneValue = new List<string>();
Dictionary<string, string> modePages = new Dictionary<string, string>();
Dictionary<string, string> evpdPages = new Dictionary<string, string>();
string vendorId = StringHandlers.CToString(report.SCSI.Inquiry?.VendorIdentification);
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.SCSI.Inquiry != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
Inquiry.SCSIInquiry inq = report.SCSI.Inquiry.Value;
2019-11-02 01:40:41 +00:00
ViewBag.lblScsiVendor = VendorString.Prettify(vendorId) != vendorId
2019-11-02 23:52:33 +00:00
? $"{vendorId} ({VendorString.Prettify(vendorId)})" : vendorId;
ViewBag.lblScsiProduct = StringHandlers.CToString(inq.ProductIdentification);
2019-11-02 01:40:41 +00:00
ViewBag.lblScsiRevision = StringHandlers.CToString(inq.ProductRevisionLevel);
}
scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry));
2019-11-02 23:52:33 +00:00
if(report.SCSI.SupportsModeSense6)
scsiOneValue.Add("Device supports MODE SENSE (6)");
if(report.SCSI.SupportsModeSense10)
scsiOneValue.Add("Device supports MODE SENSE (10)");
if(report.SCSI.SupportsModeSubpages)
scsiOneValue.Add("Device supports MODE SENSE subpages");
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.SCSI.ModeSense != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 21:37:09 +00:00
var devType = PeripheralDeviceTypes.DirectAccess;
2019-11-02 23:52:33 +00:00
if(report.SCSI.Inquiry != null)
devType = (PeripheralDeviceTypes)report.SCSI.Inquiry.Value.PeripheralDeviceType;
2019-11-02 01:40:41 +00:00
ScsiModeSense.Report(report.SCSI.ModeSense, vendorId, devType, ref scsiOneValue, ref modePages);
}
2019-11-02 23:52:33 +00:00
if(modePages.Count > 0)
ViewBag.repModeSense = modePages;
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.SCSI.EVPDPages != null)
ScsiEvpd.Report(report.SCSI.EVPDPages, vendorId, ref evpdPages);
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(evpdPages.Count > 0)
ViewBag.repEvpd = evpdPages;
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.SCSI.MultiMediaDevice != null)
2019-11-02 01:40:41 +00:00
{
testedMedia = report.SCSI.MultiMediaDevice.TestedMedia;
2019-11-02 23:52:33 +00:00
if(report.SCSI.MultiMediaDevice.ModeSense2A != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
List<string> mmcModeOneValue = new List<string>();
2019-11-02 01:40:41 +00:00
ScsiMmcMode.Report(report.SCSI.MultiMediaDevice.ModeSense2A, ref mmcModeOneValue);
2019-11-02 23:52:33 +00:00
if(mmcModeOneValue.Count > 0)
ViewBag.repScsiMmcMode = mmcModeOneValue;
2019-11-02 01:40:41 +00:00
}
2019-11-02 23:52:33 +00:00
if(report.SCSI.MultiMediaDevice.Features != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
List<string> mmcFeaturesOneValue = new List<string>();
2019-11-02 01:40:41 +00:00
ScsiMmcFeatures.Report(report.SCSI.MultiMediaDevice.Features, ref mmcFeaturesOneValue);
2019-11-02 23:52:33 +00:00
if(mmcFeaturesOneValue.Count > 0)
ViewBag.repScsiMmcFeatures = mmcFeaturesOneValue;
2019-11-02 01:40:41 +00:00
}
}
2019-11-02 23:52:33 +00:00
else if(report.SCSI.SequentialDevice != null)
2019-11-02 01:40:41 +00:00
{
ViewBag.divScsiSscVisible = true;
ViewBag.lblScsiSscGranularity =
report.SCSI.SequentialDevice.BlockSizeGranularity?.ToString() ?? "Unspecified";
ViewBag.lblScsiSscMaxBlock =
report.SCSI.SequentialDevice.MaxBlockLength?.ToString() ?? "Unspecified";
ViewBag.lblScsiSscMinBlock =
report.SCSI.SequentialDevice.MinBlockLength?.ToString() ?? "Unspecified";
2019-11-02 23:52:33 +00:00
if(report.SCSI.SequentialDevice.SupportedDensities != null)
2019-11-02 01:40:41 +00:00
ViewBag.repScsiSscDensities = report.SCSI.SequentialDevice.SupportedDensities;
2019-11-02 23:52:33 +00:00
if(report.SCSI.SequentialDevice.SupportedMediaTypes != null)
2019-11-02 01:40:41 +00:00
ViewBag.repScsiSscMedias = report.SCSI.SequentialDevice.SupportedMediaTypes;
2019-11-02 23:52:33 +00:00
if(report.SCSI.SequentialDevice.TestedMedia != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
List<string> mediaOneValue = new List<string>();
2019-11-02 01:40:41 +00:00
SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue);
2019-11-02 23:52:33 +00:00
if(mediaOneValue.Count > 0)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
sscMedia = true;
2019-11-02 01:40:41 +00:00
ViewBag.repTestedMedia = mediaOneValue;
}
}
}
2019-11-02 23:52:33 +00:00
else if(report.SCSI.ReadCapabilities != null)
2019-11-02 01:40:41 +00:00
{
removable = false;
scsiOneValue.Add("");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.Blocks.HasValue &&
report.SCSI.ReadCapabilities.BlockSize.HasValue)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
scsiOneValue.
Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each");
if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 /
1024 > 1000000)
scsiOneValue.
Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB");
else if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize /
1024 /
1024 > 1000)
scsiOneValue.
Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB");
2019-11-02 01:40:41 +00:00
else
2019-11-02 23:52:33 +00:00
scsiOneValue.
Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB");
2019-11-02 01:40:41 +00:00
}
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.MediumType.HasValue)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add($"Medium type code: {report.SCSI.ReadCapabilities.MediumType:X2}h");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.Density.HasValue)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add($"Density code: {report.SCSI.ReadCapabilities.Density:X2}h");
2019-11-02 23:52:33 +00:00
if((report.SCSI.ReadCapabilities.SupportsReadLong == true ||
report.SCSI.ReadCapabilities.SupportsReadLong16 == true) &&
report.SCSI.ReadCapabilities.LongBlockSize.HasValue)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add($"Long block size: {report.SCSI.ReadCapabilities.LongBlockSize} bytes");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsReadCapacity == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ CAPACITY (10) command.");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsReadCapacity16 == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ CAPACITY (16) command.");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsRead6 == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ (6) command.");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsRead10 == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ (10) command.");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsRead12 == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ (12) command.");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsRead16 == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ (16) command.");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsReadLong == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ LONG (10) command.");
2019-11-02 23:52:33 +00:00
if(report.SCSI.ReadCapabilities.SupportsReadLong16 == true)
2019-11-02 01:40:41 +00:00
scsiOneValue.Add("Device supports READ LONG (16) command.");
}
2019-11-02 21:37:09 +00:00
else
{
testedMedia = report.SCSI.RemovableMedias;
}
2019-11-02 01:40:41 +00:00
ViewBag.repScsi = scsiOneValue;
}
2019-11-02 23:52:33 +00:00
if(report.MultiMediaCard != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
List<string> mmcOneValue = new List<string>();
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.MultiMediaCard.CID != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCID(report.MultiMediaCard.CID).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
mmcOneValue.Add("");
}
2019-11-02 23:52:33 +00:00
if(report.MultiMediaCard.CSD != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.CSD).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
mmcOneValue.Add("");
}
2019-11-02 23:52:33 +00:00
if(report.MultiMediaCard.ExtendedCSD != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyExtendedCSD(report.MultiMediaCard.ExtendedCSD).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
mmcOneValue.Add("");
}
2019-11-02 23:52:33 +00:00
if(report.MultiMediaCard.OCR != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
mmcOneValue.Add(Decoders.MMC.Decoders.PrettifyCSD(report.MultiMediaCard.OCR).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
mmcOneValue.Add("");
}
ViewBag.repMMC = mmcOneValue;
}
2019-11-02 23:52:33 +00:00
if(report.SecureDigital != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
List<string> sdOneValue = new List<string>();
2019-11-02 01:40:41 +00:00
2019-11-02 23:52:33 +00:00
if(report.SecureDigital.CID != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCID(report.SecureDigital.CID).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
sdOneValue.Add("");
}
2019-11-02 23:52:33 +00:00
if(report.SecureDigital.CSD != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.CSD).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
sdOneValue.Add("");
}
2019-11-02 23:52:33 +00:00
if(report.SecureDigital.SCR != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifySCR(report.SecureDigital.SCR).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
sdOneValue.Add("");
}
2019-11-02 23:52:33 +00:00
if(report.SecureDigital.OCR != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
sdOneValue.Add(Decoders.SecureDigital.Decoders.PrettifyCSD(report.SecureDigital.OCR).
Replace("\n", "<br/>"));
2019-11-02 01:40:41 +00:00
sdOneValue.Add("");
}
ViewBag.repSD = sdOneValue;
}
2019-11-02 23:52:33 +00:00
if(removable &&
!sscMedia &&
testedMedia != null)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
List<string> mediaOneValue = new List<string>();
2019-11-02 01:40:41 +00:00
App_Start.TestedMedia.Report(testedMedia, ref mediaOneValue);
2019-11-02 23:52:33 +00:00
if(mediaOneValue.Count > 0)
ViewBag.repTestedMedia = mediaOneValue;
2019-11-02 01:40:41 +00:00
}
}
2019-11-02 23:52:33 +00:00
catch(Exception)
2019-11-02 01:40:41 +00:00
{
2019-11-02 23:52:33 +00:00
#if DEBUG
2019-11-02 01:40:41 +00:00
throw;
2019-11-02 23:52:33 +00:00
#endif
2019-11-02 01:40:41 +00:00
return Content("Could not load device report");
}
return View();
}
}
public class Item
{
public string Manufacturer;
public string Product;
public string ProductDescription;
public string VendorDescription;
}
public class PcmciaItem : Item
{
public string Compliance;
}
}