Files
PowerToys/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/EnvironmentVariableResult.cs
gokcekantarci a94b3eec39 .NET 8 Upgrade Silenced Errors Fix (#30469)
* [Dev][Build] .NET 8 Upgrade Silenced errors first fix.

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1859

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1854.

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1860

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1861

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1862

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1863

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1864

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1865

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA2208

* [Dev][Build] .NET 8 Upgrade Silenced errors. CS9191

* [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check

* [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check

* [Dev][Build] .NET 8 Upgrade Silenced errors.
- CompositeFormat variables used more than once in the same file were assigned to a single variable.
- GetProcessesByName logic fix.
- String comparion fix.
- ArgumentOutOfRangeException message change.

* [Dev][Build] .NET 8 Upgrade Silenced errors.
- Null check added.
- static readonly CompositeFormat added for all fields.
2023-12-28 13:37:13 +03:00

50 lines
1.8 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.Text;
using Wox.Infrastructure;
using Wox.Plugin;
namespace Microsoft.Plugin.Folder.Sources.Result
{
public class EnvironmentVariableResult : IItemResult
{
private readonly ShellAction _shellAction = new ShellAction();
private static readonly CompositeFormat WoxPluginFolderSelectFolderResultSubtitle = System.Text.CompositeFormat.Parse(Properties.Resources.wox_plugin_folder_select_folder_result_subtitle);
public string Search { get; set; }
public string Title { get; private set; }
public string Subtitle { get; private set; }
public string Path { get; private set; }
public EnvironmentVariableResult(string search, string title, string path)
{
Search = search;
Title = title;
Path = path;
}
public Wox.Plugin.Result Create(IPublicAPI contextApi)
{
return new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, Title).MatchData)
{
Title = Title,
IcoPath = Path,
// Using CurrentCulture since this is user facing
SubTitle = string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFolderResultSubtitle, Path),
ToolTipData = new ToolTipData(Title, string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFolderResultSubtitle, Path)),
QueryTextDisplay = Path,
ContextData = new SearchResult { Type = ResultType.Folder, Path = Path },
Action = c => _shellAction.Execute(Path, contextApi),
};
}
}
}