public object ConvertTo(Type t) { if (t == typeof(Func <object, Task <object> >) || t == typeof(Func <object[], Task <object> >)) { if (dictionary.ContainsKey("rpa_function") && (bool)dictionary["rpa_function"]) { if (t == typeof(Func <object, Task <object> >)) { return(new Func <object, Task <object> >((object arg) => { return RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], new object[] { arg }); })); } else if (t == typeof(Func <object[], Task <object> >)) { return(new Func <object[], Task <object> >((object[] args) => { return RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], args); })); } } else { var ex = new RemoteException("Cannot cast this object as a Function"); ex.Code = "INVALID_CAST_EXCEPTION"; throw ex; } } else if (t == typeof(Dictionary <string, object>)) { return(dictionary); } return(this); }
public override bool TryInvoke(InvokeBinder binder, object[] args, out object result) { if (server == null) { result = null; return(false); } result = RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], args); return(true); }
public Task <object> Invoke(object[] args) { return(RemoteSender.Invoke(server, socket, (string)dictionary["rpa_id"], args)); }