mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-11 05:52:19 +02:00
Made Plugin Folder Unit tests & Expanding enviroment search (#6600)
* Made Plugin Folder Unit tests. Fixes '>' not recursive searching (with max). Added that paths with an UnauthorizedAccessException are ignored. Added expanding enviroment search. * Fixed some merging errors * Added feedback from review * Made the change that ryanbodrug-microsoft suggested * Stupid merge request... fixed Co-authored-by: p-storm <paul.de.man@gmail.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class FolderItemResult : IItemResult
|
||||
{
|
||||
private static readonly IExplorerAction ExplorerAction = new ExplorerAction();
|
||||
|
||||
public FolderItemResult()
|
||||
{
|
||||
}
|
||||
|
||||
public FolderItemResult(DisplayFileInfo fileSystemInfo)
|
||||
{
|
||||
Title = fileSystemInfo.Name;
|
||||
Subtitle = fileSystemInfo.FullName;
|
||||
Path = fileSystemInfo.FullName;
|
||||
}
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Subtitle { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
public string Search { get; set; }
|
||||
|
||||
public Wox.Plugin.Result Create(IPublicAPI contextApi)
|
||||
{
|
||||
return new Wox.Plugin.Result
|
||||
{
|
||||
Title = Title,
|
||||
IcoPath = Path,
|
||||
SubTitle = "Folder: " + Subtitle,
|
||||
QueryTextDisplay = Path,
|
||||
TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },
|
||||
Action = c => ExplorerAction.Execute(Path, contextApi),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user