2using System.Collections.Generic;
6using System.Threading.Tasks;
11using Microsoft.Extensions.Logging;
60 IReadOnlyDictionary<string, string> parameters,
63 var parametersString = String.Join(
'&', parameters.Select(kvp => $
"{HttpUtility.UrlEncode(kvp.Key)}={HttpUtility.UrlEncode(kvp.Value)}"));
66 parametersString = $
"{parametersString}&{launchParameters.AdditionalParameters}";
68 return parametersString;
77 InstallationIOManager = installationIOManager ??
throw new ArgumentNullException(nameof(installationIOManager));
86 IReadOnlyDictionary<string, string> parameters,
91 public virtual async ValueTask
StopServerProcess(ILogger logger,
IProcess process,
string accessIdentifier, ushort port, CancellationToken cancellationToken)
93 ArgumentNullException.ThrowIfNull(logger);
94 cancellationToken.ThrowIfCancellationRequested();
95 logger.LogTrace(
"Terminating engine server process...");
101 public async ValueTask<Dictionary<string, string>?>
LoadEnv(ILogger logger,
bool forCompiler, CancellationToken cancellationToken)
103 ArgumentNullException.ThrowIfNull(logger);
105 var envFile = forCompiler
111 logger.LogTrace(
"No {envFile} present in engine installation {version}", envFile,
Version);
115 logger.LogDebug(
"Loading {envFile} for engine installation {version}...", envFile,
Version);
118 var fileContents = Encoding.UTF8.GetString(fileBytes);
119 var parser =
new EnvParser();
123 var variables = parser.Parse(fileContents);
125 return variables.ToDictionary();
129 logger.LogWarning(ex,
"Unable to parse {envFile}!", envFile);
Information about an engine installation.
Launch settings for DreamDaemon.
string? AdditionalParameters
Parameters string for DreamDaemon.
static string EncodeParameters(IReadOnlyDictionary< string, string > parameters, DreamDaemonLaunchParameters launchParameters)
Encode given parameters for passing as world.params on the command line.
bool PromptsForNetworkAccess
If ServerExePath may create network prompts.
bool UseDotnetDump
If dotnet-dump should be used to create process dumps for this installation.
EngineVersion Version
The EngineVersion of the IEngineInstallation.
string FormatCompilerArguments(string dmePath, string? additionalArguments)
Return the command line arguments for compiling a given dmePath if compilation is necessary....
EngineInstallationBase(IIOManager installationIOManager)
Initializes a new instance of the EngineInstallationBase class.
bool PreferFileLogging
If HasStandardOutput is set, this indicates that the engine server has good file logging that should ...
virtual async ValueTask StopServerProcess(ILogger logger, IProcess process, string accessIdentifier, ushort port, CancellationToken cancellationToken)
Kills a given engine server process .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.A ValueTask<TResult> resulting in th...
Task InstallationTask
The Task that completes when the BYOND version finished installing.
string ServerExePath
The full path to the game server executable.
string CompilerExePath
The full path to the dm/DreamMaker executable.
bool HasStandardOutput
If ServerExePath supports being run as a command-line application and outputs log information to be c...
IIOManager InstallationIOManager
The IIOManager pointing to the installation directory.
string FormatServerArguments(IDmbProvider dmbProvider, IReadOnlyDictionary< string, string > parameters, DreamDaemonLaunchParameters launchParameters, string? logFilePath)
Return the command line arguments for launching with given launchParameters .The formatted arguments ...
Provides absolute paths to the latest compiled .dmbs.
Represents a BYOND installation.
Interface for using filesystems.
ValueTask< byte[]> ReadAllBytes(string path, CancellationToken cancellationToken)
Returns all the contents of a file at path as a byte array.
Task< bool > FileExists(string path, CancellationToken cancellationToken)
Check that the file at path exists.
Task< int?> Lifetime
The Task<TResult> resulting in the exit code of the process or null if the process was detached.
Abstraction over a global::System.Diagnostics.Process.
void Terminate()
Asycnhronously terminates the process.