mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
.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.
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Microsoft.Plugin.Folder
|
||||
};
|
||||
|
||||
private static PluginInitContext _context;
|
||||
private IContextMenu _contextMenuLoader;
|
||||
private ContextMenuLoader _contextMenuLoader;
|
||||
private bool _disposed;
|
||||
|
||||
public string Name => Properties.Resources.wox_plugin_folder_plugin_name;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
{
|
||||
// folder exist, add \ at the end of doesn't exist
|
||||
// Using Ordinal since this is internal and is used for a symbol
|
||||
if (!search.EndsWith(@"\", StringComparison.Ordinal))
|
||||
if (!search.EndsWith('\\'))
|
||||
{
|
||||
search += @"\";
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
@@ -12,6 +13,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
private readonly IShellAction _shellAction;
|
||||
|
||||
private static readonly CompositeFormat WoxPluginFolderSelectFolderFirstResultTitle = System.Text.CompositeFormat.Parse(Properties.Resources.wox_plugin_folder_select_folder_first_result_title);
|
||||
|
||||
public string Search { get; set; }
|
||||
|
||||
public CreateOpenCurrentFolderResult(string search)
|
||||
@@ -29,10 +32,10 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
return new Wox.Plugin.Result
|
||||
{
|
||||
Title = string.Format(CultureInfo.InvariantCulture, Properties.Resources.wox_plugin_folder_select_folder_first_result_title, new DirectoryInfo(Search).Name),
|
||||
Title = string.Format(CultureInfo.InvariantCulture, WoxPluginFolderSelectFolderFirstResultTitle, new DirectoryInfo(Search).Name),
|
||||
QueryTextDisplay = Search,
|
||||
SubTitle = Properties.Resources.wox_plugin_folder_select_folder_first_result_subtitle,
|
||||
ToolTipData = new ToolTipData(string.Format(CultureInfo.InvariantCulture, Properties.Resources.wox_plugin_folder_select_folder_first_result_title, new DirectoryInfo(Search).Name), Properties.Resources.wox_plugin_folder_select_folder_first_result_subtitle),
|
||||
ToolTipData = new ToolTipData(string.Format(CultureInfo.InvariantCulture, WoxPluginFolderSelectFolderFirstResultTitle, new DirectoryInfo(Search).Name), Properties.Resources.wox_plugin_folder_select_folder_first_result_subtitle),
|
||||
IcoPath = Search,
|
||||
Score = 500,
|
||||
Action = c => _shellAction.ExecuteSanitized(Search, contextApi),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -10,7 +11,9 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class EnvironmentVariableResult : IItemResult
|
||||
{
|
||||
private readonly IShellAction _shellAction = new ShellAction();
|
||||
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; }
|
||||
|
||||
@@ -35,8 +38,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
IcoPath = Path,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Path),
|
||||
ToolTipData = new ToolTipData(Title, string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Path)),
|
||||
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),
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Text;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -11,7 +12,9 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class FileItemResult : IItemResult
|
||||
{
|
||||
private static readonly IShellAction ShellAction = new ShellAction();
|
||||
private static readonly ShellAction ShellAction = new ShellAction();
|
||||
|
||||
private static readonly CompositeFormat WoxPluginFolderSelectFileResultSubtitle = System.Text.CompositeFormat.Parse(Properties.Resources.wox_plugin_folder_select_file_result_subtitle);
|
||||
|
||||
private readonly IPath _path;
|
||||
|
||||
@@ -38,8 +41,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
Title = Title,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath),
|
||||
ToolTipData = new ToolTipData(Title, string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath)),
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFileResultSubtitle, FilePath),
|
||||
ToolTipData = new ToolTipData(Title, string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFileResultSubtitle, FilePath)),
|
||||
IcoPath = FilePath,
|
||||
Action = c => ShellAction.Execute(FilePath, contextApi),
|
||||
ContextData = new SearchResult { Type = ResultType.File, Path = FilePath },
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -10,7 +11,9 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class FolderItemResult : IItemResult
|
||||
{
|
||||
private static readonly IShellAction ShellAction = new ShellAction();
|
||||
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);
|
||||
|
||||
public FolderItemResult()
|
||||
{
|
||||
@@ -39,8 +42,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
IcoPath = Path,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle),
|
||||
ToolTipData = new ToolTipData(Title, string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle)),
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFolderResultSubtitle, Subtitle),
|
||||
ToolTipData = new ToolTipData(Title, string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFolderResultSubtitle, Subtitle)),
|
||||
QueryTextDisplay = Path,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, Path = Path },
|
||||
Action = c => ShellAction.Execute(Path, contextApi),
|
||||
|
||||
@@ -3,12 +3,15 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class TruncatedItemResult : IItemResult
|
||||
{
|
||||
private static readonly CompositeFormat MicrosoftPluginFolderTruncationWarningSubtitle = System.Text.CompositeFormat.Parse(Properties.Resources.Microsoft_plugin_folder_truncation_warning_subtitle);
|
||||
|
||||
public int PreTruncationCount { get; set; }
|
||||
|
||||
public int PostTruncationCount { get; set; }
|
||||
@@ -25,8 +28,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
QueryTextDisplay = Search,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Microsoft_plugin_folder_truncation_warning_subtitle, PostTruncationCount, PreTruncationCount),
|
||||
ToolTipData = new ToolTipData(Properties.Resources.Microsoft_plugin_folder_truncation_warning_title, string.Format(CultureInfo.CurrentCulture, Properties.Resources.Microsoft_plugin_folder_truncation_warning_subtitle, PostTruncationCount, PreTruncationCount)),
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, MicrosoftPluginFolderTruncationWarningSubtitle, PostTruncationCount, PreTruncationCount),
|
||||
ToolTipData = new ToolTipData(Properties.Resources.Microsoft_plugin_folder_truncation_warning_title, string.Format(CultureInfo.CurrentCulture, MicrosoftPluginFolderTruncationWarningSubtitle, PostTruncationCount, PreTruncationCount)),
|
||||
IcoPath = WarningIconPath,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
|
||||
// A network path must start with \\
|
||||
// Using Ordinal since this is internal and used with a symbol
|
||||
if (!sanitizedPath.StartsWith("\\", StringComparison.Ordinal))
|
||||
if (!sanitizedPath.StartsWith('\\'))
|
||||
{
|
||||
return sanitizedPath;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Microsoft.Plugin.Folder
|
||||
.Select(item => CreateFolderResult(item.Nickname, item.Path, item.Path, search));
|
||||
}
|
||||
|
||||
private static IItemResult CreateFolderResult(string title, string subtitle, string path, string search)
|
||||
private static UserFolderResult CreateFolderResult(string title, string subtitle, string path, string search)
|
||||
{
|
||||
return new UserFolderResult
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Microsoft.Plugin.Folder.Sources;
|
||||
using Microsoft.Plugin.Folder.Sources.Result;
|
||||
using Wox.Infrastructure;
|
||||
@@ -12,7 +13,7 @@ namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
public class UserFolderResult : IItemResult
|
||||
{
|
||||
private readonly IShellAction _shellAction = new ShellAction();
|
||||
private readonly ShellAction _shellAction = new ShellAction();
|
||||
|
||||
public string Search { get; set; }
|
||||
|
||||
@@ -22,6 +23,8 @@ namespace Microsoft.Plugin.Folder
|
||||
|
||||
public string Subtitle { get; set; }
|
||||
|
||||
private static readonly CompositeFormat WoxPluginFolderSelectFolderResultSubtitle = System.Text.CompositeFormat.Parse(Properties.Resources.wox_plugin_folder_select_folder_result_subtitle);
|
||||
|
||||
public Result Create(IPublicAPI contextApi)
|
||||
{
|
||||
return new Result(StringMatcher.FuzzySearch(Search, Title).MatchData)
|
||||
@@ -30,7 +33,7 @@ namespace Microsoft.Plugin.Folder
|
||||
IcoPath = Path,
|
||||
|
||||
// Using CurrentCulture since this is user facing
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle),
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, WoxPluginFolderSelectFolderResultSubtitle, Subtitle),
|
||||
QueryTextDisplay = Path,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, Path = Path },
|
||||
Action = c => _shellAction.Execute(Path, contextApi),
|
||||
|
||||
Reference in New Issue
Block a user