Пример #1
0
        private static SentItem ReadSentItem(dynamic item)
        {
            Market.AppId.AppName?appId = null;
            if (item.app_id != null)
            {
                appId = (Market.AppId.AppName)(int) item.app_id;
            }
            string   itemId         = item.item_id ?? null;
            string   marketHashName = item.market_hash_name ?? null;
            string   image          = item.image ?? null;
            double?  price          = item.price ?? null;
            double?  suggestedPrice = item.suggested_price ?? null;
            DateTime?withdrawableAt = null;

            if (item.withdrawable_at != null)
            {
                withdrawableAt = DateTimeExtension.FromUnixTime((long)item.withdrawable_at);
            }
            DateTime?deliveredAt = null;

            if (item.delivered_at != null)
            {
                deliveredAt = DateTimeExtension.FromUnixTime((long)item.delivered_at);
            }

            SentItem sentItem = new SentItem(appId, itemId, marketHashName, image, price, suggestedPrice, withdrawableAt, deliveredAt);

            return(sentItem);
        }
Пример #2
0
        private static List <SentItem> ReadSentItems(dynamic itemsSentD)
        {
            List <SentItem> sentItems = new List <SentItem>();

            if (itemsSentD != null)
            {
                foreach (dynamic item in itemsSentD)
                {
                    SentItem sentItem = ReadSentItem(item);
                    sentItems.Add(sentItem);
                }
            }

            return(sentItems);
        }