Esempio n. 1
0
        internal string Request(string url, NameValueCollection data, string referer)
        {
            string resp;

            try
            {
                resp = SteamWeb.RequestWithException(
                    url,
                    "POST",
                    data,
                    this._cookies,
                    referer: referer,
                    proxy: this._proxy);
            }
            catch (Exception e)
            {
                throw new SteamException($"Steam error: {e.Message}", e);
            }

            try
            {
                var offerResponse = JsonConvert.DeserializeObject <NewTradeOfferResponse>(resp);
                if (!string.IsNullOrEmpty(offerResponse.TradeOfferId))
                {
                    return(offerResponse.TradeOfferId);
                }

                throw new SteamException(offerResponse.TradeError);
            }
            catch (JsonException ex)
            {
                Logger.Log.Debug(resp);
                throw new SteamException($"Unknown steam response - {ex.Message}");
            }
        }