.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

@@ -12,7 +12,7 @@ namespace ImageResizer.Models
{
public class ResizeSize : Observable
{
private static readonly IDictionary<string, string> _tokens = new Dictionary<string, string>
private static readonly Dictionary<string, string> _tokens = new Dictionary<string, string>
{
["$small$"] = Resources.Small,
["$medium$"] = Resources.Medium,

View File

@@ -10,6 +10,7 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.IO.Abstractions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
@@ -27,6 +28,8 @@ namespace ImageResizer.Properties
WriteIndented = true,
};
private static readonly CompositeFormat ValueMustBeBetween = System.Text.CompositeFormat.Parse(Properties.Resources.ValueMustBeBetween);
// Used to synchronize access to the settings.json file
private static Mutex _jsonMutex = new Mutex();
private static string _settingsPath = _fileSystem.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "Image Resizer", "settings.json");
@@ -122,7 +125,7 @@ namespace ImageResizer.Properties
if (JpegQualityLevel < 1 || JpegQualityLevel > 100)
{
// Using CurrentCulture since this is user facing
return string.Format(CultureInfo.CurrentCulture, Resources.ValueMustBeBetween, 1, 100);
return string.Format(CultureInfo.CurrentCulture, ValueMustBeBetween, 1, 100);
}
return string.Empty;