Allow downloading of specified manifest.

pull/8/head
Nicholas Hastings 13 years ago
parent 987b51e82d
commit cfc95d3f57

@ -16,6 +16,7 @@ namespace DepotDownloader
private const string DEFAULT_DIR = "depots"; private const string DEFAULT_DIR = "depots";
public const uint INVALID_APP_ID = uint.MaxValue; public const uint INVALID_APP_ID = uint.MaxValue;
public const uint INVALID_DEPOT_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(); public static DownloadConfig Config = new DownloadConfig();
@ -205,20 +206,20 @@ namespace DepotDownloader
static ulong GetSteam3DepotManifest(uint depotId, uint appId, string branch) static ulong GetSteam3DepotManifest(uint depotId, uint appId, string branch)
{ {
if (appId == INVALID_APP_ID) if (Config.ManifestId != INVALID_MANIFEST_ID)
return 0; return Config.ManifestId;
KeyValue depots = GetSteam3AppSection(appId, EAppInfoSection.Depots); KeyValue depots = GetSteam3AppSection(appId, EAppInfoSection.Depots);
KeyValue depotChild = depots[depotId.ToString()]; KeyValue depotChild = depots[depotId.ToString()];
if (depotChild == null) if (depotChild == null)
return 0; return INVALID_MANIFEST_ID;
var manifests = depotChild["manifests"]; var manifests = depotChild["manifests"];
var manifests_encrypted = depotChild["encryptedmanifests"]; var manifests_encrypted = depotChild["encryptedmanifests"];
if (manifests.Children.Count == 0 && manifests_encrypted.Children.Count == 0) if (manifests.Children.Count == 0 && manifests_encrypted.Children.Count == 0)
return 0; return INVALID_MANIFEST_ID;
var node = manifests[branch]; var node = manifests[branch];
@ -240,18 +241,18 @@ namespace DepotDownloader
if (manifest_bytes == null) if (manifest_bytes == null)
{ {
Console.WriteLine("Password was invalid for branch {0}", branch); Console.WriteLine("Password was invalid for branch {0}", branch);
return 0; return INVALID_MANIFEST_ID;
} }
return BitConverter.ToUInt64(manifest_bytes, 0); return BitConverter.ToUInt64(manifest_bytes, 0);
} }
Console.WriteLine("Invalid branch {0} for appId {1}", branch, appId); Console.WriteLine("Invalid branch {0} for appId {1}", branch, appId);
return 0; return INVALID_MANIFEST_ID;
} }
if (node.Value == null) if (node.Value == null)
return 0; return INVALID_MANIFEST_ID;
return UInt64.Parse(node.Value); return UInt64.Parse(node.Value);
} }

@ -17,5 +17,7 @@ namespace DepotDownloader
public bool UsingExclusionList { get; set; } public bool UsingExclusionList { get; set; }
public string BetaPassword { get; set; } public string BetaPassword { get; set; }
public ulong ManifestId { get; set; }
} }
} }

@ -22,6 +22,7 @@ namespace DepotDownloader
bool bDumpManifest = HasParameter( args, "-manifest-only" ); bool bDumpManifest = HasParameter( args, "-manifest-only" );
uint appId = GetParameter<uint>( args, "-app", ContentDownloader.INVALID_APP_ID ); uint appId = GetParameter<uint>( args, "-app", ContentDownloader.INVALID_APP_ID );
uint depotId = GetParameter<uint>( args, "-depot", ContentDownloader.INVALID_DEPOT_ID ); uint depotId = GetParameter<uint>( args, "-depot", ContentDownloader.INVALID_DEPOT_ID );
ContentDownloader.Config.ManifestId = GetParameter<ulong>( args, "-manifest", ContentDownloader.INVALID_MANIFEST_ID );
if ( appId == ContentDownloader.INVALID_APP_ID ) if ( appId == ContentDownloader.INVALID_APP_ID )
{ {
@ -29,6 +30,12 @@ namespace DepotDownloader
return; 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; ContentDownloader.Config.DownloadManifestOnly = bDumpManifest;
int cellId = GetParameter<int>(args, "-cellid", -1); int cellId = GetParameter<int>(args, "-cellid", -1);

Loading…
Cancel
Save