diff options
Diffstat (limited to 'src/slskd/Application/Management/ManagementService.cs')
| -rw-r--r-- | src/slskd/Application/Management/ManagementService.cs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/slskd/Application/Management/ManagementService.cs b/src/slskd/Application/Management/ManagementService.cs index 84935879..66ed2b97 100644 --- a/src/slskd/Application/Management/ManagementService.cs +++ b/src/slskd/Application/Management/ManagementService.cs @@ -15,6 +15,8 @@ // along with this program. If not, see https://www.gnu.org/licenses/. // </copyright> +using Microsoft.Extensions.Options; + namespace slskd.Management { using System; @@ -32,15 +34,23 @@ namespace slskd.Management /// <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, + 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 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,13 +61,6 @@ namespace slskd.Management => 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> @@ -70,4 +73,4 @@ namespace slskd.Management Username = Client.Username, }; } -} +}
\ No newline at end of file |
