public Device(string manufacturer, string model, string revision, DeviceType type, DeviceReport report) { WhenAdded = DateTime.UtcNow; Manufacturer = manufacturer; Model = model; Revision = revision; Type = type; USB = USB.MapUsb(report.USB); FireWire = FireWire.MapFirewire(report.FireWire); PCMCIA = PCMCIA.MapPcmcia(report.PCMCIA); ATA = ATA.MapAta(report.ATA); ATAPI = ATA.MapAta(report.ATAPI); SCSI = Models.SCSI.SCSI.MapScsi(report.SCSI); MultiMediaCard = SecureDigital.MapSd(report.MultiMediaCard); SecureDigital = SecureDigital.MapSd(report.SecureDigital); WhenAdded = DateTime.UtcNow; IsValid = true; }
public static ATA MapAta(ataType oldAta) { if (oldAta == null) { return(null); } ATA newAta = new ATA { Identify = oldAta.Identify, ReadCapabilities = TestedMedia.MapTestedMedia(oldAta.ReadCapabilities) }; if (oldAta.AdditionalPIDSpecified) { newAta.AdditionalPID = oldAta.AdditionalPID; } if (oldAta.APIOSupportedSpecified) { newAta.APIOSupported = oldAta.APIOSupported; } if (oldAta.ATAPIByteCountSpecified) { newAta.ATAPIByteCount = oldAta.ATAPIByteCount; } if (oldAta.BufferTypeSpecified) { newAta.BufferType = oldAta.BufferType; } if (oldAta.BufferSizeSpecified) { newAta.BufferSize = oldAta.BufferSize; } if (oldAta.CapabilitiesSpecified) { newAta.Capabilities = oldAta.Capabilities; } if (oldAta.Capabilities2Specified) { newAta.Capabilities2 = oldAta.Capabilities2; } if (oldAta.Capabilities3Specified) { newAta.Capabilities3 = oldAta.Capabilities3; } if (oldAta.CFAPowerModeSpecified) { newAta.CFAPowerMode = oldAta.CFAPowerMode; } if (oldAta.CommandSetSpecified) { newAta.CommandSet = oldAta.CommandSet; } if (oldAta.CommandSet2Specified) { newAta.CommandSet2 = oldAta.CommandSet2; } if (oldAta.CommandSet3Specified) { newAta.CommandSet3 = oldAta.CommandSet3; } if (oldAta.CommandSet4Specified) { newAta.CommandSet4 = oldAta.CommandSet4; } if (oldAta.CommandSet5Specified) { newAta.CommandSet5 = oldAta.CommandSet5; } if (oldAta.CurrentAAMSpecified) { newAta.CurrentAAM = oldAta.CurrentAAM; } if (oldAta.CurrentAPMSpecified) { newAta.CurrentAPM = oldAta.CurrentAPM; } if (oldAta.DataSetMgmtSpecified) { newAta.DataSetMgmt = oldAta.DataSetMgmt; } if (oldAta.DataSetMgmtSizeSpecified) { newAta.DataSetMgmtSize = oldAta.DataSetMgmtSize; } if (oldAta.DeviceFormFactorSpecified) { newAta.DeviceFormFactor = oldAta.DeviceFormFactor; } if (oldAta.DMAActiveSpecified) { newAta.DMAActive = oldAta.DMAActive; } if (oldAta.DMASupportedSpecified) { newAta.DMASupported = oldAta.DMASupported; } if (oldAta.DMATransferTimingModeSpecified) { newAta.DMATransferTimingMode = oldAta.DMATransferTimingMode; } if (oldAta.EnhancedSecurityEraseTimeSpecified) { newAta.EnhancedSecurityEraseTime = oldAta.EnhancedSecurityEraseTime; } if (oldAta.EnabledCommandSetSpecified) { newAta.EnabledCommandSet = oldAta.EnabledCommandSet; } if (oldAta.EnabledCommandSet2Specified) { newAta.EnabledCommandSet2 = oldAta.EnabledCommandSet2; } if (oldAta.EnabledCommandSet3Specified) { newAta.EnabledCommandSet3 = oldAta.EnabledCommandSet3; } if (oldAta.EnabledCommandSet4Specified) { newAta.EnabledCommandSet4 = oldAta.EnabledCommandSet4; } if (oldAta.EnabledSATAFeaturesSpecified) { newAta.EnabledSATAFeatures = oldAta.EnabledSATAFeatures; } if (oldAta.ExtendedUserSectorsSpecified) { newAta.ExtendedUserSectors = oldAta.ExtendedUserSectors; } if (oldAta.FreeFallSensitivitySpecified) { newAta.FreeFallSensitivity = oldAta.FreeFallSensitivity; } if (oldAta.FirmwareRevisionSpecified) { newAta.FirmwareRevision = oldAta.FirmwareRevision; } if (oldAta.GeneralConfigurationSpecified) { newAta.GeneralConfiguration = oldAta.GeneralConfiguration; } if (oldAta.HardwareResetResultSpecified) { newAta.HardwareResetResult = oldAta.HardwareResetResult; } if (oldAta.InterseekDelaySpecified) { newAta.InterseekDelay = oldAta.InterseekDelay; } if (oldAta.MajorVersionSpecified) { newAta.MajorVersion = oldAta.MajorVersion; } if (oldAta.MasterPasswordRevisionCodeSpecified) { newAta.MasterPasswordRevisionCode = oldAta.MasterPasswordRevisionCode; } if (oldAta.MaxDownloadMicroMode3Specified) { newAta.MaxDownloadMicroMode3 = oldAta.MaxDownloadMicroMode3; } if (oldAta.MaxQueueDepthSpecified) { newAta.MaxQueueDepth = oldAta.MaxQueueDepth; } if (oldAta.MDMAActiveSpecified) { newAta.MDMAActive = oldAta.MDMAActive; } if (oldAta.MDMASupportedSpecified) { newAta.MDMASupported = oldAta.MDMASupported; } if (oldAta.MinDownloadMicroMode3Specified) { newAta.MinDownloadMicroMode3 = oldAta.MinDownloadMicroMode3; } if (oldAta.MinMDMACycleTimeSpecified) { newAta.MinMDMACycleTime = oldAta.MinMDMACycleTime; } if (oldAta.MinorVersionSpecified) { newAta.MinorVersion = oldAta.MinorVersion; } if (oldAta.MinPIOCycleTimeNoFlowSpecified) { newAta.MinPIOCycleTimeNoFlow = oldAta.MinPIOCycleTimeNoFlow; } if (oldAta.MinPIOCycleTimeFlowSpecified) { newAta.MinPIOCycleTimeFlow = oldAta.MinPIOCycleTimeFlow; } if (oldAta.ModelSpecified) { newAta.Model = oldAta.Model; } if (oldAta.MultipleMaxSectorsSpecified) { newAta.MultipleMaxSectors = oldAta.MultipleMaxSectors; } if (oldAta.MultipleSectorNumberSpecified) { newAta.MultipleSectorNumber = oldAta.MultipleSectorNumber; } if (oldAta.NVCacheCapsSpecified) { newAta.NVCacheCaps = oldAta.NVCacheCaps; } if (oldAta.NVCacheSizeSpecified) { newAta.NVCacheSize = oldAta.NVCacheSize; } if (oldAta.NVCacheWriteSpeedSpecified) { newAta.NVCacheWriteSpeed = oldAta.NVCacheWriteSpeed; } if (oldAta.NVEstimatedSpinUpSpecified) { newAta.NVEstimatedSpinUp = oldAta.NVEstimatedSpinUp; } if (oldAta.PacketBusReleaseSpecified) { newAta.PacketBusRelease = oldAta.PacketBusRelease; } if (oldAta.PIOTransferTimingModeSpecified) { newAta.PIOTransferTimingMode = oldAta.PIOTransferTimingMode; } if (oldAta.RecommendedAAMSpecified) { newAta.RecommendedAAM = oldAta.RecommendedAAM; } if (oldAta.RecommendedMDMACycleTimeSpecified) { newAta.RecommendedMDMACycleTime = oldAta.RecommendedMDMACycleTime; } if (oldAta.RemovableStatusSetSpecified) { newAta.RemovableStatusSet = oldAta.RemovableStatusSet; } if (oldAta.SATACapabilitiesSpecified) { newAta.SATACapabilities = oldAta.SATACapabilities; } if (oldAta.SATACapabilities2Specified) { newAta.SATACapabilities2 = oldAta.SATACapabilities2; } if (oldAta.SATAFeaturesSpecified) { newAta.SATAFeatures = oldAta.SATAFeatures; } if (oldAta.SCTCommandTransportSpecified) { newAta.SCTCommandTransport = oldAta.SCTCommandTransport; } if (oldAta.SectorsPerCardSpecified) { newAta.SectorsPerCard = oldAta.SectorsPerCard; } if (oldAta.SecurityEraseTimeSpecified) { newAta.SecurityEraseTime = oldAta.SecurityEraseTime; } if (oldAta.SecurityStatusSpecified) { newAta.SecurityStatus = oldAta.SecurityStatus; } if (oldAta.ServiceBusyClearSpecified) { newAta.ServiceBusyClear = oldAta.ServiceBusyClear; } if (oldAta.SpecificConfigurationSpecified) { newAta.SpecificConfiguration = oldAta.SpecificConfiguration; } if (oldAta.StreamAccessLatencySpecified) { newAta.StreamAccessLatency = oldAta.StreamAccessLatency; } if (oldAta.StreamMinReqSizeSpecified) { newAta.StreamMinReqSize = oldAta.StreamMinReqSize; } if (oldAta.StreamPerformanceGranularitySpecified) { newAta.StreamPerformanceGranularity = oldAta.StreamPerformanceGranularity; } if (oldAta.StreamTransferTimeDMASpecified) { newAta.StreamTransferTimeDMA = oldAta.StreamTransferTimeDMA; } if (oldAta.StreamTransferTimePIOSpecified) { newAta.StreamTransferTimePIO = oldAta.StreamTransferTimePIO; } if (oldAta.TransportMajorVersionSpecified) { newAta.TransportMajorVersion = oldAta.TransportMajorVersion; } if (oldAta.TransportMinorVersionSpecified) { newAta.TransportMinorVersion = oldAta.TransportMinorVersion; } if (oldAta.TrustedComputingSpecified) { newAta.TrustedComputing = oldAta.TrustedComputing; } if (oldAta.UDMAActiveSpecified) { newAta.UDMAActive = oldAta.UDMAActive; } if (oldAta.UDMASupportedSpecified) { newAta.UDMASupported = oldAta.UDMASupported; } if (oldAta.WRVModeSpecified) { newAta.WRVMode = oldAta.WRVMode; } if (oldAta.WRVSectorCountMode3Specified) { newAta.WRVSectorCountMode3 = oldAta.WRVSectorCountMode3; } if (oldAta.WRVSectorCountMode2Specified) { newAta.WRVSectorCountMode2 = oldAta.WRVSectorCountMode2; } if (oldAta.RemovableMedias == null) { return(newAta); } newAta.RemovableMedias = new List <TestedMedia>(oldAta.RemovableMedias.Select(TestedMedia.MapTestedMedia)); return(newAta); }
public Device(DeviceReport report) { WhenAdded = DateTime.UtcNow; if (report.SecureDigital != null) { Type = DeviceType.SecureDigital; } else if (report.MultiMediaCard != null) { Type = DeviceType.MMC; } else if (report.FireWire != null) { Type = DeviceType.FireWire; } else if (report.USB != null) { Type = DeviceType.USB; } else if (report.PCMCIA != null) { Type = DeviceType.PCMCIA; } else if (report.ATAPI != null) { Type = DeviceType.ATAPI; } else if (report.ATA != null) { Type = DeviceType.ATA; } else if (report.SCSI?.Inquiry != null) { Type = DeviceType.SCSI; } if (report.CompactFlashSpecified && report.CompactFlash) { Type = DeviceType.CompactFlash; } if (!string.IsNullOrWhiteSpace(report.FireWire?.Manufacturer)) { Manufacturer = report.FireWire.Manufacturer; } else if (!string.IsNullOrWhiteSpace(report.USB?.Manufacturer)) { Manufacturer = report.USB.Manufacturer; } else if (!string.IsNullOrWhiteSpace(report.SCSI?.Inquiry?.VendorIdentification)) { Manufacturer = report.SCSI.Inquiry.VendorIdentification; } else if (!string.IsNullOrWhiteSpace(report.PCMCIA?.Manufacturer)) { Manufacturer = report.PCMCIA.Manufacturer; } else if (!string.IsNullOrWhiteSpace(report.ATAPI?.Model)) { string[] atapiSplit = report.ATAPI.Model.Split(' '); Manufacturer = atapiSplit.Length > 1 ? atapiSplit[0] : report.ATAPI.Model; } else if (!string.IsNullOrWhiteSpace(report.ATA?.Model)) { string[] ataSplit = report.ATA.Model.Split(' '); Manufacturer = ataSplit.Length > 1 ? ataSplit[0] : report.ATA.Model; } if (!string.IsNullOrWhiteSpace(report.FireWire?.Product)) { Model = report.FireWire.Product; } else if (!string.IsNullOrWhiteSpace(report.USB?.Product)) { Model = report.USB.Product; } else if (!string.IsNullOrWhiteSpace(report.SCSI?.Inquiry?.ProductIdentification)) { Model = report.SCSI.Inquiry.ProductIdentification; } else if (!string.IsNullOrWhiteSpace(report.PCMCIA?.ProductName)) { Model = report.PCMCIA.ProductName; } else if (!string.IsNullOrWhiteSpace(report.ATAPI?.Model)) { string[] atapiSplit = report.ATAPI.Model.Split(' '); Model = atapiSplit.Length > 1 ? report.ATAPI.Model.Substring(atapiSplit[0].Length + 1) : null; } else if (!string.IsNullOrWhiteSpace(report.ATA?.Model)) { string[] ataSplit = report.ATA.Model.Split(' '); Model = ataSplit.Length > 1 ? report.ATA.Model.Substring(ataSplit[0].Length + 1) : null; } if (!string.IsNullOrWhiteSpace(report.SCSI?.Inquiry?.ProductRevisionLevel)) { Revision = report.SCSI.Inquiry.ProductRevisionLevel; } else if (!string.IsNullOrWhiteSpace(report.ATAPI?.FirmwareRevision)) { Revision = report.ATAPI.FirmwareRevision; } else if (!string.IsNullOrWhiteSpace(report.ATA?.FirmwareRevision)) { Revision = report.ATA.FirmwareRevision; } USB = USB.MapUsb(report.USB); FireWire = FireWire.MapFirewire(report.FireWire); PCMCIA = PCMCIA.MapPcmcia(report.PCMCIA); ATA = ATA.MapAta(report.ATA); ATAPI = ATA.MapAta(report.ATAPI); SCSI = Models.SCSI.SCSI.MapScsi(report.SCSI); MultiMediaCard = SecureDigital.MapSd(report.MultiMediaCard); SecureDigital = SecureDigital.MapSd(report.SecureDigital); WhenAdded = DateTime.UtcNow; IsValid = true; }