Add -V/--version

Fixes #531
pull/538/head DepotDownloader_2.7.0
Pavel Djundik 1 year ago
parent 53fefe6da2
commit 8117d8f6c2

@ -20,6 +20,7 @@ namespace DepotDownloader
{ {
if (args.Length == 0) if (args.Length == 0)
{ {
PrintVersion();
PrintUsage(); PrintUsage();
if (OperatingSystem.IsWindowsVersionAtLeast(5, 0)) if (OperatingSystem.IsWindowsVersionAtLeast(5, 0))
@ -38,8 +39,17 @@ namespace DepotDownloader
#region Common Options #region Common Options
// Not using HasParameter because it is case insensitive
if (args.Length == 1 && (args[0] == "-V" || args[0] == "--version"))
{
PrintVersion(true);
return 0;
}
if (HasParameter(args, "-debug")) if (HasParameter(args, "-debug"))
{ {
PrintVersion(true);
DebugLog.Enabled = true; DebugLog.Enabled = true;
DebugLog.AddListener((category, message) => DebugLog.AddListener((category, message) =>
{ {
@ -47,9 +57,6 @@ namespace DepotDownloader
}); });
var httpEventListener = new HttpDiagnosticEventListener(); var httpEventListener = new HttpDiagnosticEventListener();
DebugLog.WriteLine("DepotDownloader", "Version: {0}", Assembly.GetExecutingAssembly().GetName().Version);
DebugLog.WriteLine("DepotDownloader", "Runtime: {0}", RuntimeInformation.FrameworkDescription);
} }
var username = GetParameter<string>(args, "-username") ?? GetParameter<string>(args, "-user"); var username = GetParameter<string>(args, "-username") ?? GetParameter<string>(args, "-user");
@ -417,5 +424,18 @@ namespace DepotDownloader
Console.WriteLine(" -max-downloads <#> - maximum number of chunks to download concurrently. (default: 8)."); Console.WriteLine(" -max-downloads <#> - maximum number of chunks to download concurrently. (default: 8).");
Console.WriteLine(" -loginid <#> - a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently."); Console.WriteLine(" -loginid <#> - a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently.");
} }
static void PrintVersion(bool printExtra = false)
{
var version = typeof(Program).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
Console.WriteLine($"DepotDownloader v{version}");
if (!printExtra)
{
return;
}
Console.WriteLine($"Runtime: {RuntimeInformation.FrameworkDescription} on {RuntimeInformation.OSDescription}");
}
} }
} }

@ -87,7 +87,7 @@ Parameter | Description
`-max-servers <#>` | maximum number of content servers to use. (default: 20). `-max-servers <#>` | maximum number of content servers to use. (default: 20).
`-max-downloads <#>` | maximum number of chunks to download concurrently. (default: 8). `-max-downloads <#>` | maximum number of chunks to download concurrently. (default: 8).
`-loginid <#>` | a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently. `-loginid <#>` | a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently.
`-V` or `--version` | print version and runtime
## Frequently Asked Questions ## Frequently Asked Questions

Loading…
Cancel
Save