Add() public method

Adds the specified memory attribute.
public Add ( DeviceDriverPhysicalMemoryAttribute memoryAttribute ) : void
memoryAttribute DeviceDriverPhysicalMemoryAttribute The memory attribute.
return void
Beispiel #1
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;
                    }

                    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);
                    }
                }
            }
        }
        /// <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);
                    }
                }
            }
        }