2020-06-09 10:12:49 +00:00
|
|
|
|
using System;
|
2020-05-24 22:14:21 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
2020-06-06 12:13:22 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
|
2020-05-24 22:14:21 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class QuickFolderAccess
|
|
|
|
|
|
{
|
2020-08-25 11:24:53 +00:00
|
|
|
|
internal List<Result> FolderListMatched(Query query, List<FolderLink> folderLinks, PluginInitContext context)
|
2020-05-24 22:14:21 +00:00
|
|
|
|
{
|
2020-06-09 10:12:49 +00:00
|
|
|
|
if (string.IsNullOrEmpty(query.Search))
|
2020-08-25 11:24:53 +00:00
|
|
|
|
return new List<Result>();
|
2020-06-09 10:12:49 +00:00
|
|
|
|
|
2020-05-24 22:14:21 +00:00
|
|
|
|
string search = query.Search.ToLower();
|
2020-06-09 10:12:49 +00:00
|
|
|
|
|
|
|
|
|
|
var queriedFolderLinks = folderLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
|
|
|
|
|
|
|
return queriedFolderLinks.Select(item =>
|
|
|
|
|
|
new ResultManager(context)
|
2020-06-29 20:20:22 +00:00
|
|
|
|
.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
2020-06-09 10:12:49 +00:00
|
|
|
|
.ToList();
|
2020-05-24 22:14:21 +00:00
|
|
|
|
}
|
2020-08-25 11:24:53 +00:00
|
|
|
|
|
|
|
|
|
|
internal List<Result> FolderListAll(Query query, List<FolderLink> folderLinks, PluginInitContext context)
|
|
|
|
|
|
=> folderLinks
|
|
|
|
|
|
.Select(item =>
|
|
|
|
|
|
new ResultManager(context).CreateFolderResult(item.Nickname, item.Path, item.Path, query))
|
|
|
|
|
|
.ToList();
|
2020-05-24 22:14:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|