tgstation-server 6.13.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
SessionControllerFactory.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Globalization;
4using System.Linq;
5using System.Net.Sockets;
6using System.Text;
7using System.Threading;
8using System.Threading.Tasks;
9
10using Microsoft.Extensions.Logging;
11
29
31{
34 {
38 const string DreamDaemonLogsPath = "DreamDaemonLogs";
39
44
49
54
59
64
69
74
79
84
89
94
99
104
109
114
118 readonly ILoggerFactory loggerFactory;
119
123 readonly ILogger<SessionControllerFactory> logger;
124
129
134
142 async ValueTask PortBindTest(ushort port, EngineType engineType, CancellationToken cancellationToken)
143 {
144 logger.LogTrace("Bind test: {port}", port);
145 try
146 {
147 // GIVE ME THE FUCKING PORT BACK WINDOWS!!!!
148 const int MaxAttempts = 5;
149 for (var i = 0; i < MaxAttempts; ++i)
150 try
151 {
152 SocketExtensions.BindTest(platformIdentifier, port, false, engineType == EngineType.OpenDream);
153 if (i > 0)
154 logger.LogDebug("Clearing the socket took {iterations} attempts :/", i + 1);
155
156 break;
157 }
158 catch (SocketException ex) when (platformIdentifier.IsWindows && ex.SocketErrorCode == SocketError.AddressAlreadyInUse && i < (MaxAttempts - 1))
159 {
160 await asyncDelayer.Delay(TimeSpan.FromSeconds(1), cancellationToken);
161 }
162 }
163 catch (SocketException ex) when (ex.SocketErrorCode == SocketError.AddressAlreadyInUse)
164 {
165 throw new JobException(ErrorCode.GameServerPortInUse, ex);
166 }
167 }
168
207 ILoggerFactory loggerFactory,
208 ILogger<SessionControllerFactory> logger,
210 Api.Models.Instance instance)
211 {
212 this.processExecutor = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
213 this.engineManager = engineManager ?? throw new ArgumentNullException(nameof(engineManager));
214 this.topicClientFactory = topicClientFactory ?? throw new ArgumentNullException(nameof(topicClientFactory));
215 this.cryptographySuite = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
216 this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
217 this.gameIOManager = gameIOManager ?? throw new ArgumentNullException(nameof(gameIOManager));
218 this.diagnosticsIOManager = diagnosticsIOManager ?? throw new ArgumentNullException(nameof(diagnosticsIOManager));
219 this.chat = chat ?? throw new ArgumentNullException(nameof(chat));
220 this.networkPromptReaper = networkPromptReaper ?? throw new ArgumentNullException(nameof(networkPromptReaper));
221 this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
222 this.bridgeRegistrar = bridgeRegistrar ?? throw new ArgumentNullException(nameof(bridgeRegistrar));
223 this.serverPortProvider = serverPortProvider ?? throw new ArgumentNullException(nameof(serverPortProvider));
224 this.eventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
225 this.asyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer));
226 this.dotnetDumpService = dotnetDumpService ?? throw new ArgumentNullException(nameof(dotnetDumpService));
227 this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
228 this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
229 this.sessionConfiguration = sessionConfiguration ?? throw new ArgumentNullException(nameof(sessionConfiguration));
230 this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
231 }
232
234 #pragma warning disable CA1506 // TODO: Decomplexify
235 public async ValueTask<ISessionController> LaunchNew(
236 IDmbProvider dmbProvider,
237 IEngineExecutableLock? currentByondLock,
238 DreamDaemonLaunchParameters launchParameters,
239 bool apiValidate,
240 CancellationToken cancellationToken)
241 {
242 logger.LogTrace("Begin session launch...");
243 if (!launchParameters.Port.HasValue)
244 throw new InvalidOperationException("Given port is null!");
245
246 switch (dmbProvider.CompileJob.MinimumSecurityLevel)
247 {
248 case DreamDaemonSecurity.Ultrasafe:
249 break;
250 case DreamDaemonSecurity.Safe:
251 if (launchParameters.SecurityLevel == DreamDaemonSecurity.Ultrasafe)
252 {
253 logger.LogTrace("Boosting security level to minimum of Safe");
254 launchParameters.SecurityLevel = DreamDaemonSecurity.Safe;
255 }
256
257 break;
258 case DreamDaemonSecurity.Trusted:
259 if (launchParameters.SecurityLevel != DreamDaemonSecurity.Trusted)
260 logger.LogTrace("Boosting security level to minimum of Trusted");
261
262 launchParameters.SecurityLevel = DreamDaemonSecurity.Trusted;
263 break;
264 default:
265 throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Invalid DreamDaemonSecurity value: {0}", dmbProvider.CompileJob.MinimumSecurityLevel));
266 }
267
268 // get the byond lock
269 var engineLock = currentByondLock ?? await engineManager.UseExecutables(
270 dmbProvider.EngineVersion,
271 gameIOManager.ConcatPath(dmbProvider.Directory, dmbProvider.DmbName),
272 cancellationToken);
273 try
274 {
275 logger.LogDebug(
276 "Launching session with CompileJob {compileJobId}...",
277 dmbProvider.CompileJob.Id);
278
279 // mad this isn't abstracted but whatever
280 var engineType = dmbProvider.EngineVersion.Engine!.Value;
281 if (engineType == EngineType.Byond)
283
284 await PortBindTest(launchParameters.Port.Value, engineType, cancellationToken);
285
286 string? outputFilePath = null;
287 var preserveLogFile = true;
288
289 var hasStandardOutput = engineLock.HasStandardOutput;
290 if (launchParameters.LogOutput!.Value)
291 {
292 var now = DateTimeOffset.UtcNow;
293 var dateDirectory = diagnosticsIOManager.ConcatPath(DreamDaemonLogsPath, now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
294 await diagnosticsIOManager.CreateDirectory(dateDirectory, cancellationToken);
295 outputFilePath = diagnosticsIOManager.ResolvePath(
297 dateDirectory,
298 $"server-utc-{now.ToString("yyyy-MM-dd-HH-mm-ss", CultureInfo.InvariantCulture)}{(apiValidate ? "-dmapi" : String.Empty)}.log"));
299
300 logger.LogInformation("Logging server output to {path}...", outputFilePath);
301 }
302 else if (!hasStandardOutput)
303 {
304 outputFilePath = gameIOManager.ConcatPath(dmbProvider.Directory, $"{Guid.NewGuid()}.server.log");
305 preserveLogFile = false;
306 }
307
308 var accessIdentifier = cryptographySuite.GetSecureString();
309
310 if (!apiValidate && dmbProvider.CompileJob.DMApiVersion == null)
311 logger.LogDebug("Session will have no DMAPI support!");
312
313 // launch dd
314 var process = await CreateGameServerProcess(
315 dmbProvider,
316 engineLock,
317 launchParameters,
318 accessIdentifier,
319 outputFilePath,
320 apiValidate,
321 cancellationToken);
322
323 try
324 {
325 var chatTrackingContext = chat.CreateTrackingContext();
326
327 try
328 {
329 var runtimeInformation = CreateRuntimeInformation(
330 dmbProvider,
331 chatTrackingContext,
332 launchParameters.SecurityLevel!.Value,
333 launchParameters.Visibility!.Value,
334 apiValidate);
335
336 var reattachInformation = new ReattachInformation(
337 dmbProvider,
338 process,
339 runtimeInformation,
340 accessIdentifier,
341 launchParameters.Port.Value);
342
343 var byondTopicSender = topicClientFactory.CreateTopicClient(
344 TimeSpan.FromMilliseconds(
345 launchParameters.TopicRequestTimeout!.Value));
346
347 var sessionController = new SessionController(
348 reattachInformation,
349 instance,
350 process,
351 engineLock,
352 byondTopicSender,
353 chatTrackingContext,
355 chat,
360 loggerFactory.CreateLogger<SessionController>(),
361 () => LogDDOutput(
362 process,
363 outputFilePath,
364 hasStandardOutput,
365 preserveLogFile,
366 CancellationToken.None), // DCT: None available
367 launchParameters.StartupTimeout,
368 false,
369 apiValidate);
370
371 return sessionController;
372 }
373 catch
374 {
375 chatTrackingContext.Dispose();
376 throw;
377 }
378 }
379 catch
380 {
381 await using (process)
382 {
383 process.Terminate();
384 await process.Lifetime;
385 throw;
386 }
387 }
388 }
389 catch
390 {
391 if (currentByondLock == null)
392 engineLock.Dispose();
393 throw;
394 }
395 }
396#pragma warning restore CA1506
397
399 public async ValueTask<ISessionController?> Reattach(
400 ReattachInformation reattachInformation,
401 CancellationToken cancellationToken)
402 {
403 ArgumentNullException.ThrowIfNull(reattachInformation);
404
405 logger.LogTrace("Begin session reattach...");
406 var byondTopicSender = topicClientFactory.CreateTopicClient(reattachInformation.TopicRequestTimeout);
407 var engineLock = await engineManager.UseExecutables(
408 reattachInformation.Dmb.EngineVersion,
409 null, // Doesn't matter if it's trusted or not on reattach
410 cancellationToken);
411
412 try
413 {
414 logger.LogDebug(
415 "Attaching to session PID: {pid}, CompileJob: {compileJobId}...",
416 reattachInformation.ProcessId,
417 reattachInformation.Dmb.CompileJob.Id);
418
419 var process = processExecutor.GetProcess(reattachInformation.ProcessId);
420 if (process == null)
421 return null;
422
423 try
424 {
425 if (engineLock.PromptsForNetworkAccess)
427
428 var chatTrackingContext = chat.CreateTrackingContext();
429 try
430 {
431 var runtimeInformation = CreateRuntimeInformation(
432 reattachInformation.Dmb,
433 chatTrackingContext,
434 reattachInformation.LaunchSecurityLevel,
435 reattachInformation.LaunchVisibility,
436 false);
437 reattachInformation.SetRuntimeInformation(runtimeInformation);
438
439 var controller = new SessionController(
440 reattachInformation,
441 instance,
442 process,
443 engineLock,
444 byondTopicSender,
445 chatTrackingContext,
447 chat,
452 loggerFactory.CreateLogger<SessionController>(),
453 () => ValueTask.CompletedTask,
454 null,
455 true,
456 false);
457
458 process = null;
459 engineLock = null;
460 chatTrackingContext = null;
461
462 return controller;
463 }
464 catch
465 {
466 chatTrackingContext?.Dispose();
467 throw;
468 }
469 }
470 catch
471 {
472 if (process != null)
473 await process.DisposeAsync();
474
475 throw;
476 }
477 }
478 catch
479 {
480 engineLock?.Dispose();
481 throw;
482 }
483 }
484
496 async ValueTask<IProcess> CreateGameServerProcess(
497 IDmbProvider dmbProvider,
498 IEngineExecutableLock engineLock,
499 DreamDaemonLaunchParameters launchParameters,
500 string accessIdentifier,
501 string? logFilePath,
502 bool apiValidate,
503 CancellationToken cancellationToken)
504 {
505 // important to run on all ports to allow port changing
506 var environment = await engineLock.LoadEnv(logger, false, cancellationToken);
507 var arguments = engineLock.FormatServerArguments(
508 dmbProvider,
509 new Dictionary<string, string>
510 {
512 { DMApiConstants.ParamServerPort, serverPortProvider.HttpApiPort.ToString(CultureInfo.InvariantCulture) },
513 { DMApiConstants.ParamAccessIdentifier, accessIdentifier },
514 },
515 launchParameters,
516 !engineLock.HasStandardOutput || engineLock.PreferFileLogging
517 ? logFilePath
518 : null);
519
520 // If this isnt a staging DD (From a Deployment), fire off events
521 if (!apiValidate)
523 EventType.DreamDaemonPreLaunch,
524 Enumerable.Empty<string?>(),
525 false,
526 cancellationToken);
527
528 var process = await processExecutor.LaunchProcess(
529 engineLock.ServerExePath,
530 dmbProvider.Directory,
531 arguments,
532 cancellationToken,
533 environment,
534 logFilePath,
535 engineLock.HasStandardOutput,
536 true);
537
538 try
539 {
540 if (!apiValidate)
541 {
543 process.AdjustPriority(true);
544 }
546 process.AdjustPriority(false);
547
548 if (!engineLock.HasStandardOutput)
550
551 if (!apiValidate)
553 EventType.DreamDaemonLaunch,
554 new List<string>
555 {
556 process.Id.ToString(CultureInfo.InvariantCulture),
557 },
558 false,
559 cancellationToken);
560
561 return process;
562 }
563 catch
564 {
565 await using (process)
566 {
567 process.Terminate();
568 await process.Lifetime;
569 throw;
570 }
571 }
572 }
573
583 async ValueTask LogDDOutput(IProcess process, string? outputFilePath, bool cliSupported, bool preserveFile, CancellationToken cancellationToken)
584 {
585 try
586 {
587 string? ddOutput = null;
588 if (cliSupported)
589 ddOutput = (await process.GetCombinedOutput(cancellationToken))!;
590
591 if (ddOutput == null)
592 try
593 {
594 var dreamDaemonLogBytes = await gameIOManager.ReadAllBytes(
595 outputFilePath!,
596 cancellationToken);
597
598 ddOutput = Encoding.UTF8.GetString(dreamDaemonLogBytes);
599 }
600 finally
601 {
602 if (!preserveFile)
603 try
604 {
605 logger.LogTrace("Deleting temporary log file {path}...", outputFilePath);
606 await gameIOManager.DeleteFile(outputFilePath!, cancellationToken);
607 }
608 catch (Exception ex)
609 {
610 // this is expected on OD at time of the support changes.
611 // I've open a change to fix it: https://github.com/space-wizards/RobustToolbox/pull/4501
612 logger.LogWarning(ex, "Failed to delete server log file {outputFilePath}!", outputFilePath);
613 }
614 }
615
616 logger.LogTrace(
617 "Server Output:{newLine}{output}",
618 Environment.NewLine,
619 ddOutput);
620 }
621 catch (Exception ex)
622 {
623 logger.LogWarning(ex, "Error reading server output!");
624 }
625 }
626
637 IDmbProvider dmbProvider,
638 IChatTrackingContext chatTrackingContext,
639 DreamDaemonSecurity securityLevel,
640 DreamDaemonVisibility visibility,
641 bool apiValidateOnly)
642 => new(
643 chatTrackingContext,
644 dmbProvider,
646 instance.Name!,
647 securityLevel,
648 visibility,
650 apiValidateOnly);
651
656 async ValueTask CheckPagerIsNotRunning()
657 {
659 return;
660
661 await using var otherProcess = processExecutor.GetProcessByName("byond");
662 if (otherProcess == null)
663 return;
664
665 var otherUsername = otherProcess.GetExecutingUsername();
666
667 await using var ourProcess = processExecutor.GetCurrentProcess();
668 var ourUsername = ourProcess.GetExecutingUsername();
669
670 if (otherUsername.Equals(ourUsername, StringComparison.Ordinal))
671 throw new JobException(ErrorCode.DreamDaemonPagerRunning);
672 }
673 }
674}
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:14
Metadata about a server instance.
Definition Instance.cs:9
virtual ? Version DMApiVersion
The DMAPI Version.
Definition CompileJob.cs:43
DreamDaemonSecurity? MinimumSecurityLevel
The minimum DreamDaemonSecurity required to run the CompileJob's output.
Definition CompileJob.cs:35
ushort? Port
The port DreamDaemon uses. This should be publically accessible.
DreamDaemonVisibility? Visibility
The DreamDaemonVisibility level of DreamDaemon. No-op for EngineType.OpenDream.
bool? LogOutput
If process output/error text should be logged.
uint? TopicRequestTimeout
The timeout for sending and receiving BYOND topics in milliseconds.
DreamDaemonSecurity? SecurityLevel
The DreamDaemonSecurity level of DreamDaemon. No-op for EngineType.OpenDream.
Representation of the initial data passed as part of a BridgeCommandType.Startup request.
Constants used for communication with the DMAPI.
const string ParamServerPort
Identifies the Core.IServerPortProvider.HttpApiPort of the server.
const string ParamAccessIdentifier
Identifies the DMApiParameters.AccessIdentifier for the session.
const string ParamApiVersion
Identifies a DMAPI execution with the version as the value.
static readonly Version InteropVersion
The DMAPI InteropVersion being used.
Parameters necessary for duplicating a ISessionController session.
TimeSpan TopicRequestTimeout
The TimeSpan which indicates when topic requests should timeout.
void SetRuntimeInformation(RuntimeInformation runtimeInformation)
Set the RuntimeInformation post construction.
IDmbProvider Dmb
The IDmbProvider used by DreamDaemon.
SessionControllerFactory(IProcessExecutor processExecutor, IEngineManager engineManager, ITopicClientFactory topicClientFactory, ICryptographySuite cryptographySuite, IAssemblyInformationProvider assemblyInformationProvider, IIOManager gameIOManager, IIOManager diagnosticsIOManager, IChatManager chat, INetworkPromptReaper networkPromptReaper, IPlatformIdentifier platformIdentifier, IBridgeRegistrar bridgeRegistrar, IServerPortProvider serverPortProvider, IEventConsumer eventConsumer, IAsyncDelayer asyncDelayer, IDotnetDumpService dotnetDumpService, ILoggerFactory loggerFactory, ILogger< SessionControllerFactory > logger, SessionConfiguration sessionConfiguration, Api.Models.Instance instance)
Initializes a new instance of the SessionControllerFactory class.
readonly IEventConsumer eventConsumer
The IEventConsumer for the SessionControllerFactory.
readonly ITopicClientFactory topicClientFactory
The ITopicClientFactory for the SessionControllerFactory.
readonly SessionConfiguration sessionConfiguration
The SessionConfiguration for the SessionControllerFactory.
readonly IServerPortProvider serverPortProvider
The IServerPortProvider for the SessionControllerFactory.
readonly ILoggerFactory loggerFactory
The ILoggerFactory for the SessionControllerFactory.
readonly IProcessExecutor processExecutor
The IProcessExecutor for the SessionControllerFactory.
readonly IIOManager gameIOManager
The IIOManager for the Game directory.
async ValueTask CheckPagerIsNotRunning()
Make sure the BYOND pager is not running.
readonly IPlatformIdentifier platformIdentifier
The IPlatformIdentifier for the SessionControllerFactory.
async ValueTask LogDDOutput(IProcess process, string? outputFilePath, bool cliSupported, bool preserveFile, CancellationToken cancellationToken)
Attempts to log DreamDaemon output.
RuntimeInformation CreateRuntimeInformation(IDmbProvider dmbProvider, IChatTrackingContext chatTrackingContext, DreamDaemonSecurity securityLevel, DreamDaemonVisibility visibility, bool apiValidateOnly)
Create RuntimeInformation.
readonly ICryptographySuite cryptographySuite
The ICryptographySuite for the SessionControllerFactory.
async ValueTask< IProcess > CreateGameServerProcess(IDmbProvider dmbProvider, IEngineExecutableLock engineLock, DreamDaemonLaunchParameters launchParameters, string accessIdentifier, string? logFilePath, bool apiValidate, CancellationToken cancellationToken)
Creates the game server IProcess.
readonly IBridgeRegistrar bridgeRegistrar
The IBridgeRegistrar for the SessionControllerFactory.
async ValueTask PortBindTest(ushort port, EngineType engineType, CancellationToken cancellationToken)
Check if a given port can be bound to.
const string DreamDaemonLogsPath
Path in Diagnostics folder to DreamDaemon logs.
readonly Api.Models.Instance instance
The Api.Models.Instance for the SessionControllerFactory.
readonly INetworkPromptReaper networkPromptReaper
The INetworkPromptReaper for the SessionControllerFactory.
readonly ILogger< SessionControllerFactory > logger
The ILogger for the SessionControllerFactory.
readonly IChatManager chat
The IChatManager for the SessionControllerFactory.
readonly IAssemblyInformationProvider assemblyInformationProvider
The IAssemblyInformationProvider for the SessionControllerFactory.
async ValueTask< ISessionController > LaunchNew(IDmbProvider dmbProvider, IEngineExecutableLock? currentByondLock, DreamDaemonLaunchParameters launchParameters, bool apiValidate, CancellationToken cancellationToken)
Create a ISessionController from a freshly launch DreamDaemon instance.A ValueTask<TResult> resulting...
readonly IDotnetDumpService dotnetDumpService
The IDotnetDumpService for the SessionControllerFactory.
readonly IEngineManager engineManager
The IEngineManager for the SessionControllerFactory.
async ValueTask< ISessionController?> Reattach(ReattachInformation reattachInformation, CancellationToken cancellationToken)
Create a ISessionController from an existing DreamDaemon instance.A ValueTask<TResult> resulting in a...
readonly IAsyncDelayer asyncDelayer
The IAsyncDelayer for the SessionControllerFactory.
readonly IIOManager diagnosticsIOManager
The IIOManager for the Diagnostics directory.
Configuration options for the game sessions.
bool HighPriorityLiveDreamDaemon
If the public DreamDaemon instances are set to be above normal priority processes.
bool LowPriorityDeploymentProcesses
If the deployment DreamMaker and DreamDaemon instances are set to be below normal priority processes.
Extension methods for the Socket class.
static void BindTest(IPlatformIdentifier platformIdentifier, ushort port, bool includeIPv6, bool udp)
Attempt to exclusively bind to a given port .
Operation exceptions thrown from the context of a Models.Job.
DreamDaemonSecurity LaunchSecurityLevel
The DreamDaemonSecurity level DreamDaemon was launched with.
DreamDaemonVisibility LaunchVisibility
The DreamDaemonVisibility DreamDaemon was launched with.
For managing connected chat services.
IChatTrackingContext CreateTrackingContext()
Start tracking Commands.CustomCommands and ChannelRepresentations.
Represents a tracking of dynamic chat json files.
Provides absolute paths to the latest compiled .dmbs.
EngineVersion EngineVersion
The Api.Models.EngineVersion used to build the .dmb.
Models.CompileJob CompileJob
The CompileJob of the .dmb.
Represents usage of the two primary BYOND server executables.
string ServerExePath
The full path to the game server executable.
ValueTask< Dictionary< string, string >?> LoadEnv(ILogger logger, bool forCompiler, CancellationToken cancellationToken)
Loads the environment settings for either the server or compiler.
string FormatServerArguments(IDmbProvider dmbProvider, IReadOnlyDictionary< string, string > parameters, DreamDaemonLaunchParameters launchParameters, string? logFilePath)
Return the command line arguments for launching with given launchParameters .
bool HasStandardOutput
If ServerExePath supports being run as a command-line application and outputs log information to be c...
ValueTask< IEngineExecutableLock > UseExecutables(EngineVersion? requiredVersion, string? trustDmbFullPath, CancellationToken cancellationToken)
Lock the current installation's location and return a IEngineExecutableLock.
Consumes EventTypes and takes the appropriate actions.
ValueTask HandleEvent(EventType eventType, IEnumerable< string?> parameters, bool deploymentPipeline, CancellationToken cancellationToken)
Handle a given eventType .
ITopicClient CreateTopicClient(TimeSpan timeout)
Create a ITopicClient.
Provides access to the server's HttpApiPort.
ushort HttpApiPort
The port the server listens on.
Interface for using filesystems.
Definition IIOManager.cs:13
string ResolvePath()
Retrieve the full path of the current working directory.
ValueTask< byte[]> ReadAllBytes(string path, CancellationToken cancellationToken)
Returns all the contents of a file at path as a byte array.
string ConcatPath(params string[] paths)
Combines an array of strings into a path.
Task CreateDirectory(string path, CancellationToken cancellationToken)
Create a directory at path .
Task DeleteFile(string path, CancellationToken cancellationToken)
Deletes a file at path .
Contains various cryptographic functions.
string GetSecureString()
Generates a 40-length secure ascii string.
Service for managing the dotnet-dump installation.
On Windows, DreamDaemon will show an unskippable prompt when using /world/proc/OpenPort()....
void RegisterProcess(IProcess process)
Register a given process for network prompt reaping.
For identifying the current platform.
bool IsWindows
If the current platform is a Windows platform.
ValueTask< IProcess > LaunchProcess(string fileName, string workingDirectory, string arguments, CancellationToken cancellationToken, IReadOnlyDictionary< string, string >? environment=null, string? fileRedirect=null, bool readStandardHandles=false, bool noShellExecute=false)
Launch a IProcess.
IProcess GetCurrentProcess()
Get a IProcess representing the running executable.
IProcess? GetProcess(int id)
Get a IProcess by id .
IProcess? GetProcessByName(string name)
Get a IProcess with a given name .
Abstraction over a global::System.Diagnostics.Process.
Definition IProcess.cs:11
string GetExecutingUsername()
Get the name of the account executing the IProcess.
Task< string?> GetCombinedOutput(CancellationToken cancellationToken)
Get the stderr and stdout output of the IProcess.
ValueTask Delay(TimeSpan timeSpan, CancellationToken cancellationToken)
Create a Task that completes after a given timeSpan .
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.
Definition ErrorCode.cs:12
DreamDaemonVisibility
The visibility setting for DreamDaemon.
DreamDaemonSecurity
DreamDaemon's security level.
EngineType
The type of engine the codebase is using.
Definition EngineType.cs:7
EventType
Types of events. Mirror in tgs.dm. Prefer last listed name for script.
Definition EventType.cs:7