mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
|
{
|
|
public class QuickFolderAccess
|
|
{
|
|
internal List<Result> FolderList(Query query, List<FolderLink> folderLinks, PluginInitContext context)
|
|
{
|
|
if (string.IsNullOrEmpty(query.Search))
|
|
return folderLinks
|
|
.Select(item =>
|
|
new ResultManager(context)
|
|
.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
|
.ToList();
|
|
|
|
string search = query.Search.ToLower();
|
|
|
|
var queriedFolderLinks = folderLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
|
|
|
return queriedFolderLinks.Select(item =>
|
|
new ResultManager(context)
|
|
.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
|
.ToList();
|
|
}
|
|
}
|
|
}
|