Fix downloading depots for an app that share an app id with another app.

This commit is contained in:
Nicholas Hastings committed 2013-10-08 13:21:05 -04:00
1 parent e96e8bae51
commit 798e66d055
1 file changed
+8 -9
+8 -9
View File
@@ -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);