tgstation-server
The /tg/station 13 server suite
CommandFactory.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
7 
8 namespace Tgstation.Server.Host.Components.Chat.Commands
9 {
12  {
17 
22 
27 
32 
36  readonly Models.Instance instance;
37 
42 
51  public CommandFactory(IApplication application, IByondManager byondManager, IRepositoryManager repositoryManager, IDatabaseContextFactory databaseContextFactory, Models.Instance instance)
52  {
53  this.application = application ?? throw new ArgumentNullException(nameof(application));
54  this.byondManager = byondManager ?? throw new ArgumentNullException(nameof(byondManager));
55  this.repositoryManager = repositoryManager ?? throw new ArgumentNullException(nameof(repositoryManager));
56  this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
57  this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
58  }
59 
64  public void SetWatchdog(IWatchdog watchdog)
65  {
66  if (this.watchdog != null)
67  throw new InvalidOperationException("SetWatchdog has already been called!");
68  this.watchdog = watchdog ?? throw new ArgumentNullException(nameof(watchdog));
69  }
70 
72  public IReadOnlyList<ICommand> GenerateCommands()
73  {
74  if (watchdog == null)
75  throw new InvalidOperationException("SetWatchdog has not been called!");
76  return new List<ICommand>
77  {
78  new VersionCommand(application),
79  new ByondCommand(byondManager, watchdog),
80  new RevisionCommand(watchdog, repositoryManager, instance),
81  new PullRequestsCommand(watchdog, repositoryManager, databaseContextFactory, instance),
82  new KekCommand()
83  };
84  }
85  }
86 }
Configures the ASP.NET Core web application
Definition: IApplication.cs:8
readonly IByondManager byondManager
The IByondManager for the CommandFactory
Factory for scoping usage of IDatabaseContexts. Meant for use by Components
readonly Models.Instance instance
The Models.Instance for the CommandFactory
ICommand to return the IApplication.VersionString
readonly IDatabaseContextFactory databaseContextFactory
The IDatabaseContextFactory for the CommandFactory
Command for reading the active Api.Models.TestMerges
For managing the BYOND installation
IWatchdog watchdog
The IWatchdog for the CommandFactory
CommandFactory(IApplication application, IByondManager byondManager, IRepositoryManager repositoryManager, IDatabaseContextFactory databaseContextFactory, Models.Instance instance)
Construct a CommandFactory
IReadOnlyList< ICommand > GenerateCommands()
Generate builtin ICommands
For displaying Api.Models.Internal.RevisionInformation
For displaying the installed Byond version
Definition: ByondCommand.cs:14
Factory for creating and loading IRepositorys
void SetWatchdog(IWatchdog watchdog)
Set a watchdog for the CommandFactory
readonly IApplication application
The IApplication for the CommandFactory
readonly IRepositoryManager repositoryManager
The IRepositoryManager for the CommandFactory
Runs and monitors the twin server controllers
Definition: IWatchdog.cs:12