tgstation-server 6.12.3
The /tg/station 13 server suite
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
Tgstation.Server.Host.Program Class Referencesealed

Entrypoint for the Process. More...

Public Member Functions

 Program ()
 Initializes a new instance of the Program class.
 

Static Public Member Functions

static async Task< int > Main (string[] args)
 Entrypoint for the Program.
 

Static Private Member Functions

static ? string TopLevelArgsParse (ref string[] args)
 Parse Program top level args .
 

Detailed Description

Entrypoint for the Process.

Definition at line 19 of file Program.cs.

Constructor & Destructor Documentation

◆ Program()

Tgstation.Server.Host.Program.Program ( )

Initializes a new instance of the Program class.

Definition at line 34 of file Program.cs.

35 {
37 }
Sets up dependency injection.
static IServerFactory CreateDefaultServerFactory()
Create the default IServerFactory.

References Tgstation.Server.Host.Core.Application.CreateDefaultServerFactory().

Referenced by Tgstation.Server.Host.Program.Main().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ Main()

static async Task< int > Tgstation.Server.Host.Program.Main ( string[]  args)
static

Entrypoint for the Program.

Parameters
argsThe command line arguments.
Returns
A Task resulting in the global::System.Diagnostics.Process.ExitCode.

Definition at line 44 of file Program.cs.

45 {
46 // first arg is 100% always the update path, starting it otherwise is solely for debugging purposes
47 var updatePath = TopLevelArgsParse(ref args);
48
49 var program = new Program();
50 return (int)await program.Main(args, updatePath);
51 }
Program()
Initializes a new instance of the Program class.
Definition Program.cs:34
static ? string TopLevelArgsParse(ref string[] args)
Parse Program top level args .
Definition Program.cs:58

References Tgstation.Server.Host.Program.Program(), and Tgstation.Server.Host.Program.TopLevelArgsParse().

Here is the call graph for this function:

◆ TopLevelArgsParse()

static ? string Tgstation.Server.Host.Program.TopLevelArgsParse ( ref string[]  args)
staticprivate

Parse Program top level args .

Parameters
argsThe arguments Array which may be changed.
Returns
The update path for the server, if present.

Definition at line 58 of file Program.cs.

59 {
60 if (args.Length == 0)
61 return null;
62
63 var potentialUpdatePath = args[0];
64 if (potentialUpdatePath.Equals("cli", StringComparison.OrdinalIgnoreCase))
65 return null;
66
67 var listArgs = new List<string>(args);
68 listArgs.RemoveAt(0);
69
70 // second arg should be host watchdog version
71 if (listArgs.Count > 0)
72 {
73 var expectedHostWatchdogVersion = HostWatchdogVersion;
74 if (Version.TryParse(listArgs.First(), out var actualHostWatchdogVersion)
75 && actualHostWatchdogVersion.Major != expectedHostWatchdogVersion.Major)
76 throw new InvalidOperationException(
77 $"Incompatible host watchdog version ({actualHostWatchdogVersion}) for server ({expectedHostWatchdogVersion})! A major update was released and a full restart will be required. Please manually offline your servers!");
78 }
79
80 if (listArgs.Remove("--attach-debugger"))
81 Debugger.Launch();
82
83 args = [.. listArgs];
84 return potentialUpdatePath;
85 }

Referenced by Tgstation.Server.Host.Program.Main().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: