tgstation-server  4.4.0
The /tg/station 13 server suite
CommandFactory.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
8 
9 namespace Tgstation.Server.Host.Components.Chat.Commands
10 {
13  {
18 
23 
28 
33 
37  readonly Models.Instance instance;
38 
43 
53  IAssemblyInformationProvider assemblyInformationProvider,
54  IByondManager byondManager,
55  IRepositoryManager repositoryManager,
56  IDatabaseContextFactory databaseContextFactory,
57  Models.Instance instance)
58  {
59  this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
60  this.byondManager = byondManager ?? throw new ArgumentNullException(nameof(byondManager));
61  this.repositoryManager = repositoryManager ?? throw new ArgumentNullException(nameof(repositoryManager));
62  this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
63  this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
64  }
65 
70  public void SetWatchdog(IWatchdog watchdog)
71  {
72  if (this.watchdog != null)
73  throw new InvalidOperationException("SetWatchdog has already been called!");
74  this.watchdog = watchdog ?? throw new ArgumentNullException(nameof(watchdog));
75  }
76 
78  public IReadOnlyList<ICommand> GenerateCommands()
79  {
80  if (watchdog == null)
81  throw new InvalidOperationException("SetWatchdog has not been called!");
82  return new List<ICommand>
83  {
84  new VersionCommand(assemblyInformationProvider),
85  new ByondCommand(byondManager, watchdog),
86  new RevisionCommand(watchdog, repositoryManager),
87  new PullRequestsCommand(watchdog, repositoryManager, databaseContextFactory, instance),
88  new KekCommand()
89  };
90  }
91  }
92 }
Factory for scoping usage of IDatabaseContexts. Meant for use by Components
readonly IByondManager byondManager
The IByondManager for the CommandFactory
readonly Models.Instance instance
The Models.Instance for the CommandFactory
ICommand to return the IAssemblyInformationProvider.VersionString
readonly IDatabaseContextFactory databaseContextFactory
The IDatabaseContextFactory for the CommandFactory
For managing the BYOND installation
IWatchdog watchdog
The IWatchdog for the CommandFactory
IReadOnlyList< ICommand > GenerateCommands()
Generate builtin ICommands
For displaying Api.Models.Internal.RevisionInformation
For displaying the installed Byond version
Definition: ByondCommand.cs:15
Factory for creating and loading IRepositorys
void SetWatchdog(IWatchdog watchdog)
Set a watchdog for the CommandFactory
CommandFactory(IAssemblyInformationProvider assemblyInformationProvider, IByondManager byondManager, IRepositoryManager repositoryManager, IDatabaseContextFactory databaseContextFactory, Models.Instance instance)
Construct a CommandFactory
readonly IRepositoryManager repositoryManager
The IRepositoryManager for the CommandFactory
Runs and monitors the twin server controllers
Definition: IWatchdog.cs:15
readonly IAssemblyInformationProvider assemblyInformationProvider
The IAssemblyInformationProvider for the CommandFactory