Ejemplo n.º 1
0
 public void AddDeviceDriver(DeviceDriver deviceDriver)
 {
     deviceDrivers.AddLast(deviceDriver);
 }
Ejemplo 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;

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