Inheritance: System.Attribute, IDeviceDriver
Exemple #1
0
 private IDeviceDriver GetIDeviceDriver(CustomAttributeData attributeData)
 {
     if (attributeData.AttributeType == typeof(ISADeviceDriverAttribute))
     {
         var attribute = new ISADeviceDriverAttribute();
         foreach (var arg in attributeData.NamedArguments)
         {
             if (arg.MemberName == "Platforms")
             {
                 attribute.Platforms = (PlatformArchitecture)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "BasePort")
             {
                 attribute.BasePort = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "PortRange")
             {
                 attribute.PortRange = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "AltBasePort")
             {
                 attribute.AltBasePort = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "AltPortRange")
             {
                 attribute.AltPortRange = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "AutoLoad")
             {
                 attribute.AutoLoad = (bool)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "ForceOption")
             {
                 attribute.ForceOption = (string)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "IRQ")
             {
                 attribute.IRQ = (byte)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "BaseAddress")
             {
                 attribute.BaseAddress = (uint)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "AddressRange")
             {
                 attribute.AddressRange = (uint)arg.TypedValue.Value;
             }
         }
         return(attribute);
     }
     else
     {
         var attribute = new PCIDeviceDriverAttribute();
         foreach (var arg in attributeData.NamedArguments)
         {
             if (arg.MemberName == "Platforms")
             {
                 attribute.Platforms = (PlatformArchitecture)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "DeviceID")
             {
                 attribute.DeviceID = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "VendorID")
             {
                 attribute.VendorID = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "SubVendorID")
             {
                 attribute.SubSystemVendorID = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "SubDeviceID")
             {
                 attribute.SubSystemID = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "RevisionID")
             {
                 attribute.RevisionID = (byte)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "ProgIF")
             {
                 attribute.ProgIF = (byte)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "ClassCode")
             {
                 attribute.ClassCode = (ushort)arg.TypedValue.Value;
             }
             else if (arg.MemberName == "SubClassCode")
             {
                 attribute.SubClassCode = (byte)arg.TypedValue.Value;
             }
         }
         return(attribute);
     }
 }
 private IDeviceDriver GetIDeviceDriver(CustomAttributeData attributeData)
 {
     if (attributeData.AttributeType == typeof(ISADeviceDriverAttribute))
     {
         var attribute = new ISADeviceDriverAttribute();
         foreach (var arg in attributeData.NamedArguments)
         {
             if (arg.MemberName == "Platforms")
                 attribute.Platforms = (PlatformArchitecture)arg.TypedValue.Value;
             else if (arg.MemberName == "BasePort")
                 attribute.BasePort = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "PortRange")
                 attribute.PortRange = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "AltBasePort")
                 attribute.AltBasePort = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "AltPortRange")
                 attribute.AltPortRange = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "AutoLoad")
                 attribute.AutoLoad = (bool)arg.TypedValue.Value;
             else if (arg.MemberName == "ForceOption")
                 attribute.ForceOption = (string)arg.TypedValue.Value;
             else if (arg.MemberName == "IRQ")
                 attribute.IRQ = (byte)arg.TypedValue.Value;
             else if (arg.MemberName == "BaseAddress")
                 attribute.BaseAddress = (uint)arg.TypedValue.Value;
             else if (arg.MemberName == "AddressRange")
                 attribute.AddressRange = (uint)arg.TypedValue.Value;
         }
         return attribute;
     }
     else
     {
         var attribute = new PCIDeviceDriverAttribute();
         foreach (var arg in attributeData.NamedArguments)
         {
             if (arg.MemberName == "Platforms")
                 attribute.Platforms = (PlatformArchitecture)arg.TypedValue.Value;
             else if (arg.MemberName == "DeviceID")
                 attribute.DeviceID = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "VendorID")
                 attribute.VendorID = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "SubVendorID")
                 attribute.SubSystemVendorID = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "SubDeviceID")
                 attribute.SubSystemID = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "RevisionID")
                 attribute.RevisionID = (byte)arg.TypedValue.Value;
             else if (arg.MemberName == "ProgIF")
                 attribute.ProgIF = (byte)arg.TypedValue.Value;
             else if (arg.MemberName == "ClassCode")
                 attribute.ClassCode = (ushort)arg.TypedValue.Value;
             else if (arg.MemberName == "SubClassCode")
                 attribute.SubClassCode = (byte)arg.TypedValue.Value;
         }
         return attribute;
     }
 }