From cfc95d3f57d8a007fd7af6768a8bcee361dfc641 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Tue, 10 Sep 2013 10:31:32 -0400 Subject: [PATCH] Allow downloading of specified manifest. --- DepotDownloader/ContentDownloader.cs | 15 ++++++++------- DepotDownloader/DownloadConfig.cs | 2 ++ DepotDownloader/Program.cs | 7 +++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 106b0b8..d89a8bc 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -16,6 +16,7 @@ namespace DepotDownloader private const string DEFAULT_DIR = "depots"; public const uint INVALID_APP_ID = uint.MaxValue; public const uint INVALID_DEPOT_ID = uint.MaxValue; + public const ulong INVALID_MANIFEST_ID = ulong.MaxValue; public static DownloadConfig Config = new DownloadConfig(); @@ -205,20 +206,20 @@ namespace DepotDownloader static ulong GetSteam3DepotManifest(uint depotId, uint appId, string branch) { - if (appId == INVALID_APP_ID) - return 0; + if (Config.ManifestId != INVALID_MANIFEST_ID) + return Config.ManifestId; KeyValue depots = GetSteam3AppSection(appId, EAppInfoSection.Depots); KeyValue depotChild = depots[depotId.ToString()]; if (depotChild == null) - return 0; + return INVALID_MANIFEST_ID; var manifests = depotChild["manifests"]; var manifests_encrypted = depotChild["encryptedmanifests"]; if (manifests.Children.Count == 0 && manifests_encrypted.Children.Count == 0) - return 0; + return INVALID_MANIFEST_ID; var node = manifests[branch]; @@ -240,18 +241,18 @@ namespace DepotDownloader if (manifest_bytes == null) { Console.WriteLine("Password was invalid for branch {0}", branch); - return 0; + return INVALID_MANIFEST_ID; } return BitConverter.ToUInt64(manifest_bytes, 0); } Console.WriteLine("Invalid branch {0} for appId {1}", branch, appId); - return 0; + return INVALID_MANIFEST_ID; } if (node.Value == null) - return 0; + return INVALID_MANIFEST_ID; return UInt64.Parse(node.Value); } diff --git a/DepotDownloader/DownloadConfig.cs b/DepotDownloader/DownloadConfig.cs index 458192e..5fd2c0d 100644 --- a/DepotDownloader/DownloadConfig.cs +++ b/DepotDownloader/DownloadConfig.cs @@ -17,5 +17,7 @@ namespace DepotDownloader public bool UsingExclusionList { get; set; } public string BetaPassword { get; set; } + + public ulong ManifestId { get; set; } } } diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index 325bd36..f58e747 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -22,6 +22,7 @@ namespace DepotDownloader bool bDumpManifest = HasParameter( args, "-manifest-only" ); uint appId = GetParameter( args, "-app", ContentDownloader.INVALID_APP_ID ); uint depotId = GetParameter( args, "-depot", ContentDownloader.INVALID_DEPOT_ID ); + ContentDownloader.Config.ManifestId = GetParameter( args, "-manifest", ContentDownloader.INVALID_MANIFEST_ID ); if ( appId == ContentDownloader.INVALID_APP_ID ) { @@ -29,6 +30,12 @@ namespace DepotDownloader return; } + if (depotId == ContentDownloader.INVALID_DEPOT_ID && ContentDownloader.Config.ManifestId != ContentDownloader.INVALID_MANIFEST_ID) + { + Console.WriteLine("Error: -manifest requires -depot to be specified"); + return; + } + ContentDownloader.Config.DownloadManifestOnly = bDumpManifest; int cellId = GetParameter(args, "-cellid", -1);