|
1 | | -using System.IO; |
2 | 1 | using System.Net; |
3 | | -using System.Threading; |
4 | | -using System.Threading.Tasks; |
5 | 2 | using NWebDav.Server.Dispatching; |
6 | 3 | using OwlCore.Storage.Memory; |
7 | 4 | using SecureFolderFS.Core.FileSystem; |
|
10 | 7 | using SecureFolderFS.Core.WebDav.AppModels; |
11 | 8 | using SecureFolderFS.Storage.VirtualFileSystem; |
12 | 9 |
|
13 | | -namespace SecureFolderFS.Cli; |
14 | | - |
15 | | -internal sealed class CliWebDavFileSystem : WebDavFileSystem |
| 10 | +namespace SecureFolderFS.Cli |
16 | 11 | { |
17 | | - protected override async Task<IVfsRoot> MountAsync(FileSystemSpecifics specifics, HttpListener listener, WebDavOptions options, |
18 | | - IRequestDispatcher requestDispatcher, CancellationToken cancellationToken) |
| 12 | + /// <inheritdoc cref="IFileSystemInfo"/> |
| 13 | + internal sealed class CliWebDavFileSystem : WebDavFileSystem |
19 | 14 | { |
20 | | - await Task.CompletedTask; |
| 15 | + /// <inheritdoc/> |
| 16 | + public override Task<string> GetVolumeNameAsync(string candidateName, |
| 17 | + CancellationToken cancellationToken = default) |
| 18 | + { |
| 19 | + return Task.FromResult(candidateName); |
| 20 | + } |
| 21 | + |
| 22 | + /// <inheritdoc/> |
| 23 | + protected override async Task<IVfsRoot> MountAsync(FileSystemSpecifics specifics, HttpListener listener, |
| 24 | + WebDavOptions options, |
| 25 | + IRequestDispatcher requestDispatcher, CancellationToken cancellationToken) |
| 26 | + { |
| 27 | + await Task.CompletedTask; |
21 | 28 |
|
22 | | - var remotePath = $"{options.Protocol}://{options.Domain}:{options.Port}/"; |
23 | | - var webDavWrapper = new WebDavWrapper(listener, requestDispatcher, remotePath); |
24 | | - webDavWrapper.StartFileSystem(); |
| 29 | + var remotePath = $"{options.Protocol}://{options.Domain}:{options.Port}/"; |
| 30 | + var webDavWrapper = new WebDavWrapper(listener, requestDispatcher, remotePath); |
| 31 | + webDavWrapper.StartFileSystem(); |
25 | 32 |
|
26 | | - var virtualizedRoot = new MemoryFolder(remotePath, options.VolumeName); |
27 | | - var plaintextRoot = new CryptoFolder(Path.DirectorySeparatorChar.ToString(), specifics.ContentFolder, specifics); |
28 | | - return new WebDavVfsRoot(webDavWrapper, virtualizedRoot, plaintextRoot, specifics); |
| 33 | + var virtualizedRoot = new MemoryFolder(remotePath, options.VolumeName); |
| 34 | + var plaintextRoot = new CryptoFolder(Path.DirectorySeparatorChar.ToString(), specifics.ContentFolder, specifics); |
| 35 | + return new WebDavVfsRoot(webDavWrapper, virtualizedRoot, plaintextRoot, specifics); |
| 36 | + } |
29 | 37 | } |
30 | 38 | } |
31 | | - |
|
0 commit comments