Beispiel #1
0
        private static SteamInventory ReadSteamInventory(dynamic steamInventoryD)
        {
            SteamInventory steamInventory = null;

            if (steamInventoryD != null)
            {
                dynamic items = steamInventoryD.items;

                int?totalItems = steamInventoryD.total_items ?? null;

                List <SteamInventoryItem> steamInventoryItems = new List <SteamInventoryItem>();
                if (items != null)
                {
                    foreach (dynamic item in items)
                    {
                        SteamInventoryItem steamInventoryItem = ReadSteamInventoryItem(item);
                        steamInventoryItems.Add(steamInventoryItem);
                    }
                }

                steamInventory = new SteamInventory(totalItems, steamInventoryItems);
            }

            return(steamInventory);
        }
Beispiel #2
0
        private static SteamInventoryItem ReadSteamInventoryItem(dynamic item)
        {
            ReadInventoryItem(item, out string marketHashName, out double?suggestedPrice, out string itemType, out string image);
            int?          numberOfItems      = item.number_of_items ?? null;
            double?       recentAveragePrice = (item.recent_sales_info == null) ? null : item.recent_sales_info.average_price;
            List <string> itemIds            = new List <string>();

            foreach (dynamic itemId in item.item_ids)
            {
                itemIds.Add((string)itemId);
            }

            SteamInventoryItem steamInventoryItem = new SteamInventoryItem(marketHashName, suggestedPrice, itemType, image, numberOfItems, itemIds, recentAveragePrice);

            return(steamInventoryItem);
        }