.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

@@ -237,7 +237,7 @@ namespace FancyZonesEditor
private SnappyHelperBase snappyX;
private SnappyHelperBase snappyY;
private SnappyHelperBase NewMagneticSnapper(bool isX, ResizeMode mode)
private SnappyHelperMagnetic NewMagneticSnapper(bool isX, ResizeMode mode)
{
Rect workingArea = App.Overlay.WorkArea;
int screenAxisOrigin = (int)(isX ? workingArea.Left : workingArea.Top);
@@ -245,7 +245,7 @@ namespace FancyZonesEditor
return new SnappyHelperMagnetic(Model.Zones, ZoneIndex, isX, mode, screenAxisOrigin, screenAxisSize);
}
private SnappyHelperBase NewNonMagneticSnapper(bool isX, ResizeMode mode)
private SnappyHelperNonMagnetic NewNonMagneticSnapper(bool isX, ResizeMode mode)
{
Rect workingArea = App.Overlay.WorkArea;
int screenAxisOrigin = (int)(isX ? workingArea.Left : workingArea.Top);

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Globalization;
using System.Text;
using System.Windows.Automation.Peers;
using System.Windows.Controls;
@@ -10,6 +11,8 @@ namespace FancyZonesEditor.Controls
{
internal sealed class CustomSliderAutomationPeer : SliderAutomationPeer
{
private static readonly CompositeFormat CustomSliderAnnounce = System.Text.CompositeFormat.Parse(Properties.Resources.Custom_slider_announce);
private string name = string.Empty;
public CustomSliderAutomationPeer(Slider owner)
@@ -29,7 +32,7 @@ namespace FancyZonesEditor.Controls
string announce = string.Format(
CultureInfo.CurrentCulture,
Properties.Resources.Custom_slider_announce,
CustomSliderAnnounce,
name,
element.Minimum,
element.Maximum,

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
@@ -36,6 +37,10 @@ namespace FancyZonesEditor
private bool haveTriedToGetFocusAlready;
private static readonly CompositeFormat EditTemplate = System.Text.CompositeFormat.Parse(Properties.Resources.Edit_Template);
private static readonly CompositeFormat PixelValue = System.Text.CompositeFormat.Parse(Properties.Resources.Pixel_Value);
private static readonly CompositeFormat TemplateZoneCountValue = System.Text.CompositeFormat.Parse(Properties.Resources.Template_Zone_Count_Value);
public int WrapPanelItemSize { get; set; } = DefaultWrapPanelItemSize;
public MainWindow(bool spanZonesAcrossMonitors, Rect workArea)
@@ -335,7 +340,7 @@ namespace FancyZonesEditor
App.Overlay.StartEditing(_settings.SelectedModel);
Keyboard.ClearFocus();
EditLayoutDialogTitle.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Edit_Template, ((LayoutModel)dataContext).Name);
EditLayoutDialogTitle.Text = string.Format(CultureInfo.CurrentCulture, EditTemplate, ((LayoutModel)dataContext).Name);
await EditLayoutDialog.ShowAsync();
}
@@ -567,7 +572,7 @@ namespace FancyZonesEditor
FrameworkElementAutomationPeer.FromElement(SensitivityInput) as SliderAutomationPeer;
string activityId = "sliderValueChanged";
string value = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Pixel_Value, SensitivityInput.Value);
string value = string.Format(CultureInfo.CurrentCulture, PixelValue, SensitivityInput.Value);
if (peer != null && value != null)
{
@@ -588,7 +593,7 @@ namespace FancyZonesEditor
FrameworkElementAutomationPeer.FromElement(TemplateZoneCount) as SliderAutomationPeer;
string activityId = "templateZoneCountValueChanged";
string value = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Template_Zone_Count_Value, TemplateZoneCount.Value);
string value = string.Format(CultureInfo.CurrentCulture, TemplateZoneCountValue, TemplateZoneCount.Value);
if (peer != null && value != null)
{
@@ -609,7 +614,7 @@ namespace FancyZonesEditor
FrameworkElementAutomationPeer.FromElement(Spacing) as SliderAutomationPeer;
string activityId = "spacingValueChanged";
string value = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Pixel_Value, Spacing.Value);
string value = string.Format(CultureInfo.CurrentCulture, PixelValue, Spacing.Value);
if (peer != null && value != null)
{

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.Collections.ObjectModel;
using System.ComponentModel;
@@ -231,7 +232,7 @@ namespace FancyZonesEditor
{
foreach (LayoutModel model in CustomModels)
{
if (model.Uuid == currentApplied.ZonesetUuid.ToUpperInvariant())
if (string.Equals(model.Uuid, currentApplied.ZonesetUuid, StringComparison.OrdinalIgnoreCase))
{
// found match
foundModel = model;