2using System.Globalization;
5using System.Threading.Tasks;
7using Microsoft.Extensions.Logging;
40 protected ILogger<ByondInstallerBase>
Logger {
get; }
55 IOManager = ioManager ??
throw new ArgumentNullException(nameof(ioManager));
57 Logger = logger ??
throw new ArgumentNullException(nameof(logger));
64 public async Task
CleanCache(CancellationToken cancellationToken)
68 Logger.LogDebug(
"Cleaning BYOND cache...");
75 catch (OperationCanceledException)
81 Logger.LogWarning(e,
"Error deleting BYOND cache!");
86 public abstract Task
InstallByond(Version version,
string path, CancellationToken cancellationToken);
89 public abstract Task
UpgradeInstallation(Version version,
string path, CancellationToken cancellationToken);
92 public async Task<MemoryStream>
DownloadVersion(Version version, CancellationToken cancellationToken)
94 ArgumentNullException.ThrowIfNull(version);
96 Logger.LogTrace(
"Downloading BYOND version {major}.{minor}...", version.Major, version.Minor);
101 await download.GetResult(cancellationToken));
102 return await buffer.GetOwnedResult(cancellationToken);
async Task CleanCache(CancellationToken cancellationToken)
Attempts to cleans the BYOND cache folder for the system. A Task representing the running operation.
IIOManager IOManager
Gets the IIOManager for the ByondInstallerBase.
async Task< MemoryStream > DownloadVersion(Version version, CancellationToken cancellationToken)
Download a given BYOND version . A Task<TResult> resulting in a MemoryStream of the zipfile.
abstract string GetDreamDaemonName(Version version, out bool supportsCli)
Get the file name of the DreamDaemon executable. The file name of the DreamDaemon executable.
const string CacheDirectoryName
The name of BYOND's cache directory.
readonly IFileDownloader fileDownloader
The IFileDownloader for the ByondInstallerBase.
abstract string DreamMakerName
Get the file name of the DreamMaker executable.
abstract string PathToUserByondFolder
The path to the BYOND folder for the user.
ILogger< ByondInstallerBase > Logger
Gets the ILogger for the ByondInstallerBase.
abstract Task InstallByond(Version version, string path, CancellationToken cancellationToken)
Does actions necessary to get an extracted BYOND installation working. A Task representing the runnin...
ByondInstallerBase(IIOManager ioManager, IFileDownloader fileDownloader, ILogger< ByondInstallerBase > logger)
Initializes a new instance of the ByondInstallerBase class.
abstract string ByondRevisionsUrlTemplate
Gets the URL formatter string for downloading a byond version of {0:Major} {1:Minor}.
abstract Task UpgradeInstallation(Version version, string path, CancellationToken cancellationToken)
Does actions necessary to get upgrade a BYOND version installed by a previous version of TGS....
IFileStreamProvider that provides a ISeekableFileStreamProvider from an input Stream.
For downloading and installing BYOND extractions for a given system.
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 DeleteDirectory(string path, CancellationToken cancellationToken)
Recursively delete a directory, removes and does not enter any symlinks encounterd.