diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-09-27 09:40:22 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-09-27 09:40:22 -0500 |
| commit | 71f164ca388efe640c378a9f0e14b374fc789c52 (patch) | |
| tree | 3def17286ee10a1a270d26fc469a0bc42f426f56 /src | |
| parent | 5cdb5cc91786c5f49bfa1f136c1c71fc52367110 (diff) | |
| download | slskd-71f164ca388efe640c378a9f0e14b374fc789c52.tar.gz | |
refactor listing
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Shares/ShareService.cs | 7 | ||||
| -rw-r--r-- | src/slskd/Shares/SharedFileCache.cs | 18 |
2 files changed, 4 insertions, 21 deletions
diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs index e99d048a..4505ea3e 100644 --- a/src/slskd/Shares/ShareService.cs +++ b/src/slskd/Shares/ShareService.cs @@ -150,10 +150,11 @@ namespace slskd.Shares /// <returns>The contents of the directory.</returns> public Task<Directory> ListDirectoryAsync(string directory) { - var list = Cache.List(directory.LocalizePath()); - var normalizedList = new Directory(list.Name.NormalizePathForSoulseek(), list.Files); + var localPath = directory.LocalizePath(); - return Task.FromResult(normalizedList); + var files = Repository.ListFiles(localPath); + + return Task.FromResult(new Directory(directory, files)); } /// <summary> diff --git a/src/slskd/Shares/SharedFileCache.cs b/src/slskd/Shares/SharedFileCache.cs index 190679a8..6e6cc6e6 100644 --- a/src/slskd/Shares/SharedFileCache.cs +++ b/src/slskd/Shares/SharedFileCache.cs @@ -51,13 +51,6 @@ namespace slskd.Shares Task FillAsync(IEnumerable<Share> shares, IEnumerable<Regex> filters); /// <summary> - /// Returns the contents of the specified <paramref name="directory"/>. - /// </summary> - /// <param name="directory">The directory for which the contents are to be listed.</param> - /// <returns>The contents of the directory.</returns> - Directory List(string directory); - - /// <summary> /// Substitutes the mask in the specified <paramref name="filename"/> with the original path, if the mask is tracked /// by the cache. /// </summary> @@ -380,17 +373,6 @@ namespace slskd.Shares } /// <summary> - /// Returns the contents of the specified <paramref name="directory"/>. - /// </summary> - /// <param name="directory">The directory for which the contents are to be listed.</param> - /// <returns>The contents of the directory.</returns> - public Directory List(string directory) - { - var files = Repository.ListFiles(directory); - return new Directory(directory, files); - } - - /// <summary> /// Substitutes the mask in the specified <paramref name="filename"/> with the original path, if the mask is tracked /// by the cache. /// </summary> |
