* 1) Making Directory Methods private.
2) Removing the CreateDirectory / DeleteDirectory functionality from all Settings Unit Tests.
* Abstracting disk access via IIOProvider to be able to provide mocks for unit tests instead of writing to disk. This also prevents developers who are running unit tests from interfering with the PowerToys settings on their local dev box.
* Dependency Injecting stub SettingsUtils for all tests
* Removing ISettingsUtils from constructors of objects that need to be deserialized (ColorPickerSettings/PowerLauncherSettings) as this breaks System.Text.Json
* Removing unused namespace reference
* Removing redifined mock
* As per PR feedback. Stub Settings utils should work with any settings type if the intent is to compile / avoid null ref exceptions.
Strangely when implementing this fix it became apparent that a stub settings isn't enough, and disk access needed to be mocked. I can't explain why the tests were passing previously.
* Leveraging GetMockIOProviderForSaveLoadExists
* Added a keyboard hook to the runner
* Update RootKeyboardHook
* Enable reading the whole JsonObject property
* Renamed RootKeyboardHook to CentralizedKeyboardHook
* Fixed build break, changed callback return type to bool
* Added Hotkey struct which somehow went missing
+ Cherry-pick fixes
* Reorganized the kb hook
* Basic version works
* Various fixes
* Finishing touches
* Fix potential threading issue
* int -> size_t
* Add default initializers to the Hotkey struct
* Added a suggested comment
* Unified a constant
* Use C# classes instead of native calls for sync
* Added a claryfing comment
* Use std::move
* Renamed a method
* Possible fix for compilation errors
* Fix a regression
* Show a message on failure
* Added DISABLE_LOWLEVEL_HOOK support
* Allow running Launcher as standalone
* Rename string constants
* Add the setting for the Sensitivity Radius to JSON and the Editor
Use the setting when determining Zones to highligh
* Fix FanzyZones unit tests
Add test for Json upgrade
* Updated texts in FancyZone Editor
More Text to Resources / Use Resources
* Added constant for default of Sensitivity Radius
* When installing from scratch of when a new device is added set the sensitivity radius to the default.
Move all the constant values to a single namespace
* restore correct formatting
Co-authored-by: Remy Blok <remy.blok@prodware.nl>
* Implemented possibility to add commandline arguments in the Program Plugin
* Add missing return statement inc ommandArgumentParser loop
* Fix typos
* Fix Additional Typo
* Changed -c to /c to make it a valid cmd argument
* Added small comment about importance of order in _programArgumentParsers
Co-authored-by: Roy <royvou@hotmailcom>
* Do not zone window if it merges with other window (e.g. merge Chrome tab into other Chrome window
* Small move of func call
* Address PR comment
* remove include
* Address PR comment 2
* Added an Alt key hook
* Refactor a block of code into a method
* Again refactored existing code
* Apparently Win+Alt does not reach FancyZones
* Using Ctrl+alt instead of Win+alt for now
* It works
* Fixed VD change
* Remove unused member
* Fix compilation error
* Enable shrinking
* Fixed comments in .h files
* Remove newline
* Refactored a function into two
The next task is to simplify their code.
* Updated a comment
* Update a variable name
* Reverted to the old implementation of directional move
* More refactoring
* Remove space
* Fixed windows getting stuck
* Changed function name
* Updated UnregisteredApps code
* Added file type checking code and Folder and File classifications
* Added more file formats
* Removed run as admin for lnk folders
* Added script files as executable and changed hashset to case insensitive
* Removed runasadmin for generic files
* Removed FileTypes enum
* Extended ApplicationTypes enum
* Fix file format error
* Cleaned use of ApplicationType enum to public and match AppType and used ApplicationType in OnAppRenamed
* Modify tests to use ApplicationType enum
* Added tests for new App types
* Modified dummy appref
* Mock Directory.Exists and add tests for GetAppTypeFromPath
* Combined tests
* Adding FxCop to Microsoft.Plugin.WindowWalker
* Delete WindowResult.cs -- Fix for CA1812 WindowResult is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it static (Shared in Visual Basic).
* Fix for CA1806 UpdateOpenWindowsList calls EnumWindows but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
* Fix for: CA1066 Type Microsoft.Plugin.WindowWalker.Components.InteropAndHelpers.RECT should implement IEquatable<T> because it overrides Equals
* Fix for: CA1052 Type 'FuzzyMatching' is a static holder type but is neither static nor NotInheritable
* Suppress for CA1069 - These values are defined in
https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles.
CA1069 The enum member 'WS_EX_LTRREADING' has the same constant value '0' as member 'WS_EX_LEFT'
CA1069 The enum member 'WS_EX_RIGHTSCROLLBAR' has the same constant value '0' as member 'WS_EX_LEFT'
* Supress CA1069
Code Description
CA1069 The enum member 'SWP_NOREPOSITION' has the same constant value '512' as member 'SWP_NOOWNERZORDER'
CA1069 The enum member 'SWP_FRAMECHANGED' has the same constant value '32' as member 'SWP_DRAWFRAME'
* Suprress CA1069 for ShowWindow values. See
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow
CA1069 The enum member 'ShowMaximized' has the same constant value '3' as member 'Maximize'
* Fix code formatting error
* Fix for CA2235: Making POINT serializable
CA2235 Field MinPosition is a member of type WINDOWPLACEMENT which is serializable but is of type Microsoft.Plugin.WindowWalker.Components.InteropAndHelpers.POINT which is not serializable
CA2235 Field MaxPosition is a member of type WINDOWPLACEMENT which is serializable but is of type Microsoft.Plugin.WindowWalker.Components.InteropAndHelpers.POINT which is not serializable
* Fix CA2235 Making RECT serializable
CA2235 Field NormalPosition is a member of type WINDOWPLACEMENT which is serializable but is of type Microsoft.Plugin.WindowWalker.Components.InteropAndHelpers.RECT which is not serializable
* Fixes for CA2101 Specify marshaling for P/Invoke string arguments.
* Fixes for CA2007 Consider calling ConfigureAwait on the awaited task
* Fixes for the following (CA1822 / CA1801):
CA1822 Member 'OnOpenWindowsUpdate' does not access instance data and can be marked as static
Code Description
CA1801 Parameter value of method add_OnOpenWindowsUpdate is never used. Remove the parameter or use it in the method body.
CA1801 Parameter value of method remove_OnOpenWindowsUpdate is never used. Remove the parameter or use it in the method body.
* Fix: CA1710 Rename OpenWindowsUpdateHandler to end in 'EventHandler'
* Fix CA1822 Member 'GetProcessIDFromWindowHandle' does not access instance data and can be marked as static
* Fix CA1062 In externally visible method 'List<int> FuzzyMatching.FindBestFuzzyMatch(string text, string searchText)', validate parameter 'searchText' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.
* Fixes for CA1304 The behavior of 'string.ToLower()' could vary based on the current user's locale settings.
CA1304 The behavior of 'string.ToLower()' could vary based on the current user's locale settings. Replace this call in 'FuzzyMatching.FindBestFuzzyMatch(string, string)' with a call to 'string.ToLower(CultureInfo)'.
Code Description
CA1304 The behavior of 'string.ToLower()' could vary based on the current user's locale settings. Replace this call in 'FuzzyMatching.FindBestFuzzyMatch(string, string)' with a call to 'string.ToLower(CultureInfo)'.
* Supressing warning for CA1814: Prefer jagged arrays over multidimensional however this might be something to consider if needing to optimize the window walker search.
* Fix: CA1062 In externally visible method 'List<List<int>> FuzzyMatching.GetAllMatchIndexes(bool[,] matches)', validate parameter 'matches' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.
* Fix for CA1062 In externally visible method 'int FuzzyMatching.CalculateScoreForMatches(List<int> matches)', validate parameter 'matches' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.
* Fixes for CA1806 Calls x... but does not use the HRESULT or error code that the method returns. This could lead to unexpected behavior in error conditions or low-resource situations. Use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method.
Using discard for methods that return void, and checking the hresult before returning parameters.
* Fix for CA1820 Test for empty strings using 'string.Length' property or 'string.IsNullOrEmpty' method instead of an Equality check
* Supress CA1031 Modify 'get_WindowIcon' to catch a more specific allowed exception type, or rethrow the exception
* Code Description
CA1062 In externally visible method 'List<Result> Main.Query(Query query)', validate parameter 'query' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.
* Fixes For CA1304 The behavior of 'string.ToUpper()' could vary based on the current user's locale settings.
CA1304 The behavior of 'string.ToLower()' could vary based on the current user's locale settings. Replace this call in 'SearchController.SearchText.set' with a call to 'string.ToLower(CultureInfo)'.
CA1304 The behavior of 'string.ToLower()' could vary based on the current user's locale settings. Replace this call in 'Window.ProcessName.get' with a call to 'string.ToLower(CultureInfo)'.
CA1304 The behavior of 'string.ToLower()' could vary based on the current user's locale settings. Replace this call in 'Window.SwitchToWindow()' with a call to 'string.ToLower(CultureInfo)'.
CA1304 The behavior of 'string.ToUpper()' could vary based on the current user's locale settings. Replace this call in 'Window.ToString()' with a call to 'string.ToUpper(CultureInfo)'.
CA1307 The behavior of 'string.Equals(string?)' could vary based on the current user's locale settings. Replace this call in 'Microsoft.Plugin.WindowWalker.Components.Window.SwitchToWindow()' with a call to 'string.Equals(string?, System.StringComparison)'.
* Fix: CA1710 Rename SearchResultUpdateHandler to end in 'EventHandler'
* Fix CA1060 Move pinvokes to native methods class
* Fix: CS0067 The event 'OpenWindows.OnOpenWindowsUpdateEventHandler' is never used
1) Remove SearchController::OpenWindowsUpdateHandler(object sender, SearchResultUpdateEventArgs e) as it wasn't being called and was redundant with Update Search Text.
2) In Main.cs calling UpdateOpenWindowsList before UpdateSearchText so that the latest enumerated windows will be called.
3) Removing unused OnOpenWindowsUpdateEventHandler and related code.
* Revert "Fixes for CA2101 Specify marshaling for P/Invoke string arguments."
This reverts commit b3dfe07915.
* Fixing CA2101 by turning off best fit mapping for methods that require ANSI marshalling.
See: https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2101?view=vs-2019
* Previous fix for CA1806 misunderstood int result as hresult. The actual return value is number of characters written.
NativeMethods.GetWindowText(hwnd, titleBuffer, sizeOfTitle);
* Previous fix for CA1806 misunderstood int result as hresult. The actual return value is number of characters written.
NativeMethods.GetClassName(Hwnd, windowClassName, windowClassName.MaxCapacity);
* Removing unused window code. This was done instead of validating fxcop changes in WindowIcon.
* Fixing typos in Window.cs (charachter -> character)