From 770e931191983638dd3c422720af014779ad75ad Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 28 May 2021 15:02:09 -0500 Subject: docs --- src/slskd/Core/Search/Extensions.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/slskd/Core/Search/Extensions.cs b/src/slskd/Core/Search/Extensions.cs index 2ff1139c..d52975d2 100644 --- a/src/slskd/Core/Search/Extensions.cs +++ b/src/slskd/Core/Search/Extensions.cs @@ -18,10 +18,18 @@ namespace slskd.Search { using System; + using System.Linq; using Soulseek; public static class Extensions { + /// + /// Returns a copy of the specified with the specified actions bound, while retaining the existing actions. + /// + /// + /// + /// + /// public static SearchOptions WithActions( this SearchOptions options, Action stateChanged = null, @@ -61,5 +69,26 @@ namespace slskd.Search responseReceived(args); }); } + + /// + /// Creates a projection over the specified which omits responses. + /// + /// + /// + public static IQueryable WithoutResponses(this IQueryable query) + { + return query.Select(s => new Search() + { + Id = s.Id, + StartedAt = s.StartedAt, + EndedAt = s.EndedAt, + FileCount = s.FileCount, + LockedFileCount = s.LockedFileCount, + ResponseCount = s.ResponseCount, + SearchText = s.SearchText, + State = s.State, + Token = s.Token, + }); + } } } -- cgit v1.2.3