public static string GetFieldSignature(IntPtr field) { jvalue[] array = new jvalue[1]; array[0].l = field; return(AndroidJNISafe.CallStaticStringMethod(AndroidReflection.s_ReflectionHelperClass, AndroidReflection.s_ReflectionHelperGetFieldSignature, array)); }
protected ReturnType _CallStatic <ReturnType>(string methodName, params object[] args) { ReturnType local; if (args == null) { args = new object[1]; } IntPtr methodID = AndroidJNIHelper.GetMethodID <ReturnType>(this.m_jclass, methodName, args, true); jvalue[] jvalueArray = AndroidJNIHelper.CreateJNIArgArray(args); try { if (AndroidReflection.IsPrimitive(typeof(ReturnType))) { if (typeof(ReturnType) == typeof(int)) { return((ReturnType)AndroidJNISafe.CallStaticIntMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(bool)) { return((ReturnType)AndroidJNISafe.CallStaticBooleanMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(byte)) { return((ReturnType)AndroidJNISafe.CallStaticByteMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(short)) { return((ReturnType)AndroidJNISafe.CallStaticShortMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(long)) { return((ReturnType)AndroidJNISafe.CallStaticLongMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(float)) { return((ReturnType)AndroidJNISafe.CallStaticFloatMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(double)) { return((ReturnType)AndroidJNISafe.CallStaticDoubleMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(char)) { return((ReturnType)AndroidJNISafe.CallStaticCharMethod(this.m_jclass, methodID, jvalueArray)); } } else { if (typeof(ReturnType) == typeof(string)) { return((ReturnType)AndroidJNISafe.CallStaticStringMethod(this.m_jclass, methodID, jvalueArray)); } if (typeof(ReturnType) == typeof(AndroidJavaClass)) { return((ReturnType)AndroidJavaClassDeleteLocalRef(AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, jvalueArray))); } if (typeof(ReturnType) == typeof(AndroidJavaObject)) { return((ReturnType)AndroidJavaObjectDeleteLocalRef(AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, jvalueArray))); } if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(ReturnType))) { throw new Exception("JNI: Unknown return type '" + typeof(ReturnType) + "'"); } return(AndroidJNIHelper.ConvertFromJNIArray <ReturnType>(AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, jvalueArray))); } local = default(ReturnType); } finally { AndroidJNIHelper.DeleteJNIArgArray(args, jvalueArray); } return(local); }
protected ReturnType _CallStatic <ReturnType>(string methodName, params object[] args) { bool flag = args == null; if (flag) { args = new object[1]; } IntPtr methodID = AndroidJNIHelper.GetMethodID <ReturnType>(this.m_jclass, methodName, args, true); jvalue[] array = AndroidJNIHelper.CreateJNIArgArray(args); ReturnType result; try { bool flag2 = AndroidReflection.IsPrimitive(typeof(ReturnType)); if (flag2) { bool flag3 = typeof(ReturnType) == typeof(int); if (flag3) { result = (ReturnType)((object)AndroidJNISafe.CallStaticIntMethod(this.m_jclass, methodID, array)); } else { bool flag4 = typeof(ReturnType) == typeof(bool); if (flag4) { result = (ReturnType)((object)AndroidJNISafe.CallStaticBooleanMethod(this.m_jclass, methodID, array)); } else { bool flag5 = typeof(ReturnType) == typeof(byte); if (flag5) { Debug.LogWarning("Return type <Byte> for Java method call is obsolete, use return type <SByte> instead"); result = (ReturnType)((object)((byte)AndroidJNISafe.CallStaticSByteMethod(this.m_jclass, methodID, array))); } else { bool flag6 = typeof(ReturnType) == typeof(sbyte); if (flag6) { result = (ReturnType)((object)AndroidJNISafe.CallStaticSByteMethod(this.m_jclass, methodID, array)); } else { bool flag7 = typeof(ReturnType) == typeof(short); if (flag7) { result = (ReturnType)((object)AndroidJNISafe.CallStaticShortMethod(this.m_jclass, methodID, array)); } else { bool flag8 = typeof(ReturnType) == typeof(long); if (flag8) { result = (ReturnType)((object)AndroidJNISafe.CallStaticLongMethod(this.m_jclass, methodID, array)); } else { bool flag9 = typeof(ReturnType) == typeof(float); if (flag9) { result = (ReturnType)((object)AndroidJNISafe.CallStaticFloatMethod(this.m_jclass, methodID, array)); } else { bool flag10 = typeof(ReturnType) == typeof(double); if (flag10) { result = (ReturnType)((object)AndroidJNISafe.CallStaticDoubleMethod(this.m_jclass, methodID, array)); } else { bool flag11 = typeof(ReturnType) == typeof(char); if (flag11) { result = (ReturnType)((object)AndroidJNISafe.CallStaticCharMethod(this.m_jclass, methodID, array)); } else { result = default(ReturnType); } } } } } } } } } } else { bool flag12 = typeof(ReturnType) == typeof(string); if (flag12) { result = (ReturnType)((object)AndroidJNISafe.CallStaticStringMethod(this.m_jclass, methodID, array)); } else { bool flag13 = typeof(ReturnType) == typeof(AndroidJavaClass); if (flag13) { IntPtr intPtr = AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, array); result = ((intPtr == IntPtr.Zero) ? default(ReturnType) : ((ReturnType)((object)AndroidJavaObject.AndroidJavaClassDeleteLocalRef(intPtr)))); } else { bool flag14 = typeof(ReturnType) == typeof(AndroidJavaObject); if (flag14) { IntPtr intPtr2 = AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, array); result = ((intPtr2 == IntPtr.Zero) ? default(ReturnType) : ((ReturnType)((object)AndroidJavaObject.AndroidJavaObjectDeleteLocalRef(intPtr2)))); } else { bool flag15 = AndroidReflection.IsAssignableFrom(typeof(Array), typeof(ReturnType)); if (!flag15) { string arg_408_0 = "JNI: Unknown return type '"; Type expr_3F7 = typeof(ReturnType); throw new Exception(arg_408_0 + ((expr_3F7 != null) ? expr_3F7.ToString() : null) + "'"); } IntPtr intPtr3 = AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, array); result = ((intPtr3 == IntPtr.Zero) ? default(ReturnType) : ((ReturnType)((object)AndroidJNIHelper.ConvertFromJNIArray <ReturnType>(intPtr3)))); } } } } } finally { AndroidJNIHelper.DeleteJNIArgArray(args, array); } return(result); }