From 5cccb58849a2cb36cf41c26602df36a425e7c544 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 23 Jun 2021 08:34:06 -0500 Subject: docs for ManagementService --- .../Application/Management/IManagementService.cs | 21 ++++++++++++++++- .../Application/Management/ManagementService.cs | 26 ++++++++++++++++++++-- 2 files changed, 44 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/slskd/Application/Management/IManagementService.cs b/src/slskd/Application/Management/IManagementService.cs index 8e890b1e..4ee2185e 100644 --- a/src/slskd/Application/Management/IManagementService.cs +++ b/src/slskd/Application/Management/IManagementService.cs @@ -17,12 +17,31 @@ namespace slskd.Management { + using System; using System.Threading.Tasks; + /// + /// Application and Soulseek client management. + /// public interface IManagementService { - void DisconnectServer(string message = null); + /// + /// Disconnects the Soulseek client from the server. + /// + /// An optional message containing the reason for the disconnect. + /// An optional Exception to associate with the disconnect. + void DisconnectServer(string message = null, Exception exception = null); + + /// + /// Connects the Soulseek client to the server using the configured username and password. + /// + /// The operation context. Task ConnectServerAsync(); + + /// + /// Gets the current state of the connection to the Soulseek server. + /// + /// The current server state. ServerState GetServerState(); } } diff --git a/src/slskd/Application/Management/ManagementService.cs b/src/slskd/Application/Management/ManagementService.cs index 2c15b441..84935879 100644 --- a/src/slskd/Application/Management/ManagementService.cs +++ b/src/slskd/Application/Management/ManagementService.cs @@ -17,11 +17,20 @@ namespace slskd.Management { + using System; using System.Threading.Tasks; using Soulseek; + /// + /// Application and Soulseek client management. + /// public class ManagementService : IManagementService { + /// + /// Initializes a new instance of the class. + /// + /// The options monitor used to derive application options. + /// The Soulseek client. public ManagementService( Microsoft.Extensions.Options.IOptionsMonitor optionsMonitor, ISoulseekClient soulseekClient) @@ -33,12 +42,25 @@ namespace slskd.Management private ISoulseekClient Client { get; } private Options Options { get; } - public void DisconnectServer(string message = null) - => Client.Disconnect(message, new IntentionalDisconnectException(message)); + /// + /// Disconnects the Soulseek client from the server. + /// + /// An optional message containing the reason for the disconnect. + /// An optional Exception to associate with the disconnect. + public void DisconnectServer(string message = null, Exception exception = null) + => Client.Disconnect(message, exception ?? new IntentionalDisconnectException(message)); + /// + /// Connects the Soulseek client to the server using the configured username and password. + /// + /// The operation context. public Task ConnectServerAsync() => Client.ConnectAsync(Options.Soulseek.Username, Options.Soulseek.Password); + /// + /// Gets the current state of the connection to the Soulseek server. + /// + /// The current server state. public ServerState GetServerState() => new ServerState() { -- cgit v1.2.3