.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:
gokcekantarci
2023-12-28 13:37:13 +03:00
committed by GitHub
parent cd57659ef6
commit a94b3eec39
112 changed files with 429 additions and 291 deletions

View File

@@ -2,6 +2,7 @@
// 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;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -157,12 +158,12 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
/// </summary>
public static void FeetToFt(ref string[] split)
{
if (split[1].ToLowerInvariant() == "feet")
if (string.Equals(split[1], "feet", StringComparison.OrdinalIgnoreCase))
{
split[1] = "ft";
}
if (split[3].ToLowerInvariant() == "feet")
if (string.Equals(split[3], "feet", StringComparison.OrdinalIgnoreCase))
{
split[3] = "ft";
}
@@ -183,7 +184,8 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
public static void GallonHandler(ref string[] split, CultureInfo culture)
{
HashSet<string> britishCultureNames = new HashSet<string>() { "en-AI", "en-VG", "en-GB", "en-KY", "en-MS", "en-AG", "en-DM", "en-GD", "en-KN", "en-LC", "en-VC", "en-IE", "en-GY", "en-AE" };
if (split[1].ToLowerInvariant() == "gal" || split[1].ToLowerInvariant() == "gallon")
if (string.Equals(split[1], "gal", StringComparison.OrdinalIgnoreCase) ||
string.Equals(split[1], "gallon", StringComparison.OrdinalIgnoreCase))
{
if (britishCultureNames.Contains(culture.Name))
{
@@ -195,7 +197,8 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
}
}
if (split[3].ToLowerInvariant() == "gal" || split[3].ToLowerInvariant() == "gallon")
if (string.Equals(split[3], "gal", StringComparison.OrdinalIgnoreCase) ||
string.Equals(split[3], "gallon", StringComparison.OrdinalIgnoreCase))
{
if (britishCultureNames.Contains(culture.Name))
{