3using System.Threading.Tasks;
78 public async Task
MakeActive(CancellationToken cancellationToken)
80 if (Interlocked.Exchange(ref
swapped, 1) != 0)
81 throw new InvalidOperationException(
"Already swapped!");
A IDmbProvider that uses symlinks.
string DmbName
The file name of the .dmb.
string Directory
The primary game directory with a trailing directory separator.
readonly IDmbProvider baseProvider
The IDmbProvider we are swapping for.
volatile int swapped
Backing field for Swapped.
void KeepAlive()
Disposing the IDmbProvider won't cause a cleanup of the working directory.
bool Swapped
If MakeActive(CancellationToken) has been run.
async Task MakeActive(CancellationToken cancellationToken)
Make the SwappableDmbProvider active by replacing the live link with our CompileJob.
readonly ISymlinkFactory symlinkFactory
The ISymlinkFactory to use.
const string LiveGameDirectory
The directory where the baseProvider is symlinked to.
readonly IIOManager ioManager
The IIOManager to use.
SwappableDmbProvider(IDmbProvider baseProvider, IIOManager ioManager, ISymlinkFactory symlinkFactory)
Initializes a new instance of the SwappableDmbProvider class.
Provides absolute paths to the latest compiled .dmbs.
void KeepAlive()
Disposing the IDmbProvider won't cause a cleanup of the working directory.
string Directory
The primary game directory with a trailing directory separator.
string DmbName
The file name of the .dmb.
CompileJob CompileJob
The CompileJob of the .dmb.
Interface for using filesystems.
string ResolvePath()
Retrieve the full path of the current working directory.
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.
For creating filesystem symbolic links.
Task CreateSymbolicLink(string targetPath, string linkPath, CancellationToken cancellationToken)
Create a symbolic link.
bool SymlinkedDirectoriesAreDeletedAsFiles
If directory symlinks must be deleted as files would in the current environment.