public AsmoneyAPIError GetBalance(string currency, out double amount) { amount = 0; string str = m_client.InvokeVargs("getbalance", m_username, m_apiname, m_password, currency).ToString(); if (str == "Invalid user") { return(AsmoneyAPIError.AME_InvalidUser); } if (str == "Invalid api data") { return(AsmoneyAPIError.AME_InvalidAPIData); } if (str == "Invalid IP") { return(AsmoneyAPIError.AME_InvalidIP); } if (str == "Invalid IP setup") { return(AsmoneyAPIError.AME_InvalidIPSetup); } if (str == "Invalid") { return(AsmoneyAPIError.AME_InvalidCurrency); } amount = Convert.ToDouble(str); return(AsmoneyAPIError.AME_OK); }
static void Main() { // // Demonstration of client calls to a JSON-RPC service. // JsonRpcClient client = new JsonRpcClient(); client.Url = "http://www.raboof.com/projects/jayrock/demo.ashx"; Console.WriteLine(client.Invoke("system.about")); Console.WriteLine(client.Invoke("system.version")); Console.WriteLine(string.Join(Environment.NewLine, (string[])(new ArrayList((ICollection)client.Invoke("system.listMethods"))).ToArray(typeof(string)))); Console.WriteLine(client.Invoke("now")); Console.WriteLine(((DateTime)client.Invoke(typeof(DateTime), "now")).ToString("r")); Console.WriteLine(client.InvokeVargs("sum", 123, 456)); Console.WriteLine(client.Invoke("sum", new JsonObject { { "a", 123 }, { "b", 456 } })); Console.WriteLine(client.InvokeVargs("total", new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 })); client.CookieContainer = new CookieContainer(); Console.WriteLine(client.Invoke("counter")); Console.WriteLine(client.Invoke("counter")); }
public static string getResponse(string methodName, JsonRpcClient client, JsonObject args) { return(client.InvokeVargs(methodName, args).ToString()); }