internal void Invoke(string name, object[] args, ref Value ret) { if (methods != null && methods.ContainsKey(name)) { foreach (Method method in methods[name]) { if (method.method != null) { if (ValidateArguments(method.method, args)) { object rv = Invoke(method.method, method.obj, args); if (method.method.ReturnType != typeof(void)) { ScriptObjectHelper.ToValue(ref ret, rv); } return; } } } } Console.WriteLine("ScriptObject.Invoke: NOT IMPLEMENTED: {0}", name.ToLower()); }
bool GetPropertyFromUnmanaged(string scriptAlias, IntPtr[] uargs, int arg_count, ref Value value) { object[] args; if (ManagedObject is IDictionary && scriptAlias != "item") { args = new object[] { scriptAlias }; scriptAlias = "item"; } else { args = new object[arg_count]; for (int i = 0; i < arg_count; i++) { if (uargs[i] == IntPtr.Zero) { args[i] = null; } else { Value val = (Value)Marshal.PtrToStructure(uargs[i], typeof(Value)); args[i] = ScriptObjectHelper.FromValue(val); } } } object v = GetProperty(scriptAlias, args); ScriptObjectHelper.ToValue(ref value, v); return(true); }
internal object InvokeInternal(string name, params object [] args) { CheckName(name); CheckHandle(); int length = args == null ? 0 : args.Length; object result = null; Mono.Value res; Mono.Value [] vargs = new Mono.Value [length]; for (int i = 0; i < length; i++) { ScriptObjectHelper.ToValue(ref vargs [i], args [i]); } if (!NativeMethods.html_object_invoke(PluginHost.Handle, Handle, name, vargs, (uint)length, out res)) { throw new InvalidOperationException(); } using (res) if (res.k != Mono.Kind.INVALID) { result = ScriptObjectHelper.FromValue(res); } return(result); }
internal object InvokeSelfInternal(params object [] args) { CheckHandle(); int length = args == null ? 0 : args.Length; object result = null; Mono.Value res; Mono.Value [] vargs = new Mono.Value [length]; for (int i = 0; i < length; i++) { ScriptObjectHelper.ToValue(ref vargs [i], args [i]); } try { if (!NativeMethods.html_object_invoke_self(PluginHost.Handle, Handle, vargs, (uint)length, out res)) { throw new InvalidOperationException(); } if (res.k != Mono.Kind.INVALID) { result = ScriptObjectHelper.FromValue(res); } } finally { res.Dispose(); foreach (var v in vargs) { v.Dispose(); } } return(result); }
internal static void SetPropertyInternal(IntPtr h, string name, object value) { CheckName(name); Mono.Value dp = new Mono.Value(); ScriptObjectHelper.ToValue(ref dp, value); using (dp) { NativeMethods.html_object_set_property(PluginHost.Handle, h, name, ref dp); } }