Exemplo n.º 1
0
        private static RecentTradeOffer ReadRecentTradeOffer(dynamic offer)
        {
            string steamTradeOfferId = offer.steam_trade_offer_id ?? null;
            TradeOfferStatusType?steamTradeOfferStatus = null;

            if (offer.steam_trade_offer_state != null)
            {
                steamTradeOfferStatus = (TradeOfferStatusType)(int)offer.steam_trade_offer_state;
            }
            string senderUid         = offer.sender_uid ?? null;
            string recipientUid      = offer.recipient_uid ?? null;
            int?   numItemsSent      = offer.num_items_sent ?? null;
            int?   numItemsRetrieved = offer.num_items_retrieved ?? null;
            string tradeMessage      = offer.trade_message ?? null;

            TradeTokenAndTradeIdFromString(tradeMessage, out string bitSkinsTradeToken, out string bitSkinsTradeId);
            DateTime?createdAt = null;

            if (offer.created_at != null)
            {
                createdAt = DateTimeExtension.FromUnixTime((long)offer.created_at);
            }
            DateTime?updatedAt = null;

            if (offer.updated_at != null)
            {
                updatedAt = DateTimeExtension.FromUnixTime((long)offer.updated_at);
            }

            RecentTradeOffer recentTradeOffer = new RecentTradeOffer(steamTradeOfferId, steamTradeOfferStatus, senderUid, recipientUid, numItemsSent,
                                                                     numItemsRetrieved, bitSkinsTradeToken, bitSkinsTradeId, tradeMessage, createdAt, updatedAt);

            return(recentTradeOffer);
        }
Exemplo n.º 2
0
        private static List <RecentTradeOffer> ReadRecentTradeOffers(string result)
        {
            dynamic responseServerD = JsonConvert.DeserializeObject(result);
            dynamic offersD         = responseServerD.data.offers;

            List <RecentTradeOffer> recentTradeOffers = new List <RecentTradeOffer>();

            if (offersD != null)
            {
                foreach (dynamic offer in offersD)
                {
                    RecentTradeOffer recentTradeOffer = ReadRecentTradeOffer(offer);
                    recentTradeOffers.Add(recentTradeOffer);
                }
            }

            return(recentTradeOffers);
        }