Added server side code for creating

http://discimagechef.claunia.com with statistics and device
	reports.
This commit is contained in:
2017-06-03 01:19:47 +01:00
parent 64e95a31f9
commit 39e72a1cf9
24 changed files with 4988 additions and 1008 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -36,12 +36,59 @@
// ****************************************************************************/
// //$Id$
using System;
using System.Collections.Generic;
using DiscImageChef.Metadata;
namespace DiscImageChef.Server.App_Start
{
public class ScsiEvpd
public static class ScsiEvpd
{
public ScsiEvpd()
public static void Report(pageType[] pages, string vendor, ref Dictionary<string, string> evpdPages)
{
foreach(pageType evpd in pages)
{
if(evpd.page >= 0x01 && evpd.page <= 0x7F)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.DecodeASCIIPage(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0x81)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_81(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0x82)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.DecodePage82(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0x83)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_83(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0x84)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_84(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0x85)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_85(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0x86)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_86(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0x89)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_89(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0xB0)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_B0(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0xB2)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), string.Format("TapeAlert Supported Flags Bitmap: 0x{0:X16}<br/>", Decoders.SCSI.EVPD.DecodePageB2(evpd.value)));
else if(evpd.page == 0xB4)
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.DecodePageB4(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0xC0 && vendor.Trim() == "quantum")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_C0_Quantum(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0xC0 && vendor.Trim() == "seagate")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_C0_Seagate(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0xC0 && vendor.Trim() == "ibm")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_C0_IBM(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0xC1 && vendor.Trim() == "ibm")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_C1_IBM(evpd.value).Replace("\n", "<br/>"));
else if((evpd.page == 0xC0 || evpd.page == 0xC1) && vendor.Trim() == "certance")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_C0_C1_Certance(evpd.value).Replace("\n", "<br/>"));
else if((evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5 || evpd.page == 0xC6) &&
vendor.Trim() == "certance")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_C2_C3_C4_C5_C6_Certance(evpd.value).Replace("\n", "<br/>"));
else if((evpd.page == 0xC0 || evpd.page == 0xC1 || evpd.page == 0xC2 || evpd.page == 0xC3 || evpd.page == 0xC4 || evpd.page == 0xC5) &&
vendor.Trim() == "hp")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_C0_to_C5_HP(evpd.value).Replace("\n", "<br/>"));
else if(evpd.page == 0xDF && vendor.Trim() == "certance")
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), Decoders.SCSI.EVPD.PrettifyPage_DF_Certance(evpd.value).Replace("\n", "<br/>"));
else
evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), "Undecoded");
}
}
}
}

View File

@@ -36,12 +36,346 @@
// ****************************************************************************/
// //$Id$
using System;
using System.Collections.Generic;
using DiscImageChef.Decoders.SCSI.MMC;
using DiscImageChef.Metadata;
namespace DiscImageChef.Server.App_Start
{
public class ScsiMmcFeatures
public static class ScsiMmcFeatures
{
public ScsiMmcFeatures()
public static void Report(mmcFeaturesType ftr, ref List<string> mmcOneValue)
{
if(ftr.SupportsAACS && ftr.AACSVersionSpecified)
mmcOneValue.Add(string.Format("Drive supports AACS version {0}", ftr.AACSVersion));
else if(ftr.SupportsAACS)
mmcOneValue.Add("Drive supports AACS");
if(ftr.AGIDsSpecified)
mmcOneValue.Add(string.Format("Drive supports {0} AGIDs concurrently", ftr.AGIDs));
if(ftr.CanGenerateBindingNonce)
{
mmcOneValue.Add("Drive supports generating the binding nonce");
if(ftr.BindingNonceBlocksSpecified)
mmcOneValue.Add(string.Format("{0} media blocks are required for the binding nonce", ftr.BindingNonceBlocks));
}
if(ftr.BlocksPerReadableUnit > 1)
mmcOneValue.Add(string.Format("{0} logical blocks per media writable unit", ftr.BlocksPerReadableUnit));
if(ftr.BufferUnderrunFreeInDVD)
mmcOneValue.Add("Drive supports zero loss linking writing DVDs");
if(ftr.BufferUnderrunFreeInSAO)
mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode");
if(ftr.BufferUnderrunFreeInTAO)
mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode");
if(ftr.CanAudioScan)
mmcOneValue.Add("Drive supports the SCAN command");
if(ftr.CanEject)
mmcOneValue.Add("Drive can eject media");
if(ftr.CanEraseSector)
mmcOneValue.Add("Drive supports media that require erasing before writing");
if(ftr.CanExpandBDRESpareArea)
mmcOneValue.Add("Drive can expand the spare area on a formatted BD-RE disc");
if(ftr.CanFormat)
mmcOneValue.Add("Drive can format media into logical blocks");
if(ftr.CanFormatBDREWithoutSpare)
mmcOneValue.Add("Drive can format BD-RE with no spares allocated");
if(ftr.CanFormatQCert)
mmcOneValue.Add("Drive can format BD-RE discs with quick certification");
if(ftr.CanFormatCert)
mmcOneValue.Add("Drive can format BD-RE discs with full certification");
if(ftr.CanFormatFRF)
mmcOneValue.Add("Drive can fast re-format BD-RE discs");
if(ftr.CanFormatRRM)
mmcOneValue.Add("Drive can format BD-R discs with RRM format");
if(ftr.CanLoad)
mmcOneValue.Add("Drive can load media");
if(ftr.CanMuteSeparateChannels)
mmcOneValue.Add("Drive is able to mute channels separately");
if(ftr.CanOverwriteSAOTrack)
mmcOneValue.Add("Drive can overwrite a SAO track with another in CD-RWs");
if(ftr.CanOverwriteTAOTrack)
mmcOneValue.Add("Drive can overwrite a TAO track with another in CD-RWs");
if(ftr.CanPlayCDAudio)
mmcOneValue.Add("Drive has an analogue audio output");
if(ftr.CanPseudoOverwriteBDR)
mmcOneValue.Add("Drive can write BD-R on Pseudo-OVerwrite SRM mode");
if(ftr.CanReadAllDualR)
mmcOneValue.Add("Drive can read DVD-R DL from all recording modes");
if(ftr.CanReadAllDualRW)
mmcOneValue.Add("Drive can read DVD-RW DL from all recording modes");
if(ftr.CanReadBD)
mmcOneValue.Add("Drive can read BD-ROM");
if(ftr.CanReadBDR)
mmcOneValue.Add("Drive can read BD-R Ver.1");
if(ftr.CanReadBDRE1)
mmcOneValue.Add("Drive can read BD-RE Ver.1");
if(ftr.CanReadBDRE2)
mmcOneValue.Add("Drive can read BD-RE Ver.2");
if(ftr.CanReadBDROM)
mmcOneValue.Add("Drive can read BD-ROM Ver.1");
if(ftr.CanReadBluBCA)
mmcOneValue.Add("Drive can read BD's Burst Cutting Area");
if(ftr.CanReadCD)
mmcOneValue.Add("Drive can read CD-ROM");
if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write CD-MRW and DVD+MRW");
else if(ftr.CanReadDVDPlusMRW && ftr.CanWriteDVDPlusMRW)
mmcOneValue.Add("Drive can read and write DVD+MRW");
else if(ftr.CanWriteCDMRW && ftr.CanReadDVDPlusMRW)
mmcOneValue.Add("Drive and read DVD+MRW and read and write CD-MRW");
else if(ftr.CanWriteCDMRW)
mmcOneValue.Add("Drive can read and write CD-MRW");
else if(ftr.CanReadDVDPlusMRW)
mmcOneValue.Add("Drive can read CD-MRW and DVD+MRW");
else if(ftr.CanReadCDMRW)
mmcOneValue.Add("Drive can read CD-MRW");
if(ftr.CanReadCPRM_MKB)
mmcOneValue.Add("Drive supports reading Media Key Block of CPRM");
if(ftr.CanReadDDCD)
mmcOneValue.Add("Drive can read DDCDs");
if(ftr.CanReadDVD)
mmcOneValue.Add("Drive can read DVD");
if(ftr.CanWriteDVDPlusRW)
mmcOneValue.Add("Drive can read and write DVD+RW");
else if(ftr.CanReadDVDPlusRW)
mmcOneValue.Add("Drive can read DVD+RW");
if(ftr.CanWriteDVDPlusR)
mmcOneValue.Add("Drive can read and write DVD+R");
else if(ftr.CanReadDVDPlusR)
mmcOneValue.Add("Drive can read DVD+R");
if(ftr.CanWriteDVDPlusRDL)
mmcOneValue.Add("Drive can read and write DVD+R DL");
else if(ftr.CanReadDVDPlusRDL)
mmcOneValue.Add("Drive can read DVD+R DL");
if(ftr.CanReadDriveAACSCertificate)
mmcOneValue.Add("Drive supports reading the Drive Certificate");
if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM");
else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDR)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R");
else if(ftr.CanReadHDDVD && ftr.CanReadHDDVDRAM)
mmcOneValue.Add("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM");
else if(ftr.CanReadHDDVD)
mmcOneValue.Add("Drive can read HD DVD-ROM and HD DVD-RW");
if(ftr.CanReadLeadInCDText)
mmcOneValue.Add("Drive can return CD-Text from Lead-In");
if(ftr.CanReadOldBDR)
mmcOneValue.Add("Drive can read BD-R pre-1.0");
if(ftr.CanReadOldBDRE)
mmcOneValue.Add("Drive can read BD-RE pre-1.0");
if(ftr.CanReadOldBDROM)
mmcOneValue.Add("Drive can read BD-ROM pre-1.0");
if(ftr.CanReadSpareAreaInformation)
mmcOneValue.Add("Drive can return Spare Area Information");
if(ftr.CanReportDriveSerial)
mmcOneValue.Add("Drive is to report drive serial number");
if(ftr.CanReportMediaSerial)
mmcOneValue.Add("Drive is to read media serial number");
if(ftr.CanTestWriteDDCDR)
mmcOneValue.Add("Drive can do a test writing with DDCD-R");
if(ftr.CanTestWriteDVD)
mmcOneValue.Add("Drive can do a test writing with DVDs");
if(ftr.CanTestWriteInSAO)
mmcOneValue.Add("Drive can do a test writing in Session at Once Mode");
if(ftr.CanTestWriteInTAO)
mmcOneValue.Add("Drive can do a test writing in Track at Once Mode");
if(ftr.CanUpgradeFirmware)
mmcOneValue.Add("Drive supports Microcode Upgrade");
if(ftr.ErrorRecoveryPage)
mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page");
if(ftr.Locked)
mmcOneValue.Add("Drive can lock media");
if(ftr.LogicalBlockSize > 0)
mmcOneValue.Add(string.Format("{0} bytes per logical block", ftr.LogicalBlockSize));
if(ftr.MultiRead)
mmcOneValue.Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification");
switch(ftr.PhysicalInterfaceStandard)
{
case PhysicalInterfaces.Unspecified:
mmcOneValue.Add("Drive uses an unspecified physical interface");
break;
case PhysicalInterfaces.SCSI:
mmcOneValue.Add("Drive uses SCSI interface");
break;
case PhysicalInterfaces.ATAPI:
mmcOneValue.Add("Drive uses ATAPI interface");
break;
case PhysicalInterfaces.IEEE1394:
mmcOneValue.Add("Drive uses IEEE-1394 interface");
break;
case PhysicalInterfaces.IEEE1394A:
mmcOneValue.Add("Drive uses IEEE-1394A interface");
break;
case PhysicalInterfaces.FC:
mmcOneValue.Add("Drive uses Fibre Channel interface");
break;
case PhysicalInterfaces.IEEE1394B:
mmcOneValue.Add("Drive uses IEEE-1394B interface");
break;
case PhysicalInterfaces.SerialATAPI:
mmcOneValue.Add("Drive uses Serial ATAPI interface");
break;
case PhysicalInterfaces.USB:
mmcOneValue.Add("Drive uses USB interface");
break;
case PhysicalInterfaces.Vendor:
mmcOneValue.Add("Drive uses a vendor unique interface");
break;
default:
mmcOneValue.Add(string.Format("Drive uses an unknown interface with code {0}", (uint)ftr.PhysicalInterfaceStandard));
break;
}
if(ftr.PreventJumper)
mmcOneValue.Add("Drive power ups locked");
if(ftr.SupportsBusEncryption)
mmcOneValue.Add("Drive supports bus encryption");
if(ftr.CanWriteBD)
mmcOneValue.Add("Drive can write BD-R or BD-RE");
if(ftr.CanWriteBDR)
mmcOneValue.Add("Drive can write BD-R Ver.1");
if(ftr.CanWriteBDRE1)
mmcOneValue.Add("Drive can write BD-RE Ver.1");
if(ftr.CanWriteBDRE2)
mmcOneValue.Add("Drive can write BD-RE Ver.2");
if(ftr.CanWriteBusEncryptedBlocks)
mmcOneValue.Add("Drive supports writing with bus encryption");
if(ftr.CanWriteCDRW)
mmcOneValue.Add("Drive can write CD-RW");
if(ftr.CanWriteCDRWCAV)
mmcOneValue.Add("Drive can write High-Speed CD-RW");
if(ftr.CanWriteCDSAO && !ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once Mode:");
else if(!ftr.CanWriteCDSAO && ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in raw Mode:");
else if(ftr.CanWriteCDSAO && ftr.CanWriteRaw)
mmcOneValue.Add("Drive can write CDs in Session at Once and in Raw Modes:");
if(ftr.CanWriteCDTAO)
mmcOneValue.Add("Drive can write CDs in Track at Once Mode:");
if(ftr.CanWriteCSSManagedDVD)
mmcOneValue.Add("Drive can write CSS managed DVDs");
if(ftr.CanWriteDDCDR)
mmcOneValue.Add("Drive supports writing DDCD-R");
if(ftr.CanWriteDDCDRW)
mmcOneValue.Add("Drive supports writing DDCD-RW");
if(ftr.CanWriteDVDPlusRWDL)
mmcOneValue.Add("Drive can read and write DVD+RW DL");
else if(ftr.CanReadDVDPlusRWDL)
mmcOneValue.Add("Drive can read DVD+RW DL");
if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW && ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R, DVD-RW and DVD-R DL");
else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRDL)
mmcOneValue.Add("Drive supports writing DVD-R and DVD-R DL");
else if(ftr.CanWriteDVDR && ftr.CanWriteDVDRW)
mmcOneValue.Add("Drive supports writing DVD-R and DVD-RW");
else if(ftr.CanWriteDVDR)
mmcOneValue.Add("Drive supports writing DVD-R");
if(ftr.CanWriteHDDVDR && ftr.CanWriteHDDVDRAM)
mmcOneValue.Add("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM");
else if(ftr.CanWriteHDDVDR)
mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-R");
else if(ftr.CanWriteHDDVDRAM)
mmcOneValue.Add("Drive can write HD DVD-RW and HD DVD-RAM");
// TODO: Write HD DVD-RW
/*
else
mmcOneValue.Add("Drive can write HD DVD-RW");
*/
if(ftr.CanWriteOldBDR)
mmcOneValue.Add("Drive can write BD-R pre-1.0");
if(ftr.CanWriteOldBDRE)
mmcOneValue.Add("Drive can write BD-RE pre-1.0");
if(ftr.CanWriteRWSubchannelInTAO)
{
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Track at Once Mode");
if(ftr.CanWriteRawSubchannelInTAO)
mmcOneValue.Add("Drive accepts RAW R-W subchannel data in Track at Once Mode");
if(ftr.CanWritePackedSubchannelInTAO)
mmcOneValue.Add("Drive accepts Packed R-W subchannel data in Track at Once Mode");
}
if(ftr.CanWriteRWSubchannelInSAO)
mmcOneValue.Add("Drive can write user provided data in the R-W subchannels in Session at Once Mode");
if(ftr.CanWriteRaw && ftr.CanWriteRawMultiSession)
mmcOneValue.Add("Drive can write multi-session CDs in raw mode");
if(ftr.EmbeddedChanger)
{
mmcOneValue.Add("Drive contains an embedded changer");
if(ftr.ChangerIsSideChangeCapable)
mmcOneValue.Add("Drive can change disc side");
if(ftr.ChangerSupportsDiscPresent)
mmcOneValue.Add("Drive is able to report slots contents after a reset or change");
mmcOneValue.Add(string.Format("Drive has {0} slots", ftr.ChangerSlots + 1));
}
if(ftr.SupportsCSS && ftr.CSSVersionSpecified)
mmcOneValue.Add(string.Format("Drive supports DVD CSS/CPPM version {0}", ftr.CSSVersion));
else if(ftr.SupportsCSS)
mmcOneValue.Add("Drive supports DVD CSS/CPRM");
if(ftr.SupportsCPRM && ftr.CPRMVersionSpecified)
mmcOneValue.Add(string.Format("Drive supports DVD CPPM version {0}", 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(string.Format("Drive firmware is dated {0}", 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");
switch(ftr.LoadingMechanismType)
{
case 0:
mmcOneValue.Add("Drive uses media caddy");
break;
case 1:
mmcOneValue.Add("Drive uses a tray");
break;
case 2:
mmcOneValue.Add("Drive is pop-up");
break;
case 4:
mmcOneValue.Add("Drive is a changer with individually changeable discs");
break;
case 5:
mmcOneValue.Add("Drive is a changer using cartridges");
break;
default:
mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}", ftr.LoadingMechanismType));
break;
}
if(ftr.SupportsHybridDiscs)
mmcOneValue.Add("Drive is able to access Hybrid discs");
if(ftr.SupportsModePage1Ch)
mmcOneValue.Add("Drive supports the Informational Exceptions Control mode page 1Ch");
if(ftr.SupportsOSSC)
mmcOneValue.Add("Drive supports the Trusted Computing Group Optical Security Subsystem Class");
if(ftr.SupportsPWP)
mmcOneValue.Add("Drive supports set/release of PWP status");
if(ftr.SupportsSWPP)
mmcOneValue.Add("Drive supports the SWPP bit of the Timeout and Protect mode page");
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(string.Format("Drive has {0} volume levels", ftr.VolumeLevels + 1));
if(ftr.SupportsWriteProtectPAC)
mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media");
if(ftr.SupportsWriteInhibitDCB)
mmcOneValue.Add("Drive supports writing the Write Inhibit DCB on DVD+RW media");
mmcOneValue.Sort();
mmcOneValue.Add("");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -36,12 +36,395 @@
// ****************************************************************************/
// //$Id$
using System;
using System.Collections.Generic;
using DiscImageChef.Metadata;
using DiscImageChef.Decoders.SCSI;
namespace DiscImageChef.Server.App_Start
{
public class ScsiModeSense
public static class ScsiModeSense
{
public ScsiModeSense()
public static void Report(modeType modeSense, string vendor, PeripheralDeviceTypes deviceType, ref List<string> scsiOneValue, ref Dictionary<string, string> modePages)
{
if(modeSense.MediumTypeSpecified)
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:
scsiOneValue.Add("Device writes directly to media");
break;
case 1:
scsiOneValue.Add("Device uses a write cache");
break;
case 2:
scsiOneValue.Add("Device uses a write cache but doesn't return until cache is flushed");
break;
default:
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:
{
if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_00_SFF(page.value));
else
{
if(page.subpage != 0)
modePages.Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), "Unknown vendor mode page");
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page), "Unknown vendor mode page");
}
break;
}
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;
}
case 0x02:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_02(page.value));
else
goto default;
break;
}
case 0x03:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_03(page.value));
else
goto default;
break;
}
case 0x04:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_04(page.value));
else
goto default;
break;
}
case 0x05:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_05(page.value));
else
goto default;
break;
}
case 0x06:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_06(page.value));
else
goto default;
break;
}
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;
}
case 0x08:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_08(page.value));
else
goto default;
break;
}
case 0x0A:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0A(page.value));
else if(page.subpage == 1)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0A_S01(page.value));
else
goto default;
break;
}
case 0x0B:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0B(page.value));
else
goto default;
break;
}
case 0x0D:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0D(page.value));
else
goto default;
break;
}
case 0x0E:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0E(page.value));
else
goto default;
break;
}
case 0x0F:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_0F(page.value));
else
goto default;
break;
}
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;
}
case 0x11:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_11(page.value));
else
goto default;
break;
}
case 0x12:
case 0x13:
case 0x14:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_12_13_14(page.value));
else
goto default;
break;
}
case 0x1A:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1A(page.value));
else if(page.subpage == 1)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1A_S01(page.value));
else
goto default;
break;
}
case 0x1B:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1B(page.value));
else
goto default;
break;
}
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));
else
goto default;
break;
}
case 0x1D:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_1D(page.value));
else
goto default;
break;
}
case 0x21:
{
if(vendor == "CERTANCE")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyCertanceModePage_21(page.value));
else
goto default;
break;
}
case 0x22:
{
if(vendor == "CERTANCE")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyCertanceModePage_22(page.value));
else
goto default;
break;
}
case 0x24:
{
if(vendor == "IBM")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyIBMModePage_24(page.value));
else
goto default;
break;
}
case 0x2A:
{
if(page.subpage == 0)
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyModePage_2A(page.value));
else
goto default;
break;
}
case 0x2F:
{
if(vendor == "IBM")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyIBMModePage_2F(page.value));
else
goto default;
break;
}
case 0x30:
{
if(Modes.IsAppleModePage_30(page.value))
modePages.Add("MODE page 30h", "Drive identifies as an Apple OEM drive");
else
goto default;
break;
}
case 0x3B:
{
if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3B(page.value));
else
goto default;
break;
}
case 0x3C:
{
if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3C(page.value));
else
goto default;
break;
}
case 0x3D:
{
if(vendor == "IBM")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyIBMModePage_3D(page.value));
else if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3D(page.value));
else
goto default;
break;
}
case 0x3E:
{
if(vendor == "FUJITSU")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyFujitsuModePage_3E(page.value));
else if(vendor == "HP")
modePages.Add(string.Format("MODE page {0:X2}h", page.page), Modes.PrettifyHPModePage_3E(page.value));
else
goto default;
break;
}
default:
{
if(page.subpage != 0)
modePages.Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), "Unknown mode page");
else
modePages.Add(string.Format("MODE page {0:X2}h", page.page), "Unknown mode page");
}
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

@@ -36,12 +36,42 @@
// ****************************************************************************/
// //$Id$
using System;
using System.Collections.Generic;
using DiscImageChef.Metadata;
namespace DiscImageChef.Server.App_Start
{
public class SscTestedMedia
public static class SscTestedMedia
{
public SscTestedMedia()
public static void Report(SequentialMedia[] testedMedia, ref List<string> mediaOneValue)
{
foreach(SequentialMedia media in testedMedia)
{
if(!string.IsNullOrWhiteSpace(media.MediumTypeName))
{
mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>", media.MediumTypeName));
if(media.MediumTypeSpecified)
mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", media.MediumType));
}
else if(media.MediumTypeSpecified)
mediaOneValue.Add(string.Format("<i>Information for medium type {0:X2}h</i>", media.MediumType));
else
mediaOneValue.Add("<i>Information for unknown medium type</i>");
if(!string.IsNullOrWhiteSpace(media.Manufacturer))
mediaOneValue.Add(string.Format("Medium manufactured by: {0}", media.Manufacturer));
if(!string.IsNullOrWhiteSpace(media.Model))
mediaOneValue.Add(string.Format("Medium model: {0}", media.Model));
if(media.DensitySpecified)
mediaOneValue.Add(string.Format("Medium has density code {0:X2}h", media.Density));
if(media.CanReadMediaSerial)
mediaOneValue.Add("Drive can read medium serial number.");
if(media.MediaIsRecognized)
mediaOneValue.Add("DiscImageChef recognizes this medium.");
mediaOneValue.Add("");
}
}
}
}

View File

@@ -36,12 +36,278 @@
// ****************************************************************************/
// //$Id$
using System;
using System.Collections.Generic;
using DiscImageChef.Metadata;
namespace DiscImageChef.Server.App_Start
{
public class TestedMedia
public static class TestedMedia
{
public TestedMedia()
public static void Report(testedMediaType[] testedMedias, bool ata, ref List<string> mediaOneValue)
{
foreach(testedMediaType testedMedia in testedMedias)
{
if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName))
{
mediaOneValue.Add(string.Format("<i>Information for medium named \"{0}\"</i>", testedMedia.MediumTypeName));
if(testedMedia.MediumTypeSpecified)
mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", testedMedia.MediumType));
}
else if(testedMedia.MediumTypeSpecified)
mediaOneValue.Add(string.Format("<i>Information for medium type {0:X2}h</i>", testedMedia.MediumType));
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.");
if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer))
mediaOneValue.Add(string.Format("Medium manufactured by: {0}", testedMedia.Manufacturer));
if(!string.IsNullOrWhiteSpace(testedMedia.Model))
mediaOneValue.Add(string.Format("Medium model: {0}", testedMedia.Model));
if(testedMedia.DensitySpecified)
mediaOneValue.Add(string.Format("Density code: {0:X2}h", testedMedia.Density));
if(testedMedia.BlockSizeSpecified)
mediaOneValue.Add(string.Format("Logical sector size: {0} bytes", testedMedia.BlockSize));
if(testedMedia.PhysicalBlockSizeSpecified)
mediaOneValue.Add(string.Format("Physical sector size: {0} bytes", testedMedia.PhysicalBlockSize));
if(testedMedia.LongBlockSizeSpecified)
mediaOneValue.Add(string.Format("READ LONG sector size: {0} bytes", testedMedia.LongBlockSize));
if(testedMedia.BlocksSpecified && testedMedia.BlockSizeSpecified)
{
mediaOneValue.Add(string.Format("Medium has {0} blocks of {1} bytes each", testedMedia.Blocks, testedMedia.BlockSize));
if(((testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024) > 1000000)
{
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Tb, {2} TiB", testedMedia.Blocks * testedMedia.BlockSize,
(testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000 / 1000 / 1000, (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} GiB", testedMedia.Blocks * testedMedia.BlockSize,
(testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000 / 1000, (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024));
}
else
{
mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Mb, {2} MiB", testedMedia.Blocks * testedMedia.BlockSize,
(testedMedia.Blocks * testedMedia.BlockSize) / 1000 / 1000, (testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024));
}
}
if(testedMedia.CHS != null && testedMedia.CurrentCHS != null)
{
int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * testedMedia.CurrentCHS.Sectors;
mediaOneValue.Add(string.Format("Cylinders: {0} max., {1} current", testedMedia.CHS.Cylinders, testedMedia.CurrentCHS.Cylinders));
mediaOneValue.Add(string.Format("Heads: {0} max., {1} current", testedMedia.CHS.Heads, testedMedia.CurrentCHS.Heads));
mediaOneValue.Add(string.Format("Sectors per track: {0} max., {1} current", testedMedia.CHS.Sectors, testedMedia.CurrentCHS.Sectors));
mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0} max., {1} current", testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors,
currentSectors));
mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2} MiB", (ulong)currentSectors * testedMedia.BlockSize,
((ulong)currentSectors * testedMedia.BlockSize) / 1000 / 1000, ((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024));
}
if(testedMedia.LBASectorsSpecified)
{
mediaOneValue.Add(string.Format("Sectors addressable in sectors in 28-bit LBA mode: {0}", 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} TiB", (ulong)testedMedia.LBASectors * testedMedia.BlockSize,
((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / 1000 / 1000 / 1000, ((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} GiB", (ulong)testedMedia.LBASectors * testedMedia.BlockSize,
((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / 1000 / 1000, ((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} MiB", (ulong)testedMedia.LBASectors * testedMedia.BlockSize,
((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1000 / 1000, ((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024));
}
}
if(testedMedia.LBA48SectorsSpecified)
{
mediaOneValue.Add(string.Format("Sectors addressable in sectors in 48-bit LBA mode: {0}", 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} TiB", testedMedia.LBA48Sectors * testedMedia.BlockSize,
(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / 1000 / 1000 / 1000, (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} GiB", testedMedia.LBA48Sectors * testedMedia.BlockSize,
(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / 1000 / 1000, (testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024));
}
else
{
mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB", testedMedia.LBA48Sectors * testedMedia.BlockSize,
(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1000 / 1000, (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");
if(testedMedia.SupportsReadRetry)
mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadDma)
mediaOneValue.Add("Device can use the READ DMA command in CHS mode with this medium");
if(testedMedia.SupportsReadDmaRetry)
mediaOneValue.Add("Device can use the READ DMA RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadLong && ata)
mediaOneValue.Add("Device can use the READ LONG command in CHS mode with this medium");
if(testedMedia.SupportsReadLongRetry)
mediaOneValue.Add("Device can use the READ LONG RETRY command in CHS mode with this medium");
if(testedMedia.SupportsReadLba)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadRetryLba)
mediaOneValue.Add("Device can use the READ SECTOR(S) RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaLba)
mediaOneValue.Add("Device can use the READ DMA command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaRetryLba)
mediaOneValue.Add("Device can use the READ DMA RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLongLba)
mediaOneValue.Add("Device can use the READ LONG command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLongRetryLba)
mediaOneValue.Add("Device can use the READ LONG RETRY command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadLba48)
mediaOneValue.Add("Device can use the READ SECTOR(S) command in 48-bit LBA mode with this medium");
if(testedMedia.SupportsReadDmaLba48)
mediaOneValue.Add("Device can use the READ DMA command in 48-bit LBA mode with this medium");
if(testedMedia.SupportsSeek)
mediaOneValue.Add("Device can use the SEEK command in CHS mode with this medium");
if(testedMedia.SupportsSeekLba)
mediaOneValue.Add("Device can use the SEEK command in 28-bit LBA mode with this medium");
if(testedMedia.SupportsReadCapacity)
mediaOneValue.Add("Device can use the READ CAPACITY (10) command with this medium");
if(testedMedia.SupportsReadCapacity16)
mediaOneValue.Add("Device can use the READ CAPACITY (16) command with this medium");
if(testedMedia.SupportsRead && !ata)
mediaOneValue.Add("Device can use the READ (6) command with this medium");
if(testedMedia.SupportsRead10)
mediaOneValue.Add("Device can use the READ (10) command with this medium");
if(testedMedia.SupportsRead12)
mediaOneValue.Add("Device can use the READ (12) command with this medium");
if(testedMedia.SupportsRead16)
mediaOneValue.Add("Device can use the READ (16) command with this medium");
if(testedMedia.SupportsReadLong && !ata)
mediaOneValue.Add("Device can use the READ LONG (10) command with this medium");
if(testedMedia.SupportsReadLong16)
mediaOneValue.Add("Device can use the READ LONG (16) command with this medium");
if(testedMedia.SupportsReadCd)
mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium");
if(testedMedia.SupportsReadCdMsf)
mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium");
if(testedMedia.SupportsReadCdRaw)
mediaOneValue.Add("Device can use the READ CD command with LBA addressing with this medium to read raw sector");
if(testedMedia.SupportsReadCdMsfRaw)
mediaOneValue.Add("Device can use the READ CD command with MM:SS:FF addressing with this medium read raw sector");
if(testedMedia.SupportsHLDTSTReadRawDVD)
mediaOneValue.Add("Device can use the HL-DT-ST vendor READ DVD (RAW) command with this medium");
if(testedMedia.SupportsNECReadCDDA)
mediaOneValue.Add("Device can use the NEC vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPioneerReadCDDA)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPioneerReadCDDAMSF)
mediaOneValue.Add("Device can use the PIONEER vendor READ CD-DA MSF command with this medium");
if(testedMedia.SupportsPlextorReadCDDA)
mediaOneValue.Add("Device can use the PLEXTOR vendor READ CD-DA command with this medium");
if(testedMedia.SupportsPlextorReadRawDVD)
mediaOneValue.Add("Device can use the PLEXOR vendor READ DVD (RAW) command with this medium");
if(testedMedia.CanReadAACS)
mediaOneValue.Add("Device can read the Advanced Access Content System from this medium");
if(testedMedia.CanReadADIP)
mediaOneValue.Add("Device can read the DVD ADress-In-Pregroove from this medium");
if(testedMedia.CanReadATIP)
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)
mediaOneValue.Add("Device can report the C2 pointers when reading from this medium");
if(testedMedia.CanReadCMI)
mediaOneValue.Add("Device can read the Copyright Management Information from this medium");
if(testedMedia.CanReadCorrectedSubchannel)
mediaOneValue.Add("Device can correct subchannels when reading from this medium");
if(testedMedia.CanReadCorrectedSubchannelWithC2)
mediaOneValue.Add("Device can correct subchannels and report the C2 pointers when reading from this medium");
if(testedMedia.CanReadDCB)
mediaOneValue.Add("Device can read the Disc Control Blocks from this medium");
if(testedMedia.CanReadDDS)
mediaOneValue.Add("Device can read the Disc Definition Structure from this medium");
if(testedMedia.CanReadDMI)
mediaOneValue.Add("Device can read the Disc Manufacurer Information from this medium");
if(testedMedia.CanReadDiscInformation)
mediaOneValue.Add("Device can read the Disc Information from this medium");
if(testedMedia.CanReadFullTOC)
mediaOneValue.Add("Device can read the Table of Contents from this medium, without processing it");
if(testedMedia.CanReadHDCMI)
mediaOneValue.Add("Device can read the HD DVD Copyright Management Information from this medium");
if(testedMedia.CanReadLayerCapacity)
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)
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)
mediaOneValue.Add("Device can read the Physical Format Information from this medium");
if(testedMedia.CanReadPMA)
mediaOneValue.Add("Device can read the Power Management Area from this medium");
if(testedMedia.CanReadPQSubchannel)
mediaOneValue.Add("Device can read the P to Q subchannels from this medium");
if(testedMedia.CanReadPQSubchannelWithC2)
mediaOneValue.Add("Device can read the P to Q subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadPRI)
mediaOneValue.Add("Device can read the Pre-Recorded Information from this medium");
if(testedMedia.CanReadRWSubchannel)
mediaOneValue.Add("Device can read the R to W subchannels from this medium");
if(testedMedia.CanReadRWSubchannelWithC2)
mediaOneValue.Add("Device can read the R to W subchannels from this medium reporting the C2 pointers");
if(testedMedia.CanReadRecordablePFI)
mediaOneValue.Add("Device can read the Physical Format Information from Lead-In from this medium");
if(testedMedia.CanReadSpareAreaInformation)
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");
mediaOneValue.Add("");
}
}
}
}

View File

@@ -1,21 +1,21 @@
using System.Web.Http;
namespace DiscImageChef.Server
{
{
public static class WebApiConfig
{
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}

View File

@@ -0,0 +1,27 @@
2017-06-03 Natalia Portillo <claunia@claunia.com>
* dos.css:
* Web.config:
* Default.aspx:
* Global.asax.cs:
* packages.config:
* Default.aspx.cs:
* ViewReport.aspx:
* Ata.cs:
* ViewReport.aspx.cs:
* ScsiEvpd.cs:
* ScsiMmcMode.cs:
* TestedMedia.cs:
* Default.aspx.designer.cs:
* Statistics.xml:
* WebApiConfig.cs:
* ScsiModeSense.cs:
* SscTestedMedia.cs:
* ViewReport.aspx.designer.cs:
* DiscImageChef.Server.csproj:
* ScsiMmcFeatures.cs:
* UploadStatsController.cs:
* UploadReportController.cs: Added server side code for
creating http://discimagechef.claunia.com with statistics and
device reports.

View File

@@ -36,12 +36,67 @@
// ****************************************************************************/
// //$Id$
using System;
using System.IO;
using System.Net.Http;
using System.Web.Http;
using System.Web;
using DiscImageChef.Metadata;
using System.Xml.Serialization;
namespace DiscImageChef.Server.Controllers
{
public class UploadReportController
public class UploadReportController : ApiController
{
public UploadReportController()
[Route("api/uploadreport")]
[HttpPost]
public HttpResponseMessage UploadReport()
{
HttpResponseMessage response = new HttpResponseMessage();
response.StatusCode = System.Net.HttpStatusCode.OK;
try
{
DeviceReport newReport = new DeviceReport();
HttpRequest request = HttpContext.Current.Request;
if(request.InputStream == null)
{
response.Content = new StringContent("notstats", System.Text.Encoding.UTF8, "text/plain");
return response;
}
XmlSerializer xs = new XmlSerializer(newReport.GetType());
newReport = (DeviceReport)xs.Deserialize(request.InputStream);
if(newReport == null)
{
response.Content = new StringContent("notstats", System.Text.Encoding.UTF8, "text/plain");
return response;
}
Random rng = new Random();
string filename = string.Format("NewReport_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next());
while(File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Upload", filename)))
{
filename = string.Format("NewReport_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next());
}
FileStream newFile = new FileStream(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Upload", filename), FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
xs.Serialize(newFile, newReport);
newFile.Close();
response.Content = new StringContent("ok", System.Text.Encoding.UTF8, "text/plain");
return response;
}
catch
{
#if DEBUG
throw;
#else
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
return response;
#endif
}
}
}
}

View File

@@ -36,17 +36,440 @@
// ****************************************************************************/
// //$Id$
using System;
using System.IO;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using System.Xml.Serialization;
using DiscImageChef.Metadata;
namespace DiscImageChef.Server.App_Start
namespace DiscImageChef.Server.Controllers
{
public class UploadStatsController
public class UploadStatsController : ApiController
{
[Route("api/myfileupload")]
[Route("api/uploadstats")]
[HttpPost]
public string UploadStats()
public HttpResponseMessage UploadStats()
{
return "test";
HttpResponseMessage response = new HttpResponseMessage();
response.StatusCode = System.Net.HttpStatusCode.OK;
try
{
Stats newStats = new Stats();
HttpRequest request = HttpContext.Current.Request;
if(request.InputStream == null)
{
response.Content = new StringContent("notstats", System.Text.Encoding.UTF8, "text/plain");
return response;
}
XmlSerializer xs = new XmlSerializer(newStats.GetType());
newStats = (Stats)xs.Deserialize(request.InputStream);
if(newStats == null)
{
response.Content = new StringContent("notstats", System.Text.Encoding.UTF8, "text/plain");
return response;
}
FileStream fs = WaitForFile(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"), FileMode.Open, FileAccess.ReadWrite, FileShare.None);
if(fs == null)
{
response.Content = new StringContent("retry", System.Text.Encoding.UTF8, "text/plain");
return response;
}
Stats oldStats = new Stats();
xs = new XmlSerializer(oldStats.GetType());
oldStats = (Stats)xs.Deserialize(fs);
if(newStats.Commands != null)
{
if(oldStats.Commands == null)
oldStats.Commands = newStats.Commands;
else
{
oldStats.Commands.Analyze += newStats.Commands.Analyze;
oldStats.Commands.Benchmark += newStats.Commands.Benchmark;
oldStats.Commands.Checksum += newStats.Commands.Checksum;
oldStats.Commands.Compare += newStats.Commands.Compare;
oldStats.Commands.CreateSidecar += newStats.Commands.CreateSidecar;
oldStats.Commands.Decode += newStats.Commands.Decode;
oldStats.Commands.DeviceInfo += newStats.Commands.DeviceInfo;
oldStats.Commands.DeviceReport += newStats.Commands.DeviceReport;
oldStats.Commands.DumpMedia += newStats.Commands.DumpMedia;
oldStats.Commands.Entropy += newStats.Commands.Entropy;
oldStats.Commands.Formats += newStats.Commands.Formats;
oldStats.Commands.MediaInfo += newStats.Commands.MediaInfo;
oldStats.Commands.MediaScan += newStats.Commands.MediaScan;
oldStats.Commands.PrintHex += newStats.Commands.PrintHex;
oldStats.Commands.Verify += newStats.Commands.Verify;
}
}
if(newStats.OperatingSystems != null)
{
if(oldStats.OperatingSystems == null)
oldStats.OperatingSystems = newStats.OperatingSystems;
else
{
foreach(NameValueStats newNvs in newStats.OperatingSystems)
{
NameValueStats removeNvs = null;
NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.OperatingSystems)
{
if(oldNvs.name == newNvs.name)
{
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value };
removeNvs = oldNvs;
break;
}
}
if(removeNvs != null && addNvs != null)
{
oldStats.OperatingSystems.Remove(removeNvs);
oldStats.OperatingSystems.Add(addNvs);
}
else
oldStats.OperatingSystems.Add(newNvs);
}
}
}
else
{
if(oldStats.OperatingSystems == null)
oldStats.OperatingSystems = new System.Collections.Generic.List<NameValueStats>
{
new NameValueStats { name = "Linux", Value = 1 }
};
else
{
NameValueStats removeNvs = null;
NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.OperatingSystems)
{
if(oldNvs.name == "Linux")
{
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + 1 };
removeNvs = oldNvs;
break;
}
}
if(removeNvs != null && addNvs != null)
{
oldStats.OperatingSystems.Remove(removeNvs);
oldStats.OperatingSystems.Add(addNvs);
}
else
oldStats.OperatingSystems.Add(new NameValueStats { name = "Linux", Value = 1 });
}
}
if(newStats.Filesystems != null)
{
if(oldStats.Filesystems == null)
oldStats.Filesystems = newStats.Filesystems;
else
{
foreach(NameValueStats newNvs in newStats.Filesystems)
{
NameValueStats removeNvs = null;
NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Filesystems)
{
if(oldNvs.name == newNvs.name)
{
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value };
removeNvs = oldNvs;
break;
}
}
if(removeNvs != null && addNvs != null)
{
oldStats.Filesystems.Remove(removeNvs);
oldStats.Filesystems.Add(addNvs);
}
else
oldStats.Filesystems.Add(newNvs);
}
}
}
if(newStats.Partitions != null)
{
if(oldStats.Partitions == null)
oldStats.Partitions = newStats.Partitions;
else
{
foreach(NameValueStats newNvs in newStats.Partitions)
{
NameValueStats removeNvs = null;
NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Partitions)
{
if(oldNvs.name == newNvs.name)
{
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value };
removeNvs = oldNvs;
break;
}
}
if(removeNvs != null && addNvs != null)
{
oldStats.Partitions.Remove(removeNvs);
oldStats.Partitions.Add(addNvs);
}
else
oldStats.Partitions.Add(newNvs);
}
}
}
if(newStats.MediaImages != null)
{
if(oldStats.MediaImages == null)
oldStats.MediaImages = newStats.MediaImages;
else
{
foreach(NameValueStats newNvs in newStats.MediaImages)
{
NameValueStats removeNvs = null;
NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.MediaImages)
{
if(oldNvs.name == newNvs.name)
{
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value };
removeNvs = oldNvs;
break;
}
}
if(removeNvs != null && addNvs != null)
{
oldStats.MediaImages.Remove(removeNvs);
oldStats.MediaImages.Add(addNvs);
}
else
oldStats.MediaImages.Add(newNvs);
}
}
}
if(newStats.Filters != null)
{
if(oldStats.Filters == null)
oldStats.Filters = newStats.Filters;
else
{
foreach(NameValueStats newNvs in newStats.Filters)
{
NameValueStats removeNvs = null;
NameValueStats addNvs = null;
foreach(NameValueStats oldNvs in oldStats.Filters)
{
if(oldNvs.name == newNvs.name)
{
addNvs = new NameValueStats { name = oldNvs.name, Value = oldNvs.Value + newNvs.Value };
removeNvs = oldNvs;
break;
}
}
if(removeNvs != null && addNvs != null)
{
oldStats.Filters.Remove(removeNvs);
oldStats.Filters.Add(addNvs);
}
else
oldStats.Filters.Add(newNvs);
}
}
}
if(newStats.Devices != null)
{
if(oldStats.Devices == null)
oldStats.Devices = newStats.Devices;
else
{
foreach(DeviceStats newDev in newStats.Devices)
{
bool found = false;
foreach(DeviceStats oldDev in oldStats.Devices)
{
if(oldDev.Manufacturer == newDev.Manufacturer &&
oldDev.Model == newDev.Model &&
oldDev.Revision == newDev.Revision &&
oldDev.Bus == newDev.Bus)
{
found = true;
break;
}
}
if(!found)
oldStats.Devices.Add(newDev);
}
}
}
if(newStats.Medias != null)
{
if(oldStats.Medias == null)
oldStats.Medias = newStats.Medias;
else
{
foreach(MediaStats newMstat in newStats.Medias)
{
MediaStats removeMstat = null;
MediaStats addMstat = null;
foreach(MediaStats oldMstat in oldStats.Medias)
{
if(oldMstat.real == newMstat.real && oldMstat.type == newMstat.type)
{
addMstat = new MediaStats { real = oldMstat.real, type = oldMstat.type, Value = oldMstat.Value + newMstat.Value };
removeMstat = oldMstat;
break;
}
}
if(removeMstat != null && addMstat != null)
{
oldStats.Medias.Remove(removeMstat);
oldStats.Medias.Add(addMstat);
}
else
oldStats.Medias.Add(newMstat);
}
}
}
if(newStats.MediaScan != null)
{
if(oldStats.MediaScan == null)
oldStats.MediaScan = newStats.MediaScan;
else
{
if(oldStats.MediaScan.Sectors == null)
oldStats.MediaScan.Sectors = newStats.MediaScan.Sectors;
else
{
oldStats.MediaScan.Sectors.Correct = newStats.MediaScan.Sectors.Correct;
oldStats.MediaScan.Sectors.Error = newStats.MediaScan.Sectors.Error;
oldStats.MediaScan.Sectors.Total = newStats.MediaScan.Sectors.Total;
oldStats.MediaScan.Sectors.Unverifiable = newStats.MediaScan.Sectors.Unverifiable;
}
if(oldStats.MediaScan.Times == null)
oldStats.MediaScan.Times = newStats.MediaScan.Times;
else
{
oldStats.MediaScan.Times.LessThan10ms = newStats.MediaScan.Times.LessThan10ms;
oldStats.MediaScan.Times.LessThan150ms = newStats.MediaScan.Times.LessThan150ms;
oldStats.MediaScan.Times.LessThan3ms = newStats.MediaScan.Times.LessThan3ms;
oldStats.MediaScan.Times.LessThan500ms = newStats.MediaScan.Times.LessThan500ms;
oldStats.MediaScan.Times.LessThan50ms = newStats.MediaScan.Times.LessThan50ms;
oldStats.MediaScan.Times.MoreThan500ms = newStats.MediaScan.Times.MoreThan500ms;
}
}
}
if(newStats.Verify != null)
{
if(oldStats.Verify == null)
oldStats.Verify = newStats.Verify;
else
{
if(oldStats.Verify.Sectors == null)
oldStats.Verify.Sectors = newStats.Verify.Sectors;
else
{
oldStats.Verify.Sectors.Correct = newStats.Verify.Sectors.Correct;
oldStats.Verify.Sectors.Error = newStats.Verify.Sectors.Error;
oldStats.Verify.Sectors.Total = newStats.Verify.Sectors.Total;
oldStats.Verify.Sectors.Unverifiable = newStats.Verify.Sectors.Unverifiable;
}
if(oldStats.Verify.MediaImages == null)
oldStats.Verify.MediaImages = newStats.Verify.MediaImages;
else
{
oldStats.Verify.MediaImages.Correct = newStats.Verify.MediaImages.Correct;
oldStats.Verify.MediaImages.Failed = newStats.Verify.MediaImages.Failed;
}
}
}
Random rng = new Random();
string filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next());
while(File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", filename)))
{
filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next());
}
FileStream backup = new FileStream(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", filename), FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
fs.Seek(0, SeekOrigin.Begin);
fs.CopyTo(backup);
backup.Close();
fs.Seek(0, SeekOrigin.Begin);
xs = new XmlSerializer(oldStats.GetType());
xs.Serialize(fs, oldStats);
fs.SetLength(fs.Position);
fs.Close();
response.Content = new StringContent("ok", System.Text.Encoding.UTF8, "text/plain");
return response;
}
catch(Exception ex)
{
#if DEBUG
System.Console.WriteLine("{0} {1}", ex.Message, ex.InnerException);
throw;
#else
response.Content = new StringContent("error", System.Text.Encoding.UTF8, "text/plain");
return response;
#endif
}
}
FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
for(int numTries = 0; numTries < 100; numTries++)
{
FileStream fs = null;
try
{
fs = new FileStream(fullPath, mode, access, share);
return fs;
}
catch(IOException)
{
if(fs != null)
{
fs.Dispose();
}
System.Threading.Thread.Sleep(50);
}
}
return null;
}
}
}

View File

@@ -1,12 +1,182 @@
<%@ Page Language="C#" Inherits="DiscImageChef.Server.Default" %>
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head runat="server">
<title>Default</title>
<link type='text/css' rel='stylesheet' href='dos.css' />
<title>DiscImageChef Statistics</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button id="button1" runat="server" Text="Click me!" OnClick="button1Clicked" />
</form>
<body id="body" runat="server">
<h1 align="center">Welcome to <i><a href="http://github.com/claunia/discimagechef" target="_blank">DiscImageChef</a></i> Server version <asp:Label id="lblVersion" runat="server"/></h1>
<br/>
<div id="content" runat="server">
<div id="divCommands" runat="server">
<h4>Commands run:</h4>
<p>
<i>analyze</i> command has been run <asp:Label id="lblAnalyze" runat="server"/> times<br/>
<i>benchmark</i> command has been run <asp:Label id="lblBenchmark" runat="server"/> times<br/>
<i>checksum</i> command has been run <asp:Label id="lblChecksum" runat="server"/> times<br/>
<i>compare</i> command has been run <asp:Label id="lblCompare" runat="server"/> times<br/>
<i>create-sidecar</i> command has been run <asp:Label id="lblCreateSidecar" runat="server"/> times<br/>
<i>decode</i> command has been run <asp:Label id="lblDecode" runat="server"/> times<br/>
<i>device-info</i> command has been run <asp:Label id="lblDeviceInfo" runat="server"/> times<br/>
<i>device-report</i> command has been run <asp:Label id="lblDeviceReport" runat="server"/> times<br/>
<i>dump-media</i> command has been run <asp:Label id="lblDumpMedia" runat="server"/> times<br/>
<i>entropy</i> command has been run <asp:Label id="lblEntropy" runat="server"/> times<br/>
<i>formats</i> command has been run <asp:Label id="lblFormats" runat="server"/> times<br/>
<i>media-info</i> command has been run <asp:Label id="lblMediaInfo" runat="server"/> times<br/>
<i>media-scan</i> command has been run <asp:Label id="lblMediaScan" runat="server"/> times<br/>
<i>printhex</i> command has been run <asp:Label id="lblPrintHex" runat="server"/> times<br/>
<i>verify</i> command has been run <asp:Label id="lblVerify" runat="server"/> times
</p>
</div>
<div id="divOperatingSystems" runat="server">
<table>
<asp:Repeater id="repOperatingSystems" runat="server">
<ItemTemplate>
<tr>
<td>DiscImageChef has run on <i><asp:Label runat="server" Text='<%# Eval("name") %>' /></i> <asp:Label runat="server" Text='<%# Eval("Value") %>' /> times.</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<br/>
</div>
<div id="divFilters" runat="server">
<h3>Filters found:</h3>
<table align="center" border="1">
<tr>
<th>Filter</th>
<th>Times</th>
</tr>
<asp:Repeater ID="repFilters" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("name") %>' /></td>
<td><asp:Label runat="server" Text='<%# string.Format("{0}", Eval("Value")) %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divMediaImages" runat="server">
<h3>Media image formats found:</h3>
<table align="center" border="1">
<tr>
<th>Media image format</th>
<th>Times</th>
</tr>
<asp:Repeater ID="repMediaImages" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("name") %>' /></td>
<td><asp:Label runat="server" Text='<%# string.Format("{0}", Eval("value")) %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divPartitions" runat="server">
<h3>Partition schemes found:</h3>
<table align="center" border="1">
<tr>
<th>Partition scheme</th>
<th>Times</th>
</tr>
<asp:Repeater ID="repPartitions" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("name") %>' /></td>
<td><asp:Label runat="server" Text='<%# string.Format("{0}", Eval("value")) %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divFilesystems" runat="server">
<h3>Filesystems found:</h3>
<table align="center" border="1">
<tr>
<th>Filesystem name</th>
<th>Times</th>
</tr>
<asp:Repeater ID="repFilesystems" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("name") %>' /></td>
<td><asp:Label runat="server" Text='<%# string.Format("{0}", Eval("value")) %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divVirtualMedia" runat="server">
<h3>Media types found in images:</h3>
<table align="center" border="1">
<tr>
<th>Physical type</th>
<th>Logical type</th>
<th>Times</th>
</tr>
<asp:Repeater ID="repVirtualMedia" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("Type") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("SubType") %>' /></td>
<td><asp:Label runat="server" Text='<%# string.Format("{0}", Eval("Count")) %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divRealMedia" runat="server">
<h3>Media types found in devices:</h3>
<table align="center" border="1">
<tr>
<th>Physical type</th>
<th>Logical type</th>
<th>Times</th>
</tr>
<asp:Repeater ID="repRealMedia" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("Type") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("SubType") %>' /></td>
<td><asp:Label runat="server" Text='<%# string.Format("{0}", Eval("Count")) %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divDevices" runat="server">
<h3>Found devices:</h3>
<table align="center" border="1">
<tr>
<th>Manufacturer</th>
<th>Model</th>
<th>Revision</th>
<th>Bus</th>
<th>Report</th>
</tr>
<asp:Repeater ID="repDevices" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("Manufacturer") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("Model") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("Revision") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("Bus") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("ReportLink") %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
</div>
<hr/>
<footer>
© 2011-2017 <a href="http://www.claunia.com" target="_blank">Claunia.com</a><br/>
Fonts are © 2015-2016 <a href="http://int10h.org" target="_blank">VileR</a><br/>
CSS © 2017 <a href="http://www.freedos.org" target="_blank">The FreeDOS Project</a>
</footer>
</body>
</html>

View File

@@ -1,15 +1,249 @@
using System;
using System.Web;
using System.Web.UI;
using System.Reflection;
using System.IO;
using DiscImageChef.Metadata;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.CodeDom;
using System.Linq;
namespace DiscImageChef.Server
{
{
public partial class Default : System.Web.UI.Page
{
class MediaItem
{
public void button1Clicked(object sender, EventArgs args)
public string Type { get; set; }
public string SubType { get; set; }
public long Count { get; set; }
}
class DeviceItem
{
public string Manufacturer { get; set; }
public string Model { get; set; }
public string Revision { get; set; }
public string Bus { get; set; }
public string ReportLink { get; set; }
}
Stats statistics;
List<MediaItem> realMedia;
List<MediaItem> virtualMedia;
List<NameValueStats> operatingSystems;
List<DeviceItem> devices;
protected void Page_Load(object sender, EventArgs e)
{
lblVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
try
{
button1.Text = "You clicked me";
if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml")))
{
#if DEBUG
content.InnerHtml = string.Format("<b>Sorry, cannot load data file \"{0}\"</b>", Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"));
#else
content.InnerHtml = "<b>Sorry, cannot load data file</b>";
#endif
return;
}
statistics = new Stats();
XmlSerializer xs = new XmlSerializer(statistics.GetType());
FileStream fs = WaitForFile(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Statistics", "Statistics.xml"), FileMode.Open, FileAccess.Read, FileShare.Read);
statistics = (Stats)xs.Deserialize(fs);
fs.Close();
if(statistics.OperatingSystems != null)
{
operatingSystems = new List<NameValueStats>();
foreach(NameValueStats nvs in statistics.OperatingSystems)
operatingSystems.Add(new NameValueStats { name = Interop.DetectOS.GetPlatformName((Interop.PlatformID)Enum.Parse(typeof(Interop.PlatformID), nvs.name)), Value = nvs.Value });
repOperatingSystems.DataSource = operatingSystems.OrderBy(os => os.name).ToList();
repOperatingSystems.DataBind();
}
else
divOperatingSystems.Visible = false;
if(statistics.Commands != null)
{
lblAnalyze.Text = statistics.Commands.Analyze.ToString();
lblCompare.Text = statistics.Commands.Compare.ToString();
lblChecksum.Text = statistics.Commands.Checksum.ToString();
lblEntropy.Text = statistics.Commands.Entropy.ToString();
lblVerify.Text = statistics.Commands.Verify.ToString();
lblPrintHex.Text = statistics.Commands.PrintHex.ToString();
lblDecode.Text = statistics.Commands.Decode.ToString();
lblDeviceInfo.Text = statistics.Commands.DeviceInfo.ToString();
lblMediaInfo.Text = statistics.Commands.MediaInfo.ToString();
lblMediaScan.Text = statistics.Commands.MediaScan.ToString();
lblFormats.Text = statistics.Commands.Formats.ToString();
lblBenchmark.Text = statistics.Commands.Benchmark.ToString();
lblCreateSidecar.Text = statistics.Commands.CreateSidecar.ToString();
lblDumpMedia.Text = statistics.Commands.DumpMedia.ToString();
lblDeviceReport.Text = statistics.Commands.DeviceReport.ToString();
}
else
divCommands.Visible = false;
if(statistics.Filters != null)
{
repFilters.DataSource = statistics.Filters.OrderBy(filter => filter.name).ToList();
repFilters.DataBind();
}
else
divFilters.Visible = false;
if(statistics.MediaImages != null)
{
repMediaImages.DataSource = statistics.MediaImages.OrderBy(filter => filter.name).ToList();
repMediaImages.DataBind();
}
else
divMediaImages.Visible = false;
if(statistics.Partitions != null)
{
repPartitions.DataSource = statistics.Partitions.OrderBy(filter => filter.name).ToList();
repPartitions.DataBind();
}
else
divPartitions.Visible = false;
if(statistics.Filesystems != null)
{
repFilesystems.DataSource = statistics.Filesystems.OrderBy(filter => filter.name).ToList();
repFilesystems.DataBind();
}
else
divFilesystems.Visible = false;
if(statistics.Medias != null)
{
realMedia = new List<MediaItem>();
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);
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 });
}
if(realMedia.Count > 0)
{
repRealMedia.DataSource = realMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList();
repRealMedia.DataBind();
}
else
divRealMedia.Visible = false;
if(virtualMedia.Count > 0)
{
repVirtualMedia.DataSource = virtualMedia.OrderBy(media => media.Type).ThenBy(media => media.SubType).ToList();
repVirtualMedia.DataBind();
}
else
divVirtualMedia.Visible = false;
}
else
{
divRealMedia.Visible = false;
divVirtualMedia.Visible = false;
}
if(statistics.Devices != null)
{
devices = new List<DeviceItem>();
foreach(DeviceStats device in statistics.Devices)
{
string url = null;
string xmlFile;
if(!string.IsNullOrWhiteSpace(device.Manufacturer) && !string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision))
{
xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml";
url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}&revision={2}",
HttpUtility.UrlPathEncode(device.Manufacturer), HttpUtility.UrlPathEncode(device.Model), HttpUtility.UrlPathEncode(device.Revision));
}
else if(!string.IsNullOrWhiteSpace(device.Manufacturer) && !string.IsNullOrWhiteSpace(device.Model))
{
xmlFile = device.Manufacturer + "_" + device.Model + ".xml";
url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}",
HttpUtility.UrlPathEncode(device.Manufacturer), HttpUtility.UrlPathEncode(device.Model));
}
else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision))
{
xmlFile = device.Model + "_" + device.Revision + ".xml";
url = string.Format("ViewReport.aspx?model={0}&revision={1}",
HttpUtility.UrlPathEncode(device.Model), HttpUtility.UrlPathEncode(device.Revision));
}
else
{
xmlFile = device.Model + ".xml";
url = string.Format("ViewReport.aspx?model={0}",
HttpUtility.UrlPathEncode(device.Model));
}
if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile)))
{
url = null;
}
devices.Add(new DeviceItem()
{
Manufacturer = device.Manufacturer,
Model = device.Model,
Revision = device.Revision,
Bus = device.Bus,
ReportLink = url == null ? "No" : string.Format("<a href=\"{0}\" target=\"_blank\">Yes</a>", url)
});
}
repDevices.DataSource = devices.OrderBy(device => device.Manufacturer).ThenBy(device => device.Model).ThenBy(device => device.Revision).ThenBy(device => device.Bus).ToList();
repDevices.DataBind();
}
else
divDevices.Visible = false;
}
catch(Exception)
{
content.InnerHtml = "<b>Could not load statistics</b>";
#if DEBUG
throw;
#endif
}
}
FileStream WaitForFile(string fullPath, FileMode mode, FileAccess access, FileShare share)
{
for(int numTries = 0; numTries < 100; numTries++)
{
FileStream fs = null;
try
{
fs = new FileStream(fullPath, mode, access, share);
return fs;
}
catch(IOException)
{
if(fs != null)
{
fs.Dispose();
}
System.Threading.Thread.Sleep(50);
}
}
return null;
}
}
}

View File

@@ -1,12 +1,86 @@
using System;
using System.Web;
using System.Web.UI;
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace DiscImageChef.Server
{
public partial class Default
{
protected System.Web.UI.WebControls.Button button1;
}
}
namespace DiscImageChef.Server {
public partial class Default {
protected System.Web.UI.HtmlControls.HtmlGenericControl body;
protected System.Web.UI.WebControls.Label lblVersion;
protected System.Web.UI.HtmlControls.HtmlGenericControl content;
protected System.Web.UI.HtmlControls.HtmlGenericControl divCommands;
protected System.Web.UI.WebControls.Label lblAnalyze;
protected System.Web.UI.WebControls.Label lblBenchmark;
protected System.Web.UI.WebControls.Label lblChecksum;
protected System.Web.UI.WebControls.Label lblCompare;
protected System.Web.UI.WebControls.Label lblCreateSidecar;
protected System.Web.UI.WebControls.Label lblDecode;
protected System.Web.UI.WebControls.Label lblDeviceInfo;
protected System.Web.UI.WebControls.Label lblDeviceReport;
protected System.Web.UI.WebControls.Label lblDumpMedia;
protected System.Web.UI.WebControls.Label lblEntropy;
protected System.Web.UI.WebControls.Label lblFormats;
protected System.Web.UI.WebControls.Label lblMediaInfo;
protected System.Web.UI.WebControls.Label lblMediaScan;
protected System.Web.UI.WebControls.Label lblPrintHex;
protected System.Web.UI.WebControls.Label lblVerify;
protected System.Web.UI.HtmlControls.HtmlGenericControl divOperatingSystems;
protected System.Web.UI.WebControls.Repeater repOperatingSystems;
protected System.Web.UI.HtmlControls.HtmlGenericControl divFilters;
protected System.Web.UI.WebControls.Repeater repFilters;
protected System.Web.UI.HtmlControls.HtmlGenericControl divMediaImages;
protected System.Web.UI.WebControls.Repeater repMediaImages;
protected System.Web.UI.HtmlControls.HtmlGenericControl divPartitions;
protected System.Web.UI.WebControls.Repeater repPartitions;
protected System.Web.UI.HtmlControls.HtmlGenericControl divFilesystems;
protected System.Web.UI.WebControls.Repeater repFilesystems;
protected System.Web.UI.HtmlControls.HtmlGenericControl divVirtualMedia;
protected System.Web.UI.WebControls.Repeater repVirtualMedia;
protected System.Web.UI.HtmlControls.HtmlGenericControl divRealMedia;
protected System.Web.UI.WebControls.Repeater repRealMedia;
protected System.Web.UI.HtmlControls.HtmlGenericControl divDevices;
protected System.Web.UI.WebControls.Repeater repDevices;
}
}

View File

@@ -10,6 +10,7 @@
<OutputType>Library</OutputType>
<RootNamespace>DiscImageChef.Server</RootNamespace>
<AssemblyName>DiscImageChef.Server</AssemblyName>
<ReleaseVersion>3.3.99.0</ReleaseVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -32,11 +33,30 @@
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Net.Http.Formatting">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Web.Http">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Global.asax" />
<Content Include="Web.config" />
<Content Include="Default.aspx" />
<Content Include="packages.config" />
<Content Include="dos.css" />
<Content Include="int10h.org\vga_squarepx.eot" />
<Content Include="int10h.org\vga_squarepx.ttf" />
<Content Include="int10h.org\vga_squarepx.woff" />
<Content Include="ViewReport.aspx" />
</ItemGroup>
<ItemGroup>
<Compile Include="Global.asax.cs">
@@ -49,12 +69,83 @@
<Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="ViewReport.aspx.cs">
<DependentUpon>ViewReport.aspx</DependentUpon>
</Compile>
<Compile Include="ViewReport.aspx.designer.cs">
<DependentUpon>ViewReport.aspx</DependentUpon>
</Compile>
<Compile Include="App_Start\ScsiInquiry.cs" />
<Compile Include="App_Start\Ata.cs" />
<Compile Include="App_Start\ScsiModeSense.cs" />
<Compile Include="App_Start\ScsiEvpd.cs" />
<Compile Include="App_Start\ScsiMmcMode.cs" />
<Compile Include="App_Start\ScsiMmcFeatures.cs" />
<Compile Include="App_Start\SscTestedMedia.cs" />
<Compile Include="App_Start\TestedMedia.cs" />
<Compile Include="Controllers\UploadStatsController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Controllers\UploadReportController.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiscImageChef.Metadata\DiscImageChef.Metadata.csproj">
<Project>{9F213318-5CB8-4066-A757-074489C9F818}</Project>
<Name>DiscImageChef.Metadata</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj">
<Project>{F2B84194-26EB-4227-B1C5-6602517E85AE}</Project>
<Name>DiscImageChef.CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Interop\DiscImageChef.Interop.csproj">
<Project>{9183F2E0-A879-4F23-9EE3-C6908F1332B2}</Project>
<Name>DiscImageChef.Interop</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Decoders\DiscImageChef.Decoders.csproj">
<Project>{0BEB3088-B634-4289-AE17-CDF2D25D00D5}</Project>
<Name>DiscImageChef.Decoders</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="int10h.org\" />
<Folder Include="Controllers\" />
<Folder Include="Properties\" />
<Folder Include="Statistics\" />
<Folder Include="Reports\" />
<Folder Include="Upload\" />
</ItemGroup>
<ItemGroup>
<None Include="int10h.org\vga_squarepx.woff2" />
<None Include="usb.ids" />
<None Include="Statistics\Statistics.xml" />
<None Include="Upload\.htaccess" />
<None Include="Statistics\.htaccess" />
<None Include="Reports\.htaccess" />
<None Include="int10h.org\.htaccess" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
<Policies>
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild">
<inheritsSet />
<inheritsScope />
</DotNetNamingPolicy>
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp">
<inheritsSet />
<inheritsScope />
</TextStylePolicy>
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="False" NewLineForMembersInAnonymousTypes="False" NewLineForClausesInQuery="False" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" scope="text/x-csharp">
<inheritsSet />
<inheritsScope />
</CSharpFormattingPolicy>
<ChangeLogPolicy VcsIntegration="Enabled" UpdateMode="ProjectRoot">
<MessageStyle Header="${Date:yyyy-MM-dd} ${AuthorName} &lt;${AuthorEmail}&gt;&#xA;&#xA;" Indent="&#x9;" FirstFilePrefix="* " FileSeparator=":&#xA;* " LastFilePostfix=": " LineAlign="0" InterMessageLines="1" IncludeDirectoryPaths="False" Wrap="True" />
<inheritsSet />
<inheritsScope />
</ChangeLogPolicy>
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>

View File

@@ -39,12 +39,12 @@ using System.Web;
using System.Web.Http;
namespace DiscImageChef.Server
{
{
public class Global : HttpApplication
{
{
protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
}
}

View File

@@ -1,2 +1,2 @@
<?xml version="1.0"?>
<DicStats xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
<DicStats xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

View File

@@ -1,11 +1,157 @@
<%@ Page Language="C#" Inherits="DiscImageChef.Server.ViewReport" %>
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head runat="server">
<title>ViewReport</title>
<link type='text/css' rel='stylesheet' href='dos.css' />
<title>DiscImageChef Device Report</title>
</head>
<body>
<form id="form1" runat="server">
</form>
<body id="content" runat="server">
DiscImageChef Report for <asp:Label id="lblManufacturer" runat="server"/> <asp:Label id="lblModel" runat="server"/> <asp:Label id="lblRevision" runat="server"/>
<div id="divUsb" runat="server">
<br/>
<b>USB characteristics:</b><br/>
<i>Manufacturer:</i> <asp:Label id="lblUsbManufacturer" runat="server"/><br/>
<i>Product:</i> <asp:Label id="lblUsbProduct" runat="server"/><br/>
<i>Vendor ID:</i> <asp:Label id="lblUsbVendor" runat="server"/> <asp:Label id="lblUsbVendorDescription" runat="server"/><br/>
<i>Product ID:</i> <asp:Label id="lblUsbProductId" runat="server"/> <asp:Label id="lblUsbProductDescription" runat="server"/>
</div>
<div id="divFirewire" runat="server">
<br/>
<b>FireWire characteristics:</b><br/>
<i>Manufacturer:</i> <asp:Label id="lblFirewireManufacturer" runat="server"/><br/>
<i>Product:</i> <asp:Label id="lblFirewireProduct" runat="server"/><br/>
<i>Vendor ID:</i> <asp:Label id="lblFirewireVendor" runat="server"/><br/>
<i>Product ID:</i> <asp:Label id="lblFirewireProductId" runat="server"/>
</div>
<div id="divPcmcia" runat="server">
<br/>
<b>PCMCIA characteristics:</b><br/>
<i>Manufacturer:</i> <asp:Label id="lblPcmciaManufacturer" runat="server"/><br/>
<i>Product:</i> <asp:Label id="lblPcmciaProduct" runat="server"/><br/>
<i>Manufacturer code:</i> <asp:Label id="lblPcmciaManufacturerCode" runat="server"/><br/>
<i>Card code:</i> <asp:Label id="lblPcmciaCardCode" runat="server"/><br/>
<i>Compliance:</i> <asp:Label id="lblPcmciaCompliance" runat="server"/>
<asp:Repeater ID="repPcmciaTuples" runat="server">
<ItemTemplate>
<i><asp:Label runat="server" Text='<%# Eval("key") %>' /></i>: <asp:Label runat="server" Text='<%# Eval("value") %>' /><br/>
</ItemTemplate>
</asp:Repeater>
</div>
<div id="divAta" runat="server">
<br/>
<b>ATA<asp:Label id="lblAtapi" runat="server"/> characteristics:</b><br/>
<asp:Label id="lblAtaDeviceType" runat="server"/><br/>
<asp:Repeater ID="repAtaTwo" runat="server">
<ItemTemplate>
<i><asp:Label runat="server" Text='<%# Eval("key") %>' /></i>: <asp:Label runat="server" Text='<%# Eval("value") %>' /><br/>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="repAtaOne" runat="server">
<ItemTemplate>
<%# Container.DataItem?.ToString() ?? string.Empty%><br/>
</ItemTemplate>
</asp:Repeater>
</div>
<div id="divScsi" runat="server">
<br/>
<b>SCSI characteristics:</b><br/>
<i>Vendor:</i> <asp:Label id="lblScsiVendor" runat="server"/><br/>
<i>Product:</i> <asp:Label id="lblScsiProduct" runat="server"/><br/>
<i>Revision:</i> <asp:Label id="lblScsiRevision" runat="server"/><br/>
<asp:Repeater ID="repScsi" runat="server">
<ItemTemplate>
<%# Container.DataItem?.ToString() ?? string.Empty%><br/>
</ItemTemplate>
</asp:Repeater>
<div id="divScsiModeSense" runat="server">
<br/><i>SCSI mode sense pages:</i>
<table border="1">
<tr>
<th>Mode</th>
<th>Contents</th>
</tr>
<asp:Repeater ID="repModeSense" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("key") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("value") %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divScsiEvpd" runat="server">
<br/><i>SCSI extended vital product data pages:</i>
<table border="1">
<tr>
<th>EVPD</th>
<th>Contents</th>
</tr>
<asp:Repeater ID="repEvpd" runat="server">
<ItemTemplate>
<tr>
<td><asp:Label runat="server" Text='<%# Eval("key") %>' /></td>
<td><asp:Label runat="server" Text='<%# Eval("value") %>' /></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<div id="divScsiMmcMode" runat="server">
<br/><b>SCSI CD-ROM capabilities:</b><br/>
<asp:Repeater ID="repScsiMmcMode" runat="server">
<ItemTemplate>
<%# Container.DataItem?.ToString() ?? string.Empty%><br/>
</ItemTemplate>
</asp:Repeater>
</div>
<div id="divScsiMmcFeatures" runat="server">
<br/><b>SCSI MMC features:</b><br/>
<asp:Repeater ID="repScsiMmcFeatures" runat="server">
<ItemTemplate>
<%# Container.DataItem?.ToString() ?? string.Empty%><br/>
</ItemTemplate>
</asp:Repeater>
</div>
<div id="divScsiSsc" runat="server">
<br/><b>SCSI Streaming device capabilities:</b><br/>
Block size granularity: <asp:Label runat="server" id="lblScsiSscGranularity"/><br/>
Maximum block length: <asp:Label runat="server" id="lblScsiSscMaxBlock"/> bytes<br/>
Minimum block length: <asp:Label runat="server" id="lblScsiSscMinBlock"/> bytes<br/>
<asp:Repeater ID="repScsiSscDensities" runat="server">
<ItemTemplate>
<br/><b>Information for supported density with primary code <asp:Label runat="server" Text='<%# string.Format("{0:X2h}", Eval("PrimaryCode")) %>' /> and secondary code <asp:Label runat="server" Text='<%# string.Format("{0:X2h}", Eval("SecondaryCode")) %>' /></b><br/>
Drive can write this density: <asp:Label runat="server" Text='<%# string.Format("{0}", Eval("Writable")) %>' /><br/>
Duplicate density: <asp:Label runat="server" Text='<%# string.Format("{0}", Eval("Duplicate")) %>' /><br/>
Default density: <asp:Label runat="server" Text='<%# string.Format("{0}", Eval("DefaultDensity")) %>' /><br/>
Density has <asp:Label runat="server" Text='<%# Eval("BitsPerMm") %>' /> bits per mm, with <asp:Label runat="server" Text='<%# Eval("Tracks") %>' /> tracks in a <asp:Label runat="server" Text='<%# Eval("Width") %>' /> mm width tape
Name: <asp:Label runat="server" Text='<%# Eval("Name") %>' /><br/>
Organization: <asp:Label runat="server" Text='<%# Eval("Organization") %>' /><br/>
Description: <asp:Label runat="server" Text='<%# Eval("Description") %>' /><br/>
Maximum capacity: <asp:Label runat="server" Text='<%# Eval("Capacity") %>' /> megabytes<br/>
</ItemTemplate>
</asp:Repeater>
<asp:Repeater ID="repScsiSscMedias" runat="server">
<ItemTemplate>
<br/><b>Information for supported media with type code <asp:Label runat="server" Text='<%# string.Format("{0:X2h}", Eval("MediumType")) %>' /></b><br/>
Drive can write this density: <asp:Label runat="server" Text='<%# string.Format("{0}", Eval("Writable")) %>' /><br/>
Media is <asp:Label runat="server" Text='<%# Eval("Length") %>' /> meters long in a <asp:Label runat="server" Text='<%# Eval("Width") %>' /> mm width tape
Name: <asp:Label runat="server" Text='<%# Eval("Name") %>' /><br/>
Organization: <asp:Label runat="server" Text='<%# Eval("Organization") %>' /><br/>
Description: <asp:Label runat="server" Text='<%# Eval("Description") %>' /><br/>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
<div id="divTestedMedia" runat="server">
<br/><b>Tested media:</b><br/>
<asp:Repeater ID="repTestedMedia" runat="server">
<ItemTemplate>
<%# Container.DataItem?.ToString() ?? string.Empty%><br/>
</ItemTemplate>
</asp:Repeater>
</div>
</body>
</html>

View File

@@ -1,12 +1,483 @@
using System;
using System.Web;
using System.Web.UI;
using System.Text;
using System.IO;
using System.Xml.Serialization;
using DiscImageChef.Metadata;
using System.Collections.Generic;
using System.Net;
using static DiscImageChef.Decoders.ATA.Identify;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Server.App_Start;
using System.Web.Compilation;
using System.Web.Configuration;
namespace DiscImageChef.Server
{
public partial class ViewReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
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('?', '_');
lblManufacturer.Text = manufacturer;
lblModel.Text = model;
lblRevision.Text = revision;
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(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile)))
{
content.InnerHtml = "<b>Could not find the specified report</b>";
return;
}
DeviceReport report = new DeviceReport();
XmlSerializer xs = new XmlSerializer(report.GetType());
StreamReader sr = new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "Reports", xmlFile));
report = (DeviceReport)xs.Deserialize(sr);
sr.Close();
if(report.USB != null)
{
string usbVendorDescription = null;
string usbProductDescription = null;
GetUsbDescriptions(report.USB.VendorID, report.USB.ProductID, out usbVendorDescription, out usbProductDescription);
lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer);
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;
if(report.FireWire != null)
{
lblFirewireManufacturer.Text = HttpUtility.HtmlEncode(report.FireWire.Manufacturer);
lblFirewireProduct.Text = HttpUtility.HtmlEncode(report.FireWire.Product);
lblFirewireVendor.Text = string.Format("0x{0:x8}", report.FireWire.VendorID);
lblFirewireProductId.Text = string.Format("0x{0:x8}", report.FireWire.ProductID);
}
else
divFirewire.Visible = false;
if(report.PCMCIA != null)
{
lblPcmciaManufacturer.Text = HttpUtility.HtmlEncode(report.PCMCIA.Manufacturer);
lblPcmciaProduct.Text = HttpUtility.HtmlEncode(report.PCMCIA.ProductName);
lblPcmciaManufacturerCode.Text = string.Format("0x{0:x4}", report.PCMCIA.ManufacturerCode);
lblPcmciaCardCode.Text = string.Format("0x{0:x4}", report.PCMCIA.CardCode);
lblPcmciaCompliance.Text = HttpUtility.HtmlEncode(report.PCMCIA.Compliance);
Decoders.PCMCIA.Tuple[] tuples = Decoders.PCMCIA.CIS.GetTuples(report.PCMCIA.CIS);
if(tuples != null)
{
Dictionary<string, string> decodedTuples = new Dictionary<string, string>();
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
{
switch(tuple.Code)
{
case Decoders.PCMCIA.TupleCodes.CISTPL_NULL:
case Decoders.PCMCIA.TupleCodes.CISTPL_END:
case Decoders.PCMCIA.TupleCodes.CISTPL_MANFID:
case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_1:
break;
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO:
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICEGEO_A:
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", string.Format("{0} bits", (1 << (geometry.CardInterface - 1)) * 8));
decodedTuples.Add("Erase block", string.Format("{0} bytes", (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))));
decodedTuples.Add("Read block", string.Format("{0} bytes", (1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))));
decodedTuples.Add("Write block", string.Format("{0} bytes", (1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))));
decodedTuples.Add("Partition alignment", string.Format("{0} bytes", (1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))));
}
}
break;
case Decoders.PCMCIA.TupleCodes.CISTPL_ALTSTR:
case Decoders.PCMCIA.TupleCodes.CISTPL_BAR:
case Decoders.PCMCIA.TupleCodes.CISTPL_BATTERY:
case Decoders.PCMCIA.TupleCodes.CISTPL_BYTEORDER:
case Decoders.PCMCIA.TupleCodes.CISTPL_CFTABLE_ENTRY:
case Decoders.PCMCIA.TupleCodes.CISTPL_CFTABLE_ENTRY_CB:
case Decoders.PCMCIA.TupleCodes.CISTPL_CHECKSUM:
case Decoders.PCMCIA.TupleCodes.CISTPL_CONFIG:
case Decoders.PCMCIA.TupleCodes.CISTPL_CONFIG_CB:
case Decoders.PCMCIA.TupleCodes.CISTPL_DATE:
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE:
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_A:
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_OA:
case Decoders.PCMCIA.TupleCodes.CISTPL_DEVICE_OC:
case Decoders.PCMCIA.TupleCodes.CISTPL_EXTDEVIC:
case Decoders.PCMCIA.TupleCodes.CISTPL_FORMAT:
case Decoders.PCMCIA.TupleCodes.CISTPL_FORMAT_A:
case Decoders.PCMCIA.TupleCodes.CISTPL_FUNCE:
case Decoders.PCMCIA.TupleCodes.CISTPL_FUNCID:
case Decoders.PCMCIA.TupleCodes.CISTPL_GEOMETRY:
case Decoders.PCMCIA.TupleCodes.CISTPL_INDIRECT:
case Decoders.PCMCIA.TupleCodes.CISTPL_JEDEC_A:
case Decoders.PCMCIA.TupleCodes.CISTPL_JEDEC_C:
case Decoders.PCMCIA.TupleCodes.CISTPL_LINKTARGET:
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_A:
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_C:
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_CB:
case Decoders.PCMCIA.TupleCodes.CISTPL_LONGLINK_MFC:
case Decoders.PCMCIA.TupleCodes.CISTPL_NO_LINK:
case Decoders.PCMCIA.TupleCodes.CISTPL_ORG:
case Decoders.PCMCIA.TupleCodes.CISTPL_PWR_MGMNT:
case Decoders.PCMCIA.TupleCodes.CISTPL_SPCL:
case Decoders.PCMCIA.TupleCodes.CISTPL_SWIL:
case Decoders.PCMCIA.TupleCodes.CISTPL_VERS_2:
decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString());
break;
default:
decodedTuples.Add("Unknown tuple ID", string.Format("0x{0:X2}", (byte)tuple.Code));
break;
}
}
if(decodedTuples.Count > 0)
{
repPcmciaTuples.DataSource = decodedTuples;
repPcmciaTuples.DataBind();
}
else
repPcmciaTuples.Visible = false;
}
else
repPcmciaTuples.Visible = false;
}
else
divPcmcia.Visible = false;
bool removable = true;
testedMediaType[] testedMedia = null;
bool ata = false;
bool atapi = false;
bool sscMedia = false;
if(report.ATA != null || report.ATAPI != null)
{
ata = true;
List<string> ataOneValue = new List<string>();
Dictionary<string, string> ataTwoValue = new Dictionary<string, string>();
ataType ataReport;
if(report.ATAPI != null)
{
lblAtapi.Text = "PI";
ataReport = report.ATAPI;
atapi = true;
}
else
ataReport = report.ATA;
bool cfa = report.CompactFlashSpecified && report.CompactFlash;
if(atapi && !cfa)
lblAtaDeviceType.Text = "ATAPI device";
else if(!atapi && cfa)
lblAtaDeviceType.Text = "CompactFlash device";
else
lblAtaDeviceType.Text = "ATA device";
Ata.Report(ataReport, cfa, atapi, ref removable, ref ataOneValue, ref ataTwoValue, ref testedMedia);
repAtaOne.DataSource = ataOneValue;
repAtaOne.DataBind();
repAtaTwo.DataSource = ataTwoValue;
repAtaTwo.DataBind();
}
else
divAta.Visible = false;
if(report.SCSI != null)
{
List<string> scsiOneValue = new List<string>();
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 = 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;
scsiOneValue.AddRange(ScsiInquiry.Report(report.SCSI.Inquiry));
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");
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)
{
repModeSense.DataSource = modePages;
repModeSense.DataBind();
}
else
divScsiModeSense.Visible = false;
if(report.SCSI.EVPDPages != null)
ScsiEvpd.Report(report.SCSI.EVPDPages, report.SCSI.Inquiry.VendorIdentification, ref evpdPages);
if(evpdPages.Count > 0)
{
repEvpd.DataSource = evpdPages;
repEvpd.DataBind();
}
else
divScsiEvpd.Visible = false;
divScsiMmcMode.Visible = false;
divScsiMmcFeatures.Visible = false;
divScsiSsc.Visible = false;
if(report.SCSI.MultiMediaDevice != null)
{
testedMedia = report.SCSI.MultiMediaDevice.TestedMedia;
if(report.SCSI.MultiMediaDevice.ModeSense2A != null)
{
List<string> mmcModeOneValue = new List<string>();
ScsiMmcMode.Report(report.SCSI.MultiMediaDevice.ModeSense2A, ref mmcModeOneValue);
if(mmcModeOneValue.Count > 0)
{
divScsiMmcMode.Visible = true;
repScsiMmcMode.DataSource = mmcModeOneValue;
repScsiMmcMode.DataBind();
}
}
if(report.SCSI.MultiMediaDevice.Features != null)
{
List<string> mmcFeaturesOneValue = new List<string>();
ScsiMmcFeatures.Report(report.SCSI.MultiMediaDevice.Features, ref mmcFeaturesOneValue);
if(mmcFeaturesOneValue.Count > 0)
{
divScsiMmcFeatures.Visible = true;
repScsiMmcFeatures.DataSource = mmcFeaturesOneValue;
repScsiMmcFeatures.DataBind();
}
}
}
else if(report.SCSI.SequentialDevice != null)
{
divScsiSsc.Visible = true;
if(report.SCSI.SequentialDevice.BlockSizeGranularitySpecified)
lblScsiSscGranularity.Text = report.SCSI.SequentialDevice.BlockSizeGranularity.ToString();
else
lblScsiSscGranularity.Text = "Unspecified";
if(report.SCSI.SequentialDevice.MaxBlockLengthSpecified)
lblScsiSscMaxBlock.Text = report.SCSI.SequentialDevice.MaxBlockLength.ToString();
else
lblScsiSscMaxBlock.Text = "Unspecified";
if(report.SCSI.SequentialDevice.MinBlockLengthSpecified)
lblScsiSscMinBlock.Text = report.SCSI.SequentialDevice.MinBlockLength.ToString();
else
lblScsiSscMinBlock.Text = "Unspecified";
if(report.SCSI.SequentialDevice.SupportedDensities != null)
{
repScsiSscDensities.DataSource = report.SCSI.SequentialDevice.SupportedDensities;
repScsiSscDensities.DataBind();
}
else
repScsiSscDensities.Visible = false;
if(report.SCSI.SequentialDevice.SupportedMediaTypes != null)
{
repScsiSscMedias.DataSource = report.SCSI.SequentialDevice.SupportedMediaTypes;
repScsiSscMedias.DataBind();
}
else
repScsiSscMedias.Visible = false;
if(report.SCSI.SequentialDevice.TestedMedia != null)
{
List<string> mediaOneValue = new List<string>();
SscTestedMedia.Report(report.SCSI.SequentialDevice.TestedMedia, ref mediaOneValue);
if(mediaOneValue.Count>0)
{
sscMedia = true;
repTestedMedia.DataSource = mediaOneValue;
repTestedMedia.DataBind();
}
else
divTestedMedia.Visible = false;
}
else
divTestedMedia.Visible = false;
}
else if(report.SCSI.ReadCapabilities != null)
{
removable = false;
if(report.SCSI.ReadCapabilities.BlocksSpecified && report.SCSI.ReadCapabilities.BlockSizeSpecified)
{
scsiOneValue.Add(string.Format("Device has {0} blocks of {1} bytes each", report.SCSI.ReadCapabilities.Blocks, report.SCSI.ReadCapabilities.BlockSize));
if(((report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024) > 1000000)
{
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Tb, {2} TiB", report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize,
(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 / 1000 / 1000, (report.SCSI.ReadCapabilities.Blocks * 512) / 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} GiB", report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize,
(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000 / 1000, (report.SCSI.ReadCapabilities.Blocks * 512) / 1024 / 1024 / 1024));
}
else
{
scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Mb, {2} MiB", report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize,
(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1000 / 1000, (report.SCSI.ReadCapabilities.Blocks * 512) / 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)
scsiOneValue.Add("Device supports READ CAPACITY (16) command.");
if(report.SCSI.ReadCapabilities.SupportsRead)
scsiOneValue.Add("Device supports READ (6) command.");
if(report.SCSI.ReadCapabilities.SupportsRead10)
scsiOneValue.Add("Device supports READ (10) command.");
if(report.SCSI.ReadCapabilities.SupportsRead12)
scsiOneValue.Add("Device supports READ (12) command.");
if(report.SCSI.ReadCapabilities.SupportsRead16)
scsiOneValue.Add("Device supports READ (16) command.");
if(report.SCSI.ReadCapabilities.SupportsReadLong)
scsiOneValue.Add("Device supports READ LONG (10) command.");
if(report.SCSI.ReadCapabilities.SupportsReadLong16)
scsiOneValue.Add("Device supports READ LONG (16) command.");
}
else
testedMedia = report.SCSI.RemovableMedias;
repScsi.DataSource = scsiOneValue;
repScsi.DataBind();
}
else
divScsi.Visible = false;
if(removable && !sscMedia && testedMedia!=null)
{
List<string> mediaOneValue = new List<string>();
TestedMedia.Report(testedMedia, ata, ref mediaOneValue);
if(mediaOneValue.Count > 0)
{
sscMedia = true;
repTestedMedia.DataSource = mediaOneValue;
repTestedMedia.DataBind();
}
else
divTestedMedia.Visible = false;
}
else divTestedMedia.Visible &= sscMedia;
}
catch(Exception)
{
content.InnerHtml = "<b>Could not load device report</b>";
#if DEBUG
throw;
#endif
}
}
static void GetUsbDescriptions(ushort vendor, ushort product, out string vendorDescription, out string productDescription)
{
vendorDescription = null;
productDescription = null;
if(!File.Exists(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids")))
return;
StreamReader tocStream = new StreamReader(Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~"), "usb.ids"));
string _line;
bool inManufacturer = false;
ushort number;
while(tocStream.Peek() >= 0)
{
_line = tocStream.ReadLine();
if(_line.Length == 0 || _line[0] == '#')
continue;
if(inManufacturer)
{
// Finished with the manufacturer
if(_line[0] != '\t')
return;
number = Convert.ToUInt16(_line.Substring(1, 4), 16);
if(number == product)
{
productDescription = _line.Substring(7);
return;
}
}
else
{
// Skip products
if(_line[0] == '\t')
continue;
number = Convert.ToUInt16(_line.Substring(0, 4), 16);
if(number == vendor)
{
vendorDescription = _line.Substring(6);
inManufacturer = true;
}
}
}
}
}
}

View File

@@ -1,12 +1,114 @@
using System;
using System.Web;
using System.Web.UI;
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace DiscImageChef.Server
{
public partial class ViewReport
{
}
namespace DiscImageChef.Server {
public partial class ViewReport {
protected System.Web.UI.HtmlControls.HtmlGenericControl content;
protected System.Web.UI.WebControls.Label lblManufacturer;
protected System.Web.UI.WebControls.Label lblModel;
protected System.Web.UI.WebControls.Label lblRevision;
protected System.Web.UI.HtmlControls.HtmlGenericControl divUsb;
protected System.Web.UI.WebControls.Label lblUsbManufacturer;
protected System.Web.UI.WebControls.Label lblUsbProduct;
protected System.Web.UI.WebControls.Label lblUsbVendor;
protected System.Web.UI.WebControls.Label lblUsbVendorDescription;
protected System.Web.UI.WebControls.Label lblUsbProductId;
protected System.Web.UI.WebControls.Label lblUsbProductDescription;
protected System.Web.UI.HtmlControls.HtmlGenericControl divFirewire;
protected System.Web.UI.WebControls.Label lblFirewireManufacturer;
protected System.Web.UI.WebControls.Label lblFirewireProduct;
protected System.Web.UI.WebControls.Label lblFirewireVendor;
protected System.Web.UI.WebControls.Label lblFirewireProductId;
protected System.Web.UI.HtmlControls.HtmlGenericControl divPcmcia;
protected System.Web.UI.WebControls.Label lblPcmciaManufacturer;
protected System.Web.UI.WebControls.Label lblPcmciaProduct;
protected System.Web.UI.WebControls.Label lblPcmciaManufacturerCode;
protected System.Web.UI.WebControls.Label lblPcmciaCardCode;
protected System.Web.UI.WebControls.Label lblPcmciaCompliance;
protected System.Web.UI.WebControls.Repeater repPcmciaTuples;
protected System.Web.UI.HtmlControls.HtmlGenericControl divAta;
protected System.Web.UI.WebControls.Label lblAtapi;
protected System.Web.UI.WebControls.Label lblAtaDeviceType;
protected System.Web.UI.WebControls.Repeater repAtaTwo;
protected System.Web.UI.WebControls.Repeater repAtaOne;
protected System.Web.UI.HtmlControls.HtmlGenericControl divScsi;
protected System.Web.UI.WebControls.Label lblScsiVendor;
protected System.Web.UI.WebControls.Label lblScsiProduct;
protected System.Web.UI.WebControls.Label lblScsiRevision;
protected System.Web.UI.WebControls.Repeater repScsi;
protected System.Web.UI.HtmlControls.HtmlGenericControl divScsiModeSense;
protected System.Web.UI.WebControls.Repeater repModeSense;
protected System.Web.UI.HtmlControls.HtmlGenericControl divScsiEvpd;
protected System.Web.UI.WebControls.Repeater repEvpd;
protected System.Web.UI.HtmlControls.HtmlGenericControl divScsiMmcMode;
protected System.Web.UI.WebControls.Repeater repScsiMmcMode;
protected System.Web.UI.HtmlControls.HtmlGenericControl divScsiMmcFeatures;
protected System.Web.UI.WebControls.Repeater repScsiMmcFeatures;
protected System.Web.UI.HtmlControls.HtmlGenericControl divScsiSsc;
protected System.Web.UI.WebControls.Label lblScsiSscGranularity;
protected System.Web.UI.WebControls.Label lblScsiSscMaxBlock;
protected System.Web.UI.WebControls.Label lblScsiSscMinBlock;
protected System.Web.UI.WebControls.Repeater repScsiSscDensities;
protected System.Web.UI.WebControls.Repeater repScsiSscMedias;
protected System.Web.UI.HtmlControls.HtmlGenericControl divTestedMedia;
protected System.Web.UI.WebControls.Repeater repTestedMedia;
}
}

View File

@@ -8,7 +8,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5">
<compilation targetFramework="4.5">
<assemblies />
</compilation>
<httpRuntime targetFramework="4.5" />

View File

@@ -1,2 +1,117 @@
body {
@font-face {
font-family: 'VGAsquarePx';
src: url(int10h.org/vga_squarepx.eot);
src: url(int10h.org/vga_squarepx.eot?#iefix) format('embedded-opentype'),
url(int10h.org/vga_squarepx.woff2) format('woff2'),
url(int10h.org/vga_squarepx.woff) format('woff'),
url(int10h.org/vga_squarepx.ttf) format('truetype');
font-weight: normal;
font-style: normal;
}
/* define a black "stipple" background with DOS font */
body {
background:
radial-gradient(black 15%, transparent 16%) 0 0,
radial-gradient(black 15%, transparent 16%) 8px 8px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px;
background-color:#282828;
background-size:16px 16px;
color: #aaa;
font-family: 'VGAsquarePx', serif;
font-size: 20pt;
margin: 0;
}
/* links are cyan, hover is bright yellow */
a {
color: #0aa;
text-decoration: none;
}
a:hover {
color: #ff5;
}
/* headings and bold text are bright white */
h1,h2,h3,h4,
b, strong {
color: #fff;
font-size: 1em;
font-style: normal;
font-weight: normal;
margin: 0;
}
/* italic text is green */
em, i {
color: #0a0;
font-style: normal;
}
/* define content areas */
header, main, footer {
margin: 0 auto;
padding: 1em 0;
max-width: 800px;
}
/* use black on cyan text for header */
header {
background-color: #0aa;
color: #000;
}
/* insert the "April 1st" text */
header > h1::before {
content: "Today is April 1, 2017!";
}
header > h1 img {
display: block;
width: 300px;
}
header > form {
}
header > form fieldset {
border: none;
}
/* use black on gray for navigation */
nav {
background-color: #aaa;
color: #000;
}
nav a {
color: #000;
}
nav img {
display: none;
}
nav span {
}
nav > ul {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
nav > ul li {
display: inline;
margin: 0 .5em;
}
/* use white on blue for main text */
main {
background-color: #00a;
color: #aaa;
}
main > nav {
}
main > nav li::before {
content: ">";
}
main > section {
}
main div.third img {
display: block;
}
/* use black on brown text for footer */
footer {
background-color: #a50;
color: #000;
}
footer > nav {
}
footer > section {
}

View File

@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net461" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net461" />
</packages>

View File

@@ -33,6 +33,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Filters", "Di
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Core", "DiscImageChef.Core\DiscImageChef.Core.csproj", "{679659B8-25D0-4279-B632-56EF8F94ADC0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Server", "DiscImageChef.Server\DiscImageChef.Server.csproj", "{75342D7A-C5EA-4A6F-A511-850B54310E5B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@@ -103,39 +105,23 @@ Global
{679659B8-25D0-4279-B632-56EF8F94ADC0}.Debug|x86.Build.0 = Debug|Any CPU
{679659B8-25D0-4279-B632-56EF8F94ADC0}.Release|x86.ActiveCfg = Release|Any CPU
{679659B8-25D0-4279-B632-56EF8F94ADC0}.Release|x86.Build.0 = Release|Any CPU
{75342D7A-C5EA-4A6F-A511-850B54310E5B}.Debug|x86.ActiveCfg = Debug|Any CPU
{75342D7A-C5EA-4A6F-A511-850B54310E5B}.Debug|x86.Build.0 = Debug|Any CPU
{75342D7A-C5EA-4A6F-A511-850B54310E5B}.Release|x86.ActiveCfg = Release|Any CPU
{75342D7A-C5EA-4A6F-A511-850B54310E5B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.StandardHeader = $1
$1.Text = @/***************************************************************************\nThe Disc Image Chef\n----------------------------------------------------------------------------\n \nFilename : ${FileName}\nVersion : 1.0\nAuthor(s) : ${AuthorName}\n \nComponent : Component\n\nRevision : $Revision$\nLast change by : $Author$\nDate : $Date$\n \n--[ Description ] ----------------------------------------------------------\n \nDescription\n \n--[ License ] --------------------------------------------------------------\n \n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as\n published by the Free Software Foundation, either version 3 of the\n License, or (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n----------------------------------------------------------------------------\nCopyright (C) 2011-2015 Claunia.com\n****************************************************************************/\n//$Id$
$1.IncludeInNewFiles = True
$0.TextStylePolicy = $2
$2.scope = text/x-csharp
$2.FileWidth = 120
$2.inheritsSet = VisualStudio
$2.inheritsScope = text/plain
$2.TabsToSpaces = True
$0.CSharpFormattingPolicy = $3
$3.scope = text/x-csharp
$3.IndentBraces = True
$3.IndentBlock = False
$3.IndentSwitchCaseSection = False
$3.SpaceAfterControlFlowStatementKeyword = False
$3.IndentSwitchSection = True
$3.NewLinesForBracesInProperties = True
$3.NewLinesForBracesInAccessors = True
$3.NewLinesForBracesInAnonymousMethods = True
$3.NewLinesForBracesInControlBlocks = True
$3.NewLinesForBracesInAnonymousTypes = True
$3.NewLinesForBracesInObjectCollectionArrayInitializers = True
$3.NewLinesForBracesInLambdaExpressionBody = True
$3.NewLineForElse = True
$3.NewLineForCatch = True
$3.NewLineForFinally = True
$3.SpacingAfterMethodDeclarationName = False
$3.SpaceAfterMethodCallName = False
$3.SpaceBeforeOpenSquareBracket = False
$3.inheritsSet = Mono
$3.inheritsScope = text/x-csharp
$0.DotNetNamingPolicy = $4
$4.DirectoryNamespaceAssociation = Hierarchical
$4.ResourceNamePolicy = MSBuild
@@ -279,7 +265,6 @@ Global
$31.LastFilePostfix = "@:\n "
$31.IncludeDirectoryPaths = True
$31.LineAlign = 0
$30.inheritsSet = Mono
description = The Disc Image Chef.
version = 3.3.99.0
EndGlobalSection