tgstation-server 6.17.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
Public Member Functions | Properties | Static Private Member Functions | Private Attributes | List of all members
Tgstation.Server.Host.Components.Engine.ByondInstallation Class Referencesealed

Implementation of IEngineInstallation for EngineType.Byond. More...

Inheritance diagram for Tgstation.Server.Host.Components.Engine.ByondInstallation:
Inheritance graph
[legend]
Collaboration diagram for Tgstation.Server.Host.Components.Engine.ByondInstallation:
Collaboration graph
[legend]

Public Member Functions

 ByondInstallation (IIOManager installationIOManager, Task installationTask, EngineVersion version, string dreamDaemonPath, string dreamMakerPath, bool supportsCli, bool supportsMapThreads)
 Initializes a new instance of the ByondInstallation class.
 
override string FormatServerArguments (IDmbProvider dmbProvider, IReadOnlyDictionary< string, string > parameters, DreamDaemonLaunchParameters launchParameters, string? logFilePath)
 Return the command line arguments for launching with given launchParameters .
Parameters
dmbProviderThe IDmbProvider.
parametersThe map of parameter strings as a IReadOnlyDictionary<TKey, TValue>. MUST include Interop.DMApiConstants.ParamAccessIdentifier. Should NOT include the DreamDaemonLaunchParameters.AdditionalParameters of launchParameters .
launchParametersThe DreamDaemonLaunchParameters.
logFilePathThe full path to the log file, if any.
Returns
The formatted arguments string.

 
override string FormatCompilerArguments (string dmePath, string? additionalArguments)
 Return the command line arguments for compiling a given dmePath if compilation is necessary.
Parameters
dmePathThe full path to the .dme to compile.
additionalArgumentsOptional additional arguments provided to the compiler.
Returns
The formatted arguments string.

 
- Public Member Functions inherited from Tgstation.Server.Host.Components.Engine.EngineInstallationBase
 EngineInstallationBase (IIOManager installationIOManager)
 Initializes a new instance of the EngineInstallationBase class.
 
string FormatCompilerArguments (string dmePath, string? additionalArguments)
 Return the command line arguments for compiling a given dmePath if compilation is necessary.
Parameters
dmePathThe full path to the .dme to compile.
additionalArgumentsOptional additional arguments provided to the compiler.
Returns
The formatted arguments string.

 
string FormatServerArguments (IDmbProvider dmbProvider, IReadOnlyDictionary< string, string > parameters, DreamDaemonLaunchParameters launchParameters, string? logFilePath)
 Return the command line arguments for launching with given launchParameters .
Parameters
dmbProviderThe IDmbProvider.
parametersThe map of parameter strings as a IReadOnlyDictionary<TKey, TValue>. MUST include Interop.DMApiConstants.ParamAccessIdentifier. Should NOT include the DreamDaemonLaunchParameters.AdditionalParameters of launchParameters .
launchParametersThe DreamDaemonLaunchParameters.
logFilePathThe full path to the log file, if any.
Returns
The formatted arguments string.

 
virtual async ValueTask StopServerProcess (ILogger logger, IProcess process, string accessIdentifier, ushort port, CancellationToken cancellationToken)
 Kills a given engine server process .
Parameters
loggerThe ILogger to write to.
processThe IProcess to be terminated.
accessIdentifierThe Interop.DMApiParameters.AccessIdentifier of the session.
portThe port the server is running on.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask representing the running operation.

 
async ValueTask< Dictionary< string, string >?> LoadEnv (ILogger logger, bool forCompiler, CancellationToken cancellationToken)
 Loads the environment settings for either the server or compiler.
Parameters
loggerThe ILogger to write to.
forCompilerIf false server.env will be loaded. If true compiler.env will be loaded.
cancellationTokenThe CancellationToken for the operation.
Returns
A ValueTask<TResult> resulting in the environment Dictionary<TKey, TValue> or null if the target environment file doesn't exist.

 

Properties

override EngineVersion Version [get]
 The EngineVersion of the IEngineInstallation.
 
override string ServerExePath [get]
 The full path to the game server executable.
 
override string CompilerExePath [get]
 The full path to the dm/DreamMaker executable.
 
override bool PromptsForNetworkAccess [get]
 If ServerExePath may create network prompts.
 
override bool HasStandardOutput [get]
 If ServerExePath supports being run as a command-line application and outputs log information to be captured.
 
override bool PreferFileLogging [get]
 If HasStandardOutput is set, this indicates that the engine server has good file logging that should be preferred to ours.
 
override bool UseDotnetDump [get]
 If dotnet-dump should be used to create process dumps for this installation.
 
override Task InstallationTask [get]
 The Task that completes when the BYOND version finished installing.
 
- Properties inherited from Tgstation.Server.Host.Components.Engine.EngineInstallationBase
EngineVersion Version [get]
 The EngineVersion of the IEngineInstallation.
 
string ServerExePath [get]
 The full path to the game server executable.
 
string CompilerExePath [get]
 The full path to the dm/DreamMaker executable.
 
bool HasStandardOutput [get]
 If ServerExePath supports being run as a command-line application and outputs log information to be captured.
 
bool PreferFileLogging [get]
 If HasStandardOutput is set, this indicates that the engine server has good file logging that should be preferred to ours.
 
bool PromptsForNetworkAccess [get]
 If ServerExePath may create network prompts.
 
bool UseDotnetDump [get]
 If dotnet-dump should be used to create process dumps for this installation.
 
Task InstallationTask [get]
 The Task that completes when the BYOND version finished installing.
 
IIOManager InstallationIOManager [get]
 The IIOManager pointing to the installation directory.
 
- Properties inherited from Tgstation.Server.Host.Components.Engine.IEngineInstallation

Static Private Member Functions

static string SecurityWord (DreamDaemonSecurity securityLevel)
 Change a given securityLevel into the appropriate DreamDaemon command line word.
 
static string VisibilityWord (DreamDaemonVisibility visibility)
 Change a given visibility into the appropriate DreamDaemon command line word.
 

Private Attributes

readonly bool supportsMapThreads
 If map threads are supported by the Version.
 

Additional Inherited Members

- Static Protected Member Functions inherited from Tgstation.Server.Host.Components.Engine.EngineInstallationBase
static string EncodeParameters (IReadOnlyDictionary< string, string > parameters, DreamDaemonLaunchParameters launchParameters)
 Encode given parameters for passing as world.params on the command line.
 

Detailed Description

Implementation of IEngineInstallation for EngineType.Byond.

Definition at line 16 of file ByondInstallation.cs.

Constructor & Destructor Documentation

◆ ByondInstallation()

Tgstation.Server.Host.Components.Engine.ByondInstallation.ByondInstallation ( IIOManager  installationIOManager,
Task  installationTask,
EngineVersion  version,
string  dreamDaemonPath,
string  dreamMakerPath,
bool  supportsCli,
bool  supportsMapThreads 
)

Initializes a new instance of the ByondInstallation class.

Parameters
installationIOManagerThe IIOManager for the EngineInstallationBase.
installationTaskThe value of InstallationTask.
versionThe value of Version.
dreamDaemonPathThe value of ServerExePath.
dreamMakerPathThe value of CompilerExePath.
supportsCliIf a CLI application is being used.
supportsMapThreadsThe value of supportsMapThreads.

Definition at line 89 of file ByondInstallation.cs.

97 : base(installationIOManager)
98 {
99 InstallationTask = installationTask ?? throw new ArgumentNullException(nameof(installationTask));
100 ArgumentNullException.ThrowIfNull(version);
101
102 if (version.Engine != EngineType.Byond)
103 throw new ArgumentException($"Invalid EngineType: {version.Engine}", nameof(version));
104
105 Version = version ?? throw new ArgumentNullException(nameof(version));
106 ServerExePath = dreamDaemonPath ?? throw new ArgumentNullException(nameof(dreamDaemonPath));
107 CompilerExePath = dreamMakerPath ?? throw new ArgumentNullException(nameof(dreamMakerPath));
108 HasStandardOutput = supportsCli;
109 PromptsForNetworkAccess = !supportsCli;
110 this.supportsMapThreads = supportsMapThreads;
111 }
readonly bool supportsMapThreads
If map threads are supported by the Version.
override bool PromptsForNetworkAccess
If ServerExePath may create network prompts.
override string ServerExePath
The full path to the game server executable.
override Task InstallationTask
The Task that completes when the BYOND version finished installing.
override bool HasStandardOutput
If ServerExePath supports being run as a command-line application and outputs log information to be c...
override EngineVersion Version
The EngineVersion of the IEngineInstallation.
override string CompilerExePath
The full path to the dm/DreamMaker executable.
EngineType
The type of engine the codebase is using.
Definition EngineType.cs:7

References Tgstation.Server.Host.Components.Engine.ByondInstallation.CompilerExePath, Tgstation.Server.Api.Models.EngineVersion.Engine, Tgstation.Server.Host.Components.Engine.ByondInstallation.HasStandardOutput, Tgstation.Server.Host.Components.Engine.ByondInstallation.InstallationTask, Tgstation.Server.Host.Components.Engine.ByondInstallation.PromptsForNetworkAccess, Tgstation.Server.Host.Components.Engine.ByondInstallation.ServerExePath, Tgstation.Server.Host.Components.Engine.ByondInstallation.supportsMapThreads, and Tgstation.Server.Host.Components.Engine.ByondInstallation.Version.

Member Function Documentation

◆ FormatCompilerArguments()

override string Tgstation.Server.Host.Components.Engine.ByondInstallation.FormatCompilerArguments ( string  dmePath,
string?  additionalArguments 
)

Return the command line arguments for compiling a given dmePath if compilation is necessary.

Parameters
dmePathThe full path to the .dme to compile.
additionalArgumentsOptional additional arguments provided to the compiler.
Returns
The formatted arguments string.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 150 of file ByondInstallation.cs.

151 {
152 if (String.IsNullOrWhiteSpace(additionalArguments))
153 additionalArguments = String.Empty;
154 else
155 additionalArguments = $"{additionalArguments.Trim()} ";
156
157 return $"-clean {additionalArguments}\"{dmePath ?? throw new ArgumentNullException(nameof(dmePath))}\"";
158 }

◆ FormatServerArguments()

override string Tgstation.Server.Host.Components.Engine.ByondInstallation.FormatServerArguments ( IDmbProvider  dmbProvider,
IReadOnlyDictionary< string, string >  parameters,
DreamDaemonLaunchParameters  launchParameters,
string?  logFilePath 
)

Return the command line arguments for launching with given launchParameters .

Parameters
dmbProviderThe IDmbProvider.
parametersThe map of parameter strings as a IReadOnlyDictionary<TKey, TValue>. MUST include Interop.DMApiConstants.ParamAccessIdentifier. Should NOT include the DreamDaemonLaunchParameters.AdditionalParameters of launchParameters .
launchParametersThe DreamDaemonLaunchParameters.
logFilePathThe full path to the log file, if any.
Returns
The formatted arguments string.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 114 of file ByondInstallation.cs.

119 {
120 ArgumentNullException.ThrowIfNull(dmbProvider);
121 ArgumentNullException.ThrowIfNull(parameters);
122 ArgumentNullException.ThrowIfNull(launchParameters);
123
124 var parametersString = EncodeParameters(parameters, launchParameters);
125
126 var arguments = String.Format(
127 CultureInfo.InvariantCulture,
128 "\"{0}\" -port {1} -ports 1-65535 {2}-close -verbose -{3} -{4}{5}{6}{7} -params \"{8}\"",
129 dmbProvider.DmbName,
130 launchParameters.Port!.Value,
131 launchParameters.AllowWebClient!.Value
132 ? "-webclient "
133 : String.Empty,
134 SecurityWord(launchParameters.SecurityLevel!.Value),
135 VisibilityWord(launchParameters.Visibility!.Value),
136 logFilePath != null
137 ? $" -logself -log {logFilePath}"
138 : String.Empty, // DD doesn't output anything if -logself is set???
139 launchParameters.StartProfiler!.Value
140 ? " -profile"
141 : String.Empty,
142 supportsMapThreads && launchParameters.MapThreads!.Value != 0
143 ? $" -map-threads {launchParameters.MapThreads.Value}"
144 : String.Empty,
145 parametersString);
146 return arguments;
147 }
ushort? Port
The port DreamDaemon uses. This should be publically accessible.
bool? AllowWebClient
If the BYOND web client can be used to connect to the game server. No-op for EngineType....
static string VisibilityWord(DreamDaemonVisibility visibility)
Change a given visibility into the appropriate DreamDaemon command line word.
static string SecurityWord(DreamDaemonSecurity securityLevel)
Change a given securityLevel into the appropriate DreamDaemon command line word.
static string EncodeParameters(IReadOnlyDictionary< string, string > parameters, DreamDaemonLaunchParameters launchParameters)
Encode given parameters for passing as world.params on the command line.

References Tgstation.Server.Api.Models.Internal.DreamDaemonLaunchParameters.AllowWebClient, Tgstation.Server.Host.Components.Deployment.IDmbProvider.DmbName, Tgstation.Server.Host.Components.Engine.EngineInstallationBase.EncodeParameters(), Tgstation.Server.Api.Models.Internal.DreamDaemonLaunchParameters.MapThreads, Tgstation.Server.Api.Models.Internal.DreamDaemonLaunchParameters.Port, Tgstation.Server.Api.Models.Internal.DreamDaemonLaunchParameters.SecurityLevel, Tgstation.Server.Host.Components.Engine.ByondInstallation.SecurityWord(), Tgstation.Server.Api.Models.Internal.DreamDaemonLaunchParameters.StartProfiler, Tgstation.Server.Host.Components.Engine.ByondInstallation.supportsMapThreads, Tgstation.Server.Api.Models.Internal.DreamDaemonLaunchParameters.Visibility, and Tgstation.Server.Host.Components.Engine.ByondInstallation.VisibilityWord().

Here is the call graph for this function:

◆ SecurityWord()

static string Tgstation.Server.Host.Components.Engine.ByondInstallation.SecurityWord ( DreamDaemonSecurity  securityLevel)
staticprivate

Change a given securityLevel into the appropriate DreamDaemon command line word.

Parameters
securityLevelThe DreamDaemonSecurity level to change.
Returns
A string representation of the command line parameter.

Definition at line 52 of file ByondInstallation.cs.

53 {
54 return securityLevel switch
55 {
56 DreamDaemonSecurity.Safe => "safe",
57 DreamDaemonSecurity.Trusted => "trusted",
58 DreamDaemonSecurity.Ultrasafe => "ultrasafe",
59 _ => throw new ArgumentOutOfRangeException(nameof(securityLevel), securityLevel, String.Format(CultureInfo.InvariantCulture, "Bad DreamDaemon security level: {0}", securityLevel)),
60 };
61 }

Referenced by Tgstation.Server.Host.Components.Engine.ByondInstallation.FormatServerArguments().

Here is the caller graph for this function:

◆ VisibilityWord()

static string Tgstation.Server.Host.Components.Engine.ByondInstallation.VisibilityWord ( DreamDaemonVisibility  visibility)
staticprivate

Change a given visibility into the appropriate DreamDaemon command line word.

Parameters
visibilityThe DreamDaemonVisibility level to change.
Returns
A string representation of the command line parameter.

Definition at line 68 of file ByondInstallation.cs.

69 {
70 return visibility switch
71 {
72 DreamDaemonVisibility.Public => "public",
73 DreamDaemonVisibility.Private => "private",
74 DreamDaemonVisibility.Invisible => "invisible",
75 _ => throw new ArgumentOutOfRangeException(nameof(visibility), visibility, String.Format(CultureInfo.InvariantCulture, "Bad DreamDaemon visibility level: {0}", visibility)),
76 };
77 }

Referenced by Tgstation.Server.Host.Components.Engine.ByondInstallation.FormatServerArguments().

Here is the caller graph for this function:

Member Data Documentation

◆ supportsMapThreads

readonly bool Tgstation.Server.Host.Components.Engine.ByondInstallation.supportsMapThreads
private

Property Documentation

◆ CompilerExePath

override string Tgstation.Server.Host.Components.Engine.ByondInstallation.CompilerExePath
get

The full path to the dm/DreamMaker executable.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 25 of file ByondInstallation.cs.

25{ get; }

Referenced by Tgstation.Server.Host.Components.Engine.ByondInstallation.ByondInstallation().

◆ HasStandardOutput

override bool Tgstation.Server.Host.Components.Engine.ByondInstallation.HasStandardOutput
get

If ServerExePath supports being run as a command-line application and outputs log information to be captured.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 31 of file ByondInstallation.cs.

31{ get; }

Referenced by Tgstation.Server.Host.Components.Engine.ByondInstallation.ByondInstallation().

◆ InstallationTask

override Task Tgstation.Server.Host.Components.Engine.ByondInstallation.InstallationTask
get

The Task that completes when the BYOND version finished installing.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 40 of file ByondInstallation.cs.

40{ get; }

Referenced by Tgstation.Server.Host.Components.Engine.ByondInstallation.ByondInstallation().

◆ PreferFileLogging

override bool Tgstation.Server.Host.Components.Engine.ByondInstallation.PreferFileLogging
get

If HasStandardOutput is set, this indicates that the engine server has good file logging that should be preferred to ours.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 34 of file ByondInstallation.cs.

◆ PromptsForNetworkAccess

override bool Tgstation.Server.Host.Components.Engine.ByondInstallation.PromptsForNetworkAccess
get

◆ ServerExePath

override string Tgstation.Server.Host.Components.Engine.ByondInstallation.ServerExePath
get

The full path to the game server executable.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 22 of file ByondInstallation.cs.

22{ get; }

Referenced by Tgstation.Server.Host.Components.Engine.ByondInstallation.ByondInstallation().

◆ UseDotnetDump

override bool Tgstation.Server.Host.Components.Engine.ByondInstallation.UseDotnetDump
get

If dotnet-dump should be used to create process dumps for this installation.

Implements Tgstation.Server.Host.Components.Engine.IEngineInstallation.

Definition at line 37 of file ByondInstallation.cs.

◆ Version

override EngineVersion Tgstation.Server.Host.Components.Engine.ByondInstallation.Version
get

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