2using System.Collections.Generic;
3using System.Globalization;
6using System.Threading.Tasks;
8using Microsoft.Extensions.Logging;
71 : base(ioManager, logger)
86 installationIOManager,
89 installationIOManager.ResolvePath(
90 installationIOManager.ConcatPath(
94 out var supportsCli))),
95 installationIOManager.ResolvePath(
96 installationIOManager.ConcatPath(
100 supportsMapThreads));
104 public override async Task
CleanCache(CancellationToken cancellationToken)
110 Logger.LogDebug(
"Cleaning BYOND cache...");
111 async Task CleanDirectorySafe()
123 Logger.LogWarning(ex,
"Failed to clean BYOND cache!");
127 var cacheCleanTask = CleanDirectorySafe();
141 await Task.WhenAll(cacheCleanTask, cfgCreateTask, Task.WhenAll(additionalCleanTasks));
143 catch (
Exception ex) when (ex is not OperationCanceledException)
145 Logger.LogWarning(ex,
"Error cleaning BYOND cache!");
155 Logger.LogTrace(
"Downloading {engineType} version {version} from {url}...",
TargetEngineType, version, url);
159 await download.GetResult(cancellationToken));
161 var stream = await buffer.GetOwnedResult(cancellationToken);
170 await stream.DisposeAsync();
Information about an engine installation.
Version? Version
The System.Version of the engine. Currently only valid when Engine is EngineType.Byond.
Implementation of IEngineInstallation for EngineType.Byond.
Base implementation of IEngineInstaller for EngineType.Byond.
readonly IFileDownloader fileDownloader
The IFileDownloader for the ByondInstallerBase.
string GetDreamDaemonName(Version byondVersion, out bool supportsCli)
Get the file name of the DreamDaemon executable.
const string CacheDirectoryName
The name of BYOND's cache directory.
const string CfgDirectoryName
The path to the cfg directory.
static readonly Version MapThreadsVersion
The first Version of BYOND that supports the '-map-threads' parameter on DreamDaemon.
override ValueTask< IEngineInstallation > CreateInstallation(EngineVersion version, string path, Task installationTask, CancellationToken cancellationToken)
Creates an IEngineInstallation for a given version .A ValueTask<TResult> resulting in the IEngineInst...
string ByondRevisionsUrlTemplate
Gets the URL formatter string for downloading a byond version of {0:Major} {1:Minor}.
const string ByondBinPath
The path to the BYOND bin folder.
virtual IEnumerable< string > AdditionalCacheCleanFilePaths(string configDirectory)
List off additional file paths in the configDirectory to delete.
ByondInstallerBase(IIOManager ioManager, ILogger< ByondInstallerBase > logger, IFileDownloader fileDownloader)
Initializes a new instance of the ByondInstallerBase class.
override async Task CleanCache(CancellationToken cancellationToken)
Attempts to cleans the engine's cache folder for the system.A Task representing the running operation...
Uri GetDownloadZipUrl(EngineVersion version)
Create a Uri pointing to the location of the download for a given version .
override EngineType TargetEngineType
string PathToUserFolder
Path to the system user's local BYOND folder.
override async ValueTask< IEngineInstallationData > DownloadVersion(EngineVersion version, JobProgressReporter progressReporter, CancellationToken cancellationToken)
Download a given engine version .A ValueTask<TResult> resulting in the IEngineInstallationData for th...
string DreamMakerName
Path to the DreamMaker executable.
void CheckVersionValidity(EngineVersion version)
Check that a given version is of type EngineType.Byond.
IIOManager IOManager
Gets the IIOManager for the EngineInstallerBase.
ILogger< EngineInstallerBase > Logger
Gets the ILogger for the EngineInstallerBase.
Implementation of IEngineInstallationData for a zip file in a Stream.
IFileStreamProvider that provides a ISeekableFileStreamProvider from an input Stream.
An IIOManager that resolve relative paths from another IIOManager to a subdirectory of that.
Progress reporter for a Job.
Represents a BYOND installation.
IFileStreamProvider DownloadFile(Uri url, string? bearerToken)
Downloads a file from a given url .
Interface for using filesystems.
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 .
Task DeleteDirectory(string path, CancellationToken cancellationToken)
Recursively delete a directory, removes and does not enter any symlinks encounterd.
EngineType
The type of engine the codebase is using.