Added -list switch to print list of game servers that can be downloaded using -game.

pull/8/head
Scott Ehlert 14 years ago
parent 2a24b41d60
commit f9cac07006

@ -255,6 +255,65 @@ namespace DepotDownloader
return null;
}
public static void ListGameServers()
{
App serverAppInfoBlob = GetAppBlob( 4 );
List<string> sourceGames = new List<string>();
List<string> hl1Games = new List<string>();
List<string> thirdPartyGames = new List<string>();
foreach ( var blobField in serverAppInfoBlob.FileSystems )
{
int id = blobField.AppID;
string name = blobField.Name;
int suffixPos = name.LastIndexOf( "-win32" );
if ( suffixPos == -1 )
suffixPos = name.LastIndexOf( "-linux" );
if ( suffixPos > 0 )
name = name.Remove( suffixPos );
// These numbers come from hldsupdatetool
if ( id < 1000 )
{
if ( id < 200 )
{
if ( !hl1Games.Contains( name ) )
hl1Games.Add( name );
}
else
{
if ( !sourceGames.Contains( name ) )
sourceGames.Add( name );
}
}
else
{
if ( !thirdPartyGames.Contains( name ) )
thirdPartyGames.Add( name );
}
}
sourceGames.Sort( StringComparer.Ordinal );
hl1Games.Sort( StringComparer.Ordinal );
thirdPartyGames.Sort( StringComparer.Ordinal );
Console.WriteLine( "** 'game' options for Source DS install:\n" );
foreach ( string game in sourceGames )
Console.WriteLine( "\t\"{0}\"", game );
Console.WriteLine( "\n** 'game' options for HL1 DS install:\n");
foreach ( string game in hl1Games )
Console.WriteLine( "\t\"{0}\"", game );
Console.WriteLine( "\n** 'game' options for Third-Party game servers:\n" );
foreach ( string game in thirdPartyGames )
Console.WriteLine( "\t\"{0}\"", game );
}
static byte[] GetCdr()
{
try

@ -23,6 +23,12 @@ namespace DepotDownloader
ServerCache.Build();
CDRManager.Update();
if (HasParameter( args, "-list" ) )
{
CDRManager.ListGameServers();
return;
}
bool bDebot = true;
bool bGameserver = true;
bool bApp = true;
@ -190,7 +196,9 @@ namespace DepotDownloader
Console.WriteLine( "\t OR" );
Console.WriteLine( "\t-app #\t\t\t\t- the AppID to download." );
Console.WriteLine( "\t OR" );
Console.WriteLine( "\t-game #\t\t\t\t- the HLDSUpdateTool game server to download." );
Console.WriteLine( "\t-game name\t\t\t- the HLDSUpdateTool game server to download." );
Console.WriteLine( "\t OR" );
Console.WriteLine( "\t-list\t\t\t\t- print list of game servers that can be downloaded using -game." );
Console.WriteLine( "\t-version [# or \"latest\"]\t- the version of the depot to download.\n" );
Console.WriteLine( "Optional Parameters:" );

Loading…
Cancel
Save