GetMethodInfo() static private method

static private GetMethodInfo ( IntPtr handle ) : MonoMethodInfo
handle IntPtr
return MonoMethodInfo
Beispiel #1
0
        internal CustomAttributeData[]? GetPseudoCustomAttributesData()
        {
            int count = 0;

            /* MS.NET doesn't report MethodImplAttribute */

            MonoMethodInfo info = MonoMethodInfo.GetMethodInfo(mhandle);

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                count++;
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
                count++;
            }

            if (count == 0)
            {
                return(null);
            }
            CustomAttributeData[] attrsData = new CustomAttributeData[count];
            count = 0;

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                attrsData[count++] = new CustomAttributeData((typeof(PreserveSigAttribute)).GetConstructor(Type.EmptyTypes) !);
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
                attrsData[count++] = GetDllImportAttributeData() !;
            }

            return(attrsData);
        }
        internal object[] GetPseudoCustomAttributes()
        {
            int            num        = 0;
            MonoMethodInfo methodInfo = MonoMethodInfo.GetMethodInfo(this.mhandle);

            if ((methodInfo.iattrs & MethodImplAttributes.PreserveSig) != MethodImplAttributes.IL)
            {
                num++;
            }
            if ((methodInfo.attrs & MethodAttributes.PinvokeImpl) != MethodAttributes.PrivateScope)
            {
                num++;
            }
            if (num == 0)
            {
                return(null);
            }
            object[] array = new object[num];
            num = 0;
            if ((methodInfo.iattrs & MethodImplAttributes.PreserveSig) != MethodImplAttributes.IL)
            {
                array[num++] = new PreserveSigAttribute();
            }
            if ((methodInfo.attrs & MethodAttributes.PinvokeImpl) != MethodAttributes.PrivateScope)
            {
                DllImportAttribute dllImportAttribute = MonoMethod.GetDllImportAttribute(this.mhandle);
                if ((methodInfo.iattrs & MethodImplAttributes.PreserveSig) != MethodImplAttributes.IL)
                {
                    dllImportAttribute.PreserveSig = true;
                }
                array[num++] = dllImportAttribute;
            }
            return(array);
        }
Beispiel #3
0
        internal object[]? GetPseudoCustomAttributes()
        {
            int count = 0;

            /* MS.NET doesn't report MethodImplAttribute */

            MonoMethodInfo info = MonoMethodInfo.GetMethodInfo(mhandle);

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                count++;
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
                count++;
            }

            if (count == 0)
            {
                return(null);
            }
            object[] attrs = new object[count];
            count = 0;

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                attrs[count++] = new PreserveSigAttribute();
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
                attrs[count++] = GetDllImportAttribute();
            }

            return(attrs);
        }
Beispiel #4
0
        internal CustomAttributeData[] GetPseudoCustomAttributesData()
        {
            int count = 0;

            /* MS.NET doesn't report MethodImplAttribute */

            MonoMethodInfo info = MonoMethodInfo.GetMethodInfo(mhandle);

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                count++;
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
                count++;
            }

            if (count == 0)
            {
                return(null);
            }
            CustomAttributeData[] attrsData = new CustomAttributeData [count];
            count = 0;

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                attrsData [count++] = new CustomAttributeData((typeof(PreserveSigAttribute)).GetConstructor(Type.EmptyTypes));
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
                this.GetPInvoke(out PInvokeAttributes flags, out string entryPoint, out string dllName);
                var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument(typeof(string), dllName) };
                attrsData [count++] = new CustomAttributeData(
                    (typeof(FieldOffsetAttribute)).GetConstructor(new[] { typeof(string) }),
                    ctorArgs,
                    EmptyArray <CustomAttributeNamedArgument> .Value);                   //FIXME Get named params
            }

            return(attrsData);
        }
Beispiel #5
0
        internal object[] GetPseudoCustomAttributes()
        {
            int count = 0;

            /* MS.NET doesn't report MethodImplAttribute */

            MonoMethodInfo info = MonoMethodInfo.GetMethodInfo(mhandle);

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                count++;
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
                count++;
            }

            if (count == 0)
            {
                return(null);
            }
            object[] attrs = new object [count];
            count = 0;

            if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0)
            {
                attrs [count++] = new PreserveSigAttribute();
            }
            if ((info.attrs & MethodAttributes.PinvokeImpl) != 0)
            {
#if NETCORE
                throw new NotImplementedException();
#else
                attrs [count++] = DllImportAttribute.GetCustomAttribute(this);
#endif
            }

            return(attrs);
        }
 internal static MethodImplAttributes GetMethodImplementationFlags(IntPtr handle)
 {
     return(MonoMethodInfo.GetMethodInfo(handle).iattrs);
 }
 internal static CallingConventions GetCallingConvention(IntPtr handle)
 {
     return(MonoMethodInfo.GetMethodInfo(handle).callconv);
 }
 internal static MethodAttributes GetAttributes(IntPtr handle)
 {
     return(MonoMethodInfo.GetMethodInfo(handle).attrs);
 }
 internal static Type GetReturnType(IntPtr handle)
 {
     return(MonoMethodInfo.GetMethodInfo(handle).ret);
 }
 internal static Type GetDeclaringType(IntPtr handle)
 {
     return(MonoMethodInfo.GetMethodInfo(handle).parent);
 }