mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 911206a115 | |||
| cfd5724859 | |||
| 75d187acf8 |
@@ -6,6 +6,10 @@
|
||||
alongside Windows. The shared Backend classes are written to
|
||||
OperatingSystem.IsWindows()-gate any Windows-only paths. -->
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<!-- Declared so a RID-less restore produces assets for every target the
|
||||
CI matrix / release pipeline later publishes with no-restore. Without
|
||||
this, RID-specific publish fails with NETSDK1047. -->
|
||||
<RuntimeIdentifiers>win-x64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>DorkNet.ServerCli</RootNamespace>
|
||||
|
||||
@@ -14,8 +14,15 @@ public static class Program
|
||||
{
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
// --help / -h (and a bare invocation) print usage and exit cleanly.
|
||||
if (args.Length == 0 || args.Contains("--help") || args.Contains("-h"))
|
||||
{
|
||||
PrintHelp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
var parsed = ParseArgs(args);
|
||||
if (parsed is null) return 1; // ParseArgs already wrote --help or an error.
|
||||
if (parsed is null) return 1; // ParseArgs already wrote the error.
|
||||
|
||||
// Validate required values up front so the user sees the
|
||||
// failure before any download / process spin-up.
|
||||
@@ -216,17 +223,13 @@ public static class Program
|
||||
|
||||
private static ParsedArgs? ParseArgs(string[] args)
|
||||
{
|
||||
if (args.Length == 0 || args.Contains("--help") || args.Contains("-h"))
|
||||
{
|
||||
PrintHelp();
|
||||
return null;
|
||||
}
|
||||
|
||||
string photon = "", voice = "", region = "us";
|
||||
string mode = "localtunnel", apex = "", name = "DorkNet Server";
|
||||
string versionKey = "march_2020_03_10";
|
||||
string? serverDir = null;
|
||||
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
string Next()
|
||||
@@ -261,6 +264,12 @@ public static class Program
|
||||
|
||||
return new ParsedArgs(photon, voice, region, parsedMode, apex, name, versionKey, serverDir);
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
Console.Error.WriteLine($"error: {ex.Message} (try --help)");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void PrintHelp()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user