From de48f04b36c784061fd26bc47adaf244c0b8dfe8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 10 Jul 2021 23:51:16 -0500 Subject: add GetOptions() --- .../Application/Management/IManagementService.cs | 14 ++++++++++---- .../Application/Management/ManagementService.cs | 21 ++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) (limited to 'src') 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 @@ -25,6 +25,12 @@ namespace slskd.Management /// public interface IManagementService { + /// + /// Connects the Soulseek client to the server using the configured username and password. + /// + /// The operation context. + Task ConnectServerAsync(); + /// /// Disconnects the Soulseek client from the server. /// @@ -33,10 +39,10 @@ namespace slskd.Management void DisconnectServer(string message = null, Exception exception = null); /// - /// Connects the Soulseek client to the server using the configured username and password. + /// Gets the current application options. /// - /// The operation context. - Task ConnectServerAsync(); + /// + Options GetOptions(); /// /// Gets the current state of the connection to the Soulseek server. @@ -44,4 +50,4 @@ namespace slskd.Management /// The current server state. 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 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 OptionsMonitor { get; } + + /// + /// 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); /// /// Disconnects the Soulseek client from the server. @@ -51,11 +59,10 @@ namespace slskd.Management => Client.Disconnect(message, exception ?? new IntentionalDisconnectException(message)); /// - /// Connects the Soulseek client to the server using the configured username and password. + /// Gets the current application options. /// - /// The operation context. - public Task ConnectServerAsync() - => Client.ConnectAsync(Options.Soulseek.Username, Options.Soulseek.Password); + /// + public Options GetOptions() => Options; /// /// 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 -- cgit v1.2.3