aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-09-20 09:28:34 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-09-20 09:28:34 -0500
commitb6463178e3f4679386b57614806d148bbc9b883f (patch)
tree0dc83f47800677731cf6db1d0ebf54724c2869b1 /src/slskd/Application
parent8b015940c0386c119a2b83a55c80fa1fc0de2ff1 (diff)
downloadslskd-b6463178e3f4679386b57614806d148bbc9b883f.tar.gz
move stuff around
Diffstat (limited to 'src/slskd/Application')
-rw-r--r--src/slskd/Application/Core/API/Controllers/ApplicationController.cs (renamed from src/slskd/Application/Management/API/Controllers/ApplicationController.cs)2
-rw-r--r--src/slskd/Application/Core/API/Controllers/ConfigurationController.cs (renamed from src/slskd/Application/Management/API/Controllers/ConfigurationController.cs)3
-rw-r--r--src/slskd/Application/Core/API/Controllers/OptionsController.cs (renamed from src/slskd/Application/Management/API/Controllers/OptionsController.cs)2
-rw-r--r--src/slskd/Application/Core/API/Controllers/ServerController.cs (renamed from src/slskd/Application/Management/API/Controllers/ServerController.cs)2
-rw-r--r--src/slskd/Application/Core/API/Controllers/SessionController.cs (renamed from src/slskd/Application/Management/API/Controllers/SessionController.cs)2
-rw-r--r--src/slskd/Application/Core/API/DTO/LoginRequest.cs (renamed from src/slskd/Application/Management/API/DTO/LoginRequest.cs)2
-rw-r--r--src/slskd/Application/Core/API/DTO/ServerState.cs (renamed from src/slskd/Application/Management/API/DTO/ServerState.cs)2
-rw-r--r--src/slskd/Application/Core/API/DTO/TokenResponse.cs (renamed from src/slskd/Application/Management/API/DTO/TokenResponse.cs)2
-rw-r--r--src/slskd/Application/Core/API/Hubs/ApplicationHub.cs (renamed from src/slskd/Application/Hub.cs)10
-rw-r--r--src/slskd/Application/Core/Application.cs (renamed from src/slskd/Application/Application.cs)14
-rw-r--r--src/slskd/Application/Exceptions/ApplicationShutdownException.cs72
-rw-r--r--src/slskd/Application/Exceptions/IntentionalDisconnectException.cs72
-rw-r--r--src/slskd/Application/Exceptions/RetryException.cs72
-rw-r--r--src/slskd/Application/Exceptions/ShareAliasException.cs72
-rw-r--r--src/slskd/Application/Exceptions/ShareScanInProgressException.cs72
-rw-r--r--src/slskd/Application/Exceptions/SlskdException.cs72
-rw-r--r--src/slskd/Application/Shares/SharedFileCache.cs (renamed from src/slskd/Application/SharedFileCache.cs)2
-rw-r--r--src/slskd/Application/UserEndPointCache.cs61
18 files changed, 22 insertions, 514 deletions
diff --git a/src/slskd/Application/Management/API/Controllers/ApplicationController.cs b/src/slskd/Application/Core/API/Controllers/ApplicationController.cs
index 470e5a30..16cd68b9 100644
--- a/src/slskd/Application/Management/API/Controllers/ApplicationController.cs
+++ b/src/slskd/Application/Core/API/Controllers/ApplicationController.cs
@@ -15,7 +15,7 @@
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
-namespace slskd.Management.API
+namespace slskd.Core.API
{
using System;
using System.Diagnostics;
diff --git a/src/slskd/Application/Management/API/Controllers/ConfigurationController.cs b/src/slskd/Application/Core/API/Controllers/ConfigurationController.cs
index c28c5c7e..01c8bbc1 100644
--- a/src/slskd/Application/Management/API/Controllers/ConfigurationController.cs
+++ b/src/slskd/Application/Core/API/Controllers/ConfigurationController.cs
@@ -17,11 +17,10 @@
using Microsoft.Extensions.Options;
-namespace slskd.Management.API
+namespace slskd.Core.API
{
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
- using slskd.Management;
/// <summary>
/// Configuration.
diff --git a/src/slskd/Application/Management/API/Controllers/OptionsController.cs b/src/slskd/Application/Core/API/Controllers/OptionsController.cs
index 6f6275d1..fb2057b9 100644
--- a/src/slskd/Application/Management/API/Controllers/OptionsController.cs
+++ b/src/slskd/Application/Core/API/Controllers/OptionsController.cs
@@ -17,7 +17,7 @@
using Microsoft.Extensions.Options;
-namespace slskd.Management.API
+namespace slskd.Core.API
{
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/src/slskd/Application/Management/API/Controllers/ServerController.cs b/src/slskd/Application/Core/API/Controllers/ServerController.cs
index e3199d78..172333ec 100644
--- a/src/slskd/Application/Management/API/Controllers/ServerController.cs
+++ b/src/slskd/Application/Core/API/Controllers/ServerController.cs
@@ -17,7 +17,7 @@
using Microsoft.Extensions.Options;
-namespace slskd.Management.API
+namespace slskd.Core.API
{
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
diff --git a/src/slskd/Application/Management/API/Controllers/SessionController.cs b/src/slskd/Application/Core/API/Controllers/SessionController.cs
index a9ae0188..5f20aa9f 100644
--- a/src/slskd/Application/Management/API/Controllers/SessionController.cs
+++ b/src/slskd/Application/Core/API/Controllers/SessionController.cs
@@ -17,7 +17,7 @@
using Microsoft.Extensions.Options;
-namespace slskd.Management.API
+namespace slskd.Core.API
{
using System;
using System.Collections.Generic;
diff --git a/src/slskd/Application/Management/API/DTO/LoginRequest.cs b/src/slskd/Application/Core/API/DTO/LoginRequest.cs
index d4b8dd75..0653847d 100644
--- a/src/slskd/Application/Management/API/DTO/LoginRequest.cs
+++ b/src/slskd/Application/Core/API/DTO/LoginRequest.cs
@@ -15,7 +15,7 @@
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
-namespace slskd.Management.API
+namespace slskd.Core.API
{
public class LoginRequest
{
diff --git a/src/slskd/Application/Management/API/DTO/ServerState.cs b/src/slskd/Application/Core/API/DTO/ServerState.cs
index 80c1e856..5dd16365 100644
--- a/src/slskd/Application/Management/API/DTO/ServerState.cs
+++ b/src/slskd/Application/Core/API/DTO/ServerState.cs
@@ -15,7 +15,7 @@
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
-namespace slskd.Management
+namespace slskd.Core
{
using System.Net;
using Soulseek;
diff --git a/src/slskd/Application/Management/API/DTO/TokenResponse.cs b/src/slskd/Application/Core/API/DTO/TokenResponse.cs
index 21508b81..85992917 100644
--- a/src/slskd/Application/Management/API/DTO/TokenResponse.cs
+++ b/src/slskd/Application/Core/API/DTO/TokenResponse.cs
@@ -15,7 +15,7 @@
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
-namespace slskd.Management.API
+namespace slskd.Core.API
{
using System;
using System.IdentityModel.Tokens.Jwt;
diff --git a/src/slskd/Application/Hub.cs b/src/slskd/Application/Core/API/Hubs/ApplicationHub.cs
index 0112bcb2..be6c2fe7 100644
--- a/src/slskd/Application/Hub.cs
+++ b/src/slskd/Application/Core/API/Hubs/ApplicationHub.cs
@@ -1,4 +1,4 @@
-// <copyright file="Hub.cs" company="slskd Team">
+// <copyright file="ApplicationHub.cs" company="slskd Team">
// Copyright (c) slskd Team. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@@ -15,7 +15,7 @@
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
-namespace slskd
+namespace slskd.Core
{
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
@@ -23,7 +23,7 @@ namespace slskd
/// <summary>
/// Extension methods for the application SignalR hub.
/// </summary>
- public static class HubExtensions
+ public static class ApplicationHubExtensions
{
/// <summary>
/// Broadcast the present application state.
@@ -31,7 +31,7 @@ namespace slskd
/// <param name="hub">The hub.</param>
/// <param name="state">The state to broadcast.</param>
/// <returns>The operation context.</returns>
- public static Task BroadcastStateAsync(this IHubContext<Hub> hub, State state)
+ public static Task BroadcastStateAsync(this IHubContext<ApplicationHub> hub, State state)
{
return hub.Clients.All.SendAsync(Methods.State, state);
}
@@ -45,7 +45,7 @@ namespace slskd
/// <summary>
/// The application SignalR hub.
/// </summary>
- public class Hub : Microsoft.AspNetCore.SignalR.Hub
+ public class ApplicationHub : Hub
{
}
} \ No newline at end of file
diff --git a/src/slskd/Application/Application.cs b/src/slskd/Application/Core/Application.cs
index 97294164..56eac586 100644
--- a/src/slskd/Application/Application.cs
+++ b/src/slskd/Application/Core/Application.cs
@@ -15,7 +15,9 @@
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
-namespace slskd
+using Microsoft.Extensions.Options;
+
+namespace slskd.Core
{
using System;
using System.Collections.Concurrent;
@@ -27,13 +29,13 @@ namespace slskd
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Hosting;
- using Microsoft.Extensions.Options;
using Serilog;
using Serilog.Events;
using slskd.Configuration;
using slskd.Integrations.Pushbullet;
using slskd.Messaging;
using slskd.Search;
+ using slskd.Shares;
using slskd.Transfers;
using slskd.Users;
using Soulseek;
@@ -61,7 +63,7 @@ namespace slskd
IRoomService roomService,
ISharedFileCache sharedFileCache,
IPushbulletService pushbulletService,
- IHubContext<Hub> hubContext)
+ IHubContext<ApplicationHub> applicationHub)
{
OptionsAtStartup = optionsAtStartup;
@@ -82,7 +84,7 @@ namespace slskd
Pushbullet = pushbulletService;
RoomService = roomService;
- HubContext = hubContext;
+ ApplicationHub = applicationHub;
Client = soulseekClient;
@@ -124,7 +126,7 @@ namespace slskd
private DateTime SharesRefreshStarted { get; set; }
private IManagedState<State> State { get; }
private ITransferTracker TransferTracker { get; set; }
- private IHubContext<Hub> HubContext { get; set; }
+ private IHubContext<ApplicationHub> ApplicationHub { get; set; }
/// <summary>
/// Gets the version of the latest application release.
@@ -732,7 +734,7 @@ namespace slskd
private void State_OnChange((State Previous, State Current) state)
{
Logger.Debug("State changed from {Previous} to {Current}", state.Previous.ToJson(), state.Current.ToJson());
- HubContext.BroadcastStateAsync(state.Current);
+ ApplicationHub.BroadcastStateAsync(state.Current);
}
/// <summary>
diff --git a/src/slskd/Application/Exceptions/ApplicationShutdownException.cs b/src/slskd/Application/Exceptions/ApplicationShutdownException.cs
deleted file mode 100644
index e30b5c79..00000000
--- a/src/slskd/Application/Exceptions/ApplicationShutdownException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// <copyright file="ApplicationShutdownException.cs" company="slskd Team">
-// 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 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/.
-// </copyright>
-
-namespace slskd
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Represents a normal application shutdown.
- /// </summary>
- [ExcludeFromCodeCoverage]
- [Serializable]
- public class ApplicationShutdownException : SlskdException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ApplicationShutdownException"/> class.
- /// </summary>
- public ApplicationShutdownException()
- : base()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ApplicationShutdownException"/> class with a specified error message.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ApplicationShutdownException(string message)
- : base(message)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ApplicationShutdownException"/> class with a specified error message and a
- /// reference to the inner exception that is the cause of this exception.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- /// <param name="innerException">
- /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no
- /// inner exception is specified.
- /// </param>
- public ApplicationShutdownException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ApplicationShutdownException"/> class with serialized data.
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected ApplicationShutdownException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-} \ No newline at end of file
diff --git a/src/slskd/Application/Exceptions/IntentionalDisconnectException.cs b/src/slskd/Application/Exceptions/IntentionalDisconnectException.cs
deleted file mode 100644
index d5293e63..00000000
--- a/src/slskd/Application/Exceptions/IntentionalDisconnectException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// <copyright file="IntentionalDisconnectException.cs" company="slskd Team">
-// 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 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/.
-// </copyright>
-
-namespace slskd
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Represents an intentional client disconnect.
- /// </summary>
- [ExcludeFromCodeCoverage]
- [Serializable]
- public class IntentionalDisconnectException : SlskdException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="IntentionalDisconnectException"/> class.
- /// </summary>
- public IntentionalDisconnectException()
- : base()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IntentionalDisconnectException"/> class with a specified error message.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public IntentionalDisconnectException(string message)
- : base(message)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IntentionalDisconnectException"/> class with a specified error message and a
- /// reference to the inner exception that is the cause of this exception.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- /// <param name="innerException">
- /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no
- /// inner exception is specified.
- /// </param>
- public IntentionalDisconnectException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IntentionalDisconnectException"/> class with serialized data.
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected IntentionalDisconnectException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-} \ No newline at end of file
diff --git a/src/slskd/Application/Exceptions/RetryException.cs b/src/slskd/Application/Exceptions/RetryException.cs
deleted file mode 100644
index c688f377..00000000
--- a/src/slskd/Application/Exceptions/RetryException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// <copyright file="RetryException.cs" company="slskd Team">
-// 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 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/.
-// </copyright>
-
-namespace slskd
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Represents erorrs that originate while attempting to execute retry logic.
- /// </summary>
- [ExcludeFromCodeCoverage]
- [Serializable]
- public class RetryException : Exception
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="RetryException"/> class.
- /// </summary>
- public RetryException()
- : base()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RetryException"/> class with a specified error message.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public RetryException(string message)
- : base(message)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RetryException"/> class with a specified error message and a
- /// reference to the inner exception that is the cause of this exception.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- /// <param name="innerException">
- /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no
- /// inner exception is specified.
- /// </param>
- public RetryException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RetryException"/> class with serialized data.
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected RetryException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-} \ No newline at end of file
diff --git a/src/slskd/Application/Exceptions/ShareAliasException.cs b/src/slskd/Application/Exceptions/ShareAliasException.cs
deleted file mode 100644
index 3047d0a9..00000000
--- a/src/slskd/Application/Exceptions/ShareAliasException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// <copyright file="ShareAliasException.cs" company="slskd Team">
-// 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 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/.
-// </copyright>
-
-namespace slskd
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Represents an error that occurs when multiple share scans are attempted concurrently.
- /// </summary>
- [ExcludeFromCodeCoverage]
- [Serializable]
- public class ShareAliasException : SlskdException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareAliasException"/> class.
- /// </summary>
- public ShareAliasException()
- : base()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareAliasException"/> class with a specified error message.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ShareAliasException(string message)
- : base(message)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareAliasException"/> class with a specified error message and a
- /// reference to the inner exception that is the cause of this exception.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- /// <param name="innerException">
- /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no
- /// inner exception is specified.
- /// </param>
- public ShareAliasException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareAliasException"/> class with serialized data.
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected ShareAliasException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-} \ No newline at end of file
diff --git a/src/slskd/Application/Exceptions/ShareScanInProgressException.cs b/src/slskd/Application/Exceptions/ShareScanInProgressException.cs
deleted file mode 100644
index 2e548930..00000000
--- a/src/slskd/Application/Exceptions/ShareScanInProgressException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// <copyright file="ShareScanInProgressException.cs" company="slskd Team">
-// 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 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/.
-// </copyright>
-
-namespace slskd
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Represents an error that occurs when multiple share scans are attempted concurrently.
- /// </summary>
- [ExcludeFromCodeCoverage]
- [Serializable]
- public class ShareScanInProgressException : SlskdException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareScanInProgressException"/> class.
- /// </summary>
- public ShareScanInProgressException()
- : base()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareScanInProgressException"/> class with a specified error message.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ShareScanInProgressException(string message)
- : base(message)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareScanInProgressException"/> class with a specified error message and a
- /// reference to the inner exception that is the cause of this exception.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- /// <param name="innerException">
- /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no
- /// inner exception is specified.
- /// </param>
- public ShareScanInProgressException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ShareScanInProgressException"/> class with serialized data.
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected ShareScanInProgressException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-} \ No newline at end of file
diff --git a/src/slskd/Application/Exceptions/SlskdException.cs b/src/slskd/Application/Exceptions/SlskdException.cs
deleted file mode 100644
index 6b4cfc2a..00000000
--- a/src/slskd/Application/Exceptions/SlskdException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// <copyright file="SlskdException.cs" company="slskd Team">
-// 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 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/.
-// </copyright>
-
-namespace slskd
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Represents erorrs that originate from slskd logic.
- /// </summary>
- [ExcludeFromCodeCoverage]
- [Serializable]
- public class SlskdException : Exception
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="SlskdException"/> class.
- /// </summary>
- public SlskdException()
- : base()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="SlskdException"/> class with a specified error message.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public SlskdException(string message)
- : base(message)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="SlskdException"/> class with a specified error message and a
- /// reference to the inner exception that is the cause of this exception.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- /// <param name="innerException">
- /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no
- /// inner exception is specified.
- /// </param>
- public SlskdException(string message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="SlskdException"/> class with serialized data.
- /// </summary>
- /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
- /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
- protected SlskdException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-} \ No newline at end of file
diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/Shares/SharedFileCache.cs
index 71d1bae1..062a059c 100644
--- a/src/slskd/Application/SharedFileCache.cs
+++ b/src/slskd/Application/Shares/SharedFileCache.cs
@@ -18,7 +18,7 @@
using System.IO;
using Microsoft.Extensions.Options;
-namespace slskd
+namespace slskd.Shares
{
using System;
using System.Collections.Concurrent;
diff --git a/src/slskd/Application/UserEndPointCache.cs b/src/slskd/Application/UserEndPointCache.cs
deleted file mode 100644
index 29164cc4..00000000
--- a/src/slskd/Application/UserEndPointCache.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// <copyright file="UserEndPointCache.cs" company="slskd Team">
-// 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 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/.
-// </copyright>
-
-namespace slskd
-{
- using System;
- using System.Net;
- using Microsoft.Extensions.Caching.Memory;
- using Soulseek;
-
- /// <summary>
- /// Caches user EndPoints.
- /// </summary>
- public class UserEndPointCache : IUserEndPointCache
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="UserEndPointCache"/> class.
- /// </summary>
- public UserEndPointCache()
- {
- Cache = new MemoryCache(new MemoryCacheOptions());
- }
-
- private IMemoryCache Cache { get; }
-
- /// <summary>
- /// Caches or updates an entry.
- /// </summary>
- /// <param name="username">The username for which to cache the endpoint.</param>
- /// <param name="endPoint">The endpoint to cache.</param>
- public void AddOrUpdate(string username, IPEndPoint endPoint)
- {
- Cache.Set(username, endPoint, TimeSpan.FromSeconds(60));
- }
-
- /// <summary>
- /// Gets the cached endpoint for the specified <paramref name="username"/>, if it exists.
- /// </summary>
- /// <param name="username">The username for which to retrieve the endpoint.</param>
- /// <param name="endPoint">The cached endpoint, if it exists.</param>
- /// <returns>A value indicating whether the endpoint was found in the cache.</returns>
- public bool TryGet(string username, out IPEndPoint endPoint)
- {
- return Cache.TryGetValue(username, out endPoint);
- }
- }
-} \ No newline at end of file