Пример #1
0
 public PNPDriverIntegrator(PNPDriverDirectory driverDirectory, WindowsInstallation installation, string hardwareID, bool useLocalHardwareConfig, string enumExportPath, bool preconfigure)
     : base(driverDirectory, installation.ArchitectureIdentifier, installation.MinorOSVersion, installation.ProductType, hardwareID)
 {
     _installation           = installation;
     _useLocalHardwareConfig = useLocalHardwareConfig;
     _enumExportPath         = enumExportPath;
     _preconfigure           = preconfigure;
 }
        private static string UISelectMatchingHardwareID(PNPDriverDirectory driverDirectory, string architectureIdentifier, int minorOSVersion, int productType)
        {
            var devices = driverDirectory.ListDevices(architectureIdentifier, minorOSVersion, productType);

            Console.WriteLine();
            Console.WriteLine("Looking for matching device drivers in directory '{0}':", driverDirectory.Path);
            return(UISelectMatchingHardwareID(devices));
        }
Пример #3
0
 protected PNPDriverIntegratorBase(PNPDriverDirectory driverDirectory, string architectureIdentifier,
                                   int minorOSVersion, int productType, string hardwareID)
 {
     _driverDirectory        = driverDirectory;
     _architectureIdentifier = architectureIdentifier;
     _minorOSVersion         = minorOSVersion;
     _productType            = productType;
     _hardwareID             = hardwareID;
 }
Пример #4
0
        public static List <string> DetectMatchingExportedHardware(string path, PNPDriverDirectory driverDirectory, string architectureIdentifier, int minorOSVersion, int productType)
        {
            var devices          = driverDirectory.ListDevices(architectureIdentifier, minorOSVersion, productType);
            var driverHardwareID = new List <string>();

            foreach (var device in devices)
            {
                driverHardwareID.Add(device.Key);
            }
            return(DetectMatchingExportedHardware(path, driverHardwareID));
        }
        private static List <string> UISelectHardwareID(PNPDriverDirectory pnpDriverDirectory, WindowsInstallation installation,
                                                        bool useLocalHardwareConfig, string enumExportPath)
        {
            var hardwareIDs         = new List <string>();
            var containsRootDevices = pnpDriverDirectory.ContainsRootDevices(installation.ArchitectureIdentifier,
                                                                             installation.MinorOSVersion, installation.ProductType);

            // We should not use our detection mechanism if a driver directory contains a root device.
            if (!containsRootDevices && (useLocalHardwareConfig || enumExportPath != string.Empty))
            {
                var matchingHardwareIDs = useLocalHardwareConfig
                                        ? PNPLocalHardwareDetector.DetectMatchingLocalHardware(pnpDriverDirectory, installation.ArchitectureIdentifier,
                                                                                               installation.MinorOSVersion, installation.ProductType)
                                        : PNPExportedHardwareDetector.DetectMatchingExportedHardware(enumExportPath, pnpDriverDirectory,
                                                                                                     installation.ArchitectureIdentifier, installation.MinorOSVersion, installation.ProductType);

                var devices = pnpDriverDirectory.ListDevices(installation.ArchitectureIdentifier, installation.MinorOSVersion,
                                                             installation.ProductType);
                // We now have a list of hardware IDs that matches (some of) our devices, let's found out which of the devices match
                var matchingDevices = new List <KeyValuePair <string, string> >();
                foreach (var device in devices)
                {
                    if (matchingHardwareIDs.Contains(device.Key))
                    {
                        matchingDevices.Add(device);
                    }
                }
                Console.WriteLine();
                Console.WriteLine("Looking for matching device drivers in directory '{0}':", pnpDriverDirectory.Path);
                foreach (var device in matchingDevices)
                {
                    hardwareIDs.Add(device.Key);
                }
            }
            else
            {
                foreach (var device in pnpDriverDirectory.ListDevices(
                             installation.ArchitectureIdentifier,
                             installation.MinorOSVersion,
                             installation.ProductType))
                {
                    hardwareIDs.Add(device.Key);
                }
            }

            return(hardwareIDs);
        }
 public PNPDriverGUIModeIntegrator(PNPDriverDirectory driverDirectory, WindowsInstallation installation, string hardwareID)
     : base(driverDirectory, installation.ArchitectureIdentifier, installation.MinorOSVersion, installation.ProductType, hardwareID)
 {
     _installation = installation;
 }