diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-05-11 16:49:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-11 16:49:58 -0500 |
| commit | ff841bc6411be74e99b0b71754d23614a59c7187 (patch) | |
| tree | 2b22a5ca76cffbd1bf4b24d348b581ad0a592a0c /src/slskd/Files/FileService.cs | |
| parent | bbbd09d8208f005fd2a976c025e888e84a3448ec (diff) | |
| parent | 9a005447ef2f6726b2139b0ae4d99cf566ef365b (diff) | |
| download | slskd-ff841bc6411be74e99b0b71754d23614a59c7187.tar.gz | |
Merge pull request #1125 from slskd/file-service
Simplify file service
Diffstat (limited to 'src/slskd/Files/FileService.cs')
| -rw-r--r-- | src/slskd/Files/FileService.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/slskd/Files/FileService.cs b/src/slskd/Files/FileService.cs index c820220f..ee8271b1 100644 --- a/src/slskd/Files/FileService.cs +++ b/src/slskd/Files/FileService.cs @@ -23,7 +23,6 @@ namespace slskd.Files using System.Collections.Generic; using System.IO; using System.Linq; - using System.Security; using System.Threading.Tasks; using OneOf; using Serilog; @@ -31,7 +30,7 @@ namespace slskd.Files /// <summary> /// Manages files on disk. /// </summary> - public class FileService : IFileService + public class FileService { /// <summary> /// Initializes a new instance of the <see cref="FileService"/> class. @@ -66,7 +65,7 @@ namespace slskd.Files /// </exception> /// <exception cref="NotFoundException">Thrown if a specified directory does not exist.</exception> /// <exception cref="UnauthorizedException">Thrown if a specified directory is restricted.</exception> - public async Task<Dictionary<string, OneOf<bool, Exception>>> DeleteDirectoriesAsync(params string[] directories) + public virtual async Task<Dictionary<string, OneOf<bool, Exception>>> DeleteDirectoriesAsync(params string[] directories) { if (directories.Any(directory => Path.GetFullPath(directory) != directory)) { @@ -129,7 +128,7 @@ namespace slskd.Files /// <exception cref="ArgumentException">Thrown if any of the specified files have a relative path.</exception> /// <exception cref="NotFoundException">Thrown if a specified file does not exist.</exception> /// <exception cref="UnauthorizedException">Thrown if a specified file is restricted.</exception> - public async Task<Dictionary<string, OneOf<bool, Exception>>> DeleteFilesAsync(params string[] files) + public virtual async Task<Dictionary<string, OneOf<bool, Exception>>> DeleteFilesAsync(params string[] files) { if (files.Any(file => Path.GetFullPath(file) != file)) { @@ -182,7 +181,7 @@ namespace slskd.Files /// <exception cref="ArgumentException">Thrown if the specified directory has a relative path.</exception> /// <exception cref="NotFoundException">Thrown if the specified directory does not exist.</exception> /// <exception cref="UnauthorizedException">Thrown if the specified root directory is restricted.</exception> - public async Task<FilesystemDirectory> ListContentsAsync(string directory, EnumerationOptions enumerationOptions = null) + public virtual async Task<FilesystemDirectory> ListContentsAsync(string directory, EnumerationOptions enumerationOptions = null) { if (Path.GetFullPath(directory) != directory) { |
