Ejemplo n.º 1
0
        public IL2CPP_Class GetClass(IntPtr ptr)
        {
            IL2CPP_Class returnval = null;

            for (int i = 0; i < ClassList.Length; i++)
            {
                IL2CPP_Class type = ClassList[i];
                if (type.Ptr == ptr)
                {
                    returnval = type;
                    break;
                }
                else
                {
                    /*
                     * var nestedTypes = type.GetNestedTypes();
                     * if (nestedTypes.Length > 0)
                     * {
                     *  for (int l = 0; l < nestedTypes.Length; l++)
                     *  {
                     *      var nestedType = nestedTypes[l];
                     *      if (nestedType.Ptr == ptr)
                     *      {
                     *          returnval = nestedType;
                     *          break;
                     *      }
                     *  }
                     *  if (returnval != null)
                     *      break;
                     * }
                     */
                }
            }
            return(returnval);
        }
Ejemplo n.º 2
0
        public IL2CPP_Class GetClass(string name, string name_space, IL2CPP_BindingFlags flags)
        {
            IL2CPP_Class returnval = null;

            for (int i = 0; i < ClassList.Length; i++)
            {
                IL2CPP_Class type = ClassList[i];
                if (type.Name.Equals(name) && (string.IsNullOrEmpty(type.Namespace) || type.Namespace.Equals(name_space)) && type.HasFlag(flags))
                {
                    returnval = type;
                    break;
                }
                else
                {
                    /*
                     * var nestedTypes = type.GetNestedTypes();
                     * if (nestedTypes.Length > 0)
                     * {
                     *  for (int l = 0; l < nestedTypes.Length; l++)
                     *  {
                     *      var nestedType = nestedTypes[l];
                     *      if (nestedType.Name.Equals(name) && (string.IsNullOrEmpty(nestedType.Namespace) || nestedType.Namespace.Equals(name_space)) && nestedType.HasFlag(flags))
                     *      {
                     *          returnval = nestedType;
                     *          break;
                     *      }
                     *  }
                     *  if (returnval != null)
                     *      break;
                     * }
                     */
                }
            }
            return(returnval);
        }
Ejemplo n.º 3
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);
        }