Ejemplo n.º 1
0
        public static bool IsMethod(string className, string methodName)
        {
            if (className == null)
            {
                return(FunctionDictionary.ContainsKey(methodName));
            }

            UnknownSimObject obj = Sim.FindObjectByName <UnknownSimObject>(className);

            if (obj == null)
            {
                if (!ClassTypeDictionary.ContainsKey(className))
                {
                    return(false);
                }

                MethodInfo method = ClassTypeDictionary[className]
                                    .GetMethod(methodName, bindingFlags);
                return(method != null && method.DeclaringType.GetCustomAttributes <ConsoleClassAttribute>().Any());
            }

            Type type = GetObjectType(obj.GetClassName(), obj.GetClassNamespace(), obj);

            return(type != null &&
                   type.GetMethod(methodName, bindingFlags) !=
                   null);
        }
Ejemplo n.º 2
0
        public static string CallMethodDelegate(IntPtr className, IntPtr classNamespace, uint obj, IntPtr name,
                                                IntPtr argv, int argc,
                                                out bool result)
        {
            string _className      = Marshal.PtrToStringAnsi(className);
            string _classNamespace = Marshal.PtrToStringAnsi(classNamespace);
            string _name           = Marshal.PtrToStringAnsi(name);

            UnknownSimObject objectBaseWrapper = Sim.FindObjectById <UnknownSimObject>(obj);

            string[] strings = { };
            if (argv != IntPtr.Zero)
            {
                strings = StringMarshal.IntPtrToAnsiStringArray(argv, argc);
            }
            string strRes = EngineCallbacks.CallScriptMethod(_className, _classNamespace, objectBaseWrapper, _name, strings,
                                                             out result);

            return(strRes);
        }