aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-06-23 08:34:06 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-06-23 08:34:06 -0500
commit5cccb58849a2cb36cf41c26602df36a425e7c544 (patch)
tree7d2bbdbca14a37e35669ce4f0d7be634d0a9cc1e
parent0e3bcb456b37e71895ae929190e0723438318685 (diff)
downloadslskd-5cccb58849a2cb36cf41c26602df36a425e7c544.tar.gz
docs for ManagementService
-rw-r--r--src/slskd/Application/Management/IManagementService.cs21
-rw-r--r--src/slskd/Application/Management/ManagementService.cs26
2 files changed, 44 insertions, 3 deletions
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;
+ /// <summary>
+ /// Application and Soulseek client management.
+ /// </summary>
public interface IManagementService
{
- void DisconnectServer(string message = null);
+ /// <summary>
+ /// Disconnects the Soulseek client from the server.
+ /// </summary>
+ /// <param name="message">An optional message containing the reason for the disconnect.</param>
+ /// <param name="exception">An optional Exception to associate with the disconnect.</param>
+ void DisconnectServer(string message = null, Exception exception = null);
+
+ /// <summary>
+ /// Connects the Soulseek client to the server using the configured username and password.
+ /// </summary>
+ /// <returns>The operation context.</returns>
Task ConnectServerAsync();
+
+ /// <summary>
+ /// Gets the current state of the connection to the Soulseek server.
+ /// </summary>
+ /// <returns>The current server state.</returns>
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;
+ /// <summary>
+ /// Application and Soulseek client management.
+ /// </summary>
public class ManagementService : IManagementService
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ManagementService"/> class.
+ /// </summary>
+ /// <param name="optionsMonitor">The options monitor used to derive application options.</param>
+ /// <param name="soulseekClient">The Soulseek client.</param>
public ManagementService(
Microsoft.Extensions.Options.IOptionsMonitor<Options> 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));
+ /// <summary>
+ /// Disconnects the Soulseek client from the server.
+ /// </summary>
+ /// <param name="message">An optional message containing the reason for the disconnect.</param>
+ /// <param name="exception">An optional Exception to associate with the disconnect.</param>
+ public void DisconnectServer(string message = null, Exception exception = null)
+ => Client.Disconnect(message, exception ?? new IntentionalDisconnectException(message));
+ /// <summary>
+ /// Connects the Soulseek client to the server using the configured username and password.
+ /// </summary>
+ /// <returns>The operation context.</returns>
public Task ConnectServerAsync()
=> Client.ConnectAsync(Options.Soulseek.Username, Options.Soulseek.Password);
+ /// <summary>
+ /// Gets the current state of the connection to the Soulseek server.
+ /// </summary>
+ /// <returns>The current server state.</returns>
public ServerState GetServerState() =>
new ServerState()
{