aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Shares/ShareService.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs
new file mode 100644
index 00000000..2e4e7c95
--- /dev/null
+++ b/src/slskd/Shares/ShareService.cs
@@ -0,0 +1,27 @@
+namespace slskd.Shares
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ public interface IShareService
+ {
+ ISharedFileCache Cache { get; }
+ IReadOnlyList<Share> List(Func<Share, bool> expression = null);
+ }
+
+ public class ShareService : IShareService
+ {
+ public ShareService(ISharedFileCache sharedFileCache)
+ {
+ Cache = sharedFileCache;
+ }
+
+ public ISharedFileCache Cache { get; }
+
+ public IReadOnlyList<Share> List(Func<Share, bool> expression = null)
+ {
+ return Cache.Shares.Where(expression).ToList().AsReadOnly();
+ }
+ }
+} \ No newline at end of file