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.
pull/8/head
Netshroud 11 years ago
parent 6ae2c37c2a
commit 0b722996b5

@ -320,7 +320,7 @@ namespace DepotDownloader
steam3.Disconnect(); 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) if(steam3 != null)
steam3.RequestAppInfo(appId); steam3.RequestAppInfo(appId);
@ -335,49 +335,56 @@ namespace DepotDownloader
var depotIDs = new List<uint>(); var depotIDs = new List<uint>();
KeyValue depots = GetSteam3AppSection(appId, EAppInfoSection.Depots); 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; foreach (var depotSection in depots.Children)
if (depotSection.Children.Count == 0) {
continue; uint id = INVALID_DEPOT_ID;
if (depotSection.Children.Count == 0)
continue;
if (!uint.TryParse(depotSection.Name, out id)) if (!uint.TryParse(depotSection.Name, out id))
continue; continue;
if (depotId != INVALID_DEPOT_ID && id != depotId) if (depotId != INVALID_DEPOT_ID && id != depotId)
continue; continue;
if (!Config.DownloadAllPlatforms) if (!Config.DownloadAllPlatforms)
{
var depotConfig = depotSection["config"];
if (depotConfig != KeyValue.Invalid && depotConfig["oslist"] != KeyValue.Invalid && !string.IsNullOrWhiteSpace(depotConfig["oslist"].Value))
{ {
var oslist = depotConfig["oslist"].Value.Split(','); var depotConfig = depotSection["config"];
if (Array.IndexOf(oslist, Util.GetSteamOS()) == -1) if (depotConfig != KeyValue.Invalid && depotConfig["oslist"] != KeyValue.Invalid && !string.IsNullOrWhiteSpace(depotConfig["oslist"].Value))
continue; {
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))
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)
{ {
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<DepotDownloadInfo>(); var infos = new List<DepotDownloadInfo>();

@ -93,6 +93,7 @@ namespace DepotDownloader
ContentDownloader.Config.MaxServers = GetParameter<int>(args, "-max-servers", 8); ContentDownloader.Config.MaxServers = GetParameter<int>(args, "-max-servers", 8);
ContentDownloader.Config.MaxDownloads = GetParameter<int>(args, "-max-downloads", 4); ContentDownloader.Config.MaxDownloads = GetParameter<int>(args, "-max-downloads", 4);
string branch = GetParameter<string>(args, "-branch") ?? GetParameter<string>(args, "-beta") ?? "Public"; string branch = GetParameter<string>(args, "-branch") ?? GetParameter<string>(args, "-beta") ?? "Public";
var forceDepot = HasParameter(args, "-force-depot");
ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads); ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads);
@ -108,7 +109,7 @@ namespace DepotDownloader
} }
ContentDownloader.InitializeSteam3(username, password); ContentDownloader.InitializeSteam3(username, password);
ContentDownloader.DownloadApp(appId, depotId, branch); ContentDownloader.DownloadApp(appId, depotId, branch, forceDepot);
ContentDownloader.ShutdownSteam3(); ContentDownloader.ShutdownSteam3();
} }

Loading…
Cancel
Save