Add support for FreeToDownload apps

pull/476/head
Pavel Djundik 1 year ago
parent 4539666214
commit 2a939053d0

@ -106,7 +106,7 @@ namespace DepotDownloader
return false; return false;
} }
static async Task<bool> AccountHasAccess(uint depotId) static async Task<bool> AccountHasAccess(uint appId, uint depotId)
{ {
if (steam3 == null || steam3.steamUser.SteamID == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser)) if (steam3 == null || steam3.steamUser.SteamID == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser))
return false; return false;
@ -135,6 +135,11 @@ namespace DepotDownloader
} }
} }
// Check if this app is free to download without a license
var info = GetSteam3AppSection(appId, EAppInfoSection.Common);
if (info != null && info["FreeToDownload"].AsBoolean())
return true;
return false; return false;
} }
@ -414,7 +419,7 @@ namespace DepotDownloader
await steam3?.RequestAppInfo(appId); await steam3?.RequestAppInfo(appId);
if (!await AccountHasAccess(appId)) if (!await AccountHasAccess(appId, appId))
{ {
if (await steam3.RequestFreeAppLicense(appId)) if (await steam3.RequestFreeAppLicense(appId))
{ {
@ -551,7 +556,7 @@ namespace DepotDownloader
await steam3.RequestAppInfo(appId); await steam3.RequestAppInfo(appId);
} }
if (!await AccountHasAccess(depotId)) if (!await AccountHasAccess(appId, depotId))
{ {
Console.WriteLine("Depot {0} is not available from this account.", depotId); Console.WriteLine("Depot {0} is not available from this account.", depotId);

Loading…
Cancel
Save