@@ -26,32 +26,25 @@ internal List<Result> AccessLinkListMatched(Query query, List<AccessLink> access
2626 . OrderBy ( x => x . Type )
2727 . ThenBy ( x => x . Nickname ) ;
2828
29- return queriedAccessLinks
30- . Where ( x => x . Type == ResultType . Folder )
31- . Select ( item =>
32- resultManager . CreateFolderResult ( item . Nickname , item . Path , item . Path , query ) )
33- . Concat (
34- queriedAccessLinks
35- . Where ( x => x . Type == ResultType . File )
36- . Select ( item =>
37- resultManager . CreateFileResult ( item . Path , query ) ) )
38- . ToList ( ) ;
29+ return queriedAccessLinks . Select ( l => l . Type switch
30+ {
31+ ResultType . Folder => resultManager . CreateFolderResult ( l . Nickname , l . Path , l . Path , query ) ,
32+ ResultType . File => resultManager . CreateFileResult ( l . Path , query ) ,
33+ _ => throw new ArgumentOutOfRangeException ( )
34+
35+ } ) . ToList ( ) ;
3936 }
4037
4138 internal List < Result > AccessLinkListAll ( Query query , List < AccessLink > accessLinks )
4239 => accessLinks
4340 . OrderBy ( x => x . Type )
4441 . ThenBy ( x => x . Nickname )
45- . Where ( x => x . Type == ResultType . Folder )
46- . Select ( item =>
47- resultManager . CreateFolderResult ( item . Nickname , item . Path , item . Path , query ) )
48- . Concat (
49- accessLinks
50- . OrderBy ( x => x . Type )
51- . ThenBy ( x => x . Nickname )
52- . Where ( x => x . Type == ResultType . File )
53- . Select ( item =>
54- resultManager . CreateFileResult ( item . Path , query ) ) )
55- . ToList ( ) ;
42+ . Select ( l => l . Type switch
43+ {
44+ ResultType . Folder => resultManager . CreateFolderResult ( l . Nickname , l . Path , l . Path , query ) ,
45+ ResultType . File => resultManager . CreateFileResult ( l . Path , query ) ,
46+ _ => throw new ArgumentOutOfRangeException ( )
47+
48+ } ) . ToList ( ) ;
5649 }
5750}
0 commit comments