aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-06-29 22:14:57 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-06-29 22:14:57 -0500
commite141476ef5b6e13ec8de6cfe0d599595326ed28f (patch)
tree0eecaf2de35fce81963380209eb9636c3c9c23eb /src
parent3093c4ad7362809deb1de2a98b36a0390d08e44b (diff)
downloadslskd-e141476ef5b6e13ec8de6cfe0d599595326ed28f.tar.gz
cleanup
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application/Transfer/API/Controllers/TransfersController.cs4
-rw-r--r--src/slskd/Integrations/FTP/FTPClientFactory.cs20
-rw-r--r--src/slskd/Integrations/FTP/FTPService.cs (renamed from src/slskd/Integrations/FTP/FTPClient.cs)10
-rw-r--r--src/slskd/Integrations/FTP/IFTPClientFactory.cs7
-rw-r--r--src/slskd/Integrations/FTP/IFTPService.cs (renamed from src/slskd/Integrations/FTP/IFTPClient.cs)8
-rw-r--r--src/slskd/Startup.cs2
6 files changed, 37 insertions, 14 deletions
diff --git a/src/slskd/Application/Transfer/API/Controllers/TransfersController.cs b/src/slskd/Application/Transfer/API/Controllers/TransfersController.cs
index 8131aa8c..d0bff636 100644
--- a/src/slskd/Application/Transfer/API/Controllers/TransfersController.cs
+++ b/src/slskd/Application/Transfer/API/Controllers/TransfersController.cs
@@ -49,7 +49,7 @@ namespace slskd.Transfer.API
Microsoft.Extensions.Options.IOptionsSnapshot<Options> options,
ISoulseekClient client,
ITransferTracker tracker,
- IFTPClient ftpClient)
+ IFTPService ftpClient)
{
Client = client;
Tracker = tracker;
@@ -60,7 +60,7 @@ namespace slskd.Transfer.API
private Options Options { get; }
private ISoulseekClient Client { get; }
private ITransferTracker Tracker { get; }
- private IFTPClient FTP { get; }
+ private IFTPService FTP { get; }
/// <summary>
/// Cancels the specified download.
diff --git a/src/slskd/Integrations/FTP/FTPClientFactory.cs b/src/slskd/Integrations/FTP/FTPClientFactory.cs
index 887623a2..7e6f948e 100644
--- a/src/slskd/Integrations/FTP/FTPClientFactory.cs
+++ b/src/slskd/Integrations/FTP/FTPClientFactory.cs
@@ -21,8 +21,15 @@ namespace slskd.Integrations.FTP
using FluentFTP;
using static slskd.Options.IntegrationOptions;
+ /// <summary>
+ /// FTP client factory.
+ /// </summary>
public class FTPClientFactory : IFTPClientFactory
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FTPClientFactory"/> class.
+ /// </summary>
+ /// <param name="optionsMonitor">The options monitor used to derive application options.</param>
public FTPClientFactory(Microsoft.Extensions.Options.IOptionsMonitor<Options> optionsMonitor)
{
Options = optionsMonitor.CurrentValue;
@@ -33,15 +40,20 @@ namespace slskd.Integrations.FTP
}
catch (Exception ex)
{
- // Options should validate that the given string is parsable to FtpEncryptionMode through EnumAttribute; if this throws there's a bug somewhere.
+ // Options should validate that the given string is parsable to FtpEncryptionMode through EnumAttribute; if this
+ // throws there's a bug somewhere.
throw new ArgumentException($"Failed to parse {typeof(FtpEncryptionMode).Name} from application Options. This is most likely a programming error; please file a GitHub issue and include your FTP configuration.", ex);
}
}
- private Options Options { get; set; }
- private FTPOptions FTPOptions => Options.Integration.FTP;
private FtpEncryptionMode EncryptionMode { get; set; }
+ private FTPOptions FTPOptions => Options.Integration.FTP;
+ private Options Options { get; set; }
+ /// <summary>
+ /// Creates an instance of <see cref="FtpClient"/>.
+ /// </summary>
+ /// <returns>The created instance.</returns>
public FtpClient CreateFtpClient()
{
var client = new FtpClient(FTPOptions.Address, FTPOptions.Port, FTPOptions.Username, FTPOptions.Password);
@@ -50,4 +62,4 @@ namespace slskd.Integrations.FTP
return client;
}
}
-}
+} \ No newline at end of file
diff --git a/src/slskd/Integrations/FTP/FTPClient.cs b/src/slskd/Integrations/FTP/FTPService.cs
index 141bc10c..f9f9de66 100644
--- a/src/slskd/Integrations/FTP/FTPClient.cs
+++ b/src/slskd/Integrations/FTP/FTPService.cs
@@ -1,4 +1,4 @@
-// <copyright file="FTPClient.cs" company="slskd Team">
+// <copyright file="FTPService.cs" company="slskd Team">
// Copyright (c) slskd Team. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@@ -25,12 +25,12 @@ namespace slskd.Integrations.FTP
using Microsoft.Extensions.Logging;
using static slskd.Options.IntegrationOptions;
- public class FTPClient : IFTPClient
+ public class FTPService : IFTPService
{
- public FTPClient(
+ public FTPService(
IFTPClientFactory ftpClientFactory,
Microsoft.Extensions.Options.IOptionsMonitor<Options> optionsMonitor,
- ILogger<FTPClient> log)
+ ILogger<FTPService> log)
{
Factory = ftpClientFactory;
Options = optionsMonitor.CurrentValue;
@@ -51,7 +51,7 @@ namespace slskd.Integrations.FTP
private Options Options { get; }
private FTPOptions FTPOptions => Options.Integration.FTP;
- private ILogger<FTPClient> Log { get; set; }
+ private ILogger<FTPService> Log { get; set; }
private IFTPClientFactory Factory { get; set; }
private FtpEncryptionMode EncryptionMode { get; set; }
diff --git a/src/slskd/Integrations/FTP/IFTPClientFactory.cs b/src/slskd/Integrations/FTP/IFTPClientFactory.cs
index 760db612..2ab729d1 100644
--- a/src/slskd/Integrations/FTP/IFTPClientFactory.cs
+++ b/src/slskd/Integrations/FTP/IFTPClientFactory.cs
@@ -19,8 +19,15 @@ namespace slskd.Integrations.FTP
{
using FluentFTP;
+ /// <summary>
+ /// FTP client factory.
+ /// </summary>
public interface IFTPClientFactory
{
+ /// <summary>
+ /// Creates an instance of <see cref="FtpClient"/>.
+ /// </summary>
+ /// <returns>The created instance.</returns>
public FtpClient CreateFtpClient();
}
}
diff --git a/src/slskd/Integrations/FTP/IFTPClient.cs b/src/slskd/Integrations/FTP/IFTPService.cs
index b556ea3b..5841e0b2 100644
--- a/src/slskd/Integrations/FTP/IFTPClient.cs
+++ b/src/slskd/Integrations/FTP/IFTPService.cs
@@ -1,4 +1,4 @@
-// <copyright file="IFTPClient.cs" company="slskd Team">
+// <copyright file="IFTPService.cs" company="slskd Team">
// Copyright (c) slskd Team. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@@ -19,8 +19,12 @@ namespace slskd.Integrations.FTP
{
using System.Threading.Tasks;
- public interface IFTPClient
+ /// <summary>
+ /// FTP Integration service.
+ /// </summary>
+ public interface IFTPService
{
+
Task UploadAsync(string filename);
bool Enabled { get; }
}
diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs
index f802a56a..65781e6e 100644
--- a/src/slskd/Startup.cs
+++ b/src/slskd/Startup.cs
@@ -189,7 +189,7 @@ namespace slskd
services.AddSingleton<IManagementService, ManagementService>();
services.AddSingleton<IFTPClientFactory, FTPClientFactory>();
- services.AddTransient<IFTPClient, FTPClient>();
+ services.AddTransient<IFTPService, FTPService>();
services.AddHostedService<Service>();
services.AddSingleton(_ => Service.SoulseekClient);