Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using System.Collections.Generic;
using Android.Runtime;
namespace Com.Example.Matthew.Myapplication
{
internal delegate bool LongMethodDelegate(
IntPtr jnienv,
IntPtr theThis,
IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5,
IntPtr arg6, IntPtr arg7, IntPtr arg8, IntPtr arg9, IntPtr arg10,
IntPtr arg11, IntPtr arg12, IntPtr arg13, IntPtr arg14, IntPtr arg15,
IntPtr arg16, IntPtr arg17, IntPtr arg18, IntPtr arg19, IntPtr arg20);
partial class LongNameTest
{
static Delegate longMethodDelegate;
static Delegate GetLongMethodDelegate()
{
if (longMethodDelegate == null)
{
longMethodDelegate = JNINativeWrapper.CreateDelegate((LongMethodDelegate)onLongMethodInvoked);
}
return longMethodDelegate;
}
static bool onLongMethodInvoked(
IntPtr jnienv,
IntPtr native__this,
IntPtr native_p0, IntPtr native_p1, IntPtr native_p2, IntPtr native_p3, IntPtr native_p4,
IntPtr native_p5, IntPtr native_p6, IntPtr native_p7, IntPtr native_p8, IntPtr native_p9,
IntPtr native_p10, IntPtr native_p11, IntPtr native_p12, IntPtr native_p13, IntPtr native_p14,
IntPtr native_p15, IntPtr native_p16, IntPtr native_p17, IntPtr native_p18, IntPtr native_p19)
{
LongNameTest __this = Java.Lang.Object.GetObject<LongNameTest>(jnienv, native__this, JniHandleOwnership.DoNotTransfer);
string p0 = JNIEnv.GetString(native_p0, JniHandleOwnership.DoNotTransfer);
string p1 = JNIEnv.GetString(native_p1, JniHandleOwnership.DoNotTransfer);
string p2 = JNIEnv.GetString(native_p2, JniHandleOwnership.DoNotTransfer);
string p3 = JNIEnv.GetString(native_p3, JniHandleOwnership.DoNotTransfer);
string p4 = JNIEnv.GetString(native_p4, JniHandleOwnership.DoNotTransfer);
string p5 = JNIEnv.GetString(native_p5, JniHandleOwnership.DoNotTransfer);
string p6 = JNIEnv.GetString(native_p6, JniHandleOwnership.DoNotTransfer);
string p7 = JNIEnv.GetString(native_p7, JniHandleOwnership.DoNotTransfer);
string p8 = JNIEnv.GetString(native_p8, JniHandleOwnership.DoNotTransfer);
string p9 = JNIEnv.GetString(native_p9, JniHandleOwnership.DoNotTransfer);
string p10 = JNIEnv.GetString(native_p10, JniHandleOwnership.DoNotTransfer);
string p11 = JNIEnv.GetString(native_p11, JniHandleOwnership.DoNotTransfer);
string p12 = JNIEnv.GetString(native_p12, JniHandleOwnership.DoNotTransfer);
string p13 = JNIEnv.GetString(native_p13, JniHandleOwnership.DoNotTransfer);
string p14 = JNIEnv.GetString(native_p14, JniHandleOwnership.DoNotTransfer);
string p15 = JNIEnv.GetString(native_p15, JniHandleOwnership.DoNotTransfer);
string p16 = JNIEnv.GetString(native_p16, JniHandleOwnership.DoNotTransfer);
string p17 = JNIEnv.GetString(native_p17, JniHandleOwnership.DoNotTransfer);
string p18 = JNIEnv.GetString(native_p18, JniHandleOwnership.DoNotTransfer);
string p19 = JNIEnv.GetString(native_p19, JniHandleOwnership.DoNotTransfer);
bool __ret = __this.TestNow(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19);
return __ret;
}
const string LongMethodName = "TestNow";
const string LongMethodJNI =
"(" +
"Ljava/lang/String;" + // arg1
"Ljava/lang/String;" + // arg2
"Ljava/lang/String;" + // arg3
"Ljava/lang/String;" + // arg4
"Ljava/lang/String;" + // arg5
"Ljava/lang/String;" + // arg6
"Ljava/lang/String;" + // arg7
"Ljava/lang/String;" + // arg8
"Ljava/lang/String;" + // arg9
"Ljava/lang/String;" + // arg10
"Ljava/lang/String;" + // arg11
"Ljava/lang/String;" + // arg12
"Ljava/lang/String;" + // arg13
"Ljava/lang/String;" + // arg14
"Ljava/lang/String;" + // arg15
"Ljava/lang/String;" + // arg16
"Ljava/lang/String;" + // arg17
"Ljava/lang/String;" + // arg18
"Ljava/lang/String;" + // arg19
"Ljava/lang/String;" + // arg20
")Z";
static IntPtr longMethodPointer;
[Register(LongMethodName, LongMethodJNI, nameof(GetLongMethodDelegate))]
public virtual unsafe bool TestNow(
string p0, string p1, string p2, string p3, string p4,
string p5, string p6, string p7, string p8, string p9,
string p10, string p11, string p12, string p13, string p14,
string p15, string p16, string p17, string p18, string p19)
{
if (longMethodPointer == IntPtr.Zero)
{
longMethodPointer = JNIEnv.GetMethodID(class_ref, LongMethodName, LongMethodJNI);
}
IntPtr native_p0 = JNIEnv.NewString(p0);
IntPtr native_p1 = JNIEnv.NewString(p1);
IntPtr native_p2 = JNIEnv.NewString(p2);
IntPtr native_p3 = JNIEnv.NewString(p3);
IntPtr native_p4 = JNIEnv.NewString(p4);
IntPtr native_p5 = JNIEnv.NewString(p5);
IntPtr native_p6 = JNIEnv.NewString(p6);
IntPtr native_p7 = JNIEnv.NewString(p7);
IntPtr native_p8 = JNIEnv.NewString(p8);
IntPtr native_p9 = JNIEnv.NewString(p9);
IntPtr native_p10 = JNIEnv.NewString(p10);
IntPtr native_p11 = JNIEnv.NewString(p11);
IntPtr native_p12 = JNIEnv.NewString(p12);
IntPtr native_p13 = JNIEnv.NewString(p13);
IntPtr native_p14 = JNIEnv.NewString(p14);
IntPtr native_p15 = JNIEnv.NewString(p15);
IntPtr native_p16 = JNIEnv.NewString(p16);
IntPtr native_p17 = JNIEnv.NewString(p17);
IntPtr native_p18 = JNIEnv.NewString(p18);
IntPtr native_p19 = JNIEnv.NewString(p19);
try
{
JValue* __args = stackalloc JValue[20];
__args[0] = new JValue(native_p0);
__args[1] = new JValue(native_p1);
__args[2] = new JValue(native_p2);
__args[3] = new JValue(native_p3);
__args[4] = new JValue(native_p4);
__args[5] = new JValue(native_p5);
__args[6] = new JValue(native_p6);
__args[7] = new JValue(native_p7);
__args[8] = new JValue(native_p8);
__args[9] = new JValue(native_p9);
__args[10] = new JValue(native_p10);
__args[11] = new JValue(native_p11);
__args[12] = new JValue(native_p12);
__args[13] = new JValue(native_p13);
__args[14] = new JValue(native_p14);
__args[15] = new JValue(native_p15);
__args[16] = new JValue(native_p16);
__args[17] = new JValue(native_p17);
__args[18] = new JValue(native_p18);
__args[19] = new JValue(native_p19);
bool __ret;
if (GetType() == ThresholdType)
__ret = JNIEnv.CallBooleanMethod(((Java.Lang.Object)this).Handle, longMethodPointer, __args);
else
__ret = JNIEnv.CallNonvirtualBooleanMethod(((Java.Lang.Object)this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, LongMethodName, LongMethodJNI), __args);
return __ret;
}
finally
{
JNIEnv.DeleteLocalRef(native_p0);
JNIEnv.DeleteLocalRef(native_p1);
JNIEnv.DeleteLocalRef(native_p2);
JNIEnv.DeleteLocalRef(native_p3);
JNIEnv.DeleteLocalRef(native_p4);
JNIEnv.DeleteLocalRef(native_p5);
JNIEnv.DeleteLocalRef(native_p6);
JNIEnv.DeleteLocalRef(native_p7);
JNIEnv.DeleteLocalRef(native_p8);
JNIEnv.DeleteLocalRef(native_p9);
JNIEnv.DeleteLocalRef(native_p10);
JNIEnv.DeleteLocalRef(native_p11);
JNIEnv.DeleteLocalRef(native_p12);
JNIEnv.DeleteLocalRef(native_p13);
JNIEnv.DeleteLocalRef(native_p14);
JNIEnv.DeleteLocalRef(native_p15);
JNIEnv.DeleteLocalRef(native_p16);
JNIEnv.DeleteLocalRef(native_p17);
JNIEnv.DeleteLocalRef(native_p18);
JNIEnv.DeleteLocalRef(native_p19);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment