From 2a939053d0518b2bad959a69e590b0eab071359b Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Thu, 14 Nov 2024 11:05:02 +0200 Subject: [PATCH] Add support for FreeToDownload apps --- DepotDownloader/ContentDownloader.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index f4de1f61..f6980448 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -106,7 +106,7 @@ namespace DepotDownloader return false; } - static async Task AccountHasAccess(uint depotId) + static async Task AccountHasAccess(uint appId, uint depotId) { if (steam3 == null || steam3.steamUser.SteamID == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser)) 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; } @@ -414,7 +419,7 @@ namespace DepotDownloader await steam3?.RequestAppInfo(appId); - if (!await AccountHasAccess(appId)) + if (!await AccountHasAccess(appId, appId)) { if (await steam3.RequestFreeAppLicense(appId)) { @@ -551,7 +556,7 @@ namespace DepotDownloader await steam3.RequestAppInfo(appId); } - if (!await AccountHasAccess(depotId)) + if (!await AccountHasAccess(appId, depotId)) { Console.WriteLine("Depot {0} is not available from this account.", depotId);