From 9d586b5e9505fdf2d44aa243b3416ff9222312f4 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Thu, 7 Jul 2011 22:27:57 -0500 Subject: [PATCH] Added -beta parameter to download beta versions of depots if available. --- DepotDownloader/CDRManager.cs | 8 +++++++- DepotDownloader/Program.cs | 8 +++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/DepotDownloader/CDRManager.cs b/DepotDownloader/CDRManager.cs index 75170b89..32e34d1d 100644 --- a/DepotDownloader/CDRManager.cs +++ b/DepotDownloader/CDRManager.cs @@ -36,6 +36,9 @@ namespace DepotDownloader [BlobField( FieldKey = CDRAppRecordFields.eFieldUserDefinedRecord, Depth = 1 )] public Dictionary UserDefined { get; private set; } + + [BlobField( FieldKey = CDRAppRecordFields.eFieldBetaVersionId, Depth = 1 )] + public int BetaVersion { get; set; } } class Sub @@ -158,7 +161,7 @@ namespace DepotDownloader return app.Name; } - public static int GetLatestDepotVersion( int depotId ) + public static int GetLatestDepotVersion( int depotId, bool beta ) { App app = GetAppBlob( depotId ); @@ -167,6 +170,9 @@ namespace DepotDownloader return -1; } + if ( beta && app.BetaVersion > app.CurrentVersion ) + return app.BetaVersion; + return app.CurrentVersion; } diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index 6d7fe48d..a74b4fd0 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -59,10 +59,11 @@ namespace DepotDownloader } int depotVersion = GetIntParameter( args, "-version" ); + bool bBeta = HasParameter( args, "-beta" ); if ( !bGameserver && !bApp && depotVersion == -1 ) { - int latestVer = CDRManager.GetLatestDepotVersion( depotId ); + int latestVer = CDRManager.GetLatestDepotVersion( depotId, bBeta ); if ( latestVer == -1 ) { @@ -134,7 +135,7 @@ namespace DepotDownloader foreach ( int currentDepotId in depotIDs ) { - depotVersion = CDRManager.GetLatestDepotVersion( currentDepotId ); + depotVersion = CDRManager.GetLatestDepotVersion( currentDepotId, bBeta ); if ( depotVersion == -1 ) { Console.WriteLine( "Error: Unable to find DepotID {0} in the CDR!", currentDepotId ); @@ -208,7 +209,8 @@ namespace DepotDownloader Console.WriteLine( "\t-dir installdir\t\t\t- the directory in which to place downloaded files." ); Console.WriteLine( "\t-filelist filename.txt\t\t- a list of files to download (from the manifest). Can optionally use regex to download only certain files." ); Console.WriteLine( "\t-no-exclude\t\t\t- don't exclude any files when downloading depots with the -game parameter." ); - Console.WriteLine( "\t-all-platforms\t\t\t- downloads all platform-specific depots when -game or -app is used.\n" ); + Console.WriteLine( "\t-all-platforms\t\t\t- downloads all platform-specific depots when -game or -app is used." ); + Console.WriteLine( "\t-beta\t\t\t\t- download beta version of depots if available." ); } } }