mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
* Added comments and fixed CultureInfo / StringComparison where appropriate * Addressed comments * Fixed comment
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
// 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 System.Globalization;
|
|
using System.IO;
|
|
using Wox.Infrastructure;
|
|
using Wox.Plugin;
|
|
|
|
namespace Microsoft.Plugin.Folder.Sources.Result
|
|
{
|
|
public class FileItemResult : IItemResult
|
|
{
|
|
private static readonly IShellAction ShellAction = new ShellAction();
|
|
|
|
public string FilePath { get; set; }
|
|
|
|
public string Title => Path.GetFileName(FilePath);
|
|
|
|
public string Search { get; set; }
|
|
|
|
public Wox.Plugin.Result Create(IPublicAPI contextApi)
|
|
{
|
|
var result = new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData)
|
|
{
|
|
Title = Title,
|
|
|
|
// Using CurrentCulture since this is user facing
|
|
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath),
|
|
IcoPath = FilePath,
|
|
Action = c => ShellAction.Execute(FilePath, contextApi),
|
|
ContextData = new SearchResult { Type = ResultType.File, FullPath = FilePath },
|
|
};
|
|
return result;
|
|
}
|
|
}
|
|
}
|