mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Chore] Run solution code cleanup (#20584)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user