From 1a281f3182bd4c0308cd3956200b9fd5adbe6fe6 Mon Sep 17 00:00:00 2001 From: Ryan Kistner Date: Tue, 19 Feb 2013 20:36:31 -0700 Subject: [PATCH] DepotDownloader: More steam3 support --- DepotDownloader/ContentDownloader.cs | 24 ++++++++++++++++-------- DepotDownloader/Steam3Session.cs | 3 +++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 6cab628d..cba3dfdb 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -192,19 +192,27 @@ namespace DepotDownloader static bool AccountHasAccess( int depotId, bool appId=false ) { - if ( steam3 == null || steam3.Licenses == null ) + if ( steam3 == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser) ) return CDRManager.SubHasDepot( 0, depotId ); - steam3.RequestPackageInfo( steam3.Licenses.Select( x => x.PackageID ) ); - - foreach ( var license in steam3.Licenses ) + IEnumerable licenseQuery; + if ( steam3.steamUser.SteamID.AccountType == EAccountType.AnonUser ) + { + licenseQuery = new List() { 0 }; + } + else { - + licenseQuery = steam3.Licenses.Select( x => x.PackageID ); + } + + steam3.RequestPackageInfo( licenseQuery ); + foreach ( var license in licenseQuery ) + { SteamApps.PICSProductInfoCallback.PICSProductInfo package; - if ( steam3.PackageInfo.TryGetValue( (uint)license.PackageID, out package ) || package == null ) + if ( steam3.PackageInfo.TryGetValue( license, out package ) || package == null ) { - KeyValue root = package.KeyValues[license.PackageID.ToString()]; + KeyValue root = package.KeyValues[license.ToString()]; KeyValue subset = (appId == true ? root["appids"] : root["depotids"]); foreach ( var child in subset.Children ) @@ -214,7 +222,7 @@ namespace DepotDownloader } } - if ( CDRManager.SubHasDepot( ( int )license.PackageID, depotId ) ) + if ( CDRManager.SubHasDepot( ( int )license, depotId ) ) return true; } diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index 63ab45fa..0baa4f15 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -171,7 +171,10 @@ namespace DepotDownloader SteamApps.PICSRequest request = new SteamApps.PICSRequest(appId); if (AppTokens.ContainsKey(appId)) + { request.AccessToken = AppTokens[appId]; + request.Public = false; + } using (JobCallback appInfoCallback = new JobCallback(cbMethod, callbacks, steamApps.PICSGetProductInfo(new List() { request }, new List() { }))) {