Mono.Cecil.WindowsRuntimeProjections.Project C# (CSharp) Method

Project() public static method

public static Project ( ICustomAttributeProvider owner, CustomAttribute attribute ) : void
owner ICustomAttributeProvider
attribute CustomAttribute
return void
        public static void Project(ICustomAttributeProvider owner, CustomAttribute attribute)
        {
            if (!IsWindowsAttributeUsageAttribute (owner, attribute))
                return;

            var treatment = CustomAttributeValueTreatment.None;
            var type = (TypeDefinition) owner;

            if (type.Namespace == "Windows.Foundation.Metadata") {
                if (type.Name == "VersionAttribute")
                    treatment = CustomAttributeValueTreatment.VersionAttribute;
                else if (type.Name == "DeprecatedAttribute")
                    treatment = CustomAttributeValueTreatment.DeprecatedAttribute;
            }

            if (treatment == CustomAttributeValueTreatment.None) {
                var multiple = HasAttribute (type, "Windows.Foundation.Metadata", "AllowMultipleAttribute");
                treatment = multiple ? CustomAttributeValueTreatment.AllowMultiple : CustomAttributeValueTreatment.AllowSingle;
            }

            if (treatment != CustomAttributeValueTreatment.None) {
                var attribute_targets = (AttributeTargets) attribute.ConstructorArguments [0].Value;
                ApplyProjection (attribute, new CustomAttributeValueProjection (attribute_targets, treatment));
            }
        }

Same methods

WindowsRuntimeProjections::Project ( FieldDefinition field ) : void
WindowsRuntimeProjections::Project ( Mono.Cecil.MethodDefinition method ) : void
WindowsRuntimeProjections::Project ( Mono.Cecil.TypeDefinition type ) : void
WindowsRuntimeProjections::Project ( TypeReference type ) : void