mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36: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:
@@ -20,7 +20,7 @@ namespace PowerLauncher.Converters
|
||||
var highlightData = values[1] as List<int>;
|
||||
var selected = values[2] as bool? == true;
|
||||
|
||||
if (highlightData == null || !highlightData.Any())
|
||||
if (highlightData == null || highlightData.Count == 0)
|
||||
{
|
||||
// No highlight data, just return the text
|
||||
return new Run(text);
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace PowerLauncher.Helper
|
||||
/// Gets command line args - for ClickOnce deployed applications, command line args may not be passed directly, they have to be retrieved.
|
||||
/// </summary>
|
||||
/// <returns>List of command line arg strings.</returns>
|
||||
private static IList<string> GetCommandLineArgs(string uniqueApplicationName)
|
||||
private static List<string> GetCommandLineArgs(string uniqueApplicationName)
|
||||
{
|
||||
string[] args = null;
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace PowerLauncher.Helper
|
||||
{
|
||||
try
|
||||
{
|
||||
using (TextReader reader = new StreamReader(cmdLinePath, Encoding.Unicode))
|
||||
using (StreamReader reader = new StreamReader(cmdLinePath, Encoding.Unicode))
|
||||
{
|
||||
args = NativeMethods.CommandLineToArgvW(reader.ReadToEnd());
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
@@ -29,6 +30,8 @@ namespace PowerLauncher.Plugin
|
||||
private static readonly IDirectory Directory = FileSystem.Directory;
|
||||
private static readonly object AllPluginsLock = new object();
|
||||
|
||||
private static readonly CompositeFormat FailedToInitializePluginsTitle = System.Text.CompositeFormat.Parse(Properties.Resources.FailedToInitializePluginsTitle);
|
||||
|
||||
private static IEnumerable<PluginPair> _contextMenuPlugins = new List<PluginPair>();
|
||||
|
||||
private static List<PluginPair> _allPlugins;
|
||||
@@ -53,7 +56,7 @@ namespace PowerLauncher.Plugin
|
||||
if (_allPlugins == null)
|
||||
{
|
||||
_allPlugins = PluginConfig.Parse(Directories)
|
||||
.Where(x => x.Language.ToUpperInvariant() == AllowedLanguage.CSharp)
|
||||
.Where(x => string.Equals(x.Language, AllowedLanguage.CSharp, StringComparison.OrdinalIgnoreCase))
|
||||
.GroupBy(x => x.ID) // Deduplicates plugins by ID, choosing for each ID the highest DLL product version. This fixes issues such as https://github.com/microsoft/PowerToys/issues/14701
|
||||
.Select(g => g.OrderByDescending(x => // , where an upgrade didn't remove older versions of the plugins.
|
||||
{
|
||||
@@ -178,10 +181,10 @@ namespace PowerLauncher.Plugin
|
||||
|
||||
_contextMenuPlugins = GetPluginsForInterface<IContextMenu>();
|
||||
|
||||
if (failedPlugins.Any())
|
||||
if (!failedPlugins.IsEmpty)
|
||||
{
|
||||
var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name));
|
||||
var description = string.Format(CultureInfo.CurrentCulture, Resources.FailedToInitializePluginsDescription, failed);
|
||||
var description = string.Format(CultureInfo.CurrentCulture, FailedToInitializePluginsTitle, failed);
|
||||
Application.Current.Dispatcher.InvokeAsync(() => API.ShowMsg(Resources.FailedToInitializePluginsTitle, description, string.Empty, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace PowerLauncher
|
||||
// Watch for /Local/Microsoft/PowerToys/Launcher/Settings.json changes
|
||||
public class SettingsReader : BaseModel
|
||||
{
|
||||
private readonly ISettingsUtils _settingsUtils;
|
||||
private readonly SettingsUtils _settingsUtils;
|
||||
|
||||
private const int MaxRetries = 10;
|
||||
private static readonly object _readSyncObject = new object();
|
||||
@@ -286,7 +286,7 @@ namespace PowerLauncher
|
||||
settings.Plugins = defaultPlugins.Values.ToList();
|
||||
}
|
||||
|
||||
private static IEnumerable<PluginAdditionalOption> CombineAdditionalOptions(IEnumerable<PluginAdditionalOption> defaultAdditionalOptions, IEnumerable<PluginAdditionalOption> additionalOptions)
|
||||
private static Dictionary<string, PluginAdditionalOption>.ValueCollection CombineAdditionalOptions(IEnumerable<PluginAdditionalOption> defaultAdditionalOptions, IEnumerable<PluginAdditionalOption> additionalOptions)
|
||||
{
|
||||
var defaultOptions = defaultAdditionalOptions.ToDictionary(x => x.Key);
|
||||
foreach (var option in additionalOptions)
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -63,6 +64,8 @@ namespace PowerLauncher.ViewModel
|
||||
|
||||
internal HotkeyManager HotkeyManager { get; private set; }
|
||||
|
||||
private static readonly CompositeFormat RegisterHotkeyFailed = System.Text.CompositeFormat.Parse(Properties.Resources.registerHotkeyFailed);
|
||||
|
||||
public MainViewModel(PowerToysRunSettings settings, CancellationToken nativeThreadCancelToken)
|
||||
{
|
||||
_saved = false;
|
||||
@@ -897,7 +900,7 @@ namespace PowerLauncher.ViewModel
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
string errorMsg = string.Format(CultureInfo.InvariantCulture, Properties.Resources.registerHotkeyFailed, hotkeyStr);
|
||||
string errorMsg = string.Format(CultureInfo.InvariantCulture, RegisterHotkeyFailed, hotkeyStr);
|
||||
MessageBox.Show(errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user