tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
EngineInstallerBase.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4
5using Microsoft.Extensions.Logging;
6
10
12{
15 {
19 protected abstract EngineType TargetEngineType { get; }
20
24 protected IIOManager IOManager { get; }
25
29 protected ILogger<EngineInstallerBase> Logger { get; }
30
36 protected EngineInstallerBase(IIOManager ioManager, ILogger<EngineInstallerBase> logger)
37 {
38 IOManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
39 Logger = logger ?? throw new ArgumentNullException(nameof(logger));
40 }
41
43 public abstract IEngineInstallation CreateInstallation(EngineVersion version, string path, Task installationTask);
44
46 public abstract Task CleanCache(CancellationToken cancellationToken);
47
49 public abstract ValueTask Install(EngineVersion version, string path, bool deploymentPipelineProcesses, CancellationToken cancellationToken);
50
52 public abstract ValueTask UpgradeInstallation(EngineVersion version, string path, CancellationToken cancellationToken);
53
55 public abstract ValueTask<IEngineInstallationData> DownloadVersion(EngineVersion version, JobProgressReporter jobProgressReporter, CancellationToken cancellationToken);
56
58 public abstract ValueTask TrustDmbPath(EngineVersion version, string fullDmbPath, CancellationToken cancellationToken);
59
64 protected void CheckVersionValidity(EngineVersion version)
65 {
66 ArgumentNullException.ThrowIfNull(version);
67 if (version.Engine!.Value != TargetEngineType)
68 throw new InvalidOperationException($"Non-{TargetEngineType} engine specified: {version.Engine.Value}");
69 }
70 }
71}
Information about an engine installation.
ValueTask Install(EngineVersion version, string path, bool deploymentPipelineProcesses, CancellationToken cancellationToken)
Does actions necessary to get an extracted installation working.A ValueTask representing the running ...
ValueTask TrustDmbPath(EngineVersion version, string fullDmbPath, CancellationToken cancellationToken)
Add a given fullDmbPath to the trusted DMBs list in BYOND's config.A ValueTask representing the runn...
ValueTask UpgradeInstallation(EngineVersion version, string path, CancellationToken cancellationToken)
Does actions necessary to get upgrade a version installed by a previous version of TGS....
EngineType TargetEngineType
The EngineType the installer supports.
IEngineInstallation CreateInstallation(EngineVersion version, string path, Task installationTask)
Creates an IEngineInstallation for a given version .The IEngineInstallation.
Task CleanCache(CancellationToken cancellationToken)
Attempts to cleans the engine's cache folder for the system.A Task representing the running operation...
void CheckVersionValidity(EngineVersion version)
Check that a given version is of type EngineType.Byond.
IIOManager IOManager
Gets the IIOManager for the EngineInstallerBase.
EngineInstallerBase(IIOManager ioManager, ILogger< EngineInstallerBase > logger)
Initializes a new instance of the EngineInstallerBase class.
ILogger< EngineInstallerBase > Logger
Gets the ILogger for the EngineInstallerBase.
ValueTask< IEngineInstallationData > DownloadVersion(EngineVersion version, JobProgressReporter jobProgressReporter, CancellationToken cancellationToken)
Download a given engine version .A ValueTask<TResult> resulting in the IEngineInstallationData for th...
For downloading and installing game engines for a given system.
Interface for using filesystems.
Definition IIOManager.cs:13
EngineType
The type of engine the codebase is using.
Definition EngineType.cs:7