Esempio n. 1
0
        public FFIMethodAttributes(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentException("method");
            }

            FFIClassAttributes baseAttributes = null;
            Type type = method.DeclaringType;

            if (!CLRModuleType.TryGetTypeAttributes(type, out baseAttributes))
            {
                baseAttributes = new FFIClassAttributes(type);
                CLRModuleType.SetTypeAttributes(type, baseAttributes);
            }

            if (null != baseAttributes)
            {
                HiddenInLibrary = baseAttributes.HiddenInLibrary;
            }

            attributes = method.GetCustomAttributes(false).Cast <Attribute>().ToArray();
            foreach (var attr in attributes)
            {
                if (attr is AllowRankReductionAttribute)
                {
                    AllowRankReduction = true;
                }
                else if (attr is RuntimeRequirementAttribute)
                {
                    RequireTracing = (attr as RuntimeRequirementAttribute).RequireTracing;
                }
                else if (attr is MultiReturnAttribute)
                {
                    var multiReturnAttr = (attr as MultiReturnAttribute);
                    returnKeys = multiReturnAttr.ReturnKeys.ToList();
                }
                else if (attr is IsVisibleInDynamoLibraryAttribute)
                {
                    var visibleInLibraryAttr = attr as IsVisibleInDynamoLibraryAttribute;
                    HiddenInLibrary = (visibleInLibraryAttr.Visible == false);
                }
            }
        }