From 798e66d055cc24ad82a74abb4c9cfd306b9abad9 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Tue, 8 Oct 2013 13:21:05 -0400 Subject: [PATCH] Fix downloading depots for an app that share an app id with another app. --- DepotDownloader/ContentDownloader.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 0edc8902..59b79595 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -102,7 +102,7 @@ namespace DepotDownloader return false; } - static bool AccountHasAccess( uint depotId, bool appId=false ) + static bool AccountHasAccess( uint depotId ) { if ( steam3 == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser) ) return false; @@ -125,13 +125,12 @@ namespace DepotDownloader if ( steam3.PackageInfo.TryGetValue( license, out package ) || package == null ) { KeyValue root = package.KeyValues[license.ToString()]; - KeyValue subset = (appId == true ? root["appids"] : root["depotids"]); - foreach ( var child in subset.Children ) - { - if ( child.AsInteger() == depotId ) - return true; - } + if ( root["appids"].Children.Any( child => child.AsInteger() == depotId ) ) + return true; + + if ( root["depotids"].Children.Any( child => child.AsInteger() == depotId ) ) + return true; } } @@ -309,7 +308,7 @@ namespace DepotDownloader if(steam3 != null) steam3.RequestAppInfo(appId); - if (!AccountHasAccess(appId, true)) + if (!AccountHasAccess(appId)) { string contentName = GetAppOrDepotName(INVALID_DEPOT_ID, appId); Console.WriteLine("App {0} ({1}) is not available from this account.", appId, contentName); @@ -380,7 +379,7 @@ namespace DepotDownloader string contentName = GetAppOrDepotName(depotId, appId); - if (!AccountHasAccess(depotId, appId == depotId)) + if (!AccountHasAccess(depotId)) { Console.WriteLine("Depot {0} ({1}) is not available from this account.", depotId, contentName);