.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

@@ -24,8 +24,10 @@ namespace Wox.Plugin
ArgumentNullException.ThrowIfNull(language);
// Using InvariantCulture since this is a command line arg
return language.ToUpper(CultureInfo.InvariantCulture) == CSharp.ToUpper(CultureInfo.InvariantCulture)
|| language.ToUpper(CultureInfo.InvariantCulture) == Executable.ToUpper(CultureInfo.InvariantCulture);
var upperLanguage = language.ToUpper(CultureInfo.InvariantCulture);
return string.Equals(upperLanguage, CSharp.ToUpper(CultureInfo.InvariantCulture), StringComparison.Ordinal)
|| string.Equals(upperLanguage, Executable.ToUpper(CultureInfo.InvariantCulture), StringComparison.Ordinal);
}
}
}

View File

@@ -85,7 +85,7 @@ namespace Wox.Plugin.Common
if (appName != null)
{
// Handle indirect strings:
if (appName.StartsWith("@", StringComparison.Ordinal))
if (appName.StartsWith('@'))
{
appName = GetIndirectString(appName);
}

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using Common.UI;
using Microsoft.Win32;
using Wox.Plugin.Common.VirtualDesktop.Interop;
@@ -54,6 +55,8 @@ namespace Wox.Plugin.Common.VirtualDesktop.Helper
/// </summary>
private Guid _currentDesktop;
private static readonly CompositeFormat VirtualDesktopHelperDesktop = System.Text.CompositeFormat.Parse(Properties.Resources.VirtualDesktopHelper_Desktop);
/// <summary>
/// Initializes a new instance of the <see cref="VirtualDesktopHelper"/> class.
/// </summary>
@@ -260,7 +263,7 @@ namespace Wox.Plugin.Common.VirtualDesktop.Helper
}
// If the desktop name was not changed by the user, it isn't saved to the registry. Then we need the default name for the desktop.
var defaultName = string.Format(System.Globalization.CultureInfo.InvariantCulture, Resources.VirtualDesktopHelper_Desktop, GetDesktopNumber(desktop));
var defaultName = string.Format(System.Globalization.CultureInfo.InvariantCulture, VirtualDesktopHelperDesktop, GetDesktopNumber(desktop));
string registryPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VirtualDesktops\\Desktops\\{" + desktop.ToString().ToUpper(System.Globalization.CultureInfo.InvariantCulture) + "}";
using RegistryKey deskSubKey = Registry.CurrentUser.OpenSubKey(registryPath, false);