internal void Parse(Dictionary<string, object> data) { if (data.ContainsKey("status")) this.Success = ((string)data["status"]) == "success"; if (data.ContainsKey("error")) this.Error = (string) data["error"]; if (data.ContainsKey("id")) this.ID = (string) data["id"]; if (data.ContainsKey("name")) this.Name = (string)data["name"]; if (data.ContainsKey("firstname")) this.FirstName = (string)data["firstname"]; if (data.ContainsKey("lastname")) this.LastName = (string)data["lastname"]; if (data.ContainsKey("email")) this.Email = (string)data["email"]; if (data.ContainsKey("params")) { object[] parameters = (object[])data["params"]; for (int i = 0; i < parameters.Length; i++) { RemoteParam p = new RemoteParam(this.Conn, this); p.Parse((Dictionary<string, object>)parameters[i]); this.Params.Add(p); } } if (data.ContainsKey("objects")) { object[] objects = (object[]) data["objects"]; for(int i=0; i < objects.Length; i++) { RemoteObj o = new RemoteObj(this.Conn, this); o.Parse((Dictionary<string, object>)objects[i]); this.Objects.Add(o); } } }
public RemoteObj RemoteSend(string method, string arg0 = null, string arg1 = null, string arg2 = null, string arg3 = null, string arg4 = null, string arg5 = null, string arg6 = null) { string s = (string)this.browser.Explorer.Document.InvokeScript("APIConn", new object[] { method, arg0, arg1, arg2, arg3, arg4, arg5, arg6 }); if (s == null) { return null; } System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); var o = (Dictionary<string, object>) serializer.DeserializeObject(s); RemoteObj ret = new RemoteObj(this, null); ret.Parse(o); return ret; }