aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-07-10 23:51:16 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-07-10 23:51:16 -0500
commitde48f04b36c784061fd26bc47adaf244c0b8dfe8 (patch)
tree8635a6f8cd2a7f2acaf5871d09d77c809317995a /src
parentc67223f7b4d4c9f8baa80a9dbf48c8fd69c4c2eb (diff)
downloadslskd-de48f04b36c784061fd26bc47adaf244c0b8dfe8.tar.gz
add GetOptions()
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application/Management/IManagementService.cs14
-rw-r--r--src/slskd/Application/Management/ManagementService.cs21
2 files changed, 24 insertions, 11 deletions
diff --git a/src/slskd/Application/Management/IManagementService.cs b/src/slskd/Application/Management/IManagementService.cs
index 4ee2185e..5ece698b 100644
--- a/src/slskd/Application/Management/IManagementService.cs
+++ b/src/slskd/Application/Management/IManagementService.cs
@@ -26,6 +26,12 @@ namespace slskd.Management
public interface IManagementService
{
/// <summary>
+ /// Connects the Soulseek client to the server using the configured username and password.
+ /// </summary>
+ /// <returns>The operation context.</returns>
+ Task ConnectServerAsync();
+
+ /// <summary>
/// Disconnects the Soulseek client from the server.
/// </summary>
/// <param name="message">An optional message containing the reason for the disconnect.</param>
@@ -33,10 +39,10 @@ namespace slskd.Management
void DisconnectServer(string message = null, Exception exception = null);
/// <summary>
- /// Connects the Soulseek client to the server using the configured username and password.
+ /// Gets the current application options.
/// </summary>
- /// <returns>The operation context.</returns>
- Task ConnectServerAsync();
+ /// <returns></returns>
+ Options GetOptions();
/// <summary>
/// Gets the current state of the connection to the Soulseek server.
@@ -44,4 +50,4 @@ namespace slskd.Management
/// <returns>The current server state.</returns>
ServerState GetServerState();
}
-}
+} \ No newline at end of file
diff --git a/src/slskd/Application/Management/ManagementService.cs b/src/slskd/Application/Management/ManagementService.cs
index 84935879..4a385cff 100644
--- a/src/slskd/Application/Management/ManagementService.cs
+++ b/src/slskd/Application/Management/ManagementService.cs
@@ -35,12 +35,20 @@ namespace slskd.Management
Microsoft.Extensions.Options.IOptionsMonitor<Options> optionsMonitor,
ISoulseekClient soulseekClient)
{
- Options = optionsMonitor.CurrentValue;
+ OptionsMonitor = optionsMonitor;
Client = soulseekClient;
}
private ISoulseekClient Client { get; }
- private Options Options { get; }
+ private Options Options => OptionsMonitor.CurrentValue;
+ private Microsoft.Extensions.Options.IOptionsMonitor<Options> OptionsMonitor { get; }
+
+ /// <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>
/// Disconnects the Soulseek client from the server.
@@ -51,11 +59,10 @@ namespace slskd.Management
=> Client.Disconnect(message, exception ?? new IntentionalDisconnectException(message));
/// <summary>
- /// Connects the Soulseek client to the server using the configured username and password.
+ /// Gets the current application options.
/// </summary>
- /// <returns>The operation context.</returns>
- public Task ConnectServerAsync()
- => Client.ConnectAsync(Options.Soulseek.Username, Options.Soulseek.Password);
+ /// <returns></returns>
+ public Options GetOptions() => Options;
/// <summary>
/// Gets the current state of the connection to the Soulseek server.
@@ -70,4 +77,4 @@ namespace slskd.Management
Username = Client.Username,
};
}
-}
+} \ No newline at end of file