Exemplo n.º 1
0
        /// <summary>
        /// Registers the device drivers.
        /// </summary>
        /// <param name="assemblyInfo">The assembly info.</param>
        public void RegisterDeviceDrivers(System.Reflection.Assembly assemblyInfo)
        {
            System.Type[] types = assemblyInfo.GetTypes();

            foreach (System.Type type in types)
            {
                object[] attributes = type.GetCustomAttributes(typeof(IDeviceDriver), false);

                foreach (object attribute in attributes)
                {
                    if (((attribute as IDeviceDriver).Platforms & platformArchitecture) != 0)
                    {
                        DeviceDriver deviceDriver = new DeviceDriver(attribute as IDeviceDriver, type);

                        object[] memAttributes = type.GetCustomAttributes(typeof(DeviceDriverPhysicalMemoryAttribute), false);

                        foreach (object memAttribute in memAttributes)
                        {
                            deviceDriver.Add(memAttribute as DeviceDriverPhysicalMemoryAttribute);
                        }

                        deviceDrivers.Add(deviceDriver);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Registers the device drivers.
        /// </summary>
        /// <param name="assemblyInfo">The assembly info.</param>
        public void RegisterDeviceDrivers(Assembly assemblyInfo)
        {
            var types = assemblyInfo.DefinedTypes;

            foreach (var type in types)
            {
                var attributes = type.CustomAttributes;

                foreach (var attributeData in attributes)
                {
                    if (attributeData.AttributeType != typeof(ISADeviceDriverAttribute) &&
                        attributeData.AttributeType != typeof(PCIDeviceDriverAttribute))
                    {
                        continue;
                    }

                    IDeviceDriver attribute = GetIDeviceDriver(attributeData);

                    if ((attribute.Platforms & platformArchitecture) != 0)
                    {
                        DeviceDriver deviceDriver = new DeviceDriver(attribute, type.AsType());

                        foreach (var memAttributeData in attributes)
                        {
                            if (memAttributeData.AttributeType != typeof(DeviceDriverPhysicalMemoryAttribute))
                            {
                                continue;
                            }

                            var memAttribute = GetDeviceDriverPhysicalMemoryAttribute(memAttributeData);

                            deviceDriver.Add(memAttribute);
                        }

                        AddDeviceDriver(deviceDriver);
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Registers the device drivers.
        /// </summary>
        /// <param name="assemblyInfo">The assembly info.</param>
        public void RegisterDeviceDrivers(System.Reflection.Assembly assemblyInfo)
        {
            System.Type[] types = assemblyInfo.GetTypes();

            foreach (System.Type type in types)
            {
                object[] attributes = type.GetCustomAttributes(typeof(IDeviceDriver), false);

                foreach (object attribute in attributes)
                    if (((attribute as IDeviceDriver).Platforms & platformArchitecture) != 0)
                    {
                        DeviceDriver deviceDriver = new DeviceDriver(attribute as IDeviceDriver, type);

                        object[] memAttributes = type.GetCustomAttributes(typeof(DeviceDriverPhysicalMemoryAttribute), false);

                        foreach (object memAttribute in memAttributes)
                            deviceDriver.Add(memAttribute as DeviceDriverPhysicalMemoryAttribute);

                        deviceDrivers.Add(deviceDriver);
                    }
            }
        }
        /// <summary>
        /// Registers the device drivers.
        /// </summary>
        /// <param name="assemblyInfo">The assembly info.</param>
        public void RegisterDeviceDrivers(Assembly assemblyInfo)
        {
            var types = assemblyInfo.DefinedTypes;

            foreach (var type in types)
            {
                var attributes = type.CustomAttributes;

                foreach (var attributeData in attributes)
                {
                    if (attributeData.AttributeType != typeof(ISADeviceDriverAttribute) &&
                        attributeData.AttributeType != typeof(PCIDeviceDriverAttribute))
                        continue;

                    var attribute = GetIDeviceDriver(attributeData);

                    if ((attribute.Platforms & platformArchitecture) != 0)
                    {
                        var deviceDriver = new DeviceDriver(attribute, type.AsType());

                        foreach (var memAttributeData in attributes)
                        {
                            if (memAttributeData.AttributeType != typeof(DeviceDriverPhysicalMemoryAttribute))
                                continue;

                            var memAttribute = GetDeviceDriverPhysicalMemoryAttribute(memAttributeData);

                            deviceDriver.Add(memAttribute);
                        }

                        AddDeviceDriver(deviceDriver);
                    }
                }
            }
        }