From 0b722996b520044a18c8188ddf1135eb792a8468 Mon Sep 17 00:00:00 2001 From: Netshroud Date: Mon, 29 Dec 2014 20:06:40 +1100 Subject: [PATCH] Add -force-depot command line parameter to force attempted download of a particular depot in an app. This allows UGC depots to be downloaded, as they are not listed in the PICS configuration. --- DepotDownloader/ContentDownloader.cs | 73 +++++++++++++++------------- DepotDownloader/Program.cs | 3 +- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 98bf4c26..b5057567 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -320,7 +320,7 @@ namespace DepotDownloader steam3.Disconnect(); } - public static void DownloadApp(uint appId, uint depotId, string branch) + public static void DownloadApp(uint appId, uint depotId, string branch, bool forceDepot = false) { if(steam3 != null) steam3.RequestAppInfo(appId); @@ -335,49 +335,56 @@ namespace DepotDownloader var depotIDs = new List(); KeyValue depots = GetSteam3AppSection(appId, EAppInfoSection.Depots); - if (depots != null) + + if (forceDepot) + { + depotIDs.Add(depotId); + } + else { - foreach (var depotSection in depots.Children) + if (depots != null) { - uint id = INVALID_DEPOT_ID; - if (depotSection.Children.Count == 0) - continue; + foreach (var depotSection in depots.Children) + { + uint id = INVALID_DEPOT_ID; + if (depotSection.Children.Count == 0) + continue; - if (!uint.TryParse(depotSection.Name, out id)) - continue; + if (!uint.TryParse(depotSection.Name, out id)) + continue; - if (depotId != INVALID_DEPOT_ID && id != depotId) - continue; + if (depotId != INVALID_DEPOT_ID && id != depotId) + continue; - if (!Config.DownloadAllPlatforms) - { - var depotConfig = depotSection["config"]; - if (depotConfig != KeyValue.Invalid && depotConfig["oslist"] != KeyValue.Invalid && !string.IsNullOrWhiteSpace(depotConfig["oslist"].Value)) + if (!Config.DownloadAllPlatforms) { - var oslist = depotConfig["oslist"].Value.Split(','); - if (Array.IndexOf(oslist, Util.GetSteamOS()) == -1) - continue; + var depotConfig = depotSection["config"]; + if (depotConfig != KeyValue.Invalid && depotConfig["oslist"] != KeyValue.Invalid && !string.IsNullOrWhiteSpace(depotConfig["oslist"].Value)) + { + var oslist = depotConfig["oslist"].Value.Split(','); + if (Array.IndexOf(oslist, Util.GetSteamOS()) == -1) + continue; + } } - } - depotIDs.Add(id); + depotIDs.Add(id); + } } - } - - if (depotIDs == null || (depotIDs.Count == 0 && depotId == INVALID_DEPOT_ID)) - { - Console.WriteLine("Couldn't find any depots to download for app {0}", appId); - return; - } - else if (depotIDs.Count == 0) - { - Console.Write("Depot {0} not listed for app {1}", depotId, appId); - if (!Config.DownloadAllPlatforms) + if (depotIDs == null || (depotIDs.Count == 0 && depotId == INVALID_DEPOT_ID)) { - Console.Write(" or not available on this platform"); + Console.WriteLine("Couldn't find any depots to download for app {0}", appId); + return; + } + else if (depotIDs.Count == 0) + { + Console.Write("Depot {0} not listed for app {1}", depotId, appId); + if (!Config.DownloadAllPlatforms) + { + Console.Write(" or not available on this platform"); + } + Console.WriteLine(); + return; } - Console.WriteLine(); - return; } var infos = new List(); diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index a0d740af..61704bb5 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -93,6 +93,7 @@ namespace DepotDownloader ContentDownloader.Config.MaxServers = GetParameter(args, "-max-servers", 8); ContentDownloader.Config.MaxDownloads = GetParameter(args, "-max-downloads", 4); string branch = GetParameter(args, "-branch") ?? GetParameter(args, "-beta") ?? "Public"; + var forceDepot = HasParameter(args, "-force-depot"); ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads); @@ -108,7 +109,7 @@ namespace DepotDownloader } ContentDownloader.InitializeSteam3(username, password); - ContentDownloader.DownloadApp(appId, depotId, branch); + ContentDownloader.DownloadApp(appId, depotId, branch, forceDepot); ContentDownloader.ShutdownSteam3(); }