Пример #1
0
        internal IL2CPP_Property(IntPtr ptr) : base(ptr)
        {
            Ptr   = ptr;
            Name  = Marshal.PtrToStringAnsi(IL2CPP.il2cpp_property_get_name(Ptr));
            Flags = (IL2CPP_BindingFlags)IL2CPP.il2cpp_property_get_flags(Ptr);

            IntPtr getMethodPtr = IL2CPP.il2cpp_property_get_get_method(Ptr);

            if (getMethodPtr != IntPtr.Zero)
            {
                getMethod = new IL2CPP_Method(getMethodPtr);
            }

            IntPtr setMethodPtr = IL2CPP.il2cpp_property_get_set_method(Ptr);

            if (setMethodPtr != IntPtr.Zero)
            {
                setMethod = new IL2CPP_Method(setMethodPtr);
            }
        }
Пример #2
0
        public static IntPtr CreateInstance(IL2CPP_Class il2CppClass, IL2CPP_Method constructor = null, IntPtr[] contructorParams = null)
        {
            int paramCount = contructorParams?.Length ?? 0;

            if (constructor == null && paramCount > 0)
            {
                return(IntPtr.Zero);
            }
            IntPtr instance = IL2CPP.il2cpp_object_new(il2CppClass.Ptr);

            if (constructor == null)
            {
                IL2CPP.il2cpp_runtime_object_init(instance);
                return(instance);
            }
            else
            {
                constructor.Invoke(instance, contructorParams);
            }
            return(instance);
        }