From acd293a58a8efe20f98d8702d4823fae5ef81316 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 10 Sep 2021 18:21:23 -0500 Subject: remove I/ManagementService --- .../Management/API/Controllers/ServerController.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/slskd/Application/Management/API/Controllers/ServerController.cs') diff --git a/src/slskd/Application/Management/API/Controllers/ServerController.cs b/src/slskd/Application/Management/API/Controllers/ServerController.cs index fc47f475..127b59c0 100644 --- a/src/slskd/Application/Management/API/Controllers/ServerController.cs +++ b/src/slskd/Application/Management/API/Controllers/ServerController.cs @@ -32,12 +32,15 @@ namespace slskd.Management.API public class ServerController : ControllerBase { public ServerController( - IManagementService managementService) + IApplication application, + IStateMonitor applicationStateMonitor) { - Management = managementService; + Application = application; + ApplicationStateMonitor = applicationStateMonitor; } - private IManagementService Management { get; } + private IApplication Application { get; } + private IStateMonitor ApplicationStateMonitor { get; } /// /// Connects the client. @@ -50,9 +53,9 @@ namespace slskd.Management.API [ProducesResponseType(403)] public async Task Connect() { - if (!Management.ServerState.IsConnected) + if (!ApplicationStateMonitor.CurrentValue.Server.IsConnected) { - await Management.ConnectServerAsync(); + await Application.ConnectAsync(); } return Ok(); @@ -70,9 +73,9 @@ namespace slskd.Management.API [ProducesResponseType(403)] public IActionResult Disconnect([FromBody] string message) { - if (Management.ServerState.IsConnected) + if (ApplicationStateMonitor.CurrentValue.Server.IsConnected) { - Management.DisconnectServer(message); + Application.Disconnect(message); } return NoContent(); @@ -90,7 +93,7 @@ namespace slskd.Management.API [ProducesResponseType(403)] public IActionResult Get() { - return Ok(Management.ServerState); + return Ok(ApplicationStateMonitor.CurrentValue.Server); } } } \ No newline at end of file -- cgit v1.2.3