From a56bfb47abe33d259ba9d12d492123ab4baa3739 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 5 Aug 2021 07:53:24 -0500 Subject: rename more stuff --- .../Application/Management/ManagementService.cs | 61 ++++++++++++---------- 1 file changed, 34 insertions(+), 27 deletions(-) (limited to 'src/slskd/Application/Management/ManagementService.cs') diff --git a/src/slskd/Application/Management/ManagementService.cs b/src/slskd/Application/Management/ManagementService.cs index 2f79f496..3d7bd442 100644 --- a/src/slskd/Application/Management/ManagementService.cs +++ b/src/slskd/Application/Management/ManagementService.cs @@ -1,13 +1,18 @@ // // Copyright (c) slskd Team. All rights reserved. // -// This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public -// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/. +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. // using Microsoft.Extensions.Options; @@ -16,7 +21,6 @@ namespace slskd.Management { using System; using System.Threading.Tasks; - using slskd.Shares; using Soulseek; /// @@ -33,7 +37,7 @@ namespace slskd.Management /// The shared file cache. public ManagementService( IOptionsMonitor optionsMonitor, - IStateMonitor serviceStateMonitor, + IStateMonitor serviceStateMonitor, ISoulseekClient soulseekClient, ISharedFileCache sharedFileCache) { @@ -43,10 +47,32 @@ namespace slskd.Management SharedFileCache = sharedFileCache; } + /// + /// Gets the current state of the slskd service. + /// + public ApplicationState ApplicationState => ServiceStateMonitor.CurrentValue; + + /// + /// Gets the current state of the connection to the Soulseek server. + /// + public ServerState ServerState => + new ServerState() + { + Address = Client.Address, + IPEndPoint = Client.IPEndPoint, + State = Client.State, + Username = Client.Username, + }; + + /// + /// Gets the current state of the connection to the Soulseek server. + /// + public SharedFileCacheState SharedFileCacheState => SharedFileCache.State.CurrentValue; + private ISoulseekClient Client { get; } private Options Options => OptionsMonitor.CurrentValue; private IOptionsMonitor OptionsMonitor { get; } - private IStateMonitor ServiceStateMonitor { get; } + private IStateMonitor ServiceStateMonitor { get; } private ISharedFileCache SharedFileCache { get; } /// @@ -64,25 +90,6 @@ namespace slskd.Management public void DisconnectServer(string message = null, Exception exception = null) => Client.Disconnect(message, exception ?? new IntentionalDisconnectException(message)); - /// - /// Gets the current state of the connection to the Soulseek server. - /// - /// The current server state. - public ServerState GetServerState() => - new ServerState() - { - Address = Client.Address, - IPEndPoint = Client.IPEndPoint, - State = Client.State, - Username = Client.Username, - }; - - /// - /// Gets the current state of the slskd service. - /// - /// - public ServiceState GetServiceState() => ServiceStateMonitor.CurrentValue; - /// /// Re-scans shared directories. /// -- cgit v1.2.3