diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 39bec8f8..5ea8565d 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -458,7 +458,7 @@ namespace DepotDownloader } // Grab up to the first eight server in the allegedly best-to-worst order from Steam - Enumerable.Range(0, Math.Min(cdnServers.Count, 8)).ToList().ForEach(s => + Enumerable.Range(0, Math.Min(cdnServers.Count, Config.MaxServers)).ToList().ForEach(s => { CDNClient c; if( s == 0 ) @@ -571,7 +571,7 @@ namespace DepotDownloader var rand = new Random(); depotManifest.Files.Where(f => !f.Flags.HasFlag(EDepotFileFlag.Directory)) - .AsParallel().WithDegreeOfParallelism(4) + .AsParallel().WithDegreeOfParallelism(Config.MaxDownloads) .ForAll(file => { var clientIndex = rand.Next(0, cdnClients.Count); diff --git a/DepotDownloader/DownloadConfig.cs b/DepotDownloader/DownloadConfig.cs index 188a1253..84fc1b22 100644 --- a/DepotDownloader/DownloadConfig.cs +++ b/DepotDownloader/DownloadConfig.cs @@ -21,5 +21,8 @@ namespace DepotDownloader public ulong ManifestId { get; set; } public bool VerifyAll { get; set; } + + public int MaxServers { get; set; } + public int MaxDownloads { get; set; } } } diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index d5dd92f1..1c73de1c 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -88,6 +88,8 @@ namespace DepotDownloader ContentDownloader.Config.InstallDirectory = GetParameter(args, "-dir"); ContentDownloader.Config.DownloadAllPlatforms = HasParameter(args, "-all-platforms"); ContentDownloader.Config.VerifyAll = HasParameter(args, "-verify-all") || HasParameter(args, "-verify_all") || HasParameter(args, "-validate"); + ContentDownloader.Config.MaxServers = GetParameter(args, "-max-servers", 8); + ContentDownloader.Config.MaxDownloads = GetParameter(args, "-max-downloads", 4); string branch = GetParameter(args, "-branch") ?? GetParameter(args, "-beta") ?? "Public"; if (username != null && password == null) @@ -136,22 +138,26 @@ namespace DepotDownloader static void PrintUsage() { - Console.WriteLine( "\nUse: depotdownloader [optional parameters]\n" ); + Console.WriteLine( "\nUsage: depotdownloader [optional parameters]\n" ); Console.WriteLine( "Parameters:" ); - Console.WriteLine("\t-app #\t\t\t\t- the AppID to download."); + Console.WriteLine("\t-app <#>\t\t\t\t- the AppID to download."); Console.WriteLine(); Console.WriteLine( "Optional Parameters:" ); - Console.WriteLine( "\t-depot #\t\t\t- the DepotID to download." ); - Console.WriteLine( "\t-cellid #\t\t\t- the CellID of the content server to download from." ); - Console.WriteLine( "\t-username user\t\t\t- the username of the account to login to for restricted content." ); - Console.WriteLine( "\t-password pass\t\t\t- the password of the account to login to for restricted content." ); - 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-depot <#>\t\t\t- the DepotID to download." ); + Console.WriteLine( "\t-cellid <#>\t\t\t- the overridden CellID of the content server to download from." ); + Console.WriteLine( "\t-username \t\t\t- the username of the account to login to for restricted content." ); + Console.WriteLine( "\t-password \t\t\t- the password of the account to login to for restricted content." ); + Console.WriteLine( "\t-dir \t\t\t- the directory in which to place downloaded files." ); + Console.WriteLine( "\t-filelist \t\t- a list of files to download (from the manifest). Can optionally use regex to download only certain files." ); Console.WriteLine( "\t-all-platforms\t\t\t- downloads all platform-specific depots when -app is used." ); - Console.WriteLine( "\t-beta\t\t\t\t- download beta version of depots if available." ); - Console.WriteLine( "\t-manifest\t\t\t- downloads a human readable manifest for any depots that would be downloaded." ); + Console.WriteLine( "\t-manifest-only\t\t\t- downloads a human readable manifest for any depots that would be downloaded." ); + Console.WriteLine( "\t-beta \t\t\t\t- download from specified branch if available (default: Public)." ); + Console.WriteLine( "\t-betapassword \t\t\t- branch password if applicable." ); + Console.WriteLine( "\t-manifest \t\t\t- manifest id of content to download (requires -depot, default: current for branch)." ); + Console.WriteLine( "\t-max-servers <#>\t\t\t- maximum number of content servers to use. (default: 8)." ); + Console.WriteLine( "\t-max-downloads <#>\t\t\t- maximum number of chunks to download concurrently. (default: 4)." ); } } } diff --git a/README.md b/README.md index b181707b..c7a3b11e 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,24 @@ DepotDownloader Steam depot downloader utilizing the SteamKit2 library. Supports .NET and Mono ``` -Use: depotdownloader [optional parameters] +Usage: depotdownloader [optional parameters] Parameters: - -app # - the AppID to download. + -app <#> - the AppID to download. Optional Parameters: - -depot # - the DepotID to download. - -cellid # - the overridden CellID of the content server to download from. - -username user - the username of the account to login to for restricted content. - -password pass - the password of the account to login to for restricted content. - -dir installdir - the directory in which to place downloaded files. - -filelist file.txt - a list of files to download (from the manifest). - Can optionally use regex to download only certain files. - -all-platforms - downloads all platform-specific depots when -app is used. - -manifest-only - downloads a human readable manifest for any depots that would be downloaded. - -beta branchname - download from specified branch if available. - -betapassword pass - branch password if applicable. - -manifest manifestid - manifest id of content to download (requires -depot). + -depot <#> - the DepotID to download. + -cellid <#> - the overridden CellID of the content server to download from. + -username - the username of the account to login to for restricted content. + -password - the password of the account to login to for restricted content. + -dir - the directory in which to place downloaded files. + -filelist - a list of files to download (from the manifest). + Can optionally use regex to download only certain files. + -all-platforms - downloads all platform-specific depots when -app is used. + -manifest-only - downloads a human readable manifest for any depots that would be downloaded. + -beta - download from specified branch if available (default: Public). + -betapassword - branch password if applicable. + -manifest - manifest id of content to download (requires -depot, default: latest for branch). + -max-servers <#> - maximum number of content servers to use. (default: 8). + -max-downloads <#> - maximum number of chunks to download concurrently. (default: 4). ```