1 using Microsoft.Extensions.Logging;
4 using System.Threading.Tasks;
153 ILoggerFactory loggerFactory,
171 this.ioManager = ioManager ??
throw new ArgumentNullException(nameof(ioManager));
172 this.databaseContextFactory = databaseContextFactory ??
throw new ArgumentNullException(nameof(databaseContextFactory));
173 this.assemblyInformationProvider = assemblyInformationProvider ??
throw new ArgumentNullException(nameof(assemblyInformationProvider));
174 this.loggerFactory = loggerFactory ??
throw new ArgumentNullException(nameof(loggerFactory));
175 this.topicClientFactory = topicClientFactory ??
throw new ArgumentNullException(nameof(topicClientFactory));
176 this.cryptographySuite = cryptographySuite ??
throw new ArgumentNullException(nameof(cryptographySuite));
177 this.synchronousIOManager = synchronousIOManager ??
throw new ArgumentNullException(nameof(synchronousIOManager));
178 this.symlinkFactory = symlinkFactory ??
throw new ArgumentNullException(nameof(symlinkFactory));
179 this.byondInstaller = byondInstaller ??
throw new ArgumentNullException(nameof(byondInstaller));
180 this.chatFactory = chatFactory ??
throw new ArgumentNullException(nameof(chatFactory));
181 this.processExecutor = processExecutor ??
throw new ArgumentNullException(nameof(processExecutor));
182 this.postWriteHandler = postWriteHandler ??
throw new ArgumentNullException(nameof(postWriteHandler));
183 this.watchdogFactory = watchdogFactory ??
throw new ArgumentNullException(nameof(watchdogFactory));
184 this.jobManager = jobManager ??
throw new ArgumentNullException(nameof(jobManager));
185 this.networkPromptReaper = networkPromptReaper ??
throw new ArgumentNullException(nameof(networkPromptReaper));
186 this.gitHubClientFactory = gitHubClientFactory ??
throw new ArgumentNullException(nameof(gitHubClientFactory));
187 this.platformIdentifier = platformIdentifier ??
throw new ArgumentNullException(nameof(platformIdentifier));
188 this.repositoryFactory = repositoryFactory ??
throw new ArgumentNullException(nameof(repositoryFactory));
189 this.repositoryCommands = repositoryCommands ??
throw new ArgumentNullException(nameof(repositoryCommands));
190 this.serverPortProvider = serverPortProvider ??
throw new ArgumentNullException(nameof(serverPortProvider));
194 #pragma warning disable CA1506 // TODO: Decomplexify 205 var configurationIoManager =
new ResolvingIOManager(instanceIoManager,
"Configuration");
207 var configuration =
new StaticFiles.Configuration(configurationIoManager, synchronousIOManager, symlinkFactory, processExecutor, postWriteHandler, platformIdentifier, loggerFactory.CreateLogger<StaticFiles.Configuration>());
218 var byond =
new ByondManager(byondIOManager, byondInstaller, eventConsumer, loggerFactory.CreateLogger<
ByondManager>());
220 var commandFactory =
new CommandFactory(assemblyInformationProvider, byond, repoManager, databaseContextFactory, metadata);
222 var chatManager = chatFactory.CreateChatManager(instanceIoManager, commandFactory, metadata.ChatSettings);
230 assemblyInformationProvider,
239 metadata.CloneMetadata());
241 var dmbFactory =
new DmbFactory(databaseContextFactory, gameIoManager, loggerFactory.CreateLogger<
DmbFactory>(), metadata.CloneMetadata());
245 databaseContextFactory,
249 metadata.CloneMetadata());
250 var watchdog = watchdogFactory.CreateWatchdog(
254 sessionControllerFactory,
256 diagnosticsIOManager,
258 metadata.CloneMetadata(),
259 metadata.DreamDaemonSettings);
260 eventConsumer.SetWatchdog(watchdog);
261 commandFactory.SetWatchdog(watchdog);
269 sessionControllerFactory,
277 metadata.CloneMetadata());
280 metadata.CloneMetadata(),
287 databaseContextFactory,
291 loggerFactory.CreateLogger<
Instance>());
303 dmbFactory.Dispose();
309 chatManager.Dispose();
315 repoManager.Dispose();
319 #pragma warning restore CA1506 324 CheckSystemCompatibility();
325 return byondInstaller.CleanCache(cancellationToken);
329 public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
334 private void CheckSystemCompatibility() => repositoryFactory.CreateInMemory().Dispose();
readonly ISynchronousIOManager synchronousIOManager
The ISynchronousIOManager for the InstanceFactory
readonly IByondInstaller byondInstaller
The IByondInstaller for the InstanceFactory
Task StartAsync(CancellationToken cancellationToken)
Handles changing file modes/permissions after writing
An IIOManager that resolve relative paths from another IIOManager to a subdirectory of that ...
readonly IServerPortProvider serverPortProvider
The IServerPortProvider for the InstanceFactory.
Use server authentication
Factory for scoping usage of IDatabaseContexts. Meant for use by Components
For low level interactions with a LibGit2Sharp.IRepository.
readonly ILoggerFactory loggerFactory
The ILoggerFactory for the InstanceFactory
readonly ICryptographySuite cryptographySuite
The ICryptographySuite for the InstanceFactory
For creating filesystem symbolic links
Factory for ITopicClients
Contains various cryptographic functions
readonly IProcessExecutor processExecutor
The IProcessExecutor for the InstanceFactory
For creating IGitHubClients
readonly INetworkPromptReaper networkPromptReaper
The INetworkPromptReaper for the InstanceFactory
readonly IPostWriteHandler postWriteHandler
The IPostWriteHandler for the InstanceFactory
Factory for creating LibGit2Sharp.IRepositorys.
For downloading and installing BYOND extractions for a given system
For accessing the disk in a synchronous manner
readonly IDatabaseContextFactory databaseContextFactory
The IDatabaseContextFactory for the InstanceFactory
readonly IWatchdogFactory watchdogFactory
The IWatchdogFactory for the InstanceFactory
Factory for creating IInstances
readonly ILibGit2RepositoryFactory repositoryFactory
The ILibGit2RepositoryFactory for the InstanceFactory.
For interacting with the instance services
For creating IChatManagers
readonly IIOManager ioManager
The IIOManager for the InstanceFactory
readonly IGitHubClientFactory gitHubClientFactory
The IGitHubClientFactory for the InstanceFactory
readonly IPlatformIdentifier platformIdentifier
The IPlatformIdentifier for the InstanceFactory
readonly ISymlinkFactory symlinkFactory
The ISymlinkFactory for the InstanceFactory
readonly IJobManager jobManager
The IJobManager for the InstanceFactory
readonly IChatManagerFactory chatFactory
The IChatManagerFactory for the InstanceFactory
readonly ITopicClientFactory topicClientFactory
The ITopicClientFactory for the InstanceFactory
Manages the runtime of Jobs
IInstance CreateInstance(IBridgeRegistrar bridgeRegistrar, Models.Instance metadata)
Create an IInstance
On Windows, DreamDaemon will show an unskippable prompt when using /world/proc/OpenPort(). This looks out for those prompts and immediately clicks "Yes" if the owning process has registered for it
readonly ILibGit2Commands repositoryCommands
The ILibGit2Commands for the InstanceFactory.
Interface for using filesystems
Registers IBridgeHandlers.
InstanceFactory(IIOManager ioManager, IDatabaseContextFactory databaseContextFactory, IAssemblyInformationProvider assemblyInformationProvider, ILoggerFactory loggerFactory, ITopicClientFactory topicClientFactory, ICryptographySuite cryptographySuite, ISynchronousIOManager synchronousIOManager, ISymlinkFactory symlinkFactory, IByondInstaller byondInstaller, IChatManagerFactory chatFactory, IProcessExecutor processExecutor, IPostWriteHandler postWriteHandler, IWatchdogFactory watchdogFactory, IJobManager jobManager, INetworkPromptReaper networkPromptReaper, IGitHubClientFactory gitHubClientFactory, IPlatformIdentifier platformIdentifier, ILibGit2RepositoryFactory repositoryFactory, ILibGit2Commands repositoryCommands, IServerPortProvider serverPortProvider)
Construct an InstanceFactory
Provides access to the server's HttpApiPort.
Repository(LibGit2Sharp.IRepository libGitRepo, ILibGit2Commands commands, IIOManager ioMananger, IEventConsumer eventConsumer, ICredentialsProvider credentialsProvider, ILogger< Repository > logger, Action onDispose)
Construct a Repository
readonly IAssemblyInformationProvider assemblyInformationProvider
The IAssemblyInformationProvider for the InstanceFactory
For launching IProcess'