Create new more extensible device report format in JSON.

This commit is contained in:
2018-11-25 17:47:14 +00:00
parent 8ef2e1bcb6
commit 667acd9faa
18 changed files with 829 additions and 1848 deletions

View File

@@ -134,6 +134,7 @@
<e p="MediaTypeFromSCSI.cs" t="Include" />
<e p="Metadata" t="Include">
<e p="DeviceReport.cs" t="Include" />
<e p="DeviceReportV2.cs" t="Include" />
<e p="Dimensions.cs" t="Include" />
<e p="MediaType.cs" t="Include" />
<e p="Resume.cs" t="Include" />

View File

@@ -76,6 +76,7 @@
<Compile Include="Interop\PlatformID.cs" />
<Compile Include="Interop\Version.cs" />
<Compile Include="Metadata\DeviceReport.cs" />
<Compile Include="Metadata\DeviceReportV2.cs" />
<Compile Include="Metadata\Dimensions.cs" />
<Compile Include="Metadata\MediaType.cs" />
<Compile Include="Metadata\Resume.cs" />

View File

@@ -0,0 +1,422 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : DeviceReportV2.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : JSON metadata.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains classes for a JSON device report.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System;
using System.Xml.Serialization;
using DiscImageChef.Decoders.ATA;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Decoders.SCSI.MMC;
// ReSharper disable InconsistentNaming
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace DiscImageChef.CommonTypes.Metadata
{
public class DeviceReportV2
{
public Usb USB { get; set; }
public FireWire FireWire { get; set; }
public Pcmcia PCMCIA { get; set; }
public bool CompactFlash { get; set; }
public Ata ATA { get; set; }
public Ata ATAPI { get; set; }
public Scsi SCSI { get; set; }
public MmcSd MultiMediaCard { get; set; }
public MmcSd SecureDigital { get; set; }
}
public class Usb
{
public ushort VendorID { get; set; }
public ushort ProductID { get; set; }
public string Manufacturer { get; set; }
public string Product { get; set; }
public bool RemovableMedia { get; set; }
public byte[] Descriptors { get; set; }
}
public class FireWire
{
public uint VendorID { get; set; }
public uint ProductID { get; set; }
public string Manufacturer { get; set; }
public string Product { get; set; }
public bool RemovableMedia { get; set; }
}
public class Ata
{
public Identify.IdentifyDevice? IdentifyDevice { get; set; }
public byte[] Identify { get; set; }
public TestedMedia ReadCapabilities { get; set; }
public TestedMedia[] RemovableMedias { get; set; }
}
public class Chs
{
public ushort Cylinders { get; set; }
public ushort Heads { get; set; }
public ushort Sectors { get; set; }
}
public class Scsi
{
public Inquiry.SCSIInquiry? Inquiry { get; set; }
public byte[] InquiryData { get; set; }
public ScsiPage[] EVPDPages { get; set; }
public bool SupportsModeSense6 { get; set; }
public bool SupportsModeSense10 { get; set; }
public bool SupportsModeSubpages { get; set; }
public ScsiMode ModeSense { get; set; }
public Mmc MultiMediaDevice { get; set; }
public TestedMedia ReadCapabilities { get; set; }
public TestedMedia[] RemovableMedias { get; set; }
public Ssc SequentialDevice { get; set; }
public byte[] ModeSense6Data { get; set; }
public byte[] ModeSense10Data { get; set; }
}
public class ScsiMode
{
public byte? MediumType { get; set; }
public bool WriteProtected { get; set; }
public BlockDescriptor[] BlockDescriptors { get; set; }
public byte? Speed { get; set; }
public byte? BufferedMode { get; set; }
public bool BlankCheckEnabled { get; set; }
public bool DPOandFUA { get; set; }
public ScsiPage[] ModePages { get; set; }
}
public class BlockDescriptor
{
public byte Density { get; set; }
public ulong? Blocks { get; set; }
public uint? BlockLength { get; set; }
[XmlIgnore]
public bool BlocksSpecified { get; set; }
[XmlIgnore]
public bool BlockLengthSpecified { get; set; }
}
public class ScsiPage
{
public byte page { get; set; }
public byte subpage { get; set; }
public byte[] value { get; set; }
}
public class Mmc
{
public Modes.ModePage_2A? ModeSense2A { get; set; }
public MmcFeatures Features { get; set; }
public TestedMedia[] TestedMedia { get; set; }
}
public class MmcFeatures
{
public byte? AACSVersion { get; set; }
public byte? AGIDs { get; set; }
public byte? BindingNonceBlocks { get; set; }
public ushort? BlocksPerReadableUnit { get; set; }
public bool BufferUnderrunFreeInDVD { get; set; }
public bool BufferUnderrunFreeInSAO { get; set; }
public bool BufferUnderrunFreeInTAO { get; set; }
public bool CanAudioScan { get; set; }
public bool CanEject { get; set; }
public bool CanEraseSector { get; set; }
public bool CanExpandBDRESpareArea { get; set; }
public bool CanFormat { get; set; }
public bool CanFormatBDREWithoutSpare { get; set; }
public bool CanFormatCert { get; set; }
public bool CanFormatFRF { get; set; }
public bool CanFormatQCert { get; set; }
public bool CanFormatRRM { get; set; }
public bool CanGenerateBindingNonce { get; set; }
public bool CanLoad { get; set; }
public bool CanMuteSeparateChannels { get; set; }
public bool CanOverwriteSAOTrack { get; set; }
public bool CanOverwriteTAOTrack { get; set; }
public bool CanPlayCDAudio { get; set; }
public bool CanPseudoOverwriteBDR { get; set; }
public bool CanReadAllDualR { get; set; }
public bool CanReadAllDualRW { get; set; }
public bool CanReadBD { get; set; }
public bool CanReadBDR { get; set; }
public bool CanReadBDRE1 { get; set; }
public bool CanReadBDRE2 { get; set; }
public bool CanReadBDROM { get; set; }
public bool CanReadBluBCA { get; set; }
public bool CanReadCD { get; set; }
public bool CanReadCDMRW { get; set; }
public bool CanReadCPRM_MKB { get; set; }
public bool CanReadDDCD { get; set; }
public bool CanReadDVD { get; set; }
public bool CanReadDVDPlusMRW { get; set; }
public bool CanReadDVDPlusR { get; set; }
public bool CanReadDVDPlusRDL { get; set; }
public bool CanReadDVDPlusRW { get; set; }
public bool CanReadDVDPlusRWDL { get; set; }
public bool CanReadDriveAACSCertificate { get; set; }
public bool CanReadHDDVD { get; set; }
public bool CanReadHDDVDR { get; set; }
public bool CanReadHDDVDRAM { get; set; }
public bool CanReadLeadInCDText { get; set; }
public bool CanReadOldBDR { get; set; }
public bool CanReadOldBDRE { get; set; }
public bool CanReadOldBDROM { get; set; }
public bool CanReadSpareAreaInformation { get; set; }
public bool CanReportDriveSerial { get; set; }
public bool CanReportMediaSerial { get; set; }
public bool CanTestWriteDDCDR { get; set; }
public bool CanTestWriteDVD { get; set; }
public bool CanTestWriteInSAO { get; set; }
public bool CanTestWriteInTAO { get; set; }
public bool CanUpgradeFirmware { get; set; }
public bool CanWriteBD { get; set; }
public bool CanWriteBDR { get; set; }
public bool CanWriteBDRE1 { get; set; }
public bool CanWriteBDRE2 { get; set; }
public bool CanWriteBusEncryptedBlocks { get; set; }
public bool CanWriteCDMRW { get; set; }
public bool CanWriteCDRW { get; set; }
public bool CanWriteCDRWCAV { get; set; }
public bool CanWriteCDSAO { get; set; }
public bool CanWriteCDTAO { get; set; }
public bool CanWriteCSSManagedDVD { get; set; }
public bool CanWriteDDCDR { get; set; }
public bool CanWriteDDCDRW { get; set; }
public bool CanWriteDVDPlusMRW { get; set; }
public bool CanWriteDVDPlusR { get; set; }
public bool CanWriteDVDPlusRDL { get; set; }
public bool CanWriteDVDPlusRW { get; set; }
public bool CanWriteDVDPlusRWDL { get; set; }
public bool CanWriteDVDR { get; set; }
public bool CanWriteDVDRDL { get; set; }
public bool CanWriteDVDRW { get; set; }
public bool CanWriteHDDVDR { get; set; }
public bool CanWriteHDDVDRAM { get; set; }
public bool CanWriteOldBDR { get; set; }
public bool CanWriteOldBDRE { get; set; }
public bool CanWritePackedSubchannelInTAO { get; set; }
public bool CanWriteRWSubchannelInSAO { get; set; }
public bool CanWriteRWSubchannelInTAO { get; set; }
public bool CanWriteRaw { get; set; }
public bool CanWriteRawMultiSession { get; set; }
public bool CanWriteRawSubchannelInTAO { get; set; }
public bool ChangerIsSideChangeCapable { get; set; }
public byte ChangerSlots { get; set; }
public bool ChangerSupportsDiscPresent { get; set; }
public byte? CPRMVersion { get; set; }
public byte? CSSVersion { get; set; }
public bool DBML { get; set; }
public bool DVDMultiRead { get; set; }
public bool EmbeddedChanger { get; set; }
public bool ErrorRecoveryPage { get; set; }
public DateTime? FirmwareDate { get; set; }
public byte? LoadingMechanismType { get; set; }
public bool Locked { get; set; }
public uint? LogicalBlockSize { get; set; }
public bool MultiRead { get; set; }
public PhysicalInterfaces? PhysicalInterfaceStandard { get; set; }
public uint? PhysicalInterfaceStandardNumber { get; set; }
public bool PreventJumper { get; set; }
public bool SupportsAACS { get; set; }
public bool SupportsBusEncryption { get; set; }
public bool SupportsC2 { get; set; }
public bool SupportsCPRM { get; set; }
public bool SupportsCSS { get; set; }
public bool SupportsDAP { get; set; }
public bool SupportsDeviceBusyEvent { get; set; }
public bool SupportsHybridDiscs { get; set; }
public bool SupportsModePage1Ch { get; set; }
public bool SupportsOSSC { get; set; }
public bool SupportsPWP { get; set; }
public bool SupportsSWPP { get; set; }
public bool SupportsSecurDisc { get; set; }
public bool SupportsSeparateVolume { get; set; }
public bool SupportsVCPS { get; set; }
public bool SupportsWriteInhibitDCB { get; set; }
public bool SupportsWriteProtectPAC { get; set; }
public ushort? VolumeLevels { get; set; }
}
public class TestedMedia
{
public Identify.IdentifyDevice? IdentifyDevice { get; set; }
public byte[] IdentifyData { get; set; }
public ulong? Blocks { get; set; }
public uint? BlockSize { get; set; }
public bool? CanReadAACS { get; set; }
public bool? CanReadADIP { get; set; }
public bool? CanReadATIP { get; set; }
public bool? CanReadBCA { get; set; }
public bool? CanReadC2Pointers { get; set; }
public bool? CanReadCMI { get; set; }
public bool? CanReadCorrectedSubchannel { get; set; }
public bool? CanReadCorrectedSubchannelWithC2 { get; set; }
public bool? CanReadDCB { get; set; }
public bool? CanReadDDS { get; set; }
public bool? CanReadDMI { get; set; }
public bool? CanReadDiscInformation { get; set; }
public bool? CanReadFullTOC { get; set; }
public bool? CanReadHDCMI { get; set; }
public bool? CanReadLayerCapacity { get; set; }
public bool? CanReadLeadIn { get; set; }
public bool? CanReadLeadOut { get; set; }
public bool? CanReadMediaID { get; set; }
public bool? CanReadMediaSerial { get; set; }
public bool? CanReadPAC { get; set; }
public bool? CanReadPFI { get; set; }
public bool? CanReadPMA { get; set; }
public bool? CanReadPQSubchannel { get; set; }
public bool? CanReadPQSubchannelWithC2 { get; set; }
public bool? CanReadPRI { get; set; }
public bool? CanReadRWSubchannel { get; set; }
public bool? CanReadRWSubchannelWithC2 { get; set; }
public bool? CanReadRecordablePFI { get; set; }
public bool? CanReadSpareAreaInformation { get; set; }
public bool? CanReadTOC { get; set; }
public byte? Density { get; set; }
public uint? LongBlockSize { get; set; }
public string Manufacturer { get; set; }
public bool MediaIsRecognized { get; set; }
public byte? MediumType { get; set; }
public string MediumTypeName { get; set; }
public string Model { get; set; }
public bool? SupportsHLDTSTReadRawDVD { get; set; }
public bool? SupportsNECReadCDDA { get; set; }
public bool? SupportsPioneerReadCDDA { get; set; }
public bool? SupportsPioneerReadCDDAMSF { get; set; }
public bool? SupportsPlextorReadCDDA { get; set; }
public bool? SupportsPlextorReadRawDVD { get; set; }
public bool? SupportsRead10 { get; set; }
public bool? SupportsRead12 { get; set; }
public bool? SupportsRead16 { get; set; }
public bool? SupportsRead { get; set; }
public bool? SupportsReadCapacity16 { get; set; }
public bool? SupportsReadCapacity { get; set; }
public bool? SupportsReadCd { get; set; }
public bool? SupportsReadCdMsf { get; set; }
public bool? SupportsReadCdRaw { get; set; }
public bool? SupportsReadCdMsfRaw { get; set; }
public bool? SupportsReadLong16 { get; set; }
public bool? SupportsReadLong { get; set; }
public byte[] ModeSense6Data { get; set; }
public byte[] ModeSense10Data { get; set; }
public Chs CHS { get; set; }
public Chs CurrentCHS { get; set; }
public uint? LBASectors { get; set; }
public ulong? LBA48Sectors { get; set; }
public ushort? LogicalAlignment { get; set; }
public ushort? NominalRotationRate { get; set; }
public uint? PhysicalBlockSize { get; set; }
public bool? SolidStateDevice { get; set; }
public ushort? UnformattedBPT { get; set; }
public ushort? UnformattedBPS { get; set; }
public bool? SupportsReadDmaLba { get; set; }
public bool? SupportsReadDmaRetryLba { get; set; }
public bool? SupportsReadLba { get; set; }
public bool? SupportsReadRetryLba { get; set; }
public bool? SupportsReadLongLba { get; set; }
public bool? SupportsReadLongRetryLba { get; set; }
public bool? SupportsSeekLba { get; set; }
public bool? SupportsReadDmaLba48 { get; set; }
public bool? SupportsReadLba48 { get; set; }
public bool? SupportsReadDma { get; set; }
public bool? SupportsReadDmaRetry { get; set; }
public bool? SupportsReadRetry { get; set; }
public bool? SupportsReadLongRetry { get; set; }
public bool? SupportsSeek { get; set; }
}
public class Ssc
{
public byte? BlockSizeGranularity { get; set; }
public uint? MaxBlockLength { get; set; }
public uint? MinBlockLength { get; set; }
public SupportedDensity[] SupportedDensities { get; set; }
public SupportedMedia[] SupportedMediaTypes { get; set; }
public TestedSequentialMedia[] TestedMedia { get; set; }
}
public struct TestedSequentialMedia
{
public bool? CanReadMediaSerial { get; set; }
public byte? Density { get; set; }
public string Manufacturer { get; set; }
public bool MediaIsRecognized { get; set; }
public byte? MediumType { get; set; }
public string MediumTypeName { get; set; }
public string Model { get; set; }
public SupportedDensity[] SupportedDensities { get; set; }
public SupportedMedia[] SupportedMediaTypes { get; set; }
public byte[] ModeSense6Data { get; set; }
public byte[] ModeSense10Data { get; set; }
}
public class Pcmcia
{
public byte[] CIS { get; set; }
public string Compliance { get; set; }
public ushort? ManufacturerCode { get; set; }
public ushort? CardCode { get; set; }
public string Manufacturer { get; set; }
public string ProductName { get; set; }
public string[] AdditionalInformation { get; set; }
}
public class MmcSd
{
public byte[] CID { get; set; }
public byte[] CSD { get; set; }
public byte[] OCR { get; set; }
public byte[] SCR { get; set; }
public byte[] ExtendedCSD { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -48,7 +48,7 @@ namespace DiscImageChef.Core.Devices.Report
/// <param name="dev">Device</param>
/// <param name="report">Device report</param>
/// <param name="debug">If debug is enabled</param>
internal static void Report(Device dev, ref DeviceReport report, bool debug)
internal static void Report(Device dev, ref DeviceReportV2 report, bool debug)
{
if(report == null) return;
@@ -61,486 +61,7 @@ namespace DiscImageChef.Core.Devices.Report
if(!Identify.Decode(buffer).HasValue) return;
Identify.IdentifyDevice? atapiIdNullable = Identify.Decode(buffer);
if(atapiIdNullable != null)
{
Identify.IdentifyDevice atapiId = atapiIdNullable.Value;
report.ATAPI = new ataType();
if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID))
{
report.ATAPI.AdditionalPID = atapiId.AdditionalPID;
report.ATAPI.AdditionalPIDSpecified = true;
}
if(atapiId.APIOSupported != 0)
{
report.ATAPI.APIOSupported = atapiId.APIOSupported;
report.ATAPI.APIOSupportedSpecified = true;
}
if(atapiId.ATAPIByteCount != 0)
{
report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount;
report.ATAPI.ATAPIByteCountSpecified = true;
}
if(atapiId.BufferType != 0)
{
report.ATAPI.BufferType = atapiId.BufferType;
report.ATAPI.BufferTypeSpecified = true;
}
if(atapiId.BufferSize != 0)
{
report.ATAPI.BufferSize = atapiId.BufferSize;
report.ATAPI.BufferSizeSpecified = true;
}
if(atapiId.Capabilities != 0)
{
report.ATAPI.Capabilities = atapiId.Capabilities;
report.ATAPI.CapabilitiesSpecified = true;
}
if(atapiId.Capabilities2 != 0)
{
report.ATAPI.Capabilities2 = atapiId.Capabilities2;
report.ATAPI.Capabilities2Specified = true;
}
if(atapiId.Capabilities3 != 0)
{
report.ATAPI.Capabilities3 = atapiId.Capabilities3;
report.ATAPI.Capabilities3Specified = true;
}
if(atapiId.CFAPowerMode != 0)
{
report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode;
report.ATAPI.CFAPowerModeSpecified = true;
}
if(atapiId.CommandSet != 0)
{
report.ATAPI.CommandSet = atapiId.CommandSet;
report.ATAPI.CommandSetSpecified = true;
}
if(atapiId.CommandSet2 != 0)
{
report.ATAPI.CommandSet2 = atapiId.CommandSet2;
report.ATAPI.CommandSet2Specified = true;
}
if(atapiId.CommandSet3 != 0)
{
report.ATAPI.CommandSet3 = atapiId.CommandSet3;
report.ATAPI.CommandSet3Specified = true;
}
if(atapiId.CommandSet4 != 0)
{
report.ATAPI.CommandSet4 = atapiId.CommandSet4;
report.ATAPI.CommandSet4Specified = true;
}
if(atapiId.CommandSet5 != 0)
{
report.ATAPI.CommandSet5 = atapiId.CommandSet5;
report.ATAPI.CommandSet5Specified = true;
}
if(atapiId.CurrentAAM != 0)
{
report.ATAPI.CurrentAAM = atapiId.CurrentAAM;
report.ATAPI.CurrentAAMSpecified = true;
}
if(atapiId.CurrentAPM != 0)
{
report.ATAPI.CurrentAPM = atapiId.CurrentAPM;
report.ATAPI.CurrentAPMSpecified = true;
}
if(atapiId.DataSetMgmt != 0)
{
report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt;
report.ATAPI.DataSetMgmtSpecified = true;
}
if(atapiId.DataSetMgmtSize != 0)
{
report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize;
report.ATAPI.DataSetMgmtSizeSpecified = true;
}
if(atapiId.DeviceFormFactor != 0)
{
report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor;
report.ATAPI.DeviceFormFactorSpecified = true;
}
if(atapiId.DMAActive != 0)
{
report.ATAPI.DMAActive = atapiId.DMAActive;
report.ATAPI.DMAActiveSpecified = true;
}
if(atapiId.DMASupported != 0)
{
report.ATAPI.DMASupported = atapiId.DMASupported;
report.ATAPI.DMASupportedSpecified = true;
}
if(atapiId.DMATransferTimingMode != 0)
{
report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode;
report.ATAPI.DMATransferTimingModeSpecified = true;
}
if(atapiId.EnhancedSecurityEraseTime != 0)
{
report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime;
report.ATAPI.EnhancedSecurityEraseTimeSpecified = true;
}
if(atapiId.EnabledCommandSet != 0)
{
report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet;
report.ATAPI.EnabledCommandSetSpecified = true;
}
if(atapiId.EnabledCommandSet2 != 0)
{
report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2;
report.ATAPI.EnabledCommandSet2Specified = true;
}
if(atapiId.EnabledCommandSet3 != 0)
{
report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3;
report.ATAPI.EnabledCommandSet3Specified = true;
}
if(atapiId.EnabledCommandSet4 != 0)
{
report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4;
report.ATAPI.EnabledCommandSet4Specified = true;
}
if(atapiId.EnabledSATAFeatures != 0)
{
report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures;
report.ATAPI.EnabledSATAFeaturesSpecified = true;
}
if(atapiId.ExtendedUserSectors != 0)
{
report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors;
report.ATAPI.ExtendedUserSectorsSpecified = true;
}
if(atapiId.FreeFallSensitivity != 0)
{
report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity;
report.ATAPI.FreeFallSensitivitySpecified = true;
}
if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision))
{
report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision;
report.ATAPI.FirmwareRevisionSpecified = true;
}
if(atapiId.GeneralConfiguration != 0)
{
report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration;
report.ATAPI.GeneralConfigurationSpecified = true;
}
if(atapiId.HardwareResetResult != 0)
{
report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult;
report.ATAPI.HardwareResetResultSpecified = true;
}
if(atapiId.InterseekDelay != 0)
{
report.ATAPI.InterseekDelay = atapiId.InterseekDelay;
report.ATAPI.InterseekDelaySpecified = true;
}
if(atapiId.MajorVersion != 0)
{
report.ATAPI.MajorVersion = atapiId.MajorVersion;
report.ATAPI.MajorVersionSpecified = true;
}
if(atapiId.MasterPasswordRevisionCode != 0)
{
report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode;
report.ATAPI.MasterPasswordRevisionCodeSpecified = true;
}
if(atapiId.MaxDownloadMicroMode3 != 0)
{
report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3;
report.ATAPI.MaxDownloadMicroMode3Specified = true;
}
if(atapiId.MaxQueueDepth != 0)
{
report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth;
report.ATAPI.MaxQueueDepthSpecified = true;
}
if(atapiId.MDMAActive != 0)
{
report.ATAPI.MDMAActive = atapiId.MDMAActive;
report.ATAPI.MDMAActiveSpecified = true;
}
if(atapiId.MDMASupported != 0)
{
report.ATAPI.MDMASupported = atapiId.MDMASupported;
report.ATAPI.MDMASupportedSpecified = true;
}
if(atapiId.MinDownloadMicroMode3 != 0)
{
report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3;
report.ATAPI.MinDownloadMicroMode3Specified = true;
}
if(atapiId.MinMDMACycleTime != 0)
{
report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime;
report.ATAPI.MinMDMACycleTimeSpecified = true;
}
if(atapiId.MinorVersion != 0)
{
report.ATAPI.MinorVersion = atapiId.MinorVersion;
report.ATAPI.MinorVersionSpecified = true;
}
if(atapiId.MinPIOCycleTimeNoFlow != 0)
{
report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow;
report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true;
}
if(atapiId.MinPIOCycleTimeFlow != 0)
{
report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow;
report.ATAPI.MinPIOCycleTimeFlowSpecified = true;
}
if(!string.IsNullOrWhiteSpace(atapiId.Model))
{
report.ATAPI.Model = atapiId.Model;
report.ATAPI.ModelSpecified = true;
}
if(atapiId.MultipleMaxSectors != 0)
{
report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors;
report.ATAPI.MultipleMaxSectorsSpecified = true;
}
if(atapiId.MultipleSectorNumber != 0)
{
report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber;
report.ATAPI.MultipleSectorNumberSpecified = true;
}
if(atapiId.NVCacheCaps != 0)
{
report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps;
report.ATAPI.NVCacheCapsSpecified = true;
}
if(atapiId.NVCacheSize != 0)
{
report.ATAPI.NVCacheSize = atapiId.NVCacheSize;
report.ATAPI.NVCacheSizeSpecified = true;
}
if(atapiId.NVCacheWriteSpeed != 0)
{
report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed;
report.ATAPI.NVCacheWriteSpeedSpecified = true;
}
if(atapiId.NVEstimatedSpinUp != 0)
{
report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp;
report.ATAPI.NVEstimatedSpinUpSpecified = true;
}
if(atapiId.PacketBusRelease != 0)
{
report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease;
report.ATAPI.PacketBusReleaseSpecified = true;
}
if(atapiId.PIOTransferTimingMode != 0)
{
report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode;
report.ATAPI.PIOTransferTimingModeSpecified = true;
}
if(atapiId.RecommendedAAM != 0)
{
report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM;
report.ATAPI.RecommendedAAMSpecified = true;
}
if(atapiId.RecMDMACycleTime != 0)
{
report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime;
report.ATAPI.RecommendedMDMACycleTimeSpecified = true;
}
if(atapiId.RemovableStatusSet != 0)
{
report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet;
report.ATAPI.RemovableStatusSetSpecified = true;
}
if(atapiId.SATACapabilities != 0)
{
report.ATAPI.SATACapabilities = atapiId.SATACapabilities;
report.ATAPI.SATACapabilitiesSpecified = true;
}
if(atapiId.SATACapabilities2 != 0)
{
report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2;
report.ATAPI.SATACapabilities2Specified = true;
}
if(atapiId.SATAFeatures != 0)
{
report.ATAPI.SATAFeatures = atapiId.SATAFeatures;
report.ATAPI.SATAFeaturesSpecified = true;
}
if(atapiId.SCTCommandTransport != 0)
{
report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport;
report.ATAPI.SCTCommandTransportSpecified = true;
}
if(atapiId.SectorsPerCard != 0)
{
report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard;
report.ATAPI.SectorsPerCardSpecified = true;
}
if(atapiId.SecurityEraseTime != 0)
{
report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime;
report.ATAPI.SecurityEraseTimeSpecified = true;
}
if(atapiId.SecurityStatus != 0)
{
report.ATAPI.SecurityStatus = atapiId.SecurityStatus;
report.ATAPI.SecurityStatusSpecified = true;
}
if(atapiId.ServiceBusyClear != 0)
{
report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear;
report.ATAPI.ServiceBusyClearSpecified = true;
}
if(atapiId.SpecificConfiguration != 0)
{
report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration;
report.ATAPI.SpecificConfigurationSpecified = true;
}
if(atapiId.StreamAccessLatency != 0)
{
report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency;
report.ATAPI.StreamAccessLatencySpecified = true;
}
if(atapiId.StreamMinReqSize != 0)
{
report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize;
report.ATAPI.StreamMinReqSizeSpecified = true;
}
if(atapiId.StreamPerformanceGranularity != 0)
{
report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity;
report.ATAPI.StreamPerformanceGranularitySpecified = true;
}
if(atapiId.StreamTransferTimeDMA != 0)
{
report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA;
report.ATAPI.StreamTransferTimeDMASpecified = true;
}
if(atapiId.StreamTransferTimePIO != 0)
{
report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO;
report.ATAPI.StreamTransferTimePIOSpecified = true;
}
if(atapiId.TransportMajorVersion != 0)
{
report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion;
report.ATAPI.TransportMajorVersionSpecified = true;
}
if(atapiId.TransportMinorVersion != 0)
{
report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion;
report.ATAPI.TransportMinorVersionSpecified = true;
}
if(atapiId.TrustedComputing != 0)
{
report.ATAPI.TrustedComputing = atapiId.TrustedComputing;
report.ATAPI.TrustedComputingSpecified = true;
}
if(atapiId.UDMAActive != 0)
{
report.ATAPI.UDMAActive = atapiId.UDMAActive;
report.ATAPI.UDMAActiveSpecified = true;
}
if(atapiId.UDMASupported != 0)
{
report.ATAPI.UDMASupported = atapiId.UDMASupported;
report.ATAPI.UDMASupportedSpecified = true;
}
if(atapiId.WRVMode != 0)
{
report.ATAPI.WRVMode = atapiId.WRVMode;
report.ATAPI.WRVModeSpecified = true;
}
if(atapiId.WRVSectorCountMode3 != 0)
{
report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3;
report.ATAPI.WRVSectorCountMode3Specified = true;
}
if(atapiId.WRVSectorCountMode2 != 0)
{
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
report.ATAPI.WRVSectorCountMode2Specified = true;
}
}
if(atapiIdNullable != null) report.ATAPI = new CommonTypes.Metadata.Ata {IdentifyDevice = atapiIdNullable};
if(debug) report.ATAPI.Identify = buffer;
}

View File

@@ -48,7 +48,7 @@ namespace DiscImageChef.Core.Devices.Report
/// <param name="dev">Device</param>
/// <param name="report">Device report</param>
/// <param name="removable">If device is removable</param>
internal static void Report(Device dev, ref DeviceReport report, ref bool removable)
internal static void Report(Device dev, ref DeviceReportV2 report, ref bool removable)
{
if(report == null) return;
@@ -62,7 +62,7 @@ namespace DiscImageChef.Core.Devices.Report
if(pressedKey.Key != ConsoleKey.Y) return;
report.FireWire = new firewireType
report.FireWire = new CommonTypes.Metadata.FireWire
{
Manufacturer = dev.FireWireVendorName,
Product = dev.FireWireModelName,

View File

@@ -38,7 +38,7 @@ namespace DiscImageChef.Core.Devices.Report
{
public static class Nvme
{
public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
public static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref bool removable)
{
if(report == null) return;

View File

@@ -46,9 +46,9 @@ namespace DiscImageChef.Core.Devices.Report
/// </summary>
/// <param name="dev">Device</param>
/// <param name="report">Device report</param>
internal static void Report(Device dev, ref DeviceReport report)
internal static void Report(Device dev, ref DeviceReportV2 report)
{
report.PCMCIA = new pcmciaType {CIS = dev.Cis};
report.PCMCIA = new CommonTypes.Metadata.Pcmcia {CIS = dev.Cis};
Tuple[] tuples = CIS.GetTuples(dev.Cis);
if(tuples == null) return;
@@ -60,10 +60,8 @@ namespace DiscImageChef.Core.Devices.Report
if(manfid != null)
{
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
report.PCMCIA.CardCode = manfid.CardID;
report.PCMCIA.ManufacturerCodeSpecified = true;
report.PCMCIA.CardCodeSpecified = true;
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
report.PCMCIA.CardCode = manfid.CardID;
}
break;

View File

@@ -55,7 +55,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
/// <param name="report">Device report</param>
/// <param name="debug">If debug is enabled</param>
/// <param name="removable">If device is removable</param>
public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
public static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref bool removable)
{
if(report == null) return;
@@ -87,110 +87,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Querying SCSI INQUIRY...");
sense = dev.ScsiInquiry(out byte[] buffer, out byte[] senseBuffer);
report.SCSI = new scsiType();
report.SCSI = new Scsi();
if(!sense && Inquiry.Decode(buffer).HasValue)
{
Inquiry.SCSIInquiry inq = Inquiry.Decode(buffer).Value;
report.SCSI.Inquiry = Inquiry.Decode(buffer);
List<ushort> versionDescriptors = new List<ushort>();
report.SCSI.Inquiry = new scsiInquiryType();
if(inq.DeviceTypeModifier != 0)
{
report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier;
report.SCSI.Inquiry.DeviceTypeModifierSpecified = true;
}
if(inq.ISOVersion != 0)
{
report.SCSI.Inquiry.ISOVersion = inq.ISOVersion;
report.SCSI.Inquiry.ISOVersionSpecified = true;
}
if(inq.ECMAVersion != 0)
{
report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion;
report.SCSI.Inquiry.ECMAVersionSpecified = true;
}
if(inq.ANSIVersion != 0)
{
report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion;
report.SCSI.Inquiry.ANSIVersionSpecified = true;
}
if(inq.ResponseDataFormat != 0)
{
report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat;
report.SCSI.Inquiry.ResponseDataFormatSpecified = true;
}
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification)))
{
report.SCSI.Inquiry.VendorIdentification =
StringHandlers.CToString(inq.VendorIdentification).Trim();
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification))
report.SCSI.Inquiry.VendorIdentificationSpecified = true;
}
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification)))
{
report.SCSI.Inquiry.ProductIdentification =
StringHandlers.CToString(inq.ProductIdentification).Trim();
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification))
report.SCSI.Inquiry.ProductIdentificationSpecified = true;
}
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel)))
{
report.SCSI.Inquiry.ProductRevisionLevel =
StringHandlers.CToString(inq.ProductRevisionLevel).Trim();
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel))
report.SCSI.Inquiry.ProductRevisionLevelSpecified = true;
}
if(inq.VersionDescriptors != null)
{
versionDescriptors.AddRange(inq.VersionDescriptors.Where(descriptor => descriptor != 0));
if(versionDescriptors.Count > 0)
report.SCSI.Inquiry.VersionDescriptors = versionDescriptors.ToArray();
}
report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier;
report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType;
report.SCSI.Inquiry.AsymmetricalLUNAccess = (TGPSValues)inq.TPGS;
report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking;
report.SCSI.Inquiry.AccessControlCoordinator = inq.ACC;
report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ;
report.SCSI.Inquiry.AERCSupported = inq.AERC;
report.SCSI.Inquiry.Address16 = inq.Addr16;
report.SCSI.Inquiry.Address32 = inq.Addr32;
report.SCSI.Inquiry.BasicQueueing = inq.BQue;
report.SCSI.Inquiry.EnclosureServices = inq.EncServ;
report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup;
report.SCSI.Inquiry.IUS = inq.IUS;
report.SCSI.Inquiry.LinkedCommands = inq.Linked;
report.SCSI.Inquiry.MediumChanger = inq.MChngr;
report.SCSI.Inquiry.MultiPortDevice = inq.MultiP;
report.SCSI.Inquiry.NormalACA = inq.NormACA;
report.SCSI.Inquiry.Protection = inq.Protect;
report.SCSI.Inquiry.QAS = inq.QAS;
report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr;
report.SCSI.Inquiry.Removable = inq.RMB;
report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue;
report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk;
report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC;
report.SCSI.Inquiry.TranferDisable = inq.TranDis;
report.SCSI.Inquiry.SoftReset = inq.SftRe;
report.SCSI.Inquiry.StorageArrayController = inq.SCCS;
report.SCSI.Inquiry.SyncTransfer = inq.Sync;
report.SCSI.Inquiry.WideBus16 = inq.WBus16;
report.SCSI.Inquiry.WideBus32 = inq.WBus32;
if(debug) report.SCSI.Inquiry.Data = buffer;
if(debug) report.SCSI.InquiryData = buffer;
}
DicConsole.WriteLine("Querying list of SCSI EVPDs...");
@@ -201,14 +104,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
byte[] evpdPages = EVPD.DecodePage00(buffer);
if(evpdPages != null && evpdPages.Length > 0)
{
List<pageType> evpds = new List<pageType>();
List<ScsiPage> evpds = new List<ScsiPage>();
foreach(byte page in evpdPages.Where(page => page != 0x80))
{
DicConsole.WriteLine("Querying SCSI EVPD {0:X2}h...", page);
sense = dev.ScsiInquiry(out buffer, out senseBuffer, page);
if(sense) continue;
pageType evpd = new pageType {page = page, value = buffer};
ScsiPage evpd = new ScsiPage {page = page, value = buffer};
evpds.Add(evpd);
}
@@ -287,7 +190,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(decMode.HasValue)
{
report.SCSI.ModeSense = new modeType
report.SCSI.ModeSense = new ScsiMode
{
BlankCheckEnabled = decMode.Value.Header.EBC,
DPOandFUA = decMode.Value.Header.DPOFUA,
@@ -295,27 +198,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
};
if(decMode.Value.Header.BufferedMode > 0)
{
report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode;
report.SCSI.ModeSense.BufferedModeSpecified = true;
}
report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode;
if(decMode.Value.Header.Speed > 0)
{
report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed;
report.SCSI.ModeSense.SpeedSpecified = true;
}
if(decMode.Value.Header.Speed > 0) report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed;
if(decMode.Value.Pages != null)
{
List<modePageType> modePages = new List<modePageType>();
List<ScsiPage> modePages = new List<ScsiPage>();
foreach(Modes.ModePage page in decMode.Value.Pages)
{
modePageType modePage = new modePageType
ScsiPage modePage = new ScsiPage
{
page = page.Page,
subpage = page.Subpage,
value = page.PageResponse
page = page.Page, subpage = page.Subpage, value = page.PageResponse
};
modePages.Add(modePage);
@@ -327,10 +221,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
}
string productIdentification = null;
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(report.SCSI.Inquiry?.ProductIdentification)))
productIdentification = StringHandlers.CToString(report.SCSI.Inquiry?.ProductIdentification).Trim();
switch(dev.ScsiType)
{
case PeripheralDeviceTypes.MultiMediaDevice:
Mmc.Report(dev, ref report, debug, ref cdromMode);
Mmc.Report(dev, ref report, debug, ref cdromMode, productIdentification);
break;
case PeripheralDeviceTypes.SequentialAccess:
Ssc.Report(dev, ref report, debug);
@@ -338,7 +236,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
default:
if(removable)
{
List<testedMediaType> mediaTests = new List<testedMediaType>();
List<TestedMedia> mediaTests = new List<TestedMedia>();
pressedKey = new ConsoleKeyInfo();
while(pressedKey.Key != ConsoleKey.N)
@@ -356,7 +254,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
System.Console.ReadKey(true);
testedMediaType mediaTest = new testedMediaType();
TestedMedia mediaTest = new TestedMedia();
DicConsole.Write("Please write a description of the media type and press enter: ");
mediaTest.MediumTypeName = System.Console.ReadLine();
DicConsole.Write("Please write the media manufacturer and press enter: ");
@@ -364,9 +262,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.Write("Please write the media model and press enter: ");
mediaTest.Model = System.Console.ReadLine();
mediaTest.ManufacturerSpecified = true;
mediaTest.ModelSpecified = true;
mediaTest.MediaIsRecognized = true;
mediaTest.MediaIsRecognized = true;
sense = dev.ScsiTestUnitReady(out senseBuffer, TIMEOUT, out _);
if(sense)
@@ -409,9 +305,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(mediaTest.MediaIsRecognized)
{
mediaTest.SupportsReadCapacitySpecified = true;
mediaTest.SupportsReadCapacity16Specified = true;
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
sense = dev.ReadCapacity(out buffer, out senseBuffer, TIMEOUT, out _);
if(!sense && !dev.Error)
@@ -422,8 +315,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
1;
mediaTest.BlockSize =
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
mediaTest.BlocksSpecified = true;
mediaTest.BlockSizeSpecified = true;
}
DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)...");
@@ -437,8 +328,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
mediaTest.BlockSize =
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]);
mediaTest.BlocksSpecified = true;
mediaTest.BlockSizeSpecified = true;
}
decMode = null;
@@ -464,26 +353,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(decMode.HasValue)
{
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
mediaTest.MediumTypeSpecified = true;
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
if(decMode.Value.Header.BlockDescriptors != null &&
decMode.Value.Header.BlockDescriptors.Length > 0)
{
mediaTest.Density =
(byte)decMode.Value.Header.BlockDescriptors[0].Density;
mediaTest.DensitySpecified = true;
}
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
}
mediaTest.SupportsReadSpecified = true;
mediaTest.SupportsRead10Specified = true;
mediaTest.SupportsRead12Specified = true;
mediaTest.SupportsRead16Specified = true;
mediaTest.SupportsReadLongSpecified = true;
DicConsole.WriteLine("Trying SCSI READ (6)...");
mediaTest.SupportsRead =
!dev.Read6(out buffer, out senseBuffer, 0, mediaTest.BlockSize, TIMEOUT, out _);
mediaTest.SupportsRead = !dev.Read6(out buffer, out senseBuffer, 0,
mediaTest.BlockSize ?? 512, TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead);
if(debug)
DataFile.WriteTo("SCSI Report", "read6",
@@ -493,7 +371,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Trying SCSI READ (10)...");
mediaTest.SupportsRead10 =
!dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0,
mediaTest.BlockSize, 0, 1, TIMEOUT, out _);
mediaTest.BlockSize ?? 512, 0, 1, TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead10);
if(debug)
DataFile.WriteTo("SCSI Report", "read10",
@@ -503,7 +381,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Trying SCSI READ (12)...");
mediaTest.SupportsRead12 =
!dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0,
mediaTest.BlockSize, 0, 1, false, TIMEOUT, out _);
mediaTest.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead12);
if(debug)
DataFile.WriteTo("SCSI Report", "read12",
@@ -513,7 +391,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Trying SCSI READ (16)...");
mediaTest.SupportsRead16 =
!dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0,
mediaTest.BlockSize, 0, 1, false, TIMEOUT, out _);
mediaTest.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.SupportsRead16);
if(debug)
DataFile.WriteTo("SCSI Report", "read16",
@@ -534,15 +412,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
{
mediaTest.SupportsReadLong = true;
if(decSense.Value.InformationValid && decSense.Value.ILI)
{
mediaTest.LongBlockSize =
0xFFFF - (decSense.Value.Information & 0xFFFF);
mediaTest.LongBlockSizeSpecified = true;
}
}
}
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize)
if(mediaTest.BlockSize == 512)
foreach(int i in new[]
{
@@ -559,9 +434,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
testSize, TIMEOUT, out _);
if(sense || dev.Error) continue;
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = testSize;
mediaTest.LongBlockSizeSpecified = true;
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = testSize;
break;
}
else if(mediaTest.BlockSize == 1024)
@@ -578,9 +452,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
(ushort)i, TIMEOUT, out _);
if(sense || dev.Error) continue;
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = testSize;
mediaTest.LongBlockSizeSpecified = true;
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = testSize;
break;
}
else if(mediaTest.BlockSize == 2048)
@@ -589,9 +462,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
TIMEOUT, out _);
if(!sense && !dev.Error)
{
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = 2380;
mediaTest.LongBlockSizeSpecified = true;
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = 2380;
}
}
else if(mediaTest.BlockSize == 4096)
@@ -600,9 +472,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
TIMEOUT, out _);
if(!sense && !dev.Error)
{
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = 4760;
mediaTest.LongBlockSizeSpecified = true;
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = 4760;
}
}
else if(mediaTest.BlockSize == 8192)
@@ -611,13 +482,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
TIMEOUT, out _);
if(!sense && !dev.Error)
{
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = 9424;
mediaTest.LongBlockSizeSpecified = true;
mediaTest.SupportsReadLong = true;
mediaTest.LongBlockSize = 9424;
}
}
if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize)
if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize)
{
pressedKey = new ConsoleKeyInfo();
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
@@ -637,8 +507,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
TIMEOUT, out _);
if(!sense)
{
mediaTest.LongBlockSize = i;
mediaTest.LongBlockSizeSpecified = true;
mediaTest.LongBlockSize = i;
break;
}
@@ -649,8 +518,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
}
if(debug && mediaTest.SupportsReadLong && mediaTest.LongBlockSizeSpecified &&
mediaTest.LongBlockSize != mediaTest.BlockSize)
if(debug && mediaTest.SupportsReadLong == true &&
mediaTest.LongBlockSize != mediaTest.BlockSize)
{
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
(ushort)mediaTest.LongBlockSize, TIMEOUT, out _);
@@ -660,7 +529,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
buffer);
}
mediaTest.CanReadMediaSerialSpecified = true;
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
mediaTest.CanReadMediaSerial =
!dev.ReadMediaSerialNumber(out buffer, out senseBuffer, TIMEOUT, out _);
@@ -673,13 +541,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
else
{
report.SCSI.ReadCapabilities = new testedMediaType();
report.SCSI.ReadCapabilitiesSpecified = true;
report.SCSI.ReadCapabilities = new TestedMedia();
report.SCSI.ReadCapabilities.MediaIsRecognized = true;
report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true;
report.SCSI.ReadCapabilities.SupportsReadCapacity16Specified = true;
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
sense = dev.ReadCapacity(out buffer, out senseBuffer, TIMEOUT, out _);
if(!sense && !dev.Error)
@@ -689,8 +553,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1;
report.SCSI.ReadCapabilities.BlockSize =
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
report.SCSI.ReadCapabilities.BlocksSpecified = true;
report.SCSI.ReadCapabilities.BlockSizeSpecified = true;
}
DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)...");
@@ -704,8 +566,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
report.SCSI.ReadCapabilities.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
report.SCSI.ReadCapabilities.BlockSize =
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]);
report.SCSI.ReadCapabilities.BlocksSpecified = true;
report.SCSI.ReadCapabilities.BlockSizeSpecified = true;
}
decMode = null;
@@ -732,65 +592,51 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(decMode.HasValue)
{
report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType;
report.SCSI.ReadCapabilities.MediumTypeSpecified = true;
report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType;
if(decMode.Value.Header.BlockDescriptors != null &&
decMode.Value.Header.BlockDescriptors.Length > 0)
{
report.SCSI.ReadCapabilities.Density =
(byte)decMode.Value.Header.BlockDescriptors[0].Density;
report.SCSI.ReadCapabilities.DensitySpecified = true;
}
}
report.SCSI.ReadCapabilities.SupportsReadSpecified = true;
report.SCSI.ReadCapabilities.SupportsRead10Specified = true;
report.SCSI.ReadCapabilities.SupportsRead12Specified = true;
report.SCSI.ReadCapabilities.SupportsRead16Specified = true;
report.SCSI.ReadCapabilities.SupportsReadLongSpecified = true;
DicConsole.WriteLine("Trying SCSI READ (6)...");
report.SCSI.ReadCapabilities.SupportsRead =
!dev.Read6(out buffer, out senseBuffer, 0, report.SCSI.ReadCapabilities.BlockSize, TIMEOUT,
out _);
!dev.Read6(out buffer, out senseBuffer, 0, report.SCSI.ReadCapabilities.BlockSize ?? 512,
TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!report.SCSI.ReadCapabilities.SupportsRead);
if(debug)
DataFile.WriteTo("SCSI Report", "read6",
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
DataFile.WriteTo("SCSI Report", "read6", "_debug_" + productIdentification + ".bin",
"read results", buffer);
DicConsole.WriteLine("Trying SCSI READ (10)...");
report.SCSI.ReadCapabilities.SupportsRead10 =
!dev.Read10(out buffer, out senseBuffer, 0, false, true, false, false, 0,
report.SCSI.ReadCapabilities.BlockSize, 0, 1, TIMEOUT, out _);
report.SCSI.ReadCapabilities.BlockSize ?? 512, 0, 1, TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!report.SCSI.ReadCapabilities.SupportsRead10);
if(debug)
DataFile.WriteTo("SCSI Report", "read10",
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
DataFile.WriteTo("SCSI Report", "read10", "_debug_" + productIdentification + ".bin",
"read results", buffer);
DicConsole.WriteLine("Trying SCSI READ (12)...");
report.SCSI.ReadCapabilities.SupportsRead12 =
!dev.Read12(out buffer, out senseBuffer, 0, false, true, false, false, 0,
report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, TIMEOUT, out _);
report.SCSI.ReadCapabilities.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!report.SCSI.ReadCapabilities.SupportsRead12);
if(debug)
DataFile.WriteTo("SCSI Report", "read12",
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
DataFile.WriteTo("SCSI Report", "read12", "_debug_" + productIdentification + ".bin",
"read results", buffer);
DicConsole.WriteLine("Trying SCSI READ (16)...");
report.SCSI.ReadCapabilities.SupportsRead16 =
!dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0,
report.SCSI.ReadCapabilities.BlockSize, 0, 1, false, TIMEOUT, out _);
report.SCSI.ReadCapabilities.BlockSize ?? 512, 0, 1, false, TIMEOUT, out _);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!report.SCSI.ReadCapabilities.SupportsRead16);
if(debug)
DataFile.WriteTo("SCSI Report", "read16",
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
DataFile.WriteTo("SCSI Report", "read16", "_debug_" + productIdentification + ".bin",
"read results", buffer);
report.SCSI.ReadCapabilities.LongBlockSize = report.SCSI.ReadCapabilities.BlockSize;
@@ -805,16 +651,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
{
report.SCSI.ReadCapabilities.SupportsReadLong = true;
if(decSense.Value.InformationValid && decSense.Value.ILI)
{
report.SCSI.ReadCapabilities.LongBlockSize =
0xFFFF - (decSense.Value.Information & 0xFFFF);
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
}
}
}
if(report.SCSI.ReadCapabilities.SupportsReadLong &&
report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize)
if(report.SCSI.ReadCapabilities.SupportsReadLong == true &&
report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize)
if(report.SCSI.ReadCapabilities.BlockSize == 512)
foreach(int i in new[]
{
@@ -831,9 +674,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
TIMEOUT, out _);
if(sense || dev.Error) continue;
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
break;
}
else if(report.SCSI.ReadCapabilities.BlockSize == 1024)
@@ -850,9 +692,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
TIMEOUT, out _);
if(sense || dev.Error) continue;
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
break;
}
else if(report.SCSI.ReadCapabilities.BlockSize == 2048)
@@ -861,9 +702,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
out _);
if(!sense && !dev.Error)
{
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = 2380;
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = 2380;
}
}
else if(report.SCSI.ReadCapabilities.BlockSize == 4096)
@@ -872,9 +712,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
out _);
if(!sense && !dev.Error)
{
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = 4760;
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = 4760;
}
}
else if(report.SCSI.ReadCapabilities.BlockSize == 8192)
@@ -883,14 +722,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
out _);
if(!sense && !dev.Error)
{
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = 9424;
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
report.SCSI.ReadCapabilities.SupportsReadLong = true;
report.SCSI.ReadCapabilities.LongBlockSize = 9424;
}
}
if(report.SCSI.ReadCapabilities.SupportsReadLong &&
report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize)
if(report.SCSI.ReadCapabilities.SupportsReadLong == true &&
report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize)
{
pressedKey = new ConsoleKeyInfo();
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
@@ -918,8 +756,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
bingo.Close();
}
report.SCSI.ReadCapabilities.LongBlockSize = i;
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
report.SCSI.ReadCapabilities.LongBlockSize = i;
break;
}
@@ -930,17 +767,15 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
}
if(debug &&
report.SCSI.ReadCapabilities.SupportsReadLong &&
report.SCSI.ReadCapabilities.LongBlockSizeSpecified &&
report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize)
if(debug && report.SCSI.ReadCapabilities.SupportsReadLong == true &&
report.SCSI.ReadCapabilities.LongBlockSize !=
report.SCSI.ReadCapabilities.BlockSize)
{
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0,
(ushort)report.SCSI.ReadCapabilities.LongBlockSize, TIMEOUT, out _);
if(!sense)
DataFile.WriteTo("SCSI Report", "readlong10",
"_debug_" + report.SCSI.Inquiry.ProductIdentification + ".bin",
"read results", buffer);
"_debug_" + productIdentification + ".bin", "read results", buffer);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -52,7 +52,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
/// <param name="dev">Device</param>
/// <param name="report">Device report</param>
/// <param name="debug">If debug is enabled</param>
internal static void Report(Device dev, ref DeviceReport report, bool debug)
internal static void Report(Device dev, ref DeviceReportV2 report, bool debug)
{
if(report == null) return;
@@ -60,7 +60,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
const uint TIMEOUT = 5;
ConsoleKeyInfo pressedKey;
report.SCSI.SequentialDevice = new sscType();
report.SCSI.SequentialDevice = new CommonTypes.Metadata.Ssc();
DicConsole.WriteLine("Querying SCSI READ BLOCK LIMITS...");
sense = dev.ReadBlockLimits(out byte[] buffer, out byte[] senseBuffer, TIMEOUT, out _);
if(!sense)
@@ -69,22 +69,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(decBl.HasValue)
{
if(decBl.Value.granularity > 0)
{
report.SCSI.SequentialDevice.BlockSizeGranularitySpecified = true;
report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity;
}
report.SCSI.SequentialDevice.BlockSizeGranularity = decBl.Value.granularity;
if(decBl.Value.maxBlockLen > 0)
{
report.SCSI.SequentialDevice.MaxBlockLengthSpecified = true;
report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen;
}
report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen;
if(decBl.Value.minBlockLen > 0)
{
report.SCSI.SequentialDevice.MinBlockLengthSpecified = true;
report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen;
}
report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen;
}
}
@@ -153,7 +144,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
}
List<SequentialMedia> seqTests = new List<SequentialMedia>();
List<TestedSequentialMedia> seqTests = new List<TestedSequentialMedia>();
pressedKey = new ConsoleKeyInfo();
while(pressedKey.Key != ConsoleKey.N)
@@ -171,7 +162,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready.");
System.Console.ReadKey(true);
SequentialMedia seqTest = new SequentialMedia();
TestedSequentialMedia seqTest = new TestedSequentialMedia();
DicConsole.Write("Please write a description of the media type and press enter: ");
seqTest.MediumTypeName = System.Console.ReadLine();
DicConsole.Write("Please write the media manufacturer and press enter: ");
@@ -246,14 +237,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(decMode.HasValue)
{
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
seqTest.MediumTypeSpecified = true;
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
if(decMode.Value.Header.BlockDescriptors != null &&
decMode.Value.Header.BlockDescriptors.Length > 0)
{
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
seqTest.DensitySpecified = true;
}
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
}
}
@@ -310,7 +297,6 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
}
seqTest.CanReadMediaSerialSpecified = true;
DicConsole.WriteLine("Trying SCSI READ MEDIA SERIAL NUMBER...");
seqTest.CanReadMediaSerial = !dev.ReadMediaSerialNumber(out buffer, out senseBuffer, TIMEOUT, out _);
seqTests.Add(seqTest);

View File

@@ -46,17 +46,17 @@ namespace DiscImageChef.Core.Devices.Report
/// </summary>
/// <param name="dev">Device</param>
/// <param name="report">Device report</param>
public static void Report(Device dev, ref DeviceReport report)
public static void Report(Device dev, ref DeviceReportV2 report)
{
if(report == null) return;
switch(dev.Type)
{
case DeviceType.MMC:
report.MultiMediaCard = new mmcsdType();
report.MultiMediaCard = new MmcSd();
break;
case DeviceType.SecureDigital:
report.SecureDigital = new mmcsdType();
report.SecureDigital = new MmcSd();
break;
}

View File

@@ -49,7 +49,7 @@ namespace DiscImageChef.Core.Devices.Report
/// <param name="report">Device report</param>
/// <param name="removable">If device is removable</param>
/// <param name="debug">If debug is enabled</param>
internal static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
internal static void Report(Device dev, ref DeviceReportV2 report, bool debug, ref bool removable)
{
if(report == null) return;
@@ -63,7 +63,7 @@ namespace DiscImageChef.Core.Devices.Report
if(pressedKey.Key != ConsoleKey.Y) return;
report.USB = new usbType
report.USB = new CommonTypes.Metadata.Usb
{
Manufacturer = dev.UsbManufacturerString,
Product = dev.UsbProductString,

View File

@@ -49,8 +49,10 @@ using DiscImageChef.Devices;
using Eto.Forms;
using Eto.Serialization.Xaml;
using Schemas;
using Ata = DiscImageChef.Core.Devices.Dumping.Ata;
using DeviceInfo = DiscImageChef.Core.Devices.Info.DeviceInfo;
using MediaType = DiscImageChef.CommonTypes.MediaType;
using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi;
namespace DiscImageChef.Gui.Forms
{

View File

@@ -42,6 +42,8 @@ using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Server.App_Start;
using Ata = DiscImageChef.Server.App_Start.Ata;
using TestedMedia = DiscImageChef.Server.App_Start.TestedMedia;
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
namespace DiscImageChef.Server

View File

@@ -32,12 +32,13 @@
using System;
using System.IO;
using System.Xml.Serialization;
using DiscImageChef.CommonTypes.Metadata;
using DiscImageChef.Console;
using DiscImageChef.Core;
using DiscImageChef.Core.Devices.Report;
using DiscImageChef.Core.Devices.Report.SCSI;
using DiscImageChef.Devices;
using Newtonsoft.Json;
using Ata = DiscImageChef.Core.Devices.Report.Ata;
namespace DiscImageChef.Commands
{
@@ -63,21 +64,18 @@ namespace DiscImageChef.Commands
Core.Statistics.AddDevice(dev);
CommonTypes.Metadata.DeviceReport report = new CommonTypes.Metadata.DeviceReport();
bool removable = false;
string xmlFile;
if(!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision))
xmlFile =
dev.Manufacturer + "_" + dev.Model + "_" + dev.Revision + ".xml";
else if(!string.IsNullOrWhiteSpace(dev.Manufacturer))
xmlFile = dev.Manufacturer + "_" + dev.Model + ".xml";
else if(!string.IsNullOrWhiteSpace(dev.Revision))
xmlFile = dev.Model + "_" + dev.Revision + ".xml";
else
xmlFile =
dev.Model + ".xml";
DeviceReportV2 report = new DeviceReportV2();
bool removable = false;
string jsonFile;
xmlFile = xmlFile.Replace('\\', '_').Replace('/', '_').Replace('?', '_');
if(!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision))
jsonFile = dev.Manufacturer + "_" + dev.Model + "_" + dev.Revision + ".json";
else if(!string.IsNullOrWhiteSpace(dev.Manufacturer))
jsonFile = dev.Manufacturer + "_" + dev.Model + ".json";
else if(!string.IsNullOrWhiteSpace(dev.Revision)) jsonFile = dev.Model + "_" + dev.Revision + ".json";
else jsonFile = dev.Model + ".json";
jsonFile = jsonFile.Replace('\\', '_').Replace('/', '_').Replace('?', '_');
switch(dev.Type)
{
@@ -98,14 +96,20 @@ namespace DiscImageChef.Commands
default: throw new NotSupportedException("Unknown device type.");
}
FileStream xmlFs = new FileStream(xmlFile, FileMode.Create);
FileStream jsonFs = new FileStream(jsonFile, FileMode.Create);
StreamWriter jsonSw = new StreamWriter(jsonFs);
jsonSw.Write(JsonConvert.SerializeObject(report, Formatting.Indented,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
}));
jsonSw.Close();
jsonFs.Close();
XmlSerializer xmlSer = new XmlSerializer(typeof(CommonTypes.Metadata.DeviceReport));
xmlSer.Serialize(xmlFs, report);
xmlFs.Close();
Core.Statistics.AddCommand("device-report");
if(Settings.Settings.Current.ShareReports) Remote.SubmitReport(report);
// TODO:
//if(Settings.Settings.Current.ShareReports) Remote.SubmitReport(report);
}
}
}

View File

@@ -45,6 +45,8 @@ using DiscImageChef.Core.Devices.Dumping;
using DiscImageChef.Core.Logging;
using DiscImageChef.Devices;
using Schemas;
using Ata = DiscImageChef.Core.Devices.Dumping.Ata;
using Scsi = DiscImageChef.Core.Devices.Dumping.Scsi;
namespace DiscImageChef.Commands
{

View File

@@ -265,6 +265,7 @@
<PackageReference Include="Eto.Platform.Gtk" Version="2.4.1" />
<PackageReference Include="Eto.Platform.Mac64" Version="2.4.1" />
<PackageReference Include="Eto.Platform.Wpf" Version="2.4.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.2-beta" />
</ItemGroup>