[Chore] Run solution code cleanup (#20584)

This commit is contained in:
Andrey Nekrasov
2022-09-16 11:54:58 +03:00
committed by GitHub
parent 09f4dead7f
commit ca3c758046
133 changed files with 108 additions and 359 deletions

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Microsoft.Win32; using Microsoft.Win32;

View File

@@ -6,9 +6,6 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using interop;
using Microsoft.VisualBasic;
using Windows.Storage;
namespace MeasureToolUI.Helpers namespace MeasureToolUI.Helpers
{ {

View File

@@ -2,11 +2,8 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Windows.Interop;
using Common.UI; using Common.UI;
using interop; using interop;
using PowerOCR.Helpers;
using PowerOCR.Utilities; using PowerOCR.Utilities;
namespace PowerOCR.Keyboard namespace PowerOCR.Keyboard

View File

@@ -5,7 +5,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Windows.Input;
using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using PowerOCR.Settings; using PowerOCR.Settings;
using PowerOCR.Utilities; using PowerOCR.Utilities;

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Diagnostics;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;

View File

@@ -9,7 +9,6 @@ using System.IO.Abstractions;
using System.Threading; using System.Threading;
using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Telemetry;
namespace PowerOCR.Settings namespace PowerOCR.Settings
{ {

View File

@@ -9,8 +9,6 @@ using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using Awake.Core.Models;
using Microsoft.Win32; using Microsoft.Win32;
using NLog; using NLog;
using Windows.Win32; using Windows.Win32;

View File

@@ -4,10 +4,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -19,7 +17,6 @@ using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging; using Windows.Win32.UI.WindowsAndMessaging;
#pragma warning disable CS8602 // Dereference of a possibly null reference. #pragma warning disable CS8602 // Dereference of a possibly null reference.
#pragma warning disable CS8603 // Possible null reference return.
namespace Awake.Core namespace Awake.Core
{ {
@@ -94,7 +91,6 @@ namespace Awake.Core
settings.Properties.TrayTimeShortcuts); settings.Properties.TrayTimeShortcuts);
} }
[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:Single line comments should begin with single space", Justification = "For debugging purposes - will remove later.")]
public static void SetTray(string text, bool keepDisplayOn, AwakeMode mode, Dictionary<string, int> trayTimeShortcuts) public static void SetTray(string text, bool keepDisplayOn, AwakeMode mode, Dictionary<string, int> trayTimeShortcuts)
{ {
TrayMenu = new DestroyMenuSafeHandle(PInvoke.CreatePopupMenu()); TrayMenu = new DestroyMenuSafeHandle(PInvoke.CreatePopupMenu());

View File

@@ -19,7 +19,6 @@ using Awake.Core;
using interop; using interop;
using ManagedCommon; using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Telemetry.Events;
using NLog; using NLog;
using Windows.Win32; using Windows.Win32;
using Windows.Win32.Foundation; using Windows.Win32.Foundation;

View File

@@ -14,7 +14,6 @@ namespace ColorPicker
{ {
public static CompositionContainer Container { get; private set; } public static CompositionContainer Container { get; private set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "This is properly disposed of in MainWindow.Xaml.cs")]
public static void InitializeContainer(object initPoint) public static void InitializeContainer(object initPoint)
{ {
var catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly()); var catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly());

View File

@@ -233,9 +233,7 @@ namespace ColorPicker.Controls
DetailsFlyout.Hide(); DetailsFlyout.Hide();
} }
#pragma warning disable CA1801 // Review unused parameters
private void DetailsFlyout_Closed(object sender, object e) private void DetailsFlyout_Closed(object sender, object e)
#pragma warning restore CA1801 // Review unused parameters
{ {
HideDetails(); HideDetails();
AppStateHandler.BlockEscapeKeyClosingColorPickerEditor = false; AppStateHandler.BlockEscapeKeyClosingColorPickerEditor = false;
@@ -247,11 +245,7 @@ namespace ColorPicker.Controls
HexCode.Text = ColorToHex(_originalColor); HexCode.Text = ColorToHex(_originalColor);
} }
#pragma warning disable CA1822 // Mark members as static
#pragma warning disable CA1801 // Review unused parameters
private void DetailsFlyout_Opened(object sender, object e) private void DetailsFlyout_Opened(object sender, object e)
#pragma warning restore CA1801 // Review unused parameters
#pragma warning restore CA1822 // Mark members as static
{ {
AppStateHandler.BlockEscapeKeyClosingColorPickerEditor = true; AppStateHandler.BlockEscapeKeyClosingColorPickerEditor = true;
} }
@@ -331,10 +325,7 @@ namespace ColorPicker.Controls
private static string ColorToHex(Color color, string oldValue = "") private static string ColorToHex(Color color, string oldValue = "")
{ {
string newHexString = BitConverter.ToString(new byte[] { color.R, color.G, color.B }).Replace("-", string.Empty, StringComparison.InvariantCulture); string newHexString = BitConverter.ToString(new byte[] { color.R, color.G, color.B }).Replace("-", string.Empty, StringComparison.InvariantCulture);
#pragma warning disable CA1308 // Normalize strings to uppercase - Supressed because we want to show hex value in lower case on all places
newHexString = newHexString.ToLowerInvariant(); newHexString = newHexString.ToLowerInvariant();
#pragma warning restore CA1308 // Normalize strings to uppercase
// Return only with hashtag if user typed it before // Return only with hashtag if user typed it before
bool addHashtag = oldValue.StartsWith("#", StringComparison.InvariantCulture); bool addHashtag = oldValue.StartsWith("#", StringComparison.InvariantCulture);

View File

@@ -212,9 +212,7 @@ namespace ColorPicker.Helpers
_hwndSource = hwndSource; _hwndSource = hwndSource;
} }
#pragma warning disable CA1801 // Review unused parameters
public IntPtr ProcessWindowMessages(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled) public IntPtr ProcessWindowMessages(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
#pragma warning restore CA1801 // Review unused parameters
{ {
switch (msg) switch (msg)
{ {

View File

@@ -17,7 +17,6 @@ namespace ColorPicker.Helpers
{ {
public static readonly HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero); public static readonly HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Interop")]
private MonitorResolutionHelper(IntPtr monitor, IntPtr hdc) private MonitorResolutionHelper(IntPtr monitor, IntPtr hdc)
{ {
var info = new MonitorInfoEx(); var info = new MonitorInfoEx();
@@ -74,7 +73,6 @@ namespace ColorPicker.Helpers
public ArrayList Monitors { get; private set; } public ArrayList Monitors { get; private set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Interop")]
public bool Callback( public bool Callback(
IntPtr monitor, IntPtr monitor,
IntPtr hdc, IntPtr hdc,

View File

@@ -32,62 +32,58 @@ namespace ColorPicker.Helpers
switch (method) switch (method)
{ {
case GroupExportedColorsBy.Color: case GroupExportedColorsBy.Color:
{
foreach (Color color in (IList)colorsToExport)
{ {
var tmp = new Dictionary<string, string>();
foreach (var colorFormatModel in colorFormatModels)
{
var colorInSpecificFormat = colorFormatModel.Convert(color);
if (colorFormatModel.FormatName == "HEX")
{
colorInSpecificFormat = "#" + colorInSpecificFormat;
}
tmp.Add(
colorFormatModel.FormatName,
#pragma warning disable CA1308 // Normalize strings to uppercase
colorInSpecificFormat.Replace(
colorFormatModel.FormatName.ToLower(CultureInfo.InvariantCulture),
string.Empty,
StringComparison.InvariantCultureIgnoreCase));
#pragma warning restore CA1308 // Normalize strings to uppercase
}
colors.Add($"color{i++}", tmp);
}
}
break;
case GroupExportedColorsBy.Format:
{
foreach (var colorFormatModel in colorFormatModels)
{
var tmp = new Dictionary<string, string>();
i = 1;
foreach (Color color in (IList)colorsToExport) foreach (Color color in (IList)colorsToExport)
{ {
var colorInSpecificFormat = colorFormatModel.Convert(color); var tmp = new Dictionary<string, string>();
if (colorFormatModel.FormatName == "HEX") foreach (var colorFormatModel in colorFormatModels)
{ {
colorInSpecificFormat = "#" + colorInSpecificFormat; var colorInSpecificFormat = colorFormatModel.Convert(color);
if (colorFormatModel.FormatName == "HEX")
{
colorInSpecificFormat = "#" + colorInSpecificFormat;
}
tmp.Add(
colorFormatModel.FormatName,
colorInSpecificFormat.Replace(
colorFormatModel.FormatName.ToLower(CultureInfo.InvariantCulture),
string.Empty,
StringComparison.InvariantCultureIgnoreCase));
} }
tmp.Add( colors.Add($"color{i++}", tmp);
$"color{i++}",
#pragma warning disable CA1308 // Normalize strings to uppercase
colorInSpecificFormat.Replace(
colorFormatModel.FormatName.ToLower(CultureInfo.InvariantCulture),
string.Empty,
StringComparison.InvariantCultureIgnoreCase));
#pragma warning restore CA1308 // Normalize strings to uppercase
} }
colors.Add(colorFormatModel.FormatName, tmp);
} }
}
break; break;
case GroupExportedColorsBy.Format:
{
foreach (var colorFormatModel in colorFormatModels)
{
var tmp = new Dictionary<string, string>();
i = 1;
foreach (Color color in (IList)colorsToExport)
{
var colorInSpecificFormat = colorFormatModel.Convert(color);
if (colorFormatModel.FormatName == "HEX")
{
colorInSpecificFormat = "#" + colorInSpecificFormat;
}
tmp.Add(
$"color{i++}",
colorInSpecificFormat.Replace(
colorFormatModel.FormatName.ToLower(CultureInfo.InvariantCulture),
string.Empty,
StringComparison.InvariantCultureIgnoreCase));
}
colors.Add(colorFormatModel.FormatName, tmp);
}
}
break;
} }
return colors; return colors;
@@ -121,9 +117,9 @@ namespace ColorPicker.Helpers
public static string ToJson(this Dictionary<string, Dictionary<string, string>> source, bool indented = true) public static string ToJson(this Dictionary<string, Dictionary<string, string>> source, bool indented = true)
{ {
var options = new JsonSerializerOptions var options = new JsonSerializerOptions
{ {
WriteIndented = indented, WriteIndented = indented,
}; };
return JsonSerializer.Serialize(source, options); return JsonSerializer.Serialize(source, options);
} }

View File

@@ -17,53 +17,20 @@ namespace ColorPicker
{ {
private const int GWL_EX_STYLE = -20; private const int GWL_EX_STYLE = -20;
private const int WS_EX_TOOLWINDOW = 0x00000080; private const int WS_EX_TOOLWINDOW = 0x00000080;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int WH_KEYBOARD_LL = 13; public const int WH_KEYBOARD_LL = 13;
public const int VkSnapshot = 0x2c; public const int VkSnapshot = 0x2c;
public const int KfAltdown = 0x2000; public const int KfAltdown = 0x2000;
public const int LlkhfAltdown = KfAltdown >> 8; public const int LlkhfAltdown = KfAltdown >> 8;
public const int MonitorinfofPrimary = 0x00000001; public const int MonitorinfofPrimary = 0x00000001;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int VK_SHIFT = 0x10; public const int VK_SHIFT = 0x10;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int VK_CONTROL = 0x11; public const int VK_CONTROL = 0x11;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int VK_MENU = 0x12; public const int VK_MENU = 0x12;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int VK_LWIN = 0x5B; public const int VK_LWIN = 0x5B;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int VK_RWIN = 0x5C; public const int VK_RWIN = 0x5C;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int VK_ESCAPE = 0x1B; public const int VK_ESCAPE = 0x1B;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int WM_HOTKEY = 0x0312; public const int WM_HOTKEY = 0x0312;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int WM_KEYDOWN = 0x0100; public const int WM_KEYDOWN = 0x0100;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const int WM_KEYUP = 0x0101; public const int WM_KEYUP = 0x0101;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public const uint MOD_NOREPEAT = 0x4000; public const uint MOD_NOREPEAT = 0x4000;
public delegate bool MonitorEnumProc( public delegate bool MonitorEnumProc(
@@ -117,7 +84,6 @@ namespace ColorPicker
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
internal static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); internal static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Interop object")]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct POINT internal struct POINT
{ {
@@ -125,7 +91,6 @@ namespace ColorPicker
public int y; public int y;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Interop object")]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct MSLLHOOKSTRUCT internal struct MSLLHOOKSTRUCT
{ {
@@ -145,7 +110,6 @@ namespace ColorPicker
public static explicit operator System.Windows.Point(PointInter point) => new System.Windows.Point(point.X, point.Y); public static explicit operator System.Windows.Point(PointInter point) => new System.Windows.Point(point.X, point.Y);
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Interop object")]
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct Rect internal struct Rect
{ {
@@ -155,7 +119,6 @@ namespace ColorPicker
public int bottom; public int bottom;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Interop object")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "false positive, used in MonitorResolutionHelper")] [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "false positive, used in MonitorResolutionHelper")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
internal class MonitorInfoEx internal class MonitorInfoEx

View File

@@ -7,7 +7,6 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Drawing.Drawing2D;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -177,10 +176,10 @@ namespace ColorPicker.ViewModels
var colors = SerializationHelper.ConvertToDesiredColorFormats((IList)colorsToExport, ColorRepresentations, method); var colors = SerializationHelper.ConvertToDesiredColorFormats((IList)colorsToExport, ColorRepresentations, method);
var dialog = new SaveFileDialog var dialog = new SaveFileDialog
{ {
Title = "Save selected colors to", Title = "Save selected colors to",
Filter = "Text Files (*.txt)|*.txt|Json Files (*.json)|*.json", Filter = "Text Files (*.txt)|*.txt|Json Files (*.json)|*.json",
}; };
if (dialog.ShowDialog() == true) if (dialog.ShowDialog() == true)
{ {

View File

@@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Threading;
using Common.UI; using Common.UI;
using FancyZonesEditor.Logs; using FancyZonesEditor.Logs;
using FancyZonesEditor.Utils; using FancyZonesEditor.Utils;

View File

@@ -4,7 +4,6 @@
namespace FancyZonesEditor.Controls namespace FancyZonesEditor.Controls
{ {
using System.Windows;
using System.Windows.Automation.Peers; using System.Windows.Automation.Peers;
using System.Windows.Controls; using System.Windows.Controls;

View File

@@ -290,11 +290,11 @@ namespace FancyZonesEditor
if (IsActualSize) if (IsActualSize)
{ {
rect.Style = (Style)FindResource("CanvasLayoutActualScalePreviewStyle"); rect.Style = (Style)FindResource("CanvasLayoutActualScalePreviewStyle");
} }
else else
{ {
rect.Style = (Style)FindResource("CanvasLayoutSmallScalePreviewStyle"); rect.Style = (Style)FindResource("CanvasLayoutSmallScalePreviewStyle");
} }
frame.Children.Add(rect); frame.Children.Add(rect);

View File

@@ -14,7 +14,6 @@ using Common.UI;
using FancyZonesEditor.Logs; using FancyZonesEditor.Logs;
using FancyZonesEditor.Models; using FancyZonesEditor.Models;
using FancyZonesEditor.Utils; using FancyZonesEditor.Utils;
using ModernWpf.Automation.Peers;
using ModernWpf.Controls; using ModernWpf.Controls;
namespace FancyZonesEditor namespace FancyZonesEditor

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using FancyZonesEditor.Models; using FancyZonesEditor.Models;
namespace FancyZonesEditor namespace FancyZonesEditor

View File

@@ -24,7 +24,5 @@ namespace FancyZonesEditor
public int Offset { get; } public int Offset { get; }
} }
#pragma warning disable CA1711 // Identifiers should not have incorrect suffix (Causes warning in another class if fixed)
public delegate void SplitEventHandler(object sender, SplitEventArgs args); public delegate void SplitEventHandler(object sender, SplitEventArgs args);
#pragma warning restore CA1711 // Identifiers should not have incorrect suffix
} }

View File

@@ -17,11 +17,9 @@ namespace FancyZonesEditor.Utils
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
#pragma warning disable SA1310 // Field names should not contain underscore
private const int GWL_EX_STYLE = -20; private const int GWL_EX_STYLE = -20;
private const int WS_EX_APPWINDOW = 0x00040000; private const int WS_EX_APPWINDOW = 0x00040000;
private const int WS_EX_TOOLWINDOW = 0x00000080; private const int WS_EX_TOOLWINDOW = 0x00000080;
#pragma warning restore SA1310 // Field names should not contain underscore
public static void SetWindowStyleToolWindow(Window hwnd) public static void SetWindowStyleToolWindow(Window hwnd)
{ {

View File

@@ -25,9 +25,7 @@ namespace ImageResizer.Properties
} }
[ClassInitialize] [ClassInitialize]
#pragma warning disable CA1801 // Review unused parameters
public static void ClassInitialize(TestContext context) public static void ClassInitialize(TestContext context)
#pragma warning restore CA1801 // Review unused parameters
{ {
// new App() needs to be created since Settings.Reload() uses App.Current to update properties on the UI thread. App() can be created only once otherwise it results in System.InvalidOperationException : Cannot create more than one System.Windows.Application instance in the same AppDomain. // new App() needs to be created since Settings.Reload() uses App.Current to update properties on the UI thread. App() can be created only once otherwise it results in System.InvalidOperationException : Cannot create more than one System.Windows.Application instance in the same AppDomain.
_imageResizerApp = new App(); _imageResizerApp = new App();

View File

@@ -85,10 +85,10 @@ namespace ImageResizer.Models
{ {
BitmapMetadata originalMetadata = (BitmapMetadata)originalFrame.Metadata; BitmapMetadata originalMetadata = (BitmapMetadata)originalFrame.Metadata;
#if DEBUG #if DEBUG
Debug.WriteLine($"### Processing metadata of file {_file}"); Debug.WriteLine($"### Processing metadata of file {_file}");
originalMetadata.PrintsAllMetadataToDebugOutput(); originalMetadata.PrintsAllMetadataToDebugOutput();
#endif #endif
var metadata = GetValidMetadata(originalMetadata, transformedBitmap, containerFormat); var metadata = GetValidMetadata(originalMetadata, transformedBitmap, containerFormat);

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/ // See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
using System; using System;
using System.Text.Encodings.Web;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;

View File

@@ -10,7 +10,6 @@ using System.Runtime.InteropServices;
namespace ImageResizer.Utilities namespace ImageResizer.Utilities
{ {
// Win32 functions required for temporary workaround for issue #1273 // Win32 functions required for temporary workaround for issue #1273
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Naming used in Win32 dll")]
internal class NativeMethods internal class NativeMethods
{ {
[DllImport("user32.dll")] [DllImport("user32.dll")]

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/ // See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
using System.Collections.Generic; using System.Collections.Generic;
using ImageResizer.ViewModels;
namespace ImageResizer.Views namespace ImageResizer.Views
{ {

View File

@@ -34,7 +34,7 @@ namespace ImageResizer.Views
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ {
return (Visibility)value == Visibility.Visible; return (Visibility)value == Visibility.Visible;
} }
} }
} }

View File

@@ -4,8 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using UnitsNet; using UnitsNet;
namespace Community.PowerToys.Run.Plugin.UnitConverter namespace Community.PowerToys.Run.Plugin.UnitConverter

View File

@@ -47,8 +47,8 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.RemoteMachinesHelper
var machine = new VSCodeRemoteMachine(); var machine = new VSCodeRemoteMachine();
machine.Host = h.Host; machine.Host = h.Host;
machine.VSCodeInstance = vscodeInstance; machine.VSCodeInstance = vscodeInstance;
machine.HostName = h.HostName != null ? h.HostName : string.Empty; machine.HostName = h.HostName ?? string.Empty;
machine.User = h.User != null ? h.User : string.Empty; machine.User = h.User ?? string.Empty;
results.Add(machine); results.Add(machine);
} }

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces

View File

@@ -75,7 +75,7 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper
Instances = new List<VSCodeInstance>(); Instances = new List<VSCodeInstance>();
paths = paths.Where(x => paths = paths.Where(x =>
x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) || x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) ||
x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) || x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) ||
x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToList(); x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToList();
foreach (var path in paths) foreach (var path in paths)

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.IO; using System.IO;
using Microsoft.Plugin.Folder.Sources;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.Plugin.Folder.Sources.Tests namespace Microsoft.Plugin.Folder.Sources.Tests

View File

@@ -3,9 +3,7 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Plugin.Folder.Sources;
using Microsoft.Plugin.Folder.Sources.Result; using Microsoft.Plugin.Folder.Sources.Result;
using Wox.Plugin;
namespace Microsoft.Plugin.Folder namespace Microsoft.Plugin.Folder
{ {

View File

@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Plugin.Folder.Sources; using Microsoft.Plugin.Folder.Sources;
using Microsoft.Plugin.Folder.Sources.Result; using Microsoft.Plugin.Folder.Sources.Result;
using Wox.Plugin;
namespace Microsoft.Plugin.Folder namespace Microsoft.Plugin.Folder
{ {

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Collections.Generic; using System.Collections.Generic;
using Wox.Infrastructure.Storage;
namespace Microsoft.Plugin.Folder.Sources namespace Microsoft.Plugin.Folder.Sources
{ {

View File

@@ -14,7 +14,6 @@ namespace Microsoft.Plugin.Folder.Sources
private static readonly IFileSystem _fileSystem = new FileSystem(); private static readonly IFileSystem _fileSystem = new FileSystem();
private static readonly List<string> DriverNames = InitialDriverList().ToList(); private static readonly List<string> DriverNames = InitialDriverList().ToList();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Do not want to change the behavior of the application, but want to enforce static analysis")]
private static IEnumerable<string> InitialDriverList() private static IEnumerable<string> InitialDriverList()
{ {
// Using InvariantCulture since this is internal // Using InvariantCulture since this is internal

View File

@@ -44,7 +44,6 @@ namespace Microsoft.Plugin.Folder.Sources
return query.Any(c => c.Equals('>')); return query.Any(c => c.Equals('>'));
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Do not want to change the behavior of the application, but want to enforce static analysis")]
private (string search, string incompleteName) Process(string search) private (string search, string incompleteName) Process(string search)
{ {
string incompleteName = string.Empty; string incompleteName = string.Empty;

View File

@@ -3,13 +3,10 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Wox.Infrastructure; using Wox.Infrastructure;
using Wox.Plugin; using Wox.Plugin;
using Wox.Plugin.Logger;
namespace Microsoft.Plugin.Folder.Sources namespace Microsoft.Plugin.Folder.Sources
{ {

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using Microsoft.Win32; using Microsoft.Win32;
namespace Microsoft.Plugin.Indexer.DriveDetection namespace Microsoft.Plugin.Indexer.DriveDetection

View File

@@ -77,7 +77,6 @@ namespace Microsoft.Plugin.Indexer.Interop
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
[return: MarshalAs(UnmanagedType.LPWStr)] [return: MarshalAs(UnmanagedType.LPWStr)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "Keeping original method name")]
public virtual extern string URLBeingIndexed(); public virtual extern string URLBeingIndexed();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]

View File

@@ -75,7 +75,6 @@ namespace Microsoft.Plugin.Indexer.Interop
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
[return: MarshalAs(UnmanagedType.LPWStr)] [return: MarshalAs(UnmanagedType.LPWStr)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "Keeping original method name")]
string URLBeingIndexed(); string URLBeingIndexed();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.OleDb; using System.Data.OleDb;
@@ -10,10 +9,6 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
{ {
public class OleDBSearch : ISearch public class OleDBSearch : ISearch
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Security",
"CA2100:Review SQL queries for security vulnerabilities",
Justification = "sqlQuery does not come from user input but is generated via the ISearchQueryHelper::GenerateSqlFromUserQuery see: https://docs.microsoft.com/en-us/windows/win32/search/-search-3x-wds-qryidx-searchqueryhelper#using-the-generatesqlfromuserquery-method")]
public List<OleDBResult> Query(string connectionString, string sqlQuery) public List<OleDBResult> Query(string connectionString, string sqlQuery)
{ {
List<OleDBResult> result = new List<OleDBResult>(); List<OleDBResult> result = new List<OleDBResult>();

View File

@@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.Plugin.Indexer.Interop; using Microsoft.Plugin.Indexer.Interop;
using Wox.Plugin.Logger; using Wox.Plugin.Logger;

View File

@@ -12,7 +12,6 @@ namespace Microsoft.Plugin.Program.Programs
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAppxFactory public interface IAppxFactory
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Implements COM Interface")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Implements COM Interface")] [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Implements COM Interface")]
void _VtblGap0_2(); // skip 2 methods void _VtblGap0_2(); // skip 2 methods

View File

@@ -11,13 +11,11 @@ namespace Microsoft.Plugin.Program.Programs
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAppxManifestReader public interface IAppxManifestReader
{ {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Implements COM Interface")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Implements COM Interface")] [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Implements COM Interface")]
void _VtblGap0_1(); // skip 1 method void _VtblGap0_1(); // skip 1 method
IAppxManifestProperties GetProperties(); IAppxManifestProperties GetProperties();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Implements COM Interface")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Implements COM Interface")] [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Implements COM Interface")]
void _VtblGap1_5(); // skip 5 methods void _VtblGap1_5(); // skip 5 methods

View File

@@ -41,7 +41,6 @@ namespace Microsoft.Plugin.Program.Programs
} }
[Flags] [Flags]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Represents flags specified in IShellLink interface")]
public enum SLR_FLAGS public enum SLR_FLAGS
{ {
SLR_NO_UI = 0x1, SLR_NO_UI = 0x1,

View File

@@ -733,7 +733,6 @@ namespace Microsoft.Plugin.Program.Programs
return files; return files;
} }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "User facing path needs to be shown in lowercase.")]
private static string Extension(string path) private static string Extension(string path)
{ {
// Using InvariantCulture since this is user facing // Using InvariantCulture since this is user facing

View File

@@ -78,7 +78,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
private static bool KillProcessCommand(Window window) private static bool KillProcessCommand(Window window)
{ {
// Validate process // Validate process
if (!window.IsWindow || !window.Process.DoesExist || !window.Process.Name.Equals(WindowProcess.GetProcessNameFromProcessID(window.Process.ProcessID), StringComparison.Ordinal) ) if (!window.IsWindow || !window.Process.DoesExist || !window.Process.Name.Equals(WindowProcess.GetProcessNameFromProcessID(window.Process.ProcessID), StringComparison.Ordinal))
{ {
Log.Debug($"Can not kill process '{window.Process.Name}' ({window.Process.ProcessID}) of the window '{window.Title}' ({window.Hwnd}), because it doesn't exist.", typeof(ContextMenuHelper)); Log.Debug($"Can not kill process '{window.Process.Name}' ({window.Process.ProcessID}) of the window '{window.Title}' ({window.Hwnd}), because it doesn't exist.", typeof(ContextMenuHelper));
return false; return false;

View File

@@ -24,7 +24,6 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// <param name="text">The text to search inside of</param> /// <param name="text">The text to search inside of</param>
/// <param name="searchText">the text to search for</param> /// <param name="searchText">the text to search for</param>
/// <returns>returns the index location of each of the letters of the matches</returns> /// <returns>returns the index location of each of the letters of the matches</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1814:Prefer jagged arrays over multidimensional", Justification = "matches does not waste space with the current implementation, however this could probably be optimized to store the indices of matches instead of boolean values. Currently there are no unit tests for this, but we could refactor if memory/perf becomes an issue. ")]
internal static List<int> FindBestFuzzyMatch(string text, string searchText) internal static List<int> FindBestFuzzyMatch(string text, string searchText)
{ {
if (searchText == null) if (searchText == null)
@@ -85,7 +84,6 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// a two dimensional array with the first dimension the text and the second /// a two dimensional array with the first dimension the text and the second
/// one the search string and each cell marked as an intersection between the two</param> /// one the search string and each cell marked as an intersection between the two</param>
/// <returns>a list of the possible combinations that match the search text</returns> /// <returns>a list of the possible combinations that match the search text</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1814:Prefer jagged arrays over multidimensional", Justification = "matches does not waste space with the current implementation, however this could probably be optimized to store the indices of matches instead of boolean values. Currently there are no unit tests for this, but we could refactor if memory/perf becomes an issue. ")]
internal static List<List<int>> GetAllMatchIndexes(bool[,] matches) internal static List<List<int>> GetAllMatchIndexes(bool[,] matches)
{ {
if (matches == null) if (matches == null)

View File

@@ -13,12 +13,12 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// </summary> /// </summary>
internal static class ResultHelper internal static class ResultHelper
{ {
/// <summary> /// <summary>
/// Returns a list of all results for the query. /// Returns a list of all results for the query.
/// </summary> /// </summary>
/// <param name="searchControllerResults">List with all search controller matches</param> /// <param name="searchControllerResults">List with all search controller matches</param>
/// <param name="icon">The path to the result icon</param> /// <param name="icon">The path to the result icon</param>
/// <returns>List of results</returns> /// <returns>List of results</returns>
internal static List<Result> GetResultList(List<SearchResult> searchControllerResults, bool isKeywordSearch, string icon, string infoIcon) internal static List<Result> GetResultList(List<SearchResult> searchControllerResults, bool isKeywordSearch, string icon, string infoIcon)
{ {
bool addExplorerInfo = false; bool addExplorerInfo = false;
@@ -113,7 +113,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
return new ToolTipData(window.Title, text); return new ToolTipData(window.Title, text);
} }
else else
{ {
string text = $"hWnd: {window.Hwnd}\n" + string text = $"hWnd: {window.Hwnd}\n" +
$"Window class: {window.ClassName}\n" + $"Window class: {window.ClassName}\n" +
@@ -134,7 +134,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
$"Is AllDesktops view: {window.Desktop.IsAllDesktopsView}"; $"Is AllDesktops view: {window.Desktop.IsAllDesktopsView}";
return new ToolTipData(window.Title, text); return new ToolTipData(window.Title, text);
} }
} }
/// <summary> /// <summary>

View File

@@ -32,11 +32,11 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
} }
[DataTestMethod] [DataTestMethod]
[DataRow("((((", "only opening brackets")] [DataRow("((((", "only opening brackets")]
[DataRow("]]]", "only closing brackets")] [DataRow("]]]", "only closing brackets")]
[DataRow("([)(])", "inner bracket mismatch")] [DataRow("([)(])", "inner bracket mismatch")]
[DataRow(")(", "opening and closing reversed")] [DataRow(")(", "opening and closing reversed")]
[DataRow("(]", "mismatch in bracket type")] [DataRow("(]", "mismatch in bracket type")]
public void IsBracketComplete_TestInvalid_WhenCalled(string input, string invalidReason) public void IsBracketComplete_TestInvalid_WhenCalled(string input, string invalidReason)
{ {
// Arrange // Arrange

View File

@@ -44,9 +44,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
continue; continue;
default: default:
{ {
throw new ArgumentOutOfRangeException(nameof(direction), direction, "Can't process value"); throw new ArgumentOutOfRangeException(nameof(direction), direction, "Can't process value");
} }
} }
} }

View File

@@ -15,8 +15,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.UnitTest.Helper
[DataRow(@"HKLM\", false, @"HKLM\", "")] [DataRow(@"HKLM\", false, @"HKLM\", "")]
[DataRow(@"HKLM\\", true, @"HKLM", "")] [DataRow(@"HKLM\\", true, @"HKLM", "")]
[DataRow(@"HKLM\\Test", true, @"HKLM", "Test")] [DataRow(@"HKLM\\Test", true, @"HKLM", "Test")]
[DataRow(@"HKLM\Test\\TestTest", true, @"HKLM\Test", "TestTest")] [DataRow(@"HKLM\Test\\TestTest", true, @"HKLM\Test", "TestTest")]
[DataRow(@"HKLM\Test\\\TestTest", true, @"HKLM\Test", @"\TestTest")] [DataRow(@"HKLM\Test\\\TestTest", true, @"HKLM\Test", @"\TestTest")]
public void GetQueryPartsTest(string query, bool expectedHasValueName, string expectedQueryKey, string expectedQueryValueName) public void GetQueryPartsTest(string query, bool expectedHasValueName, string expectedQueryKey, string expectedQueryValueName)
{ {
var hasValueName = QueryHelper.GetQueryParts(query, out var queryKey, out var queryValueName); var hasValueName = QueryHelper.GetQueryParts(query, out var queryKey, out var queryValueName);

View File

@@ -255,7 +255,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Service.Helpers
private static bool IsDelayedStart(string serviceName) private static bool IsDelayedStart(string serviceName)
{ {
return (int?)Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Services\" + serviceName, false)?.GetValue("DelayedAutostart", 0, RegistryValueOptions.None) == 1; return (int?)Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Services\" + serviceName, false)?.GetValue("DelayedAutostart", 0, RegistryValueOptions.None) == 1;
} }
} }
} }

View File

@@ -238,7 +238,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Components
} }
else if (ipList[i].SuffixOrigin == SuffixOrigin.Random) else if (ipList[i].SuffixOrigin == SuffixOrigin.Random)
{ {
IPv6Temporary = ip.ToString(); IPv6Temporary = ip.ToString();
} }
else else
{ {

View File

@@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using Microsoft.PowerToys.Run.Plugin.System.Properties; using Microsoft.PowerToys.Run.Plugin.System.Properties;
using Wox.Infrastructure;
using Wox.Plugin; using Wox.Plugin;
using Wox.Plugin.Logger; using Wox.Plugin.Logger;

View File

@@ -4,7 +4,6 @@
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq; using Moq;
using Wox.Infrastructure; using Wox.Infrastructure;

View File

@@ -4,7 +4,6 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.Threading;
using Microsoft.PowerToys.Run.Plugin.TimeDate.Components; using Microsoft.PowerToys.Run.Plugin.TimeDate.Components;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;

View File

@@ -4,9 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Threading;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using ManagedCommon; using ManagedCommon;

View File

@@ -6,7 +6,6 @@ using System.Linq;
using Microsoft.PowerToys.Run.Plugin.TimeZone.Classes; using Microsoft.PowerToys.Run.Plugin.TimeZone.Classes;
using Microsoft.PowerToys.Run.Plugin.TimeZone.Helper; using Microsoft.PowerToys.Run.Plugin.TimeZone.Helper;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using NLog;
using Wox.Plugin; using Wox.Plugin;
namespace Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests namespace Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Wox.Plugin.Logger; using Wox.Plugin.Logger;

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Wox.Plugin.Logger; using Wox.Plugin.Logger;

View File

@@ -6,12 +6,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Media;
namespace PowerLauncher.Converters namespace PowerLauncher.Converters
{ {
@@ -19,9 +16,7 @@ namespace PowerLauncher.Converters
{ {
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{ {
#pragma warning disable CA1062 // Validate arguments of public methods
var text = values[0] as string; var text = values[0] as string;
#pragma warning restore CA1062 // Validate arguments of public methods
var highlightData = values[1] as List<int>; var highlightData = values[1] as List<int>;
var selected = values[2] as bool? == true; var selected = values[2] as bool? == true;

View File

@@ -2,9 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Automation.Peers; using System.Windows.Automation.Peers;
using System.Windows.Controls; using System.Windows.Controls;

View File

@@ -3,12 +3,9 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
using NLog; using NLog;
using Wox.Infrastructure;
using Wox.Infrastructure.Exception; using Wox.Infrastructure.Exception;
using Wox.Plugin; using Wox.Plugin;

View File

@@ -7,7 +7,6 @@ using System.ComponentModel;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security; using System.Security;
using System.Text; using System.Text;
using Microsoft.Win32.SafeHandles;
using static PowerLauncher.Helper.WindowsInteropHelper; using static PowerLauncher.Helper.WindowsInteropHelper;
// http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/ // http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/

View File

@@ -11,7 +11,6 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using interop;
// http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/ // http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/
// modified to allow single instance restart // modified to allow single instance restart

View File

@@ -124,9 +124,7 @@ namespace PowerLauncher
private const string EnvironmentChangeType = "Environment"; private const string EnvironmentChangeType = "Environment";
#pragma warning disable CA1801 // Review unused parameters
public IntPtr ProcessWindowMessages(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled) public IntPtr ProcessWindowMessages(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
#pragma warning restore CA1801 // Review unused parameters
{ {
switch ((WM)msg) switch ((WM)msg)
{ {

View File

@@ -481,9 +481,7 @@ namespace PowerLauncher.ViewModel
private void QueryHistory() private void QueryHistory()
{ {
// Using CurrentCulture since query is received from user and used in downstream comparisons using CurrentCulture // Using CurrentCulture since query is received from user and used in downstream comparisons using CurrentCulture
#pragma warning disable CA1308 // Normalize strings to uppercase
var query = QueryText.ToLower(CultureInfo.CurrentCulture).Trim(); var query = QueryText.ToLower(CultureInfo.CurrentCulture).Trim();
#pragma warning restore CA1308 // Normalize strings to uppercase
History.Clear(); History.Clear();
var results = new List<Result>(); var results = new List<Result>();
@@ -768,9 +766,7 @@ namespace PowerLauncher.ViewModel
return selected; return selected;
} }
#pragma warning disable CA1801 // Review unused parameters
internal bool ProcessHotKeyMessages(IntPtr wparam, IntPtr lparam) internal bool ProcessHotKeyMessages(IntPtr wparam, IntPtr lparam)
#pragma warning restore CA1801 // Review unused parameters
{ {
if (wparam.ToInt32() == _globalHotKeyId) if (wparam.ToInt32() == _globalHotKeyId)
{ {

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.IO.Abstractions; using System.IO.Abstractions;
namespace Wox.Infrastructure.FileSystemHelper namespace Wox.Infrastructure.FileSystemHelper

View File

@@ -156,10 +156,8 @@ namespace Wox.Infrastructure.Image
} }
else if (File.Exists(path)) else if (File.Exists(path))
{ {
#pragma warning disable CA1308 // Normalize strings to uppercase. Reason: extension is used with the enum ImageExtensions, which contains all lowercase values
// Using InvariantCulture since this is internal // Using InvariantCulture since this is internal
var extension = Path.GetExtension(path).ToLower(CultureInfo.InvariantCulture); var extension = Path.GetExtension(path).ToLower(CultureInfo.InvariantCulture);
#pragma warning restore CA1308 // Normalize strings to uppercase
if (ImageExtensions.Contains(extension)) if (ImageExtensions.Contains(extension))
{ {
type = ImageType.ImageFile; type = ImageType.ImageFile;

View File

@@ -19,7 +19,6 @@ namespace Wox.Infrastructure.Storage
event RenamedEventHandler Renamed; event RenamedEventHandler Renamed;
// Properties of File System watcher // Properties of File System watcher
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Abstract properties can not have private set")]
Collection<string> Filters { get; set; } Collection<string> Filters { get; set; }
bool EnableRaisingEvents { get; set; } bool EnableRaisingEvents { get; set; }

View File

@@ -5,11 +5,11 @@ using System;
namespace Wox.Plugin.Common.VirtualDesktop.Helper namespace Wox.Plugin.Common.VirtualDesktop.Helper
{ {
/// <summary> /// <summary>
/// Class that represents a Virtual Desktop /// Class that represents a Virtual Desktop
/// </summary> /// </summary>
/// <remarks>This class is named VDesktop to make clear it isn't an instance of the original Desktop class from Virtual Desktop Manager. /// <remarks>This class is named VDesktop to make clear it isn't an instance of the original Desktop class from Virtual Desktop Manager.
/// We can't use the original one, because therefore we must access private com interfaces. We aren't allowed to do this, because this is an official Microsoft project.</remarks> /// We can't use the original one, because therefore we must access private com interfaces. We aren't allowed to do this, because this is an official Microsoft project.</remarks>
public class VDesktop public class VDesktop
{ {
/// <summary> /// <summary>

View File

@@ -116,7 +116,6 @@ namespace Wox.Plugin.Common.Win32
public static extern HRESULT SHCreateStreamOnFileEx(string fileName, STGM grfMode, uint attributes, bool create, System.Runtime.InteropServices.ComTypes.IStream reserved, out System.Runtime.InteropServices.ComTypes.IStream stream); public static extern HRESULT SHCreateStreamOnFileEx(string fileName, STGM grfMode, uint attributes, bool create, System.Runtime.InteropServices.ComTypes.IStream reserved, out System.Runtime.InteropServices.ComTypes.IStream stream);
} }
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "These are the names used by win32.")]
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "These are the names used by win32.")] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "These are the names used by win32.")]
public static class Win32Constants public static class Win32Constants
{ {
@@ -777,16 +776,12 @@ namespace Wox.Plugin.Common.Win32
} }
} }
#pragma warning disable CA2225 // Operator overloads have named alternates
public static implicit operator System.Drawing.Rectangle(RECT r) public static implicit operator System.Drawing.Rectangle(RECT r)
#pragma warning restore CA2225 // Operator overloads have named alternates
{ {
return new System.Drawing.Rectangle(r.Left, r.Top, r.Width, r.Height); return new System.Drawing.Rectangle(r.Left, r.Top, r.Width, r.Height);
} }
#pragma warning disable CA2225 // Operator overloads have named alternates
public static implicit operator RECT(System.Drawing.Rectangle r) public static implicit operator RECT(System.Drawing.Rectangle r)
#pragma warning restore CA2225 // Operator overloads have named alternates
{ {
return new RECT(r); return new RECT(r);
} }
@@ -854,16 +849,12 @@ namespace Wox.Plugin.Common.Win32
{ {
} }
#pragma warning disable CA2225 // Operator overloads have named alternates
public static implicit operator System.Drawing.Point(POINT p) public static implicit operator System.Drawing.Point(POINT p)
#pragma warning restore CA2225 // Operator overloads have named alternates
{ {
return new System.Drawing.Point(p.X, p.Y); return new System.Drawing.Point(p.X, p.Y);
} }
#pragma warning disable CA2225 // Operator overloads have named alternates
public static implicit operator POINT(System.Drawing.Point p) public static implicit operator POINT(System.Drawing.Point p)
#pragma warning restore CA2225 // Operator overloads have named alternates
{ {
return new POINT(p.X, p.Y); return new POINT(p.X, p.Y);
} }

View File

@@ -2,10 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO.Abstractions; using System.IO.Abstractions;
using System.Linq;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Wox.Plugin namespace Wox.Plugin

View File

@@ -120,16 +120,12 @@ namespace Wox.Plugin
SubTitleHighlightData = subTitleHighlightData; SubTitleHighlightData = subTitleHighlightData;
} }
#pragma warning disable CA2227 // Collection properties should be read only
public IList<int> TitleHighlightData { get; set; } public IList<int> TitleHighlightData { get; set; }
#pragma warning restore CA2227 // Collection properties should be read only
/// <summary> /// <summary>
/// Gets or sets a list of indexes for the characters to be highlighted in SubTitle /// Gets or sets a list of indexes for the characters to be highlighted in SubTitle
/// </summary> /// </summary>
#pragma warning disable CA2227 // Collection properties should be read only
public IList<int> SubTitleHighlightData { get; set; } public IList<int> SubTitleHighlightData { get; set; }
#pragma warning restore CA2227 // Collection properties should be read only
/// <summary> /// <summary>
/// Gets or sets only results that originQuery match with current query will be displayed in the panel /// Gets or sets only results that originQuery match with current query will be displayed in the panel

View File

@@ -4,8 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Wox.Plugin namespace Wox.Plugin

View File

@@ -159,7 +159,7 @@ public class PowerAccent : IDisposable
public Point GetDisplayCoordinates(Size window) public Point GetDisplayCoordinates(Size window)
{ {
var activeDisplay = WindowsFunctions.GetActiveDisplay(); (Point Location, Size Size, double Dpi) activeDisplay = WindowsFunctions.GetActiveDisplay();
Rect screen = new Rect(activeDisplay.Location, activeDisplay.Size) / activeDisplay.Dpi; Rect screen = new Rect(activeDisplay.Location, activeDisplay.Size) / activeDisplay.Dpi;
Position position = _settingService.Position; Position position = _settingService.Position;

View File

@@ -10,8 +10,8 @@ namespace PowerAccent.Core.Tools
{ {
public static Point GetRawCoordinatesFromCaret(Point caret, Rect screen, Size window) public static Point GetRawCoordinatesFromCaret(Point caret, Rect screen, Size window)
{ {
var left = caret.X - (window.Width / 2); double left = caret.X - (window.Width / 2);
var top = caret.Y - window.Height - 20; double top = caret.Y - window.Height - 20;
return new Point( return new Point(
left < screen.X ? screen.X : (left + window.Width > (screen.X + screen.Width) ? (screen.X + screen.Width) - window.Width : left), left < screen.X ? screen.X : (left + window.Width > (screen.X + screen.Width) ? (screen.X + screen.Width) - window.Width : left),

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
@@ -24,7 +23,7 @@ namespace PowerAccent.Core.Tools
} }
// Using InvariantCulture since this is used for a log file name // Using InvariantCulture since this is used for a log file name
var logFilePath = _fileSystem.Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt"); string logFilePath = _fileSystem.Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt");
Trace.Listeners.Add(new TextWriterTraceListener(logFilePath)); Trace.Listeners.Add(new TextWriterTraceListener(logFilePath));
@@ -71,8 +70,8 @@ namespace PowerAccent.Core.Tools
{ {
StackTrace stackTrace = new StackTrace(); StackTrace stackTrace = new StackTrace();
var methodName = stackTrace.GetFrame(3)?.GetMethod(); System.Reflection.MethodBase methodName = stackTrace.GetFrame(3)?.GetMethod();
var className = methodName?.DeclaringType?.Name; string className = methodName?.DeclaringType?.Name;
return "[Method]: " + methodName?.Name + " [Class]: " + className; return "[Method]: " + methodName?.Name + " [Class]: " + className;
} }
} }

View File

@@ -53,9 +53,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
{ {
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
#pragma warning disable CA2000 // Do not dispose here
thumbnail = GetThumbnail(reader); thumbnail = GetThumbnail(reader);
#pragma warning restore CA2000
} }
} }

View File

@@ -53,7 +53,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
{ {
if (disposing) if (disposing)
{ {
_markdownPreviewHandlerControl.Dispose(); _markdownPreviewHandlerControl.Dispose();
} }
// TODO: free unmanaged resources (unmanaged objects) and override finalizer // TODO: free unmanaged resources (unmanaged objects) and override finalizer

View File

@@ -5,7 +5,6 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using System.Text.Json; using System.Text.Json;
namespace Microsoft.PowerToys.PreviewHandler.Monaco namespace Microsoft.PowerToys.PreviewHandler.Monaco

View File

@@ -5,9 +5,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO;
using System.IO.Abstractions; using System.IO.Abstractions;
using interop;
namespace Microsoft.PowerToys.PreviewHandler.Monaco.Helpers namespace Microsoft.PowerToys.PreviewHandler.Monaco.Helpers
{ {

View File

@@ -3,11 +3,9 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Drawing;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.ComTypes;
using System.Text;
using Common.ComInterlop; using Common.ComInterlop;
using Microsoft.PowerToys.STATestExtension; using Microsoft.PowerToys.STATestExtension;
using Microsoft.PowerToys.ThumbnailHandler.Pdf; using Microsoft.PowerToys.ThumbnailHandler.Pdf;

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;

View File

@@ -7,7 +7,6 @@ using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.ComTypes;
using System.Text; using System.Text;
using System.Windows.Forms;
using Common.ComInterlop; using Common.ComInterlop;
using Microsoft.PowerToys.STATestExtension; using Microsoft.PowerToys.STATestExtension;
using Microsoft.PowerToys.ThumbnailHandler.Svg; using Microsoft.PowerToys.ThumbnailHandler.Svg;

View File

@@ -48,9 +48,7 @@ namespace Common.Utilities
foreach (XElement element in elements) foreach (XElement element in elements)
{ {
// Using Invariant since we are doing an exact match for HTML tags and we want it to behave the same in every culture // Using Invariant since we are doing an exact match for HTML tags and we want it to behave the same in every culture
#pragma warning disable CA1308 // Normalize strings to uppercase
var elementName = element?.Name?.LocalName?.ToLowerInvariant(); var elementName = element?.Name?.LocalName?.ToLowerInvariant();
#pragma warning restore CA1308 // Normalize strings to uppercase
if (elementName != null && blockedElementsName.ContainsKey(elementName)) if (elementName != null && blockedElementsName.ContainsKey(elementName))
{ {
foundBlockedElement = true; foundBlockedElement = true;

View File

@@ -11,7 +11,6 @@ namespace Common.ComInterlop
/// The COLORREF value is used to specify an RGB color. /// The COLORREF value is used to specify an RGB color.
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")]
public struct COLORREF public struct COLORREF
{ {
/// <summary> /// <summary>

View File

@@ -10,7 +10,6 @@ namespace Common.ComInterlop
/// <summary> /// <summary>
/// Specifies the alpha type of the image. /// Specifies the alpha type of the image.
/// </summary> /// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
public enum WTS_ALPHATYPE : int public enum WTS_ALPHATYPE : int
{ {
/// <summary> /// <summary>

View File

@@ -10,7 +10,6 @@ namespace Common.ComInterlop
/// Defines the attributes of a font. /// Defines the attributes of a font.
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")]
public struct LOGFONT public struct LOGFONT
{ {
/// <summary> /// <summary>

View File

@@ -11,7 +11,6 @@ namespace Common.ComInterlop
/// Contains message information from a thread's message queue. /// Contains message information from a thread's message queue.
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")]
public struct MSG public struct MSG
{ {
/// <summary> /// <summary>

View File

@@ -11,7 +11,6 @@ namespace Common.ComInterlop
/// The RECT structure defines a rectangle by the coordinates of its upper-left and lower-right corners. /// The RECT structure defines a rectangle by the coordinates of its upper-left and lower-right corners.
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")]
public struct RECT public struct RECT
{ {
/// <summary> /// <summary>

View File

@@ -4,7 +4,6 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
using PreviewHandlerCommon.ComInterop; using PreviewHandlerCommon.ComInterop;

View File

@@ -5,9 +5,7 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices;
using Common.ComInterlop; using Common.ComInterlop;
using Microsoft.Win32;
namespace Common namespace Common
{ {

View File

@@ -38,14 +38,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public ColorPickerActivationAction ActivationAction { get; set; } public ColorPickerActivationAction ActivationAction { get; set; }
[JsonPropertyName("colorhistory")] [JsonPropertyName("colorhistory")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Need to change this collection")]
public List<string> ColorHistory { get; set; } public List<string> ColorHistory { get; set; }
[JsonPropertyName("colorhistorylimit")] [JsonPropertyName("colorhistorylimit")]
public int ColorHistoryLimit { get; set; } public int ColorHistoryLimit { get; set; }
[JsonPropertyName("visiblecolorformats")] [JsonPropertyName("visiblecolorformats")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Need to change this collection")]
public Dictionary<string, bool> VisibleColorFormats { get; set; } public Dictionary<string, bool> VisibleColorFormats { get; set; }
[JsonPropertyName("showcolorname")] [JsonPropertyName("showcolorname")]

View File

@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Microsoft.PowerToys.Settings.UI.Library.Interfaces;

Some files were not shown because too many files have changed in this diff Show More