Esempio n. 1
0
        public JNINativeMethod CreateNativeMethod(Type type, string javaName, string clrName, string javaSignature)
        {
            MethodInfo methodInfo = type.GetMethod(clrName, BindingFlags.NonPublic | BindingFlags.Static);

            if (methodInfo == null)
            {
                throw new Exception("Can't find type " + type.Name + "." + clrName);
            }
            return(JNINativeMethod.CreateNativeMethod(javaName, javaSignature, Marshal.GetFunctionPointerForDelegate(Delegate.CreateDelegate(GetDelegateType(methodInfo), methodInfo))));
        }
Esempio n. 2
0
 public void CreateType(Type type)
 {
     MethodInfo[] methodInfoArray = type.GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
     for (int i = 0; i < methodInfoArray.Length; i++)
     {
         MethodInfo methodInfo = methodInfoArray[i];
         {
             string signature = GetDelegateSignature(methodInfo);
             Entries.Add(JNINativeMethod.CreateNativeMethod(methodInfo.Name, signature,
                                                            Marshal.GetFunctionPointerForDelegate(Delegate.CreateDelegate(GetDelegateType(methodInfo), methodInfo))));
         }
     }
 }