1 using Byond.TopicSender;
2 using Microsoft.Extensions.Logging;
5 using System.Threading.Tasks;
154 ILoggerFactory loggerFactory,
155 ITopicClient byondTopicSender,
172 this.ioManager = ioManager ??
throw new ArgumentNullException(nameof(ioManager));
173 this.databaseContextFactory = databaseContextFactory ??
throw new ArgumentNullException(nameof(databaseContextFactory));
174 this.assemblyInformationProvider = assemblyInformationProvider ??
throw new ArgumentNullException(nameof(assemblyInformationProvider));
175 this.loggerFactory = loggerFactory ??
throw new ArgumentNullException(nameof(loggerFactory));
176 this.byondTopicSender = byondTopicSender ??
throw new ArgumentNullException(nameof(byondTopicSender));
177 this.cryptographySuite = cryptographySuite ??
throw new ArgumentNullException(nameof(cryptographySuite));
178 this.synchronousIOManager = synchronousIOManager ??
throw new ArgumentNullException(nameof(synchronousIOManager));
179 this.symlinkFactory = symlinkFactory ??
throw new ArgumentNullException(nameof(symlinkFactory));
180 this.byondInstaller = byondInstaller ??
throw new ArgumentNullException(nameof(byondInstaller));
181 this.chatFactory = chatFactory ??
throw new ArgumentNullException(nameof(chatFactory));
182 this.processExecutor = processExecutor ??
throw new ArgumentNullException(nameof(processExecutor));
183 this.postWriteHandler = postWriteHandler ??
throw new ArgumentNullException(nameof(postWriteHandler));
184 this.watchdogFactory = watchdogFactory ??
throw new ArgumentNullException(nameof(watchdogFactory));
185 this.jobManager = jobManager ??
throw new ArgumentNullException(nameof(jobManager));
186 this.networkPromptReaper = networkPromptReaper ??
throw new ArgumentNullException(nameof(networkPromptReaper));
187 this.gitHubClientFactory = gitHubClientFactory ??
throw new ArgumentNullException(nameof(gitHubClientFactory));
188 this.platformIdentifier = platformIdentifier ??
throw new ArgumentNullException(nameof(platformIdentifier));
189 this.repositoryFactory = repositoryFactory ??
throw new ArgumentNullException(nameof(repositoryFactory));
190 this.repositoryCommands = repositoryCommands ??
throw new ArgumentNullException(nameof(repositoryCommands));
191 this.serverPortProvider = serverPortProvider ??
throw new ArgumentNullException(nameof(serverPortProvider));
195 #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 var watchdog = watchdogFactory.CreateWatchdog(
249 sessionControllerFactory,
251 metadata.CloneMetadata(),
252 metadata.DreamDaemonSettings);
253 eventConsumer.SetWatchdog(watchdog);
254 commandFactory.SetWatchdog(watchdog);
262 sessionControllerFactory,
270 metadata.CloneMetadata());
273 metadata.CloneMetadata(),
280 databaseContextFactory,
284 loggerFactory.CreateLogger<
Instance>());
296 dmbFactory.Dispose();
302 chatManager.Dispose();
308 repoManager.Dispose();
312 #pragma warning restore CA1506 317 CheckSystemCompatibility();
318 return byondInstaller.CleanCache(cancellationToken);
322 public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
327 private void CheckSystemCompatibility() => repositoryFactory.CreateInMemory().Dispose();
readonly ITopicClient byondTopicSender
The ITopicClient for the InstanceFactory
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
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
InstanceFactory(IIOManager ioManager, IDatabaseContextFactory databaseContextFactory, IAssemblyInformationProvider assemblyInformationProvider, ILoggerFactory loggerFactory, ITopicClient byondTopicSender, 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
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
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.
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'