コード例 #1
0
        public async Task GetUserInventoryAssets()
        {
            var webSessionJson = "SESSION JSON CONTENT";
            var steamId        = 76561198000000000;

            var webSession    = JsonConvert.DeserializeObject <WebSession>(webSessionJson);
            var webAccess     = new SteamWebAccess(webSession);
            var userInventory = await UserInventory.GetInventory(webAccess, new SteamID(webSessionJson));

            // App Id of the App or Game to retrieve assets
            var appId = AppIds.DotA2;

            // Context Id of the App inventory context to retrieve assets
            var contextId = ContextIds.DotA2.Backpack;

            var assets = await userInventory.GetAssets(appId, contextId);

            foreach (var asset in assets)
            {
                // Do something with asset

                var assetId = asset.AssetId;
                var amount  = asset.Amount;

                var assetDescription = await userInventory.GetAssetDescription(asset);

                // Do something with assetDescription

                var assetName       = assetDescription.Name;
                var isAssetTradable = assetDescription.IsTradable;
            }
        }
コード例 #2
0
        public async Task GetUserInventoryApps()
        {
            var webSessionJson = "SESSION JSON CONTENT";
            var steamId        = 76561198000000000;

            var webSession    = JsonConvert.DeserializeObject <WebSession>(webSessionJson);
            var webAccess     = new SteamWebAccess(webSession);
            var userInventory = await UserInventory.GetInventory(webAccess, new SteamID(webSessionJson));

            foreach (var inventoryApp in userInventory.InventoryApps)
            {
                var appId   = inventoryApp.AppId;
                var appName = inventoryApp.Name;
                // Do something with appId and appName

                foreach (var appContext in inventoryApp.Contexts)
                {
                    var contextId   = appContext.ContextId;
                    var contextName = appContext.ContextName;

                    // Do something with appId, contextId and contextName
                }
            }
        }