2020-10-01 05:37:46 +02:00
|
|
|
|
// 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.
|
|
|
|
|
|
|
2020-10-06 18:08:41 +02:00
|
|
|
|
using System.Globalization;
|
2023-12-28 13:37:13 +03:00
|
|
|
|
using System.Text;
|
2020-10-01 05:37:46 +02:00
|
|
|
|
using Wox.Infrastructure;
|
|
|
|
|
|
using Wox.Plugin;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Plugin.Folder.Sources.Result
|
|
|
|
|
|
{
|
|
|
|
|
|
public class FolderItemResult : IItemResult
|
|
|
|
|
|
{
|
2023-12-28 13:37:13 +03:00
|
|
|
|
private static readonly ShellAction ShellAction = new ShellAction();
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly CompositeFormat WoxPluginFolderSelectFolderResultSubtitle = System.Text.CompositeFormat.Parse(Properties.Resources.wox_plugin_folder_select_folder_result_subtitle);
|
2020-10-01 05:37:46 +02:00
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
2020-10-26 15:14:33 -07:00
|
|
|
|
return new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, Title).MatchData)
|
2020-10-01 05:37:46 +02:00
|
|
|
|
{
|
|
|
|
|
|
Title = Title,
|
|
|
|
|
|
IcoPath = Path,
|
2020-10-30 16:43:09 -07:00
|
|
|
|
|
|
|
|
|
|
// Using CurrentCulture since this is user facing
|
2023-12-28 13:37:13 +03:00
|
|
|
|
SubTitle = string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFolderResultSubtitle, Subtitle),
|
|
|
|
|
|
ToolTipData = new ToolTipData(Title, string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFolderResultSubtitle, Subtitle)),
|
2020-10-01 05:37:46 +02:00
|
|
|
|
QueryTextDisplay = Path,
|
2022-12-09 14:01:44 +01:00
|
|
|
|
ContextData = new SearchResult { Type = ResultType.Folder, Path = Path },
|
2020-10-17 01:30:11 +02:00
|
|
|
|
Action = c => ShellAction.Execute(Path, contextApi),
|
2020-10-01 05:37:46 +02:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|