Exemple #1
0
        internal static ItemOnSale ReadItemOnSale(dynamic item)
        {
            string   itemId         = item.item_id ?? null;
            string   marketHashName = item.market_hash_name ?? null;
            string   itemType       = item.item_type ?? null;
            string   image          = item.image ?? null;
            double?  price          = item.price ?? null;
            double?  suggestedPrice = item.suggested_price ?? null;
            double?  floatValue     = item.float_value ?? null;
            bool?    isMine         = item.is_mine ?? null;
            DateTime?updatedAt      = null;

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

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

            ItemOnSale itemOnSale = new ItemOnSale(itemId, marketHashName, itemType, image, price,
                                                   suggestedPrice, floatValue, isMine, updatedAt, withdrawableAt);

            return(itemOnSale);
        }
Exemple #2
0
        private static List <ItemOnSale> ReadItemsOnSale(dynamic itemsOnSaleD)
        {
            List <ItemOnSale> itemsOnSale = new List <ItemOnSale>();

            if (itemsOnSaleD != null)
            {
                foreach (dynamic item in itemsOnSaleD)
                {
                    ItemOnSale itemOnSale = InventoryOnSale.ReadItemOnSale(item);
                    itemsOnSale.Add(itemOnSale);
                }
            }

            return(itemsOnSale);
        }
Exemple #3
0
        private static List <ItemOnSale> ReadItemsOnSale(string result)
        {
            dynamic responseServerD = JsonConvert.DeserializeObject(result);
            dynamic itemsD          = responseServerD.data.items;

            List <ItemOnSale> itemsOnSale = new List <ItemOnSale>();

            if (itemsD != null)
            {
                foreach (dynamic item in itemsD)
                {
                    ItemOnSale itemOnSale = ReadItemOnSale(item);
                    itemsOnSale.Add(itemOnSale);
                }
            }

            return(itemsOnSale);
        }