tgstation-server  4.3.2
The /tg/station 13 server suite
DmbProvider.cs
Go to the documentation of this file.
1 using System;
2 using Tgstation.Server.Host.IO;
4 
5 namespace Tgstation.Server.Host.Components.Deployment
6 {
8  sealed class DmbProvider : IDmbProvider
9  {
11  public string DmbName => String.Concat(CompileJob.DmeName, DreamMaker.DmbExtension);
12 
14  public string PrimaryDirectory => ioManager.ResolvePath(ioManager.ConcatPath(CompileJob.DirectoryName.ToString(), DreamMaker.ADirectoryName));
15 
17  public string SecondaryDirectory => ioManager.ResolvePath(ioManager.ConcatPath(CompileJob.DirectoryName.ToString(), DreamMaker.BDirectoryName));
18 
22  public CompileJob CompileJob { get; }
23 
28 
32  Action onDispose;
33 
40  public DmbProvider(CompileJob compileJob, IIOManager ioManager, Action onDispose)
41  {
42  CompileJob = compileJob ?? throw new ArgumentNullException(nameof(compileJob));
43  this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
44  this.onDispose = onDispose ?? throw new ArgumentNullException(nameof(onDispose));
45  }
46 
48  public void Dispose() => onDispose?.Invoke();
49 
51  public void KeepAlive() => onDispose = null;
52  }
53 }
string DmeName
The .dme file used for compilation
Definition: CompileJob.cs:16
DmbProvider(CompileJob compileJob, IIOManager ioManager, Action onDispose)
Construct a DmbProvider
Definition: DmbProvider.cs:40
const string ADirectoryName
Name of the primary directory used for compilation
Definition: DreamMaker.cs:33
readonly IIOManager ioManager
The IIOManager for the DmbProvider
Definition: DmbProvider.cs:27
const string DmbExtension
Extension for .dmbs
Definition: DreamMaker.cs:43
Guid DirectoryName
The Game folder the results were compiled into
Definition: CompileJob.cs:28
Action onDispose
The Action to run when Dispose is called
Definition: DmbProvider.cs:32
Provides absolute paths to the latest compiled .dmbs
Definition: IDmbProvider.cs:9
Interface for using filesystems
Definition: IIOManager.cs:11
const string BDirectoryName
Name of the secondary directory used for compilation
Definition: DreamMaker.cs:38