mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[Chore] Run solution code cleanup (#20584)
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32;
|
||||
|
||||
|
||||
@@ -6,9 +6,6 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using interop;
|
||||
using Microsoft.VisualBasic;
|
||||
using Windows.Storage;
|
||||
|
||||
namespace MeasureToolUI.Helpers
|
||||
{
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
// 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.Windows.Interop;
|
||||
using Common.UI;
|
||||
using interop;
|
||||
using PowerOCR.Helpers;
|
||||
using PowerOCR.Utilities;
|
||||
|
||||
namespace PowerOCR.Keyboard
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using PowerOCR.Settings;
|
||||
using PowerOCR.Utilities;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -9,7 +9,6 @@ using System.IO.Abstractions;
|
||||
using System.Threading;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
|
||||
namespace PowerOCR.Settings
|
||||
{
|
||||
|
||||
@@ -9,8 +9,6 @@ using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Awake.Core.Models;
|
||||
using Microsoft.Win32;
|
||||
using NLog;
|
||||
using Windows.Win32;
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@@ -19,7 +17,6 @@ using Windows.Win32.Foundation;
|
||||
using Windows.Win32.UI.WindowsAndMessaging;
|
||||
|
||||
#pragma warning disable CS8602 // Dereference of a possibly null reference.
|
||||
#pragma warning disable CS8603 // Possible null reference return.
|
||||
|
||||
namespace Awake.Core
|
||||
{
|
||||
@@ -94,7 +91,6 @@ namespace Awake.Core
|
||||
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)
|
||||
{
|
||||
TrayMenu = new DestroyMenuSafeHandle(PInvoke.CreatePopupMenu());
|
||||
|
||||
@@ -19,7 +19,6 @@ using Awake.Core;
|
||||
using interop;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
using NLog;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace ColorPicker
|
||||
{
|
||||
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)
|
||||
{
|
||||
var catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly());
|
||||
|
||||
@@ -233,9 +233,7 @@ namespace ColorPicker.Controls
|
||||
DetailsFlyout.Hide();
|
||||
}
|
||||
|
||||
#pragma warning disable CA1801 // Review unused parameters
|
||||
private void DetailsFlyout_Closed(object sender, object e)
|
||||
#pragma warning restore CA1801 // Review unused parameters
|
||||
{
|
||||
HideDetails();
|
||||
AppStateHandler.BlockEscapeKeyClosingColorPickerEditor = false;
|
||||
@@ -247,11 +245,7 @@ namespace ColorPicker.Controls
|
||||
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)
|
||||
#pragma warning restore CA1801 // Review unused parameters
|
||||
#pragma warning restore CA1822 // Mark members as static
|
||||
{
|
||||
AppStateHandler.BlockEscapeKeyClosingColorPickerEditor = true;
|
||||
}
|
||||
@@ -331,10 +325,7 @@ namespace ColorPicker.Controls
|
||||
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);
|
||||
|
||||
#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();
|
||||
#pragma warning restore CA1308 // Normalize strings to uppercase
|
||||
|
||||
// Return only with hashtag if user typed it before
|
||||
bool addHashtag = oldValue.StartsWith("#", StringComparison.InvariantCulture);
|
||||
|
||||
@@ -212,9 +212,7 @@ namespace ColorPicker.Helpers
|
||||
_hwndSource = hwndSource;
|
||||
}
|
||||
|
||||
#pragma warning disable CA1801 // Review unused parameters
|
||||
public IntPtr ProcessWindowMessages(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
|
||||
#pragma warning restore CA1801 // Review unused parameters
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace ColorPicker.Helpers
|
||||
{
|
||||
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)
|
||||
{
|
||||
var info = new MonitorInfoEx();
|
||||
@@ -74,7 +73,6 @@ namespace ColorPicker.Helpers
|
||||
|
||||
public ArrayList Monitors { get; private set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "Interop")]
|
||||
public bool Callback(
|
||||
IntPtr monitor,
|
||||
IntPtr hdc,
|
||||
|
||||
@@ -32,62 +32,58 @@ namespace ColorPicker.Helpers
|
||||
switch (method)
|
||||
{
|
||||
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)
|
||||
{
|
||||
var colorInSpecificFormat = colorFormatModel.Convert(color);
|
||||
if (colorFormatModel.FormatName == "HEX")
|
||||
var tmp = new Dictionary<string, string>();
|
||||
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(
|
||||
$"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($"color{i++}", tmp);
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -121,9 +117,9 @@ namespace ColorPicker.Helpers
|
||||
public static string ToJson(this Dictionary<string, Dictionary<string, string>> source, bool indented = true)
|
||||
{
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = indented,
|
||||
};
|
||||
{
|
||||
WriteIndented = indented,
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(source, options);
|
||||
}
|
||||
|
||||
@@ -17,53 +17,20 @@ namespace ColorPicker
|
||||
{
|
||||
private const int GWL_EX_STYLE = -20;
|
||||
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 VkSnapshot = 0x2c;
|
||||
public const int KfAltdown = 0x2000;
|
||||
public const int LlkhfAltdown = KfAltdown >> 8;
|
||||
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;
|
||||
|
||||
[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;
|
||||
|
||||
[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;
|
||||
|
||||
[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;
|
||||
|
||||
[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;
|
||||
|
||||
[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;
|
||||
|
||||
[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;
|
||||
|
||||
[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;
|
||||
|
||||
[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;
|
||||
|
||||
[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 delegate bool MonitorEnumProc(
|
||||
@@ -117,7 +84,6 @@ namespace ColorPicker
|
||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||
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)]
|
||||
internal struct POINT
|
||||
{
|
||||
@@ -125,7 +91,6 @@ namespace ColorPicker
|
||||
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)]
|
||||
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);
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Interop object")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct Rect
|
||||
{
|
||||
@@ -155,7 +119,6 @@ namespace ColorPicker
|
||||
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")]
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
|
||||
internal class MonitorInfoEx
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -177,10 +176,10 @@ namespace ColorPicker.ViewModels
|
||||
var colors = SerializationHelper.ConvertToDesiredColorFormats((IList)colorsToExport, ColorRepresentations, method);
|
||||
|
||||
var dialog = new SaveFileDialog
|
||||
{
|
||||
Title = "Save selected colors to",
|
||||
Filter = "Text Files (*.txt)|*.txt|Json Files (*.json)|*.json",
|
||||
};
|
||||
{
|
||||
Title = "Save selected colors to",
|
||||
Filter = "Text Files (*.txt)|*.txt|Json Files (*.json)|*.json",
|
||||
};
|
||||
|
||||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Common.UI;
|
||||
using FancyZonesEditor.Logs;
|
||||
using FancyZonesEditor.Utils;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
namespace FancyZonesEditor.Controls
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
|
||||
@@ -290,11 +290,11 @@ namespace FancyZonesEditor
|
||||
|
||||
if (IsActualSize)
|
||||
{
|
||||
rect.Style = (Style)FindResource("CanvasLayoutActualScalePreviewStyle");
|
||||
rect.Style = (Style)FindResource("CanvasLayoutActualScalePreviewStyle");
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.Style = (Style)FindResource("CanvasLayoutSmallScalePreviewStyle");
|
||||
rect.Style = (Style)FindResource("CanvasLayoutSmallScalePreviewStyle");
|
||||
}
|
||||
|
||||
frame.Children.Add(rect);
|
||||
|
||||
@@ -14,7 +14,6 @@ using Common.UI;
|
||||
using FancyZonesEditor.Logs;
|
||||
using FancyZonesEditor.Models;
|
||||
using FancyZonesEditor.Utils;
|
||||
using ModernWpf.Automation.Peers;
|
||||
using ModernWpf.Controls;
|
||||
|
||||
namespace FancyZonesEditor
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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 FancyZonesEditor.Models;
|
||||
|
||||
namespace FancyZonesEditor
|
||||
|
||||
@@ -24,7 +24,5 @@ namespace FancyZonesEditor
|
||||
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);
|
||||
#pragma warning restore CA1711 // Identifiers should not have incorrect suffix
|
||||
}
|
||||
|
||||
@@ -17,11 +17,9 @@ namespace FancyZonesEditor.Utils
|
||||
[DllImport("user32.dll")]
|
||||
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 WS_EX_APPWINDOW = 0x00040000;
|
||||
private const int WS_EX_TOOLWINDOW = 0x00000080;
|
||||
#pragma warning restore SA1310 // Field names should not contain underscore
|
||||
|
||||
public static void SetWindowStyleToolWindow(Window hwnd)
|
||||
{
|
||||
|
||||
@@ -25,9 +25,7 @@ namespace ImageResizer.Properties
|
||||
}
|
||||
|
||||
[ClassInitialize]
|
||||
#pragma warning disable CA1801 // Review unused parameters
|
||||
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.
|
||||
_imageResizerApp = new App();
|
||||
|
||||
@@ -85,10 +85,10 @@ namespace ImageResizer.Models
|
||||
{
|
||||
BitmapMetadata originalMetadata = (BitmapMetadata)originalFrame.Metadata;
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
Debug.WriteLine($"### Processing metadata of file {_file}");
|
||||
originalMetadata.PrintsAllMetadataToDebugOutput();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
var metadata = GetValidMetadata(originalMetadata, transformedBitmap, containerFormat);
|
||||
|
||||
|
||||
@@ -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/
|
||||
|
||||
using System;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ using System.Runtime.InteropServices;
|
||||
namespace ImageResizer.Utilities
|
||||
{
|
||||
// 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
|
||||
{
|
||||
[DllImport("user32.dll")]
|
||||
|
||||
@@ -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/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ImageResizer.ViewModels;
|
||||
|
||||
namespace ImageResizer.Views
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ImageResizer.Views
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (Visibility)value == Visibility.Visible;
|
||||
return (Visibility)value == Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using UnitsNet;
|
||||
|
||||
namespace Community.PowerToys.Run.Plugin.UnitConverter
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.RemoteMachinesHelper
|
||||
var machine = new VSCodeRemoteMachine();
|
||||
machine.Host = h.Host;
|
||||
machine.VSCodeInstance = vscodeInstance;
|
||||
machine.HostName = h.HostName != null ? h.HostName : string.Empty;
|
||||
machine.User = h.User != null ? h.User : string.Empty;
|
||||
machine.HostName = h.HostName ?? string.Empty;
|
||||
machine.User = h.User ?? string.Empty;
|
||||
|
||||
results.Add(machine);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.VSCodeHelper
|
||||
Instances = new List<VSCodeInstance>();
|
||||
|
||||
paths = paths.Where(x =>
|
||||
x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Contains("VS Code", StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Contains("VSCodium", StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Contains("vscode", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
foreach (var path in paths)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.IO;
|
||||
using Microsoft.Plugin.Folder.Sources;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources.Tests
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Plugin.Folder.Sources;
|
||||
using Microsoft.Plugin.Folder.Sources.Result;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Plugin.Folder.Sources;
|
||||
using Microsoft.Plugin.Folder.Sources.Result;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.Plugin.Folder
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Wox.Infrastructure.Storage;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
private static readonly IFileSystem _fileSystem = new FileSystem();
|
||||
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()
|
||||
{
|
||||
// Using InvariantCulture since this is internal
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
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)
|
||||
{
|
||||
string incompleteName = string.Empty;
|
||||
|
||||
@@ -3,13 +3,10 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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 Microsoft.Win32;
|
||||
|
||||
namespace Microsoft.Plugin.Indexer.DriveDetection
|
||||
|
||||
@@ -77,7 +77,6 @@ namespace Microsoft.Plugin.Indexer.Interop
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[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();
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
|
||||
@@ -75,7 +75,6 @@ namespace Microsoft.Plugin.Indexer.Interop
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[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();
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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.Data.OleDb;
|
||||
|
||||
@@ -10,10 +9,6 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||
{
|
||||
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)
|
||||
{
|
||||
List<OleDBResult> result = new List<OleDBResult>();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Plugin.Indexer.Interop;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
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")]
|
||||
void _VtblGap0_2(); // skip 2 methods
|
||||
|
||||
|
||||
@@ -11,13 +11,11 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||
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")]
|
||||
void _VtblGap0_1(); // skip 1 method
|
||||
|
||||
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")]
|
||||
void _VtblGap1_5(); // skip 5 methods
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
}
|
||||
|
||||
[Flags]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Represents flags specified in IShellLink interface")]
|
||||
public enum SLR_FLAGS
|
||||
{
|
||||
SLR_NO_UI = 0x1,
|
||||
|
||||
@@ -733,7 +733,6 @@ namespace Microsoft.Plugin.Program.Programs
|
||||
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)
|
||||
{
|
||||
// Using InvariantCulture since this is user facing
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
private static bool KillProcessCommand(Window window)
|
||||
{
|
||||
// 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));
|
||||
return false;
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
/// <param name="text">The text to search inside of</param>
|
||||
/// <param name="searchText">the text to search for</param>
|
||||
/// <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)
|
||||
{
|
||||
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
|
||||
/// 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>
|
||||
[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)
|
||||
{
|
||||
if (matches == null)
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
/// </summary>
|
||||
internal static class ResultHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a list of all results for the query.
|
||||
/// </summary>
|
||||
/// <param name="searchControllerResults">List with all search controller matches</param>
|
||||
/// <param name="icon">The path to the result icon</param>
|
||||
/// <returns>List of results</returns>
|
||||
/// <summary>
|
||||
/// Returns a list of all results for the query.
|
||||
/// </summary>
|
||||
/// <param name="searchControllerResults">List with all search controller matches</param>
|
||||
/// <param name="icon">The path to the result icon</param>
|
||||
/// <returns>List of results</returns>
|
||||
internal static List<Result> GetResultList(List<SearchResult> searchControllerResults, bool isKeywordSearch, string icon, string infoIcon)
|
||||
{
|
||||
bool addExplorerInfo = false;
|
||||
@@ -113,7 +113,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
|
||||
return new ToolTipData(window.Title, text);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
string text = $"hWnd: {window.Hwnd}\n" +
|
||||
$"Window class: {window.ClassName}\n" +
|
||||
@@ -134,7 +134,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
$"Is AllDesktops view: {window.Desktop.IsAllDesktopsView}";
|
||||
|
||||
return new ToolTipData(window.Title, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow("((((", "only opening brackets")]
|
||||
[DataRow("]]]", "only closing brackets")]
|
||||
[DataRow("([)(])", "inner bracket mismatch")]
|
||||
[DataRow(")(", "opening and closing reversed")]
|
||||
[DataRow("(]", "mismatch in bracket type")]
|
||||
[DataRow("((((", "only opening brackets")]
|
||||
[DataRow("]]]", "only closing brackets")]
|
||||
[DataRow("([)(])", "inner bracket mismatch")]
|
||||
[DataRow(")(", "opening and closing reversed")]
|
||||
[DataRow("(]", "mismatch in bracket type")]
|
||||
public void IsBracketComplete_TestInvalid_WhenCalled(string input, string invalidReason)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
||||
|
||||
continue;
|
||||
default:
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(direction), direction, "Can't process value");
|
||||
}
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(direction), direction, "Can't process value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.UnitTest.Helper
|
||||
[DataRow(@"HKLM\", false, @"HKLM\", "")]
|
||||
[DataRow(@"HKLM\\", true, @"HKLM", "")]
|
||||
[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)
|
||||
{
|
||||
var hasValueName = QueryHelper.GetQueryParts(query, out var queryKey, out var queryValueName);
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Service.Helpers
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||
}
|
||||
else if (ipList[i].SuffixOrigin == SuffixOrigin.Random)
|
||||
{
|
||||
IPv6Temporary = ip.ToString();
|
||||
IPv6Temporary = ip.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.PowerToys.Run.Plugin.System.Properties;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using Wox.Infrastructure;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using Microsoft.PowerToys.Run.Plugin.TimeDate.Components;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using ManagedCommon;
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Linq;
|
||||
using Microsoft.PowerToys.Run.Plugin.TimeZone.Classes;
|
||||
using Microsoft.PowerToys.Run.Plugin.TimeZone.Helper;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using NLog;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.PowerToys.Run.Plugin.TimeZone.UnitTests
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wox.Plugin.Logger;
|
||||
|
||||
|
||||
@@ -6,12 +6,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace PowerLauncher.Converters
|
||||
{
|
||||
@@ -19,9 +16,7 @@ namespace PowerLauncher.Converters
|
||||
{
|
||||
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;
|
||||
#pragma warning restore CA1062 // Validate arguments of public methods
|
||||
var highlightData = values[1] as List<int>;
|
||||
var selected = values[2] as bool? == true;
|
||||
|
||||
|
||||
@@ -2,9 +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.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
@@ -3,12 +3,9 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using NLog;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Exception;
|
||||
using Wox.Plugin;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using static PowerLauncher.Helper.WindowsInteropHelper;
|
||||
|
||||
// http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/
|
||||
|
||||
@@ -11,7 +11,6 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using interop;
|
||||
|
||||
// http://blogs.microsoft.co.il/arik/2010/05/28/wpf-single-instance-application/
|
||||
// modified to allow single instance restart
|
||||
|
||||
@@ -124,9 +124,7 @@ namespace PowerLauncher
|
||||
|
||||
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)
|
||||
#pragma warning restore CA1801 // Review unused parameters
|
||||
{
|
||||
switch ((WM)msg)
|
||||
{
|
||||
|
||||
@@ -481,9 +481,7 @@ namespace PowerLauncher.ViewModel
|
||||
private void QueryHistory()
|
||||
{
|
||||
// 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();
|
||||
#pragma warning restore CA1308 // Normalize strings to uppercase
|
||||
History.Clear();
|
||||
|
||||
var results = new List<Result>();
|
||||
@@ -768,9 +766,7 @@ namespace PowerLauncher.ViewModel
|
||||
return selected;
|
||||
}
|
||||
|
||||
#pragma warning disable CA1801 // Review unused parameters
|
||||
internal bool ProcessHotKeyMessages(IntPtr wparam, IntPtr lparam)
|
||||
#pragma warning restore CA1801 // Review unused parameters
|
||||
{
|
||||
if (wparam.ToInt32() == _globalHotKeyId)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
|
||||
namespace Wox.Infrastructure.FileSystemHelper
|
||||
|
||||
@@ -156,10 +156,8 @@ namespace Wox.Infrastructure.Image
|
||||
}
|
||||
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
|
||||
var extension = Path.GetExtension(path).ToLower(CultureInfo.InvariantCulture);
|
||||
#pragma warning restore CA1308 // Normalize strings to uppercase
|
||||
if (ImageExtensions.Contains(extension))
|
||||
{
|
||||
type = ImageType.ImageFile;
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace Wox.Infrastructure.Storage
|
||||
event RenamedEventHandler Renamed;
|
||||
|
||||
// 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; }
|
||||
|
||||
bool EnableRaisingEvents { get; set; }
|
||||
|
||||
@@ -5,11 +5,11 @@ using System;
|
||||
|
||||
namespace Wox.Plugin.Common.VirtualDesktop.Helper
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that represents a Virtual Desktop
|
||||
/// </summary>
|
||||
/// <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>
|
||||
/// <summary>
|
||||
/// Class that represents a Virtual Desktop
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public class VDesktop
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
[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.")]
|
||||
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)
|
||||
#pragma warning restore CA2225 // Operator overloads have named alternates
|
||||
{
|
||||
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)
|
||||
#pragma warning restore CA2225 // Operator overloads have named alternates
|
||||
{
|
||||
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)
|
||||
#pragma warning restore CA2225 // Operator overloads have named alternates
|
||||
{
|
||||
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)
|
||||
#pragma warning restore CA2225 // Operator overloads have named alternates
|
||||
{
|
||||
return new POINT(p.X, p.Y);
|
||||
}
|
||||
|
||||
@@ -2,10 +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.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Wox.Plugin
|
||||
|
||||
@@ -120,16 +120,12 @@ namespace Wox.Plugin
|
||||
SubTitleHighlightData = subTitleHighlightData;
|
||||
}
|
||||
|
||||
#pragma warning disable CA2227 // Collection properties should be read only
|
||||
public IList<int> TitleHighlightData { get; set; }
|
||||
#pragma warning restore CA2227 // Collection properties should be read only
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of indexes for the characters to be highlighted in SubTitle
|
||||
/// </summary>
|
||||
#pragma warning disable CA2227 // Collection properties should be read only
|
||||
public IList<int> SubTitleHighlightData { get; set; }
|
||||
#pragma warning restore CA2227 // Collection properties should be read only
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets only results that originQuery match with current query will be displayed in the panel
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Wox.Plugin
|
||||
|
||||
@@ -159,7 +159,7 @@ public class PowerAccent : IDisposable
|
||||
|
||||
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;
|
||||
Position position = _settingService.Position;
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace PowerAccent.Core.Tools
|
||||
{
|
||||
public static Point GetRawCoordinatesFromCaret(Point caret, Rect screen, Size window)
|
||||
{
|
||||
var left = caret.X - (window.Width / 2);
|
||||
var top = caret.Y - window.Height - 20;
|
||||
double left = caret.X - (window.Width / 2);
|
||||
double top = caret.Y - window.Height - 20;
|
||||
|
||||
return new Point(
|
||||
left < screen.X ? screen.X : (left + window.Width > (screen.X + screen.Width) ? (screen.X + screen.Width) - window.Width : left),
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -24,7 +23,7 @@ namespace PowerAccent.Core.Tools
|
||||
}
|
||||
|
||||
// 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));
|
||||
|
||||
@@ -71,8 +70,8 @@ namespace PowerAccent.Core.Tools
|
||||
{
|
||||
StackTrace stackTrace = new StackTrace();
|
||||
|
||||
var methodName = stackTrace.GetFrame(3)?.GetMethod();
|
||||
var className = methodName?.DeclaringType?.Name;
|
||||
System.Reflection.MethodBase methodName = stackTrace.GetFrame(3)?.GetMethod();
|
||||
string className = methodName?.DeclaringType?.Name;
|
||||
return "[Method]: " + methodName?.Name + " [Class]: " + className;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,9 +53,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Gcode
|
||||
{
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
#pragma warning disable CA2000 // Do not dispose here
|
||||
thumbnail = GetThumbnail(reader);
|
||||
#pragma warning restore CA2000
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Markdown
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_markdownPreviewHandlerControl.Dispose();
|
||||
_markdownPreviewHandlerControl.Dispose();
|
||||
}
|
||||
|
||||
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using interop;
|
||||
|
||||
namespace Microsoft.PowerToys.PreviewHandler.Monaco.Helpers
|
||||
{
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text;
|
||||
using Common.ComInterlop;
|
||||
using Microsoft.PowerToys.STATestExtension;
|
||||
using Microsoft.PowerToys.ThumbnailHandler.Pdf;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// 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.Drawing;
|
||||
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Common.ComInterlop;
|
||||
using Microsoft.PowerToys.STATestExtension;
|
||||
using Microsoft.PowerToys.ThumbnailHandler.Svg;
|
||||
|
||||
@@ -48,9 +48,7 @@ namespace Common.Utilities
|
||||
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
|
||||
#pragma warning disable CA1308 // Normalize strings to uppercase
|
||||
var elementName = element?.Name?.LocalName?.ToLowerInvariant();
|
||||
#pragma warning restore CA1308 // Normalize strings to uppercase
|
||||
if (elementName != null && blockedElementsName.ContainsKey(elementName))
|
||||
{
|
||||
foundBlockedElement = true;
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Common.ComInterlop
|
||||
/// The COLORREF value is used to specify an RGB color.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")]
|
||||
public struct COLORREF
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Common.ComInterlop
|
||||
/// <summary>
|
||||
/// Specifies the alpha type of the image.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop")]
|
||||
public enum WTS_ALPHATYPE : int
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace Common.ComInterlop
|
||||
/// Defines the attributes of a font.
|
||||
/// </summary>
|
||||
[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
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Common.ComInterlop
|
||||
/// Contains message information from a thread's message queue.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")]
|
||||
public struct MSG
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Common.ComInterlop
|
||||
/// The RECT structure defines a rectangle by the coordinates of its upper-left and lower-right corners.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Interop")]
|
||||
public struct RECT
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using PreviewHandlerCommon.ComInterop;
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using Common.ComInterlop;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
||||
@@ -38,14 +38,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
public ColorPickerActivationAction ActivationAction { get; set; }
|
||||
|
||||
[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; }
|
||||
|
||||
[JsonPropertyName("colorhistorylimit")]
|
||||
public int ColorHistoryLimit { get; set; }
|
||||
|
||||
[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; }
|
||||
|
||||
[JsonPropertyName("showcolorname")]
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user