2using System.Collections.Generic;
3using System.Globalization;
6using System.Threading.Tasks;
8using Microsoft.Extensions.Logging;
71 : base(ioManager, logger)
85 installationIOManager,
88 installationIOManager.ResolvePath(
89 installationIOManager.ConcatPath(
93 out var supportsCli))),
94 installationIOManager.ResolvePath(
95 installationIOManager.ConcatPath(
103 public override async Task
CleanCache(CancellationToken cancellationToken)
109 Logger.LogDebug(
"Cleaning BYOND cache...");
110 async Task CleanDirectorySafe()
122 Logger.LogWarning(ex,
"Failed to clean BYOND cache!");
126 var cacheCleanTask = CleanDirectorySafe();
140 await Task.WhenAll(cacheCleanTask, cfgCreateTask, Task.WhenAll(additionalCleanTasks));
142 catch (
Exception ex) when (ex is not OperationCanceledException)
144 Logger.LogWarning(ex,
"Error cleaning BYOND cache!");
154 Logger.LogTrace(
"Downloading {engineType} version {version} from {url}...",
TargetEngineType, version, url);
158 await download.GetResult(cancellationToken));
160 var stream = await buffer.GetOwnedResult(cancellationToken);
169 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.
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.
override IEngineInstallation CreateInstallation(EngineVersion version, string path, Task installationTask)
Creates an IEngineInstallation for a given version .The IEngineInstallation.
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.