Exemplo n.º 1
0
        IEnumerator _Call(string type, Hashtable items, int cost, System.Action <int, string, Hashtable> callback)
        {
            var id = _next++;

            while (id != _done)
            {
                yield return(null);
            }

            var nonce = Nonce.Generate();

            var request = endPoint.Post("/inventory/" + type);

            if (cost >= 0)
            {
                request.AddData("cost", cost);
            }

            if (items != null)
            {
                request.AddData("items", items);
            }

            request.AddData("nonce", nonce);

            endPoint.Service(request, delegate(Response result){
                _done++;
                if (result.sucessful)
                {
                    callback(id, null, result.hashtable);
                }
                else if (result.error != null && result.error.ToString() == "nsf")
                {
                    callback(id, "nsf", null);
                }
                else
                {
                    callback(id, result.localizedError, null);
                }
            });
        }
Exemplo n.º 2
0
        IEnumerator _Call(string type, int value, string reason, System.Action <int, string, Hashtable> callback)
        {
            var id = _next++;

            while (id != _done)
            {
                yield return(null);
            }

            var nonce = Nonce.Generate();

            var request = endPoint.Post("/wallet/" + type);

            if (value > 0)
            {
                request.AddData("value", value);
            }

            if (!string.IsNullOrEmpty(reason))
            {
                request.AddData("reason", reason);
            }

            request.AddData("nonce", nonce);

            endPoint.Service(request, delegate(Response result){
                _done++;
                if (result.sucessful)
                {
                    callback(id, null, result.hashtable);
                }
                else if (result.error != null && result.error.ToString() == "nsf")
                {
                    callback(id, "nsf", null);
                }
                else
                {
                    callback(id, result.localizedError, null);
                }
            });
        }