ConvertFromJNIArray() public static method

public static ConvertFromJNIArray ( IntPtr array ) : ArrayType
array IntPtr
return ArrayType
Beispiel #1
0
        protected FieldType _Get <FieldType>(string fieldName)
        {
            IntPtr fieldId = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, false);

            if (AndroidReflection.IsPrimitive(typeof(FieldType)))
            {
                if (typeof(FieldType) == typeof(int))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetIntField(this.m_jobject, fieldId));
                }
                if (typeof(FieldType) == typeof(bool))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetBooleanField(this.m_jobject, fieldId));
                }
                if (typeof(FieldType) == typeof(byte))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetByteField(this.m_jobject, fieldId));
                }
                if (typeof(FieldType) == typeof(short))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetShortField(this.m_jobject, fieldId));
                }
                if (typeof(FieldType) == typeof(long))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetLongField(this.m_jobject, fieldId));
                }
                if (typeof(FieldType) == typeof(float))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetFloatField(this.m_jobject, fieldId));
                }
                if (typeof(FieldType) == typeof(double))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetDoubleField(this.m_jobject, fieldId));
                }
                if (typeof(FieldType) == typeof(char))
                {
                    return((FieldType)(ValueType)AndroidJNISafe.GetCharField(this.m_jobject, fieldId));
                }
                return(default(FieldType));
            }
            if (typeof(FieldType) == typeof(string))
            {
                return((FieldType)AndroidJNISafe.GetStringField(this.m_jobject, fieldId));
            }
            if (typeof(FieldType) == typeof(AndroidJavaClass))
            {
                return((FieldType)AndroidJavaObject.AndroidJavaClassDeleteLocalRef(AndroidJNISafe.GetObjectField(this.m_jobject, fieldId)));
            }
            if (typeof(FieldType) == typeof(AndroidJavaObject))
            {
                return((FieldType)AndroidJavaObject.AndroidJavaObjectDeleteLocalRef(AndroidJNISafe.GetObjectField(this.m_jobject, fieldId)));
            }
            if (AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType)))
            {
                return(AndroidJNIHelper.ConvertFromJNIArray <FieldType>(AndroidJNISafe.GetObjectField(this.m_jobject, fieldId)));
            }
            throw new Exception("JNI: Unknown field type '" + (object)typeof(FieldType) + "'");
        }
        protected FieldType _GetStatic <FieldType>(string fieldName)
        {
            IntPtr fieldID = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, true);

            if (AndroidReflection.IsPrimitive(typeof(FieldType)))
            {
                if (typeof(FieldType) == typeof(int))
                {
                    return((FieldType)AndroidJNISafe.GetStaticIntField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(bool))
                {
                    return((FieldType)AndroidJNISafe.GetStaticBooleanField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(byte))
                {
                    return((FieldType)AndroidJNISafe.GetStaticByteField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(short))
                {
                    return((FieldType)AndroidJNISafe.GetStaticShortField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(long))
                {
                    return((FieldType)AndroidJNISafe.GetStaticLongField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(float))
                {
                    return((FieldType)AndroidJNISafe.GetStaticFloatField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(double))
                {
                    return((FieldType)AndroidJNISafe.GetStaticDoubleField(this.m_jclass, fieldID));
                }
                if (typeof(FieldType) == typeof(char))
                {
                    return((FieldType)AndroidJNISafe.GetStaticCharField(this.m_jclass, fieldID));
                }
                return(default(FieldType));
            }
            if (typeof(FieldType) == typeof(string))
            {
                return((FieldType)AndroidJNISafe.GetStaticStringField(this.m_jclass, fieldID));
            }
            if (typeof(FieldType) == typeof(AndroidJavaClass))
            {
                return((FieldType)AndroidJavaClassDeleteLocalRef(AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID)));
            }
            if (typeof(FieldType) == typeof(AndroidJavaObject))
            {
                return((FieldType)AndroidJavaObjectDeleteLocalRef(AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID)));
            }
            if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType)))
            {
                throw new Exception("JNI: Unknown field type '" + typeof(FieldType) + "'");
            }
            return(AndroidJNIHelper.ConvertFromJNIArray <FieldType>(AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID)));
        }
        protected ReturnType _Call <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, false);

            jvalue[] jvalueArray = AndroidJNIHelper.CreateJNIArgArray(args);
            try
            {
                if (AndroidReflection.IsPrimitive(typeof(ReturnType)))
                {
                    if (typeof(ReturnType) == typeof(int))
                    {
                        return((ReturnType)AndroidJNISafe.CallIntMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(bool))
                    {
                        return((ReturnType)AndroidJNISafe.CallBooleanMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(byte))
                    {
                        return((ReturnType)AndroidJNISafe.CallByteMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(short))
                    {
                        return((ReturnType)AndroidJNISafe.CallShortMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(long))
                    {
                        return((ReturnType)AndroidJNISafe.CallLongMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(float))
                    {
                        return((ReturnType)AndroidJNISafe.CallFloatMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(double))
                    {
                        return((ReturnType)AndroidJNISafe.CallDoubleMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(char))
                    {
                        return((ReturnType)AndroidJNISafe.CallCharMethod(this.m_jobject, methodID, jvalueArray));
                    }
                }
                else
                {
                    if (typeof(ReturnType) == typeof(string))
                    {
                        return((ReturnType)AndroidJNISafe.CallStringMethod(this.m_jobject, methodID, jvalueArray));
                    }
                    if (typeof(ReturnType) == typeof(AndroidJavaClass))
                    {
                        return((ReturnType)AndroidJavaClassDeleteLocalRef(AndroidJNISafe.CallObjectMethod(this.m_jobject, methodID, jvalueArray)));
                    }
                    if (typeof(ReturnType) == typeof(AndroidJavaObject))
                    {
                        return((ReturnType)AndroidJavaObjectDeleteLocalRef(AndroidJNISafe.CallObjectMethod(this.m_jobject, methodID, jvalueArray)));
                    }
                    if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(ReturnType)))
                    {
                        throw new Exception("JNI: Unknown return type '" + typeof(ReturnType) + "'");
                    }
                    return(AndroidJNIHelper.ConvertFromJNIArray <ReturnType>(AndroidJNISafe.CallObjectMethod(this.m_jobject, methodID, jvalueArray)));
                }
                local = default(ReturnType);
            }
            finally
            {
                AndroidJNIHelper.DeleteJNIArgArray(args, jvalueArray);
            }
            return(local);
        }
Beispiel #4
0
        protected ReturnType _CallStatic <ReturnType>(string methodName, params object[] args)
        {
            if (args == null)
            {
                args = new object[1];
            }
            IntPtr methodId = AndroidJNIHelper.GetMethodID <ReturnType>(this.m_jclass, methodName, args, true);

            jvalue[] jniArgArray = AndroidJNIHelper.CreateJNIArgArray(args);
            try
            {
                if (AndroidReflection.IsPrimitive(typeof(ReturnType)))
                {
                    if (typeof(ReturnType) == typeof(int))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticIntMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    if (typeof(ReturnType) == typeof(bool))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticBooleanMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    if (typeof(ReturnType) == typeof(byte))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticByteMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    if (typeof(ReturnType) == typeof(short))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticShortMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    if (typeof(ReturnType) == typeof(long))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticLongMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    if (typeof(ReturnType) == typeof(float))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticFloatMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    if (typeof(ReturnType) == typeof(double))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticDoubleMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    if (typeof(ReturnType) == typeof(char))
                    {
                        return((ReturnType)(ValueType)AndroidJNISafe.CallStaticCharMethod(this.m_jclass, methodId, jniArgArray));
                    }
                    return(default(ReturnType));
                }
                if (typeof(ReturnType) == typeof(string))
                {
                    return((ReturnType)AndroidJNISafe.CallStaticStringMethod(this.m_jclass, methodId, jniArgArray));
                }
                if (typeof(ReturnType) == typeof(AndroidJavaClass))
                {
                    return((ReturnType)AndroidJavaObject.AndroidJavaClassDeleteLocalRef(AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodId, jniArgArray)));
                }
                if (typeof(ReturnType) == typeof(AndroidJavaObject))
                {
                    return((ReturnType)AndroidJavaObject.AndroidJavaObjectDeleteLocalRef(AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodId, jniArgArray)));
                }
                if (AndroidReflection.IsAssignableFrom(typeof(Array), typeof(ReturnType)))
                {
                    return(AndroidJNIHelper.ConvertFromJNIArray <ReturnType>(AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodId, jniArgArray)));
                }
                throw new Exception("JNI: Unknown return type '" + (object)typeof(ReturnType) + "'");
            }
            finally
            {
                AndroidJNIHelper.DeleteJNIArgArray(args, jniArgArray);
            }
        }
        protected ReturnType _CallStatic <ReturnType>(string methodName, params object[] args)
        {
            if (args == null)
            {
                args = new object[1];
            }
            IntPtr methodID = AndroidJNIHelper.GetMethodID <ReturnType>(this.m_jclass, methodName, args, true);

            jvalue[]   array = AndroidJNIHelper.CreateJNIArgArray(args);
            ReturnType result;

            try
            {
                if (AndroidReflection.IsPrimitive(typeof(ReturnType)))
                {
                    if (typeof(ReturnType) == typeof(int))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticIntMethod(this.m_jclass, methodID, array));
                    }
                    else if (typeof(ReturnType) == typeof(bool))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticBooleanMethod(this.m_jclass, methodID, array));
                    }
                    else if (typeof(ReturnType) == typeof(byte))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticByteMethod(this.m_jclass, methodID, array));
                    }
                    else if (typeof(ReturnType) == typeof(short))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticShortMethod(this.m_jclass, methodID, array));
                    }
                    else if (typeof(ReturnType) == typeof(long))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticLongMethod(this.m_jclass, methodID, array));
                    }
                    else if (typeof(ReturnType) == typeof(float))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticFloatMethod(this.m_jclass, methodID, array));
                    }
                    else if (typeof(ReturnType) == typeof(double))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticDoubleMethod(this.m_jclass, methodID, array));
                    }
                    else if (typeof(ReturnType) == typeof(char))
                    {
                        result = (ReturnType)((object)AndroidJNISafe.CallStaticCharMethod(this.m_jclass, methodID, array));
                    }
                    else
                    {
                        result = default(ReturnType);
                    }
                }
                else if (typeof(ReturnType) == typeof(string))
                {
                    result = (ReturnType)((object)AndroidJNISafe.CallStaticStringMethod(this.m_jclass, methodID, array));
                }
                else if (typeof(ReturnType) == typeof(AndroidJavaClass))
                {
                    IntPtr intPtr = AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, array);
                    result = ((!(intPtr == IntPtr.Zero)) ? ((ReturnType)((object)AndroidJavaObject.AndroidJavaClassDeleteLocalRef(intPtr))) : default(ReturnType));
                }
                else if (typeof(ReturnType) == typeof(AndroidJavaObject))
                {
                    IntPtr intPtr2 = AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, array);
                    result = ((!(intPtr2 == IntPtr.Zero)) ? ((ReturnType)((object)AndroidJavaObject.AndroidJavaObjectDeleteLocalRef(intPtr2))) : default(ReturnType));
                }
                else
                {
                    if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(ReturnType)))
                    {
                        throw new Exception("JNI: Unknown return type '" + typeof(ReturnType) + "'");
                    }
                    IntPtr intPtr3 = AndroidJNISafe.CallStaticObjectMethod(this.m_jclass, methodID, array);
                    result = ((!(intPtr3 == IntPtr.Zero)) ? ((ReturnType)((object)AndroidJNIHelper.ConvertFromJNIArray <ReturnType>(intPtr3))) : default(ReturnType));
                }
            }
            finally
            {
                AndroidJNIHelper.DeleteJNIArgArray(args, array);
            }
            return(result);
        }
        protected FieldType _Get <FieldType>(string fieldName)
        {
            IntPtr    fieldID = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, false);
            FieldType result;

            if (AndroidReflection.IsPrimitive(typeof(FieldType)))
            {
                if (typeof(FieldType) == typeof(int))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetIntField(this.m_jobject, fieldID));
                }
                else if (typeof(FieldType) == typeof(bool))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetBooleanField(this.m_jobject, fieldID));
                }
                else if (typeof(FieldType) == typeof(byte))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetByteField(this.m_jobject, fieldID));
                }
                else if (typeof(FieldType) == typeof(short))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetShortField(this.m_jobject, fieldID));
                }
                else if (typeof(FieldType) == typeof(long))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetLongField(this.m_jobject, fieldID));
                }
                else if (typeof(FieldType) == typeof(float))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetFloatField(this.m_jobject, fieldID));
                }
                else if (typeof(FieldType) == typeof(double))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetDoubleField(this.m_jobject, fieldID));
                }
                else if (typeof(FieldType) == typeof(char))
                {
                    result = (FieldType)((object)AndroidJNISafe.GetCharField(this.m_jobject, fieldID));
                }
                else
                {
                    result = default(FieldType);
                }
            }
            else if (typeof(FieldType) == typeof(string))
            {
                result = (FieldType)((object)AndroidJNISafe.GetStringField(this.m_jobject, fieldID));
            }
            else if (typeof(FieldType) == typeof(AndroidJavaClass))
            {
                IntPtr objectField = AndroidJNISafe.GetObjectField(this.m_jobject, fieldID);
                result = ((!(objectField == IntPtr.Zero)) ? ((FieldType)((object)AndroidJavaObject.AndroidJavaClassDeleteLocalRef(objectField))) : default(FieldType));
            }
            else if (typeof(FieldType) == typeof(AndroidJavaObject))
            {
                IntPtr objectField2 = AndroidJNISafe.GetObjectField(this.m_jobject, fieldID);
                result = ((!(objectField2 == IntPtr.Zero)) ? ((FieldType)((object)AndroidJavaObject.AndroidJavaObjectDeleteLocalRef(objectField2))) : default(FieldType));
            }
            else
            {
                if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType)))
                {
                    throw new Exception("JNI: Unknown field type '" + typeof(FieldType) + "'");
                }
                IntPtr objectField3 = AndroidJNISafe.GetObjectField(this.m_jobject, fieldID);
                result = ((!(objectField3 == IntPtr.Zero)) ? ((FieldType)((object)AndroidJNIHelper.ConvertFromJNIArray <FieldType>(objectField3))) : default(FieldType));
            }
            return(result);
        }
Beispiel #7
0
        protected FieldType _GetStatic <FieldType>(string fieldName)
        {
            IntPtr    fieldID = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, true);
            bool      flag    = AndroidReflection.IsPrimitive(typeof(FieldType));
            FieldType result;

            if (flag)
            {
                bool flag2 = typeof(FieldType) == typeof(int);
                if (flag2)
                {
                    result = (FieldType)((object)AndroidJNISafe.GetStaticIntField(this.m_jclass, fieldID));
                }
                else
                {
                    bool flag3 = typeof(FieldType) == typeof(bool);
                    if (flag3)
                    {
                        result = (FieldType)((object)AndroidJNISafe.GetStaticBooleanField(this.m_jclass, fieldID));
                    }
                    else
                    {
                        bool flag4 = typeof(FieldType) == typeof(byte);
                        if (flag4)
                        {
                            Debug.LogWarning("Field type <Byte> for Java get field call is obsolete, use field type <SByte> instead");
                            result = (FieldType)((object)((byte)AndroidJNISafe.GetStaticSByteField(this.m_jclass, fieldID)));
                        }
                        else
                        {
                            bool flag5 = typeof(FieldType) == typeof(sbyte);
                            if (flag5)
                            {
                                result = (FieldType)((object)AndroidJNISafe.GetStaticSByteField(this.m_jclass, fieldID));
                            }
                            else
                            {
                                bool flag6 = typeof(FieldType) == typeof(short);
                                if (flag6)
                                {
                                    result = (FieldType)((object)AndroidJNISafe.GetStaticShortField(this.m_jclass, fieldID));
                                }
                                else
                                {
                                    bool flag7 = typeof(FieldType) == typeof(long);
                                    if (flag7)
                                    {
                                        result = (FieldType)((object)AndroidJNISafe.GetStaticLongField(this.m_jclass, fieldID));
                                    }
                                    else
                                    {
                                        bool flag8 = typeof(FieldType) == typeof(float);
                                        if (flag8)
                                        {
                                            result = (FieldType)((object)AndroidJNISafe.GetStaticFloatField(this.m_jclass, fieldID));
                                        }
                                        else
                                        {
                                            bool flag9 = typeof(FieldType) == typeof(double);
                                            if (flag9)
                                            {
                                                result = (FieldType)((object)AndroidJNISafe.GetStaticDoubleField(this.m_jclass, fieldID));
                                            }
                                            else
                                            {
                                                bool flag10 = typeof(FieldType) == typeof(char);
                                                if (flag10)
                                                {
                                                    result = (FieldType)((object)AndroidJNISafe.GetStaticCharField(this.m_jclass, fieldID));
                                                }
                                                else
                                                {
                                                    result = default(FieldType);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                bool flag11 = typeof(FieldType) == typeof(string);
                if (flag11)
                {
                    result = (FieldType)((object)AndroidJNISafe.GetStaticStringField(this.m_jclass, fieldID));
                }
                else
                {
                    bool flag12 = typeof(FieldType) == typeof(AndroidJavaClass);
                    if (flag12)
                    {
                        IntPtr staticObjectField = AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID);
                        result = ((staticObjectField == IntPtr.Zero) ? default(FieldType) : ((FieldType)((object)AndroidJavaObject.AndroidJavaClassDeleteLocalRef(staticObjectField))));
                    }
                    else
                    {
                        bool flag13 = typeof(FieldType) == typeof(AndroidJavaObject);
                        if (flag13)
                        {
                            IntPtr staticObjectField2 = AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID);
                            result = ((staticObjectField2 == IntPtr.Zero) ? default(FieldType) : ((FieldType)((object)AndroidJavaObject.AndroidJavaObjectDeleteLocalRef(staticObjectField2))));
                        }
                        else
                        {
                            bool flag14 = AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType));
                            if (!flag14)
                            {
                                string arg_3D3_0 = "JNI: Unknown field type '";
                                Type   expr_3C2  = typeof(FieldType);
                                throw new Exception(arg_3D3_0 + ((expr_3C2 != null) ? expr_3C2.ToString() : null) + "'");
                            }
                            IntPtr staticObjectField3 = AndroidJNISafe.GetStaticObjectField(this.m_jclass, fieldID);
                            result = ((staticObjectField3 == IntPtr.Zero) ? default(FieldType) : ((FieldType)((object)AndroidJNIHelper.ConvertFromJNIArray <FieldType>(staticObjectField3))));
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #8
0
        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);
        }