add file and folder type loading

This commit is contained in:
Jeremy Wu 2021-01-26 20:01:12 +11:00
parent d3127b7447
commit 85dee95fc7
3 changed files with 23 additions and 3 deletions

View file

@ -9,6 +9,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
{
public string Path { get; set; }
public ResultType Type { get; set; } = ResultType.Folder;
[JsonIgnore]
public string Nickname
{

View file

@ -23,14 +23,32 @@ namespace Flow.Launcher.Plugin.Explorer.Search.FolderLinks
var queriedFolderLinks =
folderLinks.Where(x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
return queriedFolderLinks.Select(item =>
return queriedFolderLinks
.Where(x => x.Type == ResultType.Folder)
.Select(item =>
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
.OrderBy(x => x.Title)
.Concat(
queriedFolderLinks
.Where(x => x.Type == ResultType.File)
.Select(item =>
resultManager.CreateFileResult(item.Path, query))
.OrderBy(x => x.Title))
.ToList();
}
internal List<Result> FolderListAll(Query query, List<FolderLink> folderLinks)
=> folderLinks
.Select(item => resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
.Where(x => x.Type == ResultType.Folder)
.Select(item =>
resultManager.CreateFolderResult(item.Nickname, item.Path, item.Path, query))
.OrderBy(x => x.Title)
.Concat(
folderLinks
.Where(x => x.Type == ResultType.File)
.Select(item =>
resultManager.CreateFileResult(item.Path, query))
.OrderBy(x => x.Title))
.ToList();
}
}

View file

@ -140,7 +140,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
public bool ShowIndexState { get; set; }
}
internal enum ResultType
public enum ResultType
{
Volume,
Folder,