From a31135b2657b5bdc65a6da9729d07239987a1c92 Mon Sep 17 00:00:00 2001 From: Michael Clayton Date: Thu, 25 Apr 2024 20:45:47 +0100 Subject: [PATCH] Moved code shared with PowerToys MouseJump into "Common" folder for easier synching --- .../Helpers/DrawingHelperTests.cs | 23 +- .../{ => Common}/Helpers/LayoutHelperTests.cs | 16 +- .../Common/Helpers/MouseHelperTests.cs | 69 ++++++ .../Helpers/_test-4grid-desktop.png | Bin .../Helpers/_test-4grid-expected.png | Bin .../Helpers/_test-win11-desktop.png | Bin .../Helpers/_test-win11-expected.png | Bin .../Models/Drawing/RectangleInfoTests.cs | 4 +- .../Models/Drawing/SizeInfoTests.cs | 4 +- .../FancyMouse.UnitTests.csproj | 16 +- .../Helpers/MouseHelperTests.cs | 69 ------ .../Models/Settings/AppSettingsReaderTests.cs | 6 +- .../{ => Common}/Helpers/DrawingHelper.cs | 139 ++++++----- .../{ => Common}/Helpers/LayoutHelper.cs | 21 +- .../{ => Common}/Helpers/MouseHelper.cs | 15 +- .../{ => Common}/Helpers/ScreenHelper.cs | 21 +- .../Imaging/DesktopImageRegionCopyService.cs} | 46 ++-- .../Common/Imaging/IImageRegionCopyService.cs | 19 ++ .../Imaging/StaticImageRegionCopyService.cs} | 18 +- .../{ => Common}/Models/Drawing/BoxBounds.cs | 2 +- .../{ => Common}/Models/Drawing/PointInfo.cs | 2 +- .../Models/Drawing/RectangleInfo.cs | 9 +- .../{ => Common}/Models/Drawing/ScreenInfo.cs | 6 +- .../{ => Common}/Models/Drawing/SizeInfo.cs | 9 +- .../Models/Layout/PreviewLayout.cs | 6 +- .../Models/Styles/BackgroundStyle.cs | 15 +- .../{ => Common}/Models/Styles/BorderStyle.cs | 6 +- .../{ => Common}/Models/Styles/BoxStyle.cs | 2 +- .../{ => Common}/Models/Styles/MarginStyle.cs | 6 +- .../Models/Styles/PaddingStyle.cs | 6 +- .../Models/Styles/PreviewStyle.cs | 12 +- .../{ => Common}/NativeMethods/Core/ATOM.cs | 2 +- .../{ => Common}/NativeMethods/Core/BOOL.cs | 2 +- .../{ => Common}/NativeMethods/Core/BYTE.cs | 2 +- .../{ => Common}/NativeMethods/Core/CRECT.cs | 2 +- .../{ => Common}/NativeMethods/Core/DWORD.cs | 2 +- .../{ => Common}/NativeMethods/Core/GUID.cs | 8 +- .../{ => Common}/NativeMethods/Core/HANDLE.cs | 2 +- .../NativeMethods/Core/HBITMAP.cs | 2 +- .../{ => Common}/NativeMethods/Core/HBRUSH.cs | 2 +- .../NativeMethods/Core/HCURSOR.cs | 2 +- .../{ => Common}/NativeMethods/Core/HDC.cs | 2 +- .../{ => Common}/NativeMethods/Core/HDESK.cs | 2 +- .../NativeMethods/Core/HGDIOBJ.cs | 2 +- .../{ => Common}/NativeMethods/Core/HICON.cs | 2 +- .../NativeMethods/Core/HINSTANCE.cs | 2 +- .../{ => Common}/NativeMethods/Core/HMENU.cs | 2 +- .../NativeMethods/Core/HMODULE.cs | 2 +- .../NativeMethods/Core/HMONITOR.cs | 2 +- .../NativeMethods/Core/HWINSTA.cs | 2 +- .../{ => Common}/NativeMethods/Core/HWND.cs | 2 +- .../{ => Common}/NativeMethods/Core/LONG.cs | 2 +- .../{ => Common}/NativeMethods/Core/LPARAM.cs | 2 +- .../NativeMethods/Core/LPCRECT.cs | 2 +- .../NativeMethods/Core/LPCWSTR.cs | 2 +- .../NativeMethods/Core/LPDWORD.cs | 2 +- .../NativeMethods/Core/LPPOINT.cs | 2 +- .../{ => Common}/NativeMethods/Core/LPRECT.cs | 2 +- .../{ => Common}/NativeMethods/Core/LPTSTR.cs | 2 +- .../{ => Common}/NativeMethods/Core/LPVOID.cs | 2 +- .../NativeMethods/Core/LRESULT.cs | 2 +- .../{ => Common}/NativeMethods/Core/PCWSTR.cs | 2 +- .../{ => Common}/NativeMethods/Core/POINT.cs | 2 +- .../{ => Common}/NativeMethods/Core/PVOID.cs | 2 +- .../{ => Common}/NativeMethods/Core/RECT.cs | 2 +- .../{ => Common}/NativeMethods/Core/UINT.cs | 2 +- .../{ => Common}/NativeMethods/Core/ULONG.cs | 2 +- .../NativeMethods/Core/ULONG_PTR.cs | 2 +- .../{ => Common}/NativeMethods/Core/WCHAR.cs | 2 +- .../{ => Common}/NativeMethods/Core/WORD.cs | 2 +- .../{ => Common}/NativeMethods/Core/WPARAM.cs | 2 +- .../NativeMethods/Gdi32/Gdi32.COLOR16.cs | 4 +- .../NativeMethods/Gdi32/Gdi32.COLORREF.cs | 4 +- .../Gdi/Gdi32.CreateCompatibleBitmap.cs | 4 +- .../Graphics/Gdi/Gdi32.CreateCompatibleDC.cs | 4 +- .../Graphics/Gdi/Gdi32.CreateSolidBrush.cs | 4 +- .../Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs | 2 +- .../Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs | 4 +- .../Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs | 2 +- .../Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs | 2 +- .../Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs | 4 +- .../Graphics/Gdi/Gdi32.SetStretchBltMode.cs | 4 +- .../Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs | 4 +- .../Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs | 4 +- .../Kernel32.GetCurrentThreadId.cs | 4 +- .../Kernel32.LPSECURITY_ATTRIBUTES.cs | 2 +- .../Security/Kernel32.QUEUE_FLAGS_STATUS.cs | 2 +- .../Security/Kernel32.SECURITY_ATTRIBUTES.cs | 4 +- .../SystemServices/Kernel32.CreateEventW.cs | 4 +- .../Kernel32.GetModuleHandleW.cs | 4 +- .../SystemServices/Kernel32.SetEvent.cs | 22 ++ .../{ => Common}/NativeMethods/Libraries.cs | 2 +- .../Shell32/Shell32.NOTIFYICONDATAW.cs | 4 +- .../Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs | 2 +- .../Shell32/Shell32.PNOTIFYICONDATAW.cs | 2 +- .../Shell32/Shell32.Shell_NotifyIconW.cs | 4 +- .../Gdi/User32.EnumDisplayMonitors.cs | 4 +- .../User32/Graphics/Gdi/User32.FillRect.cs | 4 +- .../Graphics/Gdi/User32.GetMonitorInfoW.cs | 4 +- .../User32/Graphics/Gdi/User32.GetWindowDC.cs | 4 +- .../Graphics/Gdi/User32.LPMONITORINFO.cs | 2 +- .../Graphics/Gdi/User32.MONITORENUMPROC .cs | 4 +- .../User32/Graphics/Gdi/User32.MONITORINFO.cs | 4 +- .../Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs | 2 +- .../Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs | 2 +- .../Graphics/Gdi/User32.MonitorFromPoint .cs | 4 +- .../User32/Graphics/Gdi/User32.ReleaseDC.cs | 4 +- .../KeyboardAndMouse/User32.HARDWAREINPUT.cs | 4 +- .../User32.HOT_KEY_MODIFIERS.cs | 2 +- .../UI/Input/KeyboardAndMouse/User32.INPUT.cs | 2 +- .../KeyboardAndMouse/User32.INPUT_TYPE.cs | 2 +- .../KeyboardAndMouse/User32.KEYBDINPUT.cs | 4 +- .../Input/KeyboardAndMouse/User32.LPINPUT.cs | 2 +- .../KeyboardAndMouse/User32.MOUSEINPUT.cs | 4 +- .../User32.MOUSE_EVENT_FLAGS.cs | 2 +- .../KeyboardAndMouse/User32.RegisterHotKey.cs | 4 +- .../KeyboardAndMouse/User32.SendInput.cs | 4 +- .../User32.UnregisterHotKey.cs | 4 +- .../User32.CreateWindowExW.cs | 4 +- .../User32.DefWindowProcW.cs | 4 +- .../User32.DestroyWindow.cs | 4 +- .../User32.DispatchMessageW.cs | 4 +- .../User32.GetClassInfoExW.cs | 4 +- .../User32.GetCursorPos.cs | 4 +- .../User32.GetDesktopWindow.cs | 4 +- .../WindowsAndMessaging/User32.GetMessageW.cs | 4 +- .../User32.GetSystemMetrics.cs | 2 +- .../UI/WindowsAndMessaging/User32.LPMSG.cs | 2 +- .../User32.LPWNDCLASSEXW.cs | 2 +- .../User32.MESSAGE_TYPE.cs | 2 +- .../UI/WindowsAndMessaging/User32.MSG.cs | 4 +- .../User32.PEEK_MESSAGE_REMOVE_TYPE.cs | 2 +- .../User32.PeekMessageW.cs | 4 +- .../User32.PostMessageW.cs | 4 +- .../User32.PostQuitMessage.cs | 2 +- .../User32.PostThreadMessageW.cs | 4 +- .../User32.RegisterClassExW.cs | 4 +- .../User32.SHOW_WINDOW_CMD.cs | 2 +- .../User32.SYSTEM_METRICS_INDEX.cs | 2 +- .../User32.SendMessageW.cs | 6 +- .../User32.SetCursorPos.cs | 4 +- .../WindowsAndMessaging/User32.ShowWindow.cs | 4 +- .../User32.TranslateMessage.cs | 4 +- .../User32.WINDOW_EX_STYLE.cs | 2 +- .../User32.WINDOW_STYLE.cs | 2 +- .../WindowsAndMessaging/User32.WNDCLASSEXW.cs | 4 +- .../User32.WNDCLASS_STYLES.cs | 2 +- .../UI/WindowsAndMessaging/User32.WNDPROC.cs | 4 +- .../WindowsAndMessaging/User32.WaitMessage.cs | 4 +- .../NativeMethods/User32/User32.cs | 2 +- .../Helpers/Screenshot/IScreenshotProvider.cs | 11 - src/FancyMouse/HotKeys/HotKeyHelper.cs | 6 +- src/FancyMouse/Hotkeys/HotKeyManager.cs | 6 +- src/FancyMouse/Hotkeys/KeyModifiers.cs | 2 +- src/FancyMouse/Hotkeys/MessageLoop.cs | 6 +- src/FancyMouse/Models/Settings/AppSettings.cs | 6 +- .../Models/Settings/V1/SettingsConverter.cs | 14 +- .../Models/Settings/V1/_FancyMouse.json | 6 + .../Models/Settings/V2/AppConfig.cs | 21 +- .../Settings/V2/BackgroundStyleSettings.cs | 16 +- .../Models/Settings/V2/BorderStyleSettings.cs | 18 +- .../Models/Settings/V2/CanvasSizeSettings.cs | 16 +- .../Models/Settings/V2/CanvasStyleSettings.cs | 17 +- .../Settings/V2/Converters/ColorConverter.cs | 112 +++++++++ .../Models/Settings/V2/MarginStyleSettings.cs | 10 +- .../Settings/V2/PaddingStyleSettings.cs | 10 +- ...iewSettings.cs => PreviewStyleSettings.cs} | 13 +- ...tyleSettings.cs => ScreenStyleSettings.cs} | 7 +- .../Models/Settings/V2/SettingsConverter.cs | 224 ++++++++++-------- .../Models/Settings/V2/_FancyMouse.json | 43 ++++ src/FancyMouse/Properties/AssemblyInfo.cs | 1 - src/FancyMouse/UI/FancyMouseForm.cs | 11 +- 172 files changed, 894 insertions(+), 615 deletions(-) rename src/FancyMouse.UnitTests/{ => Common}/Helpers/DrawingHelperTests.cs (89%) rename src/FancyMouse.UnitTests/{ => Common}/Helpers/LayoutHelperTests.cs (98%) create mode 100644 src/FancyMouse.UnitTests/Common/Helpers/MouseHelperTests.cs rename src/FancyMouse.UnitTests/{ => Common}/Helpers/_test-4grid-desktop.png (100%) rename src/FancyMouse.UnitTests/{ => Common}/Helpers/_test-4grid-expected.png (100%) rename src/FancyMouse.UnitTests/{ => Common}/Helpers/_test-win11-desktop.png (100%) rename src/FancyMouse.UnitTests/{ => Common}/Helpers/_test-win11-expected.png (100%) rename src/FancyMouse.UnitTests/{ => Common}/Models/Drawing/RectangleInfoTests.cs (98%) rename src/FancyMouse.UnitTests/{ => Common}/Models/Drawing/SizeInfoTests.cs (97%) delete mode 100644 src/FancyMouse.UnitTests/Helpers/MouseHelperTests.cs rename src/FancyMouse/{ => Common}/Helpers/DrawingHelper.cs (59%) rename src/FancyMouse/{ => Common}/Helpers/LayoutHelper.cs (92%) rename src/FancyMouse/{ => Common}/Helpers/MouseHelper.cs (94%) rename src/FancyMouse/{ => Common}/Helpers/ScreenHelper.cs (79%) rename src/FancyMouse/{Helpers/Screenshot/DesktopScreenshotProvider.cs => Common/Imaging/DesktopImageRegionCopyService.cs} (62%) create mode 100644 src/FancyMouse/Common/Imaging/IImageRegionCopyService.cs rename src/FancyMouse/{Helpers/Screenshot/ImageScreenshotProvider.cs => Common/Imaging/StaticImageRegionCopyService.cs} (50%) rename src/FancyMouse/{ => Common}/Models/Drawing/BoxBounds.cs (98%) rename src/FancyMouse/{ => Common}/Models/Drawing/PointInfo.cs (97%) rename src/FancyMouse/{ => Common}/Models/Drawing/RectangleInfo.cs (96%) rename src/FancyMouse/{ => Common}/Models/Drawing/ScreenInfo.cs (77%) rename src/FancyMouse/{ => Common}/Models/Drawing/SizeInfo.cs (91%) rename src/FancyMouse/{ => Common}/Models/Layout/PreviewLayout.cs (96%) rename src/FancyMouse/{ => Common}/Models/Styles/BackgroundStyle.cs (64%) rename src/FancyMouse/{ => Common}/Models/Styles/BorderStyle.cs (93%) rename src/FancyMouse/{ => Common}/Models/Styles/BoxStyle.cs (98%) rename src/FancyMouse/{ => Common}/Models/Styles/MarginStyle.cs (90%) rename src/FancyMouse/{ => Common}/Models/Styles/PaddingStyle.cs (90%) rename src/FancyMouse/{ => Common}/Models/Styles/PreviewStyle.cs (60%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/ATOM.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/BOOL.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/BYTE.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/CRECT.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/DWORD.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/GUID.cs (84%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HANDLE.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HBITMAP.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HBRUSH.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HCURSOR.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HDC.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HDESK.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HGDIOBJ.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HICON.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HINSTANCE.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HMENU.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HMODULE.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HMONITOR.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HWINSTA.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/HWND.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LONG.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPARAM.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPCRECT.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPCWSTR.cs (97%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPDWORD.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPPOINT.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPRECT.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPTSTR.cs (97%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LPVOID.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/LRESULT.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/PCWSTR.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/POINT.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/PVOID.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/RECT.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/UINT.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/ULONG.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/ULONG_PTR.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/WCHAR.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/WORD.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Core/WPARAM.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Gdi32.COLOR16.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Gdi32.COLORREF.cs (82%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs (88%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs (87%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs (67%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs (88%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs (88%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs (90%) rename src/FancyMouse/{ => Common}/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs (87%) rename src/FancyMouse/{ => Common}/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs (91%) create mode 100644 src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs rename src/FancyMouse/{ => Common}/NativeMethods/Libraries.cs (82%) rename src/FancyMouse/{ => Common}/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs (97%) rename src/FancyMouse/{ => Common}/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs (88%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs (88%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs (87%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs (84%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs (93%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs (89%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs (89%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs (97%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs (89%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs (98%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs (93%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs (90%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs (86%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs (86%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs (99%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs (96%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs (93%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs (94%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs (93%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs (98%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs (98%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs (92%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs (89%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs (88%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs (97%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs (99%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs (95%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs (99%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs (91%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs (89%) rename src/FancyMouse/{ => Common}/NativeMethods/User32/User32.cs (85%) delete mode 100644 src/FancyMouse/Helpers/Screenshot/IScreenshotProvider.cs create mode 100644 src/FancyMouse/Models/Settings/V1/_FancyMouse.json create mode 100644 src/FancyMouse/Models/Settings/V2/Converters/ColorConverter.cs rename src/FancyMouse/Models/Settings/V2/{PreviewSettings.cs => PreviewStyleSettings.cs} (57%) rename src/FancyMouse/Models/Settings/V2/{ScreenshotStyleSettings.cs => ScreenStyleSettings.cs} (78%) create mode 100644 src/FancyMouse/Models/Settings/V2/_FancyMouse.json diff --git a/src/FancyMouse.UnitTests/Helpers/DrawingHelperTests.cs b/src/FancyMouse.UnitTests/Common/Helpers/DrawingHelperTests.cs similarity index 89% rename from src/FancyMouse.UnitTests/Helpers/DrawingHelperTests.cs rename to src/FancyMouse.UnitTests/Common/Helpers/DrawingHelperTests.cs index 71c730f..9c2eb14 100644 --- a/src/FancyMouse.UnitTests/Helpers/DrawingHelperTests.cs +++ b/src/FancyMouse.UnitTests/Common/Helpers/DrawingHelperTests.cs @@ -1,14 +1,13 @@ using System.Drawing; -using System.Drawing.Imaging; using System.Reflection; -using FancyMouse.Helpers; -using FancyMouse.Helpers.Screenshot; -using FancyMouse.Models.Drawing; +using FancyMouse.Common.Helpers; +using FancyMouse.Common.Imaging; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.Models.Styles; using FancyMouse.Models.Settings; -using FancyMouse.Models.Styles; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Helpers; +namespace FancyMouse.UnitTests.Common.Helpers; [TestClass] public static class DrawingHelperTests @@ -53,8 +52,8 @@ public static IEnumerable GetTestCases() new RectangleInfo(0, 500, 500, 500), }, activatedLocation: new(x: 50, y: 50), - desktopImageFilename: "Helpers/_test-4grid-desktop.png", - expectedImageFilename: "Helpers/_test-4grid-expected.png"), + desktopImageFilename: "Common/Helpers/_test-4grid-desktop.png", + expectedImageFilename: "Common/Helpers/_test-4grid-expected.png"), }; /* win 11 */ yield return new object[] @@ -67,8 +66,8 @@ public static IEnumerable GetTestCases() new RectangleInfo(0, 0, 5120, 1440), }, activatedLocation: new(x: 50, y: 50), - desktopImageFilename: "Helpers/_test-win11-desktop.png", - expectedImageFilename: "Helpers/_test-win11-expected.png"), + desktopImageFilename: "Common/Helpers/_test-win11-desktop.png", + expectedImageFilename: "Common/Helpers/_test-win11-expected.png"), }; } @@ -84,8 +83,8 @@ public void RunTestCases(TestCase data) previewStyle: data.PreviewStyle, screens: data.Screens, activatedLocation: data.ActivatedLocation); - var screenshotProvider = new ImageScreenshotProvider(desktopImage); - using var actual = DrawingHelper.RenderPreview(previewLayout, screenshotProvider); + var imageCopyService = new StaticImageRegionCopyService(desktopImage); + using var actual = DrawingHelper.RenderPreview(previewLayout, imageCopyService); // load the expected image var expected = GetPreviewLayoutTests.LoadImageResource(data.ExpectedImageFilename); diff --git a/src/FancyMouse.UnitTests/Helpers/LayoutHelperTests.cs b/src/FancyMouse.UnitTests/Common/Helpers/LayoutHelperTests.cs similarity index 98% rename from src/FancyMouse.UnitTests/Helpers/LayoutHelperTests.cs rename to src/FancyMouse.UnitTests/Common/Helpers/LayoutHelperTests.cs index 73c38b5..ce7d1de 100644 --- a/src/FancyMouse.UnitTests/Helpers/LayoutHelperTests.cs +++ b/src/FancyMouse.UnitTests/Common/Helpers/LayoutHelperTests.cs @@ -1,12 +1,12 @@ using System.Drawing; using System.Text.Json; -using FancyMouse.Helpers; -using FancyMouse.Models.Drawing; -using FancyMouse.Models.Layout; -using FancyMouse.Models.Styles; +using FancyMouse.Common.Helpers; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.Models.Layout; +using FancyMouse.Common.Models.Styles; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Helpers; +namespace FancyMouse.UnitTests.Common.Helpers; [TestClass] public static class LayoutHelperTests @@ -149,7 +149,7 @@ public static IEnumerable GetTestCases() color2: Color.FromArgb(3, 68, 192) // darker blue ) ), - screenshotStyle: BoxStyle.Empty); + screenStyle: BoxStyle.Empty); var screens = new List { new(0, 0, 1024, 768), @@ -193,7 +193,7 @@ public static IEnumerable GetTestCases() height: 384 ), canvasStyle: BoxStyle.Empty, - screenshotStyle: new( + screenStyle: new( marginStyle: new( all: 1), borderStyle: new( @@ -266,7 +266,7 @@ public static IEnumerable GetTestCases() color2: Color.FromArgb(3, 68, 192) // darker blue ) ), - screenshotStyle: new( + screenStyle: new( marginStyle: new( all: 1), borderStyle: new( diff --git a/src/FancyMouse.UnitTests/Common/Helpers/MouseHelperTests.cs b/src/FancyMouse.UnitTests/Common/Helpers/MouseHelperTests.cs new file mode 100644 index 0000000..c797208 --- /dev/null +++ b/src/FancyMouse.UnitTests/Common/Helpers/MouseHelperTests.cs @@ -0,0 +1,69 @@ +using FancyMouse.Common.Helpers; +using FancyMouse.Common.Models.Drawing; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace FancyMouse.UnitTests.Common.Helpers; + +[TestClass] +public static class MouseHelperTests +{ + [TestClass] + public sealed class GetJumpLocationTests + { + public sealed class TestCase + { + public TestCase(PointInfo previewLocation, SizeInfo previewSize, RectangleInfo desktopBounds, PointInfo expectedResult) + { + this.PreviewLocation = previewLocation; + this.PreviewSize = previewSize; + this.DesktopBounds = desktopBounds; + this.ExpectedResult = expectedResult; + } + + public PointInfo PreviewLocation { get; } + + public SizeInfo PreviewSize { get; } + + public RectangleInfo DesktopBounds { get; } + + public PointInfo ExpectedResult { get; } + } + + public static IEnumerable GetTestCases() + { + // screen corners and midpoint with a zero origin + yield return new object[] { new TestCase(new(0, 0), new(160, 120), new(0, 0, 1600, 1200), new(0, 0)) }; + yield return new object[] { new TestCase(new(160, 0), new(160, 120), new(0, 0, 1600, 1200), new(1600, 0)) }; + yield return new object[] { new TestCase(new(0, 120), new(160, 120), new(0, 0, 1600, 1200), new(0, 1200)) }; + yield return new object[] { new TestCase(new(160, 120), new(160, 120), new(0, 0, 1600, 1200), new(1600, 1200)) }; + yield return new object[] { new TestCase(new(80, 60), new(160, 120), new(0, 0, 1600, 1200), new(800, 600)) }; + + // screen corners and midpoint with a positive origin + yield return new object[] { new TestCase(new(0, 0), new(160, 120), new(1000, 1000, 1600, 1200), new(1000, 1000)) }; + yield return new object[] { new TestCase(new(160, 0), new(160, 120), new(1000, 1000, 1600, 1200), new(2600, 1000)) }; + yield return new object[] { new TestCase(new(0, 120), new(160, 120), new(1000, 1000, 1600, 1200), new(1000, 2200)) }; + yield return new object[] { new TestCase(new(160, 120), new(160, 120), new(1000, 1000, 1600, 1200), new(2600, 2200)) }; + yield return new object[] { new TestCase(new(80, 60), new(160, 120), new(1000, 1000, 1600, 1200), new(1800, 1600)) }; + + // screen corners and midpoint with a negative origin + yield return new object[] { new TestCase(new(0, 0), new(160, 120), new(-1000, -1000, 1600, 1200), new(-1000, -1000)) }; + yield return new object[] { new TestCase(new(160, 0), new(160, 120), new(-1000, -1000, 1600, 1200), new(600, -1000)) }; + yield return new object[] { new TestCase(new(0, 120), new(160, 120), new(-1000, -1000, 1600, 1200), new(-1000, 200)) }; + yield return new object[] { new TestCase(new(160, 120), new(160, 120), new(-1000, -1000, 1600, 1200), new(600, 200)) }; + yield return new object[] { new TestCase(new(80, 60), new(160, 120), new(-1000, -1000, 1600, 1200), new(-200, -400)) }; + } + + [TestMethod] + [DynamicData(nameof(GetTestCases), DynamicDataSourceType.Method)] + public void RunTestCases(TestCase data) + { + var actual = MouseHelper.GetJumpLocation( + data.PreviewLocation, + data.PreviewSize, + data.DesktopBounds); + var expected = data.ExpectedResult; + Assert.AreEqual(expected.X, actual.X); + Assert.AreEqual(expected.Y, actual.Y); + } + } +} diff --git a/src/FancyMouse.UnitTests/Helpers/_test-4grid-desktop.png b/src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-desktop.png similarity index 100% rename from src/FancyMouse.UnitTests/Helpers/_test-4grid-desktop.png rename to src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-desktop.png diff --git a/src/FancyMouse.UnitTests/Helpers/_test-4grid-expected.png b/src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-expected.png similarity index 100% rename from src/FancyMouse.UnitTests/Helpers/_test-4grid-expected.png rename to src/FancyMouse.UnitTests/Common/Helpers/_test-4grid-expected.png diff --git a/src/FancyMouse.UnitTests/Helpers/_test-win11-desktop.png b/src/FancyMouse.UnitTests/Common/Helpers/_test-win11-desktop.png similarity index 100% rename from src/FancyMouse.UnitTests/Helpers/_test-win11-desktop.png rename to src/FancyMouse.UnitTests/Common/Helpers/_test-win11-desktop.png diff --git a/src/FancyMouse.UnitTests/Helpers/_test-win11-expected.png b/src/FancyMouse.UnitTests/Common/Helpers/_test-win11-expected.png similarity index 100% rename from src/FancyMouse.UnitTests/Helpers/_test-win11-expected.png rename to src/FancyMouse.UnitTests/Common/Helpers/_test-win11-expected.png diff --git a/src/FancyMouse.UnitTests/Models/Drawing/RectangleInfoTests.cs b/src/FancyMouse.UnitTests/Common/Models/Drawing/RectangleInfoTests.cs similarity index 98% rename from src/FancyMouse.UnitTests/Models/Drawing/RectangleInfoTests.cs rename to src/FancyMouse.UnitTests/Common/Models/Drawing/RectangleInfoTests.cs index aa6716d..6ebb0a9 100644 --- a/src/FancyMouse.UnitTests/Models/Drawing/RectangleInfoTests.cs +++ b/src/FancyMouse.UnitTests/Common/Models/Drawing/RectangleInfoTests.cs @@ -1,7 +1,7 @@ -using FancyMouse.Models.Drawing; +using FancyMouse.Common.Models.Drawing; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Models.Drawing; +namespace FancyMouse.UnitTests.Common.Models.Drawing; [TestClass] public static class RectangleInfoTests diff --git a/src/FancyMouse.UnitTests/Models/Drawing/SizeInfoTests.cs b/src/FancyMouse.UnitTests/Common/Models/Drawing/SizeInfoTests.cs similarity index 97% rename from src/FancyMouse.UnitTests/Models/Drawing/SizeInfoTests.cs rename to src/FancyMouse.UnitTests/Common/Models/Drawing/SizeInfoTests.cs index dfb901e..15f850d 100644 --- a/src/FancyMouse.UnitTests/Models/Drawing/SizeInfoTests.cs +++ b/src/FancyMouse.UnitTests/Common/Models/Drawing/SizeInfoTests.cs @@ -1,7 +1,7 @@ -using FancyMouse.Models.Drawing; +using FancyMouse.Common.Models.Drawing; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace FancyMouse.UnitTests.Models.Drawing; +namespace FancyMouse.UnitTests.Common.Models.Drawing; [TestClass] public static class SizeInfoTests diff --git a/src/FancyMouse.UnitTests/FancyMouse.UnitTests.csproj b/src/FancyMouse.UnitTests/FancyMouse.UnitTests.csproj index 50fef05..7917024 100644 --- a/src/FancyMouse.UnitTests/FancyMouse.UnitTests.csproj +++ b/src/FancyMouse.UnitTests/FancyMouse.UnitTests.csproj @@ -7,10 +7,10 @@ - - - - + + + + @@ -24,10 +24,10 @@ - - - - + + + + diff --git a/src/FancyMouse.UnitTests/Helpers/MouseHelperTests.cs b/src/FancyMouse.UnitTests/Helpers/MouseHelperTests.cs deleted file mode 100644 index 0bf7a8d..0000000 --- a/src/FancyMouse.UnitTests/Helpers/MouseHelperTests.cs +++ /dev/null @@ -1,69 +0,0 @@ -using FancyMouse.Helpers; -using FancyMouse.Models.Drawing; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace FancyMouse.UnitTests.Helpers; - -[TestClass] -public static class MouseHelperTests -{ - [TestClass] - public sealed class GetJumpLocationTests - { - public sealed class TestCase - { - public TestCase(PointInfo previewLocation, SizeInfo previewSize, RectangleInfo desktopBounds, PointInfo expectedResult) - { - this.PreviewLocation = previewLocation; - this.PreviewSize = previewSize; - this.DesktopBounds = desktopBounds; - this.ExpectedResult = expectedResult; - } - - public PointInfo PreviewLocation { get; } - - public SizeInfo PreviewSize { get; } - - public RectangleInfo DesktopBounds { get; } - - public PointInfo ExpectedResult { get; } - } - - public static IEnumerable GetTestCases() - { - // screen corners and midpoint with a zero origin - yield return new[] { new TestCase(new(0, 0), new(160, 120), new(0, 0, 1600, 1200), new(0, 0)) }; - yield return new[] { new TestCase(new(160, 0), new(160, 120), new(0, 0, 1600, 1200), new(1600, 0)) }; - yield return new[] { new TestCase(new(0, 120), new(160, 120), new(0, 0, 1600, 1200), new(0, 1200)) }; - yield return new[] { new TestCase(new(160, 120), new(160, 120), new(0, 0, 1600, 1200), new(1600, 1200)) }; - yield return new[] { new TestCase(new(80, 60), new(160, 120), new(0, 0, 1600, 1200), new(800, 600)) }; - - // screen corners and midpoint with a positive origin - yield return new[] { new TestCase(new(0, 0), new(160, 120), new(1000, 1000, 1600, 1200), new(1000, 1000)) }; - yield return new[] { new TestCase(new(160, 0), new(160, 120), new(1000, 1000, 1600, 1200), new(2600, 1000)) }; - yield return new[] { new TestCase(new(0, 120), new(160, 120), new(1000, 1000, 1600, 1200), new(1000, 2200)) }; - yield return new[] { new TestCase(new(160, 120), new(160, 120), new(1000, 1000, 1600, 1200), new(2600, 2200)) }; - yield return new[] { new TestCase(new(80, 60), new(160, 120), new(1000, 1000, 1600, 1200), new(1800, 1600)) }; - - // screen corners and midpoint with a negative origin - yield return new[] { new TestCase(new(0, 0), new(160, 120), new(-1000, -1000, 1600, 1200), new(-1000, -1000)) }; - yield return new[] { new TestCase(new(160, 0), new(160, 120), new(-1000, -1000, 1600, 1200), new(600, -1000)) }; - yield return new[] { new TestCase(new(0, 120), new(160, 120), new(-1000, -1000, 1600, 1200), new(-1000, 200)) }; - yield return new[] { new TestCase(new(160, 120), new(160, 120), new(-1000, -1000, 1600, 1200), new(600, 200)) }; - yield return new[] { new TestCase(new(80, 60), new(160, 120), new(-1000, -1000, 1600, 1200), new(-200, -400)) }; - } - - [TestMethod] - [DynamicData(nameof(GetTestCases), DynamicDataSourceType.Method)] - public void RunTestCases(TestCase data) - { - var actual = MouseHelper.GetJumpLocation( - data.PreviewLocation, - data.PreviewSize, - data.DesktopBounds); - var expected = data.ExpectedResult; - Assert.AreEqual(expected.X, actual.X); - Assert.AreEqual(expected.Y, actual.Y); - } - } -} diff --git a/src/FancyMouse.UnitTests/Models/Settings/AppSettingsReaderTests.cs b/src/FancyMouse.UnitTests/Models/Settings/AppSettingsReaderTests.cs index 5c40ac3..a26028e 100644 --- a/src/FancyMouse.UnitTests/Models/Settings/AppSettingsReaderTests.cs +++ b/src/FancyMouse.UnitTests/Models/Settings/AppSettingsReaderTests.cs @@ -1,9 +1,9 @@ using System.Diagnostics; using System.Drawing; using System.Text.Json; +using FancyMouse.Common.Models.Styles; using FancyMouse.HotKeys; using FancyMouse.Models.Settings; -using FancyMouse.Models.Styles; using FancyMouse.UnitTests.TestUtils; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -124,7 +124,7 @@ public void Version1WithAllValuesShouldParse() height: 600 ), canvasStyle: AppSettings.DefaultSettings.PreviewStyle.CanvasStyle, - screenshotStyle: AppSettings.DefaultSettings.PreviewStyle.ScreenshotStyle + screenStyle: AppSettings.DefaultSettings.PreviewStyle.ScreenStyle )); Assert.AreEqual( JsonSerializer.Serialize(expected), @@ -227,7 +227,7 @@ public void Version2WithAllValuesShouldParse() color2: Color.Blue ) ), - screenshotStyle: new( + screenStyle: new( marginStyle: new( all: 10 ), diff --git a/src/FancyMouse/Helpers/DrawingHelper.cs b/src/FancyMouse/Common/Helpers/DrawingHelper.cs similarity index 59% rename from src/FancyMouse/Helpers/DrawingHelper.cs rename to src/FancyMouse/Common/Helpers/DrawingHelper.cs index b11fac0..27d493b 100644 --- a/src/FancyMouse/Helpers/DrawingHelper.cs +++ b/src/FancyMouse/Common/Helpers/DrawingHelper.cs @@ -1,25 +1,25 @@ using System.Diagnostics; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using FancyMouse.Helpers.Screenshot; -using FancyMouse.Models.Drawing; -using FancyMouse.Models.Layout; -using FancyMouse.Models.Styles; +using FancyMouse.Common.Imaging; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.Models.Layout; +using FancyMouse.Common.Models.Styles; -namespace FancyMouse.Helpers; +namespace FancyMouse.Common.Helpers; internal static class DrawingHelper { internal static Bitmap RenderPreview( PreviewLayout previewLayout, - IScreenshotProvider screenshotProvider) + IImageRegionCopyService imageCopyService) { - return DrawingHelper.RenderPreview(previewLayout, screenshotProvider, null, null); + return DrawingHelper.RenderPreview(previewLayout, imageCopyService, null, null); } internal static Bitmap RenderPreview( PreviewLayout previewLayout, - IScreenshotProvider screenshotProvider, + IImageRegionCopyService imageCopyService, Action? previewImageCreatedCallback, Action? previewImageUpdatedCallback) { @@ -31,8 +31,8 @@ internal static Bitmap RenderPreview( var previewGraphics = Graphics.FromImage(previewImage); previewImageCreatedCallback?.Invoke(previewImage); - DrawingHelper.DrawBoxBorder(previewGraphics, previewLayout.PreviewStyle.CanvasStyle, previewLayout.PreviewBounds); - DrawingHelper.DrawBoxBackground( + DrawingHelper.DrawRaisedBorder(previewGraphics, previewLayout.PreviewStyle.CanvasStyle, previewLayout.PreviewBounds); + DrawingHelper.DrawBackgroundFill( previewGraphics, previewLayout.PreviewStyle.CanvasStyle, previewLayout.PreviewBounds, @@ -52,15 +52,15 @@ internal static Bitmap RenderPreview( // draw all the screenshot bezels foreach (var screenshotBounds in previewLayout.ScreenshotBounds) { - DrawingHelper.DrawBoxBorder( - previewGraphics, previewLayout.PreviewStyle.ScreenshotStyle, screenshotBounds); + DrawingHelper.DrawRaisedBorder( + previewGraphics, previewLayout.PreviewStyle.ScreenStyle, screenshotBounds); } var imageUpdated = false; var placeholdersDrawn = false; for (var i = 0; i < sourceScreens.Count; i++) { - screenshotProvider.DrawScreenshot(previewGraphics, sourceScreens[i], targetScreens[i].ContentBounds); + imageCopyService.CopyImageRegion(previewGraphics, sourceScreens[i], targetScreens[i].ContentBounds); imageUpdated = true; // show the placeholder images and show the form if it looks like it might take @@ -70,9 +70,9 @@ internal static Bitmap RenderPreview( // draw placeholder backgrounds for any undrawn screens if (!placeholdersDrawn) { - DrawingHelper.DrawPlaceholders( + DrawingHelper.DrawScreenPlaceholders( previewGraphics, - previewLayout.PreviewStyle.ScreenshotStyle, + previewLayout.PreviewStyle.ScreenStyle, targetScreens.GetRange(i + 1, targetScreens.Count - i - 1)); placeholdersDrawn = true; } @@ -93,19 +93,19 @@ internal static Bitmap RenderPreview( } /// - /// Draws a border shape with an optional 3d highlight and shadow effect. + /// Draws a border shape with an optional raised 3d highlight and shadow effect. /// - public static void DrawBoxBorder( + public static void DrawRaisedBorder( Graphics graphics, BoxStyle boxStyle, BoxBounds boxBounds) { - var borderInfo = boxStyle.BorderStyle; - if (borderInfo is { Horizontal: 0, Vertical: 0 }) + var borderStyle = boxStyle.BorderStyle; + if ((borderStyle.Horizontal == 0) || (borderStyle.Vertical == 0)) { return; } - // draw the preview border - using var borderBrush = new SolidBrush(borderInfo.Color); + // draw the main box border + using var borderBrush = new SolidBrush(borderStyle.Color); var borderRegion = new Region(boxBounds.BorderBounds.ToRectangle()); borderRegion.Exclude(boxBounds.PaddingBounds.ToRectangle()); graphics.FillRegion(borderBrush, borderRegion); @@ -115,10 +115,10 @@ public static void DrawBoxBorder( using var highlight = new Pen(Color.FromArgb(0x44, 0xFF, 0xFF, 0xFF)); using var shadow = new Pen(Color.FromArgb(0x44, 0x00, 0x00, 0x00)); - for (var i = 0; i < borderInfo.Depth; i++) + for (var i = 0; i < borderStyle.Depth; i++) { // left edge - if (borderInfo.Left >= i * 2) + if (borderStyle.Left >= i * 2) { graphics.DrawLine( highlight, @@ -128,14 +128,14 @@ public static void DrawBoxBorder( bounds.Bottom - 1 - i); graphics.DrawLine( shadow, - bounds.Left + (int)borderInfo.Left - 1 - i, - bounds.Top + (int)borderInfo.Top - 1 - i, - bounds.Left + (int)borderInfo.Left - 1 - i, - bounds.Bottom - (int)borderInfo.Bottom + i); + bounds.Left + (int)borderStyle.Left - 1 - i, + bounds.Top + (int)borderStyle.Top - 1 - i, + bounds.Left + (int)borderStyle.Left - 1 - i, + bounds.Bottom - (int)borderStyle.Bottom + i); } // top edge - if (borderInfo.Top >= i * 2) + if (borderStyle.Top >= i * 2) { graphics.DrawLine( highlight, @@ -145,21 +145,21 @@ public static void DrawBoxBorder( bounds.Top + i); graphics.DrawLine( shadow, - bounds.Left + (int)borderInfo.Left - 1 - i, - bounds.Top + (int)borderInfo.Top - 1 - i, - bounds.Right - (int)borderInfo.Right + i, - bounds.Top + (int)borderInfo.Bottom - 1 - i); + bounds.Left + (int)borderStyle.Left - 1 - i, + bounds.Top + (int)borderStyle.Top - 1 - i, + bounds.Right - (int)borderStyle.Right + i, + bounds.Top + (int)borderStyle.Bottom - 1 - i); } // right edge - if (borderInfo.Right >= i * 2) + if (borderStyle.Right >= i * 2) { graphics.DrawLine( highlight, - bounds.Right - (int)borderInfo.Right + i, - bounds.Top + (int)borderInfo.Top - 1 - i, - bounds.Right - (int)borderInfo.Right + i, - bounds.Bottom - (int)borderInfo.Bottom + i); + bounds.Right - (int)borderStyle.Right + i, + bounds.Top + (int)borderStyle.Top - 1 - i, + bounds.Right - (int)borderStyle.Right + i, + bounds.Bottom - (int)borderStyle.Bottom + i); graphics.DrawLine( shadow, bounds.Right - 1 - i, @@ -169,14 +169,14 @@ public static void DrawBoxBorder( } // bottom edge - if (borderInfo.Bottom >= i * 2) + if (borderStyle.Bottom >= i * 2) { graphics.DrawLine( highlight, - bounds.Left + (int)borderInfo.Left - 1 - i, - bounds.Bottom - (int)borderInfo.Bottom + i, - bounds.Right - (int)borderInfo.Right + i, - bounds.Bottom - (int)borderInfo.Bottom + i); + bounds.Left + (int)borderStyle.Left - 1 - i, + bounds.Bottom - (int)borderStyle.Bottom + i, + bounds.Right - (int)borderStyle.Right + i, + bounds.Bottom - (int)borderStyle.Bottom + i); graphics.DrawLine( shadow, bounds.Left + i, @@ -190,22 +190,20 @@ public static void DrawBoxBorder( /// /// Draws a gradient-filled background shape. /// - public static void DrawBoxBackground( + public static void DrawBackgroundFill( Graphics graphics, BoxStyle boxStyle, BoxBounds boxBounds, IEnumerable excludeBounds) { var backgroundBounds = boxBounds.PaddingBounds; - var backgroundInfo = boxStyle.BackgroundStyle; - using var backgroundBrush = new LinearGradientBrush( - backgroundBounds.ToRectangle(), - backgroundInfo.Color1, - backgroundInfo.Color2, - LinearGradientMode.ForwardDiagonal); - - var backgroundRegion = new Region(backgroundBounds.ToRectangle()); + using var backgroundBrush = DrawingHelper.GetBackgroundStyleBrush(boxStyle.BackgroundStyle, backgroundBounds); + if (backgroundBrush == null) + { + return; + } // it's faster to build a region with the screen areas excluded // and fill that than it is to fill the entire bounding rectangle + var backgroundRegion = new Region(backgroundBounds.ToRectangle()); foreach (var exclude in excludeBounds) { backgroundRegion.Exclude(exclude.ToRectangle()); @@ -217,13 +215,44 @@ public static void DrawBoxBackground( /// /// Draws placeholder background images for the specified screens on the preview. /// - public static void DrawPlaceholders( + public static void DrawScreenPlaceholders( Graphics graphics, BoxStyle screenStyle, IList screenBounds) { - if (screenBounds.Any()) + if (screenBounds.Count == 0) + { + return; + } + + if (screenStyle?.BackgroundStyle?.Color1 == null) { - var brush = new SolidBrush(screenStyle.BackgroundStyle.Color1); - graphics.FillRectangles(brush, screenBounds.Select(bounds => bounds.PaddingBounds.ToRectangle()).ToArray()); + return; } + + var brush = new SolidBrush(screenStyle.BackgroundStyle.Color1.Value); + graphics.FillRectangles(brush, screenBounds.Select(bounds => bounds.PaddingBounds.ToRectangle()).ToArray()); + } + + private static Brush? GetBackgroundStyleBrush(BackgroundStyle backgroundStyle, RectangleInfo backgroundBounds) + { + var backgroundBrush = backgroundStyle switch + { + { Color1: not null, Color2: not null } => + /* draw a gradient fill if both colors are specified */ + new LinearGradientBrush( + backgroundBounds.ToRectangle(), + backgroundStyle.Color1.Value, + backgroundStyle.Color2.Value, + LinearGradientMode.ForwardDiagonal), + { Color1: not null } => + /* draw a solid fill if only one color is specified */ + new SolidBrush( + backgroundStyle.Color1.Value), + { Color2: not null } => + /* draw a solid fill if only one color is specified */ + new SolidBrush( + backgroundStyle.Color2.Value), + _ => (Brush?)null, + }; + return backgroundBrush; } } diff --git a/src/FancyMouse/Helpers/LayoutHelper.cs b/src/FancyMouse/Common/Helpers/LayoutHelper.cs similarity index 92% rename from src/FancyMouse/Helpers/LayoutHelper.cs rename to src/FancyMouse/Common/Helpers/LayoutHelper.cs index 1a736fd..df7efde 100644 --- a/src/FancyMouse/Helpers/LayoutHelper.cs +++ b/src/FancyMouse/Common/Helpers/LayoutHelper.cs @@ -1,23 +1,16 @@ -using FancyMouse.Models.Drawing; -using FancyMouse.Models.Layout; -using FancyMouse.Models.Styles; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.Models.Layout; +using FancyMouse.Common.Models.Styles; -namespace FancyMouse.Helpers; +namespace FancyMouse.Common.Helpers; internal static class LayoutHelper { public static PreviewLayout GetPreviewLayout( PreviewStyle previewStyle, IEnumerable screens, PointInfo activatedLocation) { - if (previewStyle is null) - { - throw new ArgumentNullException(nameof(previewStyle)); - } - - if (screens is null) - { - throw new ArgumentNullException(nameof(screens)); - } + ArgumentNullException.ThrowIfNull(previewStyle); + ArgumentNullException.ThrowIfNull(screens); var allScreens = screens.ToList(); if (allScreens.Count == 0) @@ -89,7 +82,7 @@ public static PreviewLayout GetPreviewLayout( .Scale(scalingRatio) .Offset(builder.PreviewBounds.ContentBounds.Location.ToSize()) .Truncate(), - previewStyle.ScreenshotStyle)) + previewStyle.ScreenStyle)) .ToList(); return builder.Build(); diff --git a/src/FancyMouse/Helpers/MouseHelper.cs b/src/FancyMouse/Common/Helpers/MouseHelper.cs similarity index 94% rename from src/FancyMouse/Helpers/MouseHelper.cs rename to src/FancyMouse/Common/Helpers/MouseHelper.cs index 6d69729..f697d1d 100644 --- a/src/FancyMouse/Helpers/MouseHelper.cs +++ b/src/FancyMouse/Common/Helpers/MouseHelper.cs @@ -1,10 +1,10 @@ using System.ComponentModel; using System.Runtime.InteropServices; -using FancyMouse.Models.Drawing; -using FancyMouse.NativeMethods; -using static FancyMouse.NativeMethods.Core; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.NativeMethods; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.Helpers; +namespace FancyMouse.Common.Helpers; internal static class MouseHelper { @@ -85,13 +85,6 @@ public static void SetCursorPosition(PointInfo location) } } - /* - if ((pos.x != target.X) || (pos.y != target.Y)) - { - throw new InvalidOperationException(); - } - */ - // temporary workaround for issue #1273 MouseHelper.SimulateMouseMovementEvent(location); } diff --git a/src/FancyMouse/Helpers/ScreenHelper.cs b/src/FancyMouse/Common/Helpers/ScreenHelper.cs similarity index 79% rename from src/FancyMouse/Helpers/ScreenHelper.cs rename to src/FancyMouse/Common/Helpers/ScreenHelper.cs index 12c6ef7..daf40a9 100644 --- a/src/FancyMouse/Helpers/ScreenHelper.cs +++ b/src/FancyMouse/Common/Helpers/ScreenHelper.cs @@ -1,9 +1,10 @@ using System.ComponentModel; -using FancyMouse.Models.Drawing; -using FancyMouse.NativeMethods; -using static FancyMouse.NativeMethods.Core; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.NativeMethods; +using static FancyMouse.Common.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.User32; -namespace FancyMouse.Helpers; +namespace FancyMouse.Common.Helpers; internal static class ScreenHelper { @@ -14,10 +15,10 @@ internal static class ScreenHelper public static RectangleInfo GetVirtualScreen() { return new( - User32.GetSystemMetrics(User32.SYSTEM_METRICS_INDEX.SM_XVIRTUALSCREEN), - User32.GetSystemMetrics(User32.SYSTEM_METRICS_INDEX.SM_YVIRTUALSCREEN), - User32.GetSystemMetrics(User32.SYSTEM_METRICS_INDEX.SM_CXVIRTUALSCREEN), - User32.GetSystemMetrics(User32.SYSTEM_METRICS_INDEX.SM_CYVIRTUALSCREEN)); + User32.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_XVIRTUALSCREEN), + User32.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_YVIRTUALSCREEN), + User32.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CXVIRTUALSCREEN), + User32.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_CYVIRTUALSCREEN)); } public static IEnumerable GetAllScreens() @@ -42,8 +43,8 @@ public static IEnumerable GetAllScreens() // get detailed info about each monitor foreach (var hMonitor in hMonitors) { - var monitorInfoPtr = new User32.LPMONITORINFO( - new User32.MONITORINFO((uint)User32.MONITORINFO.Size, RECT.Empty, RECT.Empty, 0)); + var monitorInfoPtr = new LPMONITORINFO( + new MONITORINFO((uint)MONITORINFO.Size, RECT.Empty, RECT.Empty, 0)); result = User32.GetMonitorInfoW(hMonitor, monitorInfoPtr); if (!result) { diff --git a/src/FancyMouse/Helpers/Screenshot/DesktopScreenshotProvider.cs b/src/FancyMouse/Common/Imaging/DesktopImageRegionCopyService.cs similarity index 62% rename from src/FancyMouse/Helpers/Screenshot/DesktopScreenshotProvider.cs rename to src/FancyMouse/Common/Imaging/DesktopImageRegionCopyService.cs index cb87b01..509074a 100644 --- a/src/FancyMouse/Helpers/Screenshot/DesktopScreenshotProvider.cs +++ b/src/FancyMouse/Common/Imaging/DesktopImageRegionCopyService.cs @@ -1,27 +1,29 @@ using System.Diagnostics; -using FancyMouse.Models.Drawing; -using FancyMouse.NativeMethods; -using static FancyMouse.NativeMethods.Core; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.NativeMethods; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.Helpers.Screenshot; +namespace FancyMouse.Common.Imaging; /// -/// Implements an IScreenshotProvider that uses the current desktop window as the screenshot source. +/// Implements an IImageRegionCopyService that uses the current desktop window as the copy source. +/// This is used during the main application runtime to generate preview images of the desktop. /// -internal sealed class DesktopScreenshotProvider : IScreenshotProvider +internal sealed class DesktopImageRegionCopyService : IImageRegionCopyService { /// - /// Draws a screen capture from the current desktop window onto the image - /// wrapped by the specified Graphics object. + /// Copies the source region from the current desktop window + /// to the target region on the specified Graphics object. /// - public void DrawScreenshot( + public void CopyImageRegion( Graphics targetGraphics, RectangleInfo sourceBounds, RectangleInfo targetBounds) { var stopwatch = Stopwatch.StartNew(); - var (desktopHwnd, desktopHdc) = DesktopScreenshotProvider.GetDesktopDeviceContext(); - var previewHdc = DesktopScreenshotProvider.GetTargetDeviceContext(targetGraphics); + var (desktopHwnd, desktopHdc) = DesktopImageRegionCopyService.GetDesktopDeviceContext(); + var previewHdc = DesktopImageRegionCopyService.GetGraphicsDeviceContext( + targetGraphics, Gdi32.STRETCH_BLT_MODE.STRETCH_HALFTONE); stopwatch.Stop(); var source = sourceBounds.ToRectangle(); @@ -47,9 +49,9 @@ public void DrawScreenshot( // we need to release the graphics device context handle before anything // else tries to use the Graphics object otherwise it'll give an error // from GDI saying "Object is currently in use elsewhere" - DesktopScreenshotProvider.FreeTargetDeviceContext(targetGraphics, ref previewHdc); + DesktopImageRegionCopyService.FreeGraphicsDeviceContext(targetGraphics, ref previewHdc); - DesktopScreenshotProvider.FreeDesktopDeviceContext(ref desktopHwnd, ref desktopHdc); + DesktopImageRegionCopyService.FreeDesktopDeviceContext(ref desktopHwnd, ref desktopHdc); } private static (HWND DesktopHwnd, HDC DesktopHdc) GetDesktopDeviceContext() @@ -85,29 +87,31 @@ private static void FreeDesktopDeviceContext(ref HWND desktopHwnd, ref HDC deskt /// Checks if the target device context handle exists, and creates a new one from the /// specified Graphics object if not. /// - private static HDC GetTargetDeviceContext(Graphics targetGraphics) + private static HDC GetGraphicsDeviceContext(Graphics graphics, Gdi32.STRETCH_BLT_MODE mode) { - var targetHdc = (HDC)targetGraphics.GetHdc(); + var graphicsHdc = (HDC)graphics.GetHdc(); - var result = Gdi32.SetStretchBltMode(targetHdc, Gdi32.STRETCH_BLT_MODE.STRETCH_HALFTONE); + var result = Gdi32.SetStretchBltMode(graphicsHdc, mode); if (result == 0) { throw new InvalidOperationException( $"{nameof(Gdi32.SetStretchBltMode)} returned {result}"); } - return targetHdc; + return graphicsHdc; } /// /// Free the specified device context handle if it exists. /// - private static void FreeTargetDeviceContext(Graphics targetGraphics, ref HDC targetHdc) + private static void FreeGraphicsDeviceContext(Graphics graphics, ref HDC graphicsHdc) { - if ((targetGraphics is not null) && !targetHdc.IsNull) + if (graphicsHdc.IsNull) { - targetGraphics.ReleaseHdc(targetHdc.Value); - targetHdc = HDC.Null; + return; } + + graphics.ReleaseHdc(graphicsHdc.Value); + graphicsHdc = HDC.Null; } } diff --git a/src/FancyMouse/Common/Imaging/IImageRegionCopyService.cs b/src/FancyMouse/Common/Imaging/IImageRegionCopyService.cs new file mode 100644 index 0000000..c9c2d30 --- /dev/null +++ b/src/FancyMouse/Common/Imaging/IImageRegionCopyService.cs @@ -0,0 +1,19 @@ +using FancyMouse.Common.Models.Drawing; + +namespace FancyMouse.Common.Imaging; + +internal interface IImageRegionCopyService +{ + /// + /// Copies the source region from the provider's source image (e.g. the interactive desktop, + /// a static image, etc) to the target region on the specified Graphics object. + /// + /// + /// Implementations of this interface are used to capture regions of the interactive desktop + /// during runtime, or to capture regions of a static reference image during unit tests. + /// + void CopyImageRegion( + Graphics targetGraphics, + RectangleInfo sourceBounds, + RectangleInfo targetBounds); +} diff --git a/src/FancyMouse/Helpers/Screenshot/ImageScreenshotProvider.cs b/src/FancyMouse/Common/Imaging/StaticImageRegionCopyService.cs similarity index 50% rename from src/FancyMouse/Helpers/Screenshot/ImageScreenshotProvider.cs rename to src/FancyMouse/Common/Imaging/StaticImageRegionCopyService.cs index 116d458..f2f858a 100644 --- a/src/FancyMouse/Helpers/Screenshot/ImageScreenshotProvider.cs +++ b/src/FancyMouse/Common/Imaging/StaticImageRegionCopyService.cs @@ -1,14 +1,14 @@ -using FancyMouse.Models.Drawing; +using FancyMouse.Common.Models.Drawing; -namespace FancyMouse.Helpers.Screenshot; +namespace FancyMouse.Common.Imaging; /// -/// Implements an IScreenshotProvider that uses the specified image as the screenshot source. -/// (This is used for testing the DrawingHelper, rather than as part of the main application). +/// Implements an IImageRegionCopyService that uses the specified image as the copy source. +/// This is used for testing the DrawingHelper rather than as part of the main application. /// -internal sealed class ImageScreenshotProvider : IScreenshotProvider +internal sealed class StaticImageRegionCopyService : IImageRegionCopyService { - public ImageScreenshotProvider(Image sourceImage) + public StaticImageRegionCopyService(Image sourceImage) { this.SourceImage = sourceImage ?? throw new ArgumentNullException(nameof(sourceImage)); } @@ -19,10 +19,10 @@ private Image SourceImage } /// - /// Draws a screen capture from the current desktop window onto the image - /// wrapped by the specified Graphics object. + /// Copies the source region from the static source image + /// to the target region on the specified Graphics object. /// - public void DrawScreenshot( + public void CopyImageRegion( Graphics targetGraphics, RectangleInfo sourceBounds, RectangleInfo targetBounds) diff --git a/src/FancyMouse/Models/Drawing/BoxBounds.cs b/src/FancyMouse/Common/Models/Drawing/BoxBounds.cs similarity index 98% rename from src/FancyMouse/Models/Drawing/BoxBounds.cs rename to src/FancyMouse/Common/Models/Drawing/BoxBounds.cs index e88f2b4..82d141d 100644 --- a/src/FancyMouse/Models/Drawing/BoxBounds.cs +++ b/src/FancyMouse/Common/Models/Drawing/BoxBounds.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.Models.Drawing; +namespace FancyMouse.Common.Models.Drawing; public sealed class BoxBounds { diff --git a/src/FancyMouse/Models/Drawing/PointInfo.cs b/src/FancyMouse/Common/Models/Drawing/PointInfo.cs similarity index 97% rename from src/FancyMouse/Models/Drawing/PointInfo.cs rename to src/FancyMouse/Common/Models/Drawing/PointInfo.cs index 79f68d6..850b408 100644 --- a/src/FancyMouse/Models/Drawing/PointInfo.cs +++ b/src/FancyMouse/Common/Models/Drawing/PointInfo.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.Models.Drawing; +namespace FancyMouse.Common.Models.Drawing; /// /// Immutable version of a System.Drawing.Point object with some extra utility methods. diff --git a/src/FancyMouse/Models/Drawing/RectangleInfo.cs b/src/FancyMouse/Common/Models/Drawing/RectangleInfo.cs similarity index 96% rename from src/FancyMouse/Models/Drawing/RectangleInfo.cs rename to src/FancyMouse/Common/Models/Drawing/RectangleInfo.cs index 75fc657..2e10ed3 100644 --- a/src/FancyMouse/Models/Drawing/RectangleInfo.cs +++ b/src/FancyMouse/Common/Models/Drawing/RectangleInfo.cs @@ -1,7 +1,8 @@ using System.Text.Json.Serialization; -using FancyMouse.Models.Styles; +using FancyMouse.Common.Models.Styles; +using BorderStyle = FancyMouse.Common.Models.Styles.BorderStyle; -namespace FancyMouse.Models.Drawing; +namespace FancyMouse.Common.Models.Drawing; /// /// Immutable version of a System.Drawing.Rectangle object with some extra utility methods. @@ -124,7 +125,7 @@ public bool Contains(RectangleInfo rect) => (this.X <= rect.X) && (rect.X + rect.Width <= this.X + this.Width) && (this.Y <= rect.Y) && (rect.Y + rect.Height <= this.Y + this.Height); - public RectangleInfo Enlarge(Styles.BorderStyle border) => + public RectangleInfo Enlarge(BorderStyle border) => new( this.X - border.Left, this.Y - border.Top, @@ -155,7 +156,7 @@ public RectangleInfo Enlarge(PaddingStyle padding) => this.Width * scalingFactor, this.Height * scalingFactor); - public RectangleInfo Shrink(Styles.BorderStyle border) => + public RectangleInfo Shrink(BorderStyle border) => new( this.X + border.Left, this.Y + border.Top, diff --git a/src/FancyMouse/Models/Drawing/ScreenInfo.cs b/src/FancyMouse/Common/Models/Drawing/ScreenInfo.cs similarity index 77% rename from src/FancyMouse/Models/Drawing/ScreenInfo.cs rename to src/FancyMouse/Common/Models/Drawing/ScreenInfo.cs index 96c22da..bda7d71 100644 --- a/src/FancyMouse/Models/Drawing/ScreenInfo.cs +++ b/src/FancyMouse/Common/Models/Drawing/ScreenInfo.cs @@ -1,6 +1,6 @@ -using FancyMouse.NativeMethods; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.Models.Drawing; +namespace FancyMouse.Common.Models.Drawing; /// /// Immutable version of a System.Windows.Forms.Screen object so we don't need to @@ -8,7 +8,7 @@ namespace FancyMouse.Models.Drawing; /// public sealed class ScreenInfo { - internal ScreenInfo(Core.HMONITOR handle, bool primary, RectangleInfo displayArea, RectangleInfo workingArea) + internal ScreenInfo(HMONITOR handle, bool primary, RectangleInfo displayArea, RectangleInfo workingArea) { this.Handle = handle; this.Primary = primary; diff --git a/src/FancyMouse/Models/Drawing/SizeInfo.cs b/src/FancyMouse/Common/Models/Drawing/SizeInfo.cs similarity index 91% rename from src/FancyMouse/Models/Drawing/SizeInfo.cs rename to src/FancyMouse/Common/Models/Drawing/SizeInfo.cs index c4943b7..dd68fed 100644 --- a/src/FancyMouse/Models/Drawing/SizeInfo.cs +++ b/src/FancyMouse/Common/Models/Drawing/SizeInfo.cs @@ -1,6 +1,7 @@ -using FancyMouse.Models.Styles; +using FancyMouse.Common.Models.Styles; +using BorderStyle = FancyMouse.Common.Models.Styles.BorderStyle; -namespace FancyMouse.Models.Drawing; +namespace FancyMouse.Common.Models.Drawing; /// /// Immutable version of a System.Drawing.Size object with some extra utility methods. @@ -28,7 +29,7 @@ public decimal Height get; } - public SizeInfo Enlarge(Styles.BorderStyle border) => + public SizeInfo Enlarge(BorderStyle border) => new( this.Width + border.Horizontal, this.Height + border.Vertical); @@ -46,7 +47,7 @@ public SizeInfo Intersect(SizeInfo size) => public SizeInfo Negate() => new(-this.Width, -this.Height); - public SizeInfo Shrink(Styles.BorderStyle border) => + public SizeInfo Shrink(BorderStyle border) => new(this.Width - border.Horizontal, this.Height - border.Vertical); public SizeInfo Shrink(MarginStyle margin) => diff --git a/src/FancyMouse/Models/Layout/PreviewLayout.cs b/src/FancyMouse/Common/Models/Layout/PreviewLayout.cs similarity index 96% rename from src/FancyMouse/Models/Layout/PreviewLayout.cs rename to src/FancyMouse/Common/Models/Layout/PreviewLayout.cs index a63ad2c..8cf6105 100644 --- a/src/FancyMouse/Models/Layout/PreviewLayout.cs +++ b/src/FancyMouse/Common/Models/Layout/PreviewLayout.cs @@ -1,8 +1,8 @@ using System.Collections.ObjectModel; -using FancyMouse.Models.Drawing; -using FancyMouse.Models.Styles; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.Models.Styles; -namespace FancyMouse.Models.Layout; +namespace FancyMouse.Common.Models.Layout; public sealed class PreviewLayout { diff --git a/src/FancyMouse/Models/Styles/BackgroundStyle.cs b/src/FancyMouse/Common/Models/Styles/BackgroundStyle.cs similarity index 64% rename from src/FancyMouse/Models/Styles/BackgroundStyle.cs rename to src/FancyMouse/Common/Models/Styles/BackgroundStyle.cs index a10f0c7..3583bc2 100644 --- a/src/FancyMouse/Models/Styles/BackgroundStyle.cs +++ b/src/FancyMouse/Common/Models/Styles/BackgroundStyle.cs @@ -1,26 +1,29 @@ -namespace FancyMouse.Models.Styles; +namespace FancyMouse.Common.Models.Styles; /// /// Represents the background fill style for a drawing object. /// public sealed class BackgroundStyle { - public static readonly BackgroundStyle Empty = new(SystemColors.Control, SystemColors.Control); + public static readonly BackgroundStyle Empty = new( + Color.Transparent, + Color.Transparent + ); public BackgroundStyle( - Color color1, - Color color2) + Color? color1, + Color? color2) { this.Color1 = color1; this.Color2 = color2; } - public Color Color1 + public Color? Color1 { get; } - public Color Color2 + public Color? Color2 { get; } diff --git a/src/FancyMouse/Models/Styles/BorderStyle.cs b/src/FancyMouse/Common/Models/Styles/BorderStyle.cs similarity index 93% rename from src/FancyMouse/Models/Styles/BorderStyle.cs rename to src/FancyMouse/Common/Models/Styles/BorderStyle.cs index 508b0c6..ad589f6 100644 --- a/src/FancyMouse/Models/Styles/BorderStyle.cs +++ b/src/FancyMouse/Common/Models/Styles/BorderStyle.cs @@ -1,6 +1,4 @@ -using System.Text.Json.Serialization; - -namespace FancyMouse.Models.Styles; +namespace FancyMouse.Common.Models.Styles; /// /// Represents the border style for a drawing object. @@ -57,10 +55,8 @@ public decimal Depth get; } - [JsonIgnore] public decimal Horizontal => this.Left + this.Right; - [JsonIgnore] public decimal Vertical => this.Top + this.Bottom; public override string ToString() diff --git a/src/FancyMouse/Models/Styles/BoxStyle.cs b/src/FancyMouse/Common/Models/Styles/BoxStyle.cs similarity index 98% rename from src/FancyMouse/Models/Styles/BoxStyle.cs rename to src/FancyMouse/Common/Models/Styles/BoxStyle.cs index 1cc2af6..2df13ba 100644 --- a/src/FancyMouse/Models/Styles/BoxStyle.cs +++ b/src/FancyMouse/Common/Models/Styles/BoxStyle.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.Models.Styles; +namespace FancyMouse.Common.Models.Styles; /// /// Represents the styles to apply to a simple box-layout based drawing object. diff --git a/src/FancyMouse/Models/Styles/MarginStyle.cs b/src/FancyMouse/Common/Models/Styles/MarginStyle.cs similarity index 90% rename from src/FancyMouse/Models/Styles/MarginStyle.cs rename to src/FancyMouse/Common/Models/Styles/MarginStyle.cs index f0bb777..542fe60 100644 --- a/src/FancyMouse/Models/Styles/MarginStyle.cs +++ b/src/FancyMouse/Common/Models/Styles/MarginStyle.cs @@ -1,6 +1,4 @@ -using System.Text.Json.Serialization; - -namespace FancyMouse.Models.Styles; +namespace FancyMouse.Common.Models.Styles; /// /// Represents the margin style for a drawing object. @@ -42,10 +40,8 @@ public decimal Bottom get; } - [JsonIgnore] public decimal Horizontal => this.Left + this.Right; - [JsonIgnore] public decimal Vertical => this.Top + this.Bottom; public override string ToString() diff --git a/src/FancyMouse/Models/Styles/PaddingStyle.cs b/src/FancyMouse/Common/Models/Styles/PaddingStyle.cs similarity index 90% rename from src/FancyMouse/Models/Styles/PaddingStyle.cs rename to src/FancyMouse/Common/Models/Styles/PaddingStyle.cs index f2e5c20..0f54a54 100644 --- a/src/FancyMouse/Models/Styles/PaddingStyle.cs +++ b/src/FancyMouse/Common/Models/Styles/PaddingStyle.cs @@ -1,6 +1,4 @@ -using System.Text.Json.Serialization; - -namespace FancyMouse.Models.Styles; +namespace FancyMouse.Common.Models.Styles; /// /// Represents the margin style for a drawing object. @@ -42,10 +40,8 @@ public decimal Bottom get; } - [JsonIgnore] public decimal Horizontal => this.Left + this.Right; - [JsonIgnore] public decimal Vertical => this.Top + this.Bottom; public override string ToString() diff --git a/src/FancyMouse/Models/Styles/PreviewStyle.cs b/src/FancyMouse/Common/Models/Styles/PreviewStyle.cs similarity index 60% rename from src/FancyMouse/Models/Styles/PreviewStyle.cs rename to src/FancyMouse/Common/Models/Styles/PreviewStyle.cs index 7f101dd..a0fe1c4 100644 --- a/src/FancyMouse/Models/Styles/PreviewStyle.cs +++ b/src/FancyMouse/Common/Models/Styles/PreviewStyle.cs @@ -1,17 +1,17 @@ -using FancyMouse.Models.Drawing; +using FancyMouse.Common.Models.Drawing; -namespace FancyMouse.Models.Styles; +namespace FancyMouse.Common.Models.Styles; -public class PreviewStyle +public sealed class PreviewStyle { public PreviewStyle( SizeInfo canvasSize, BoxStyle canvasStyle, - BoxStyle screenshotStyle) + BoxStyle screenStyle) { this.CanvasSize = canvasSize ?? throw new ArgumentNullException(nameof(canvasSize)); this.CanvasStyle = canvasStyle ?? throw new ArgumentNullException(nameof(canvasStyle)); - this.ScreenshotStyle = screenshotStyle ?? throw new ArgumentNullException(nameof(screenshotStyle)); + this.ScreenStyle = screenStyle ?? throw new ArgumentNullException(nameof(screenStyle)); } public SizeInfo CanvasSize @@ -24,7 +24,7 @@ public BoxStyle CanvasStyle get; } - public BoxStyle ScreenshotStyle + public BoxStyle ScreenStyle { get; } diff --git a/src/FancyMouse/NativeMethods/Core/ATOM.cs b/src/FancyMouse/Common/NativeMethods/Core/ATOM.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/ATOM.cs rename to src/FancyMouse/Common/NativeMethods/Core/ATOM.cs index 1279e4b..b5c41e4 100644 --- a/src/FancyMouse/NativeMethods/Core/ATOM.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/ATOM.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/BOOL.cs b/src/FancyMouse/Common/NativeMethods/Core/BOOL.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/BOOL.cs rename to src/FancyMouse/Common/NativeMethods/Core/BOOL.cs index f066c17..3000532 100644 --- a/src/FancyMouse/NativeMethods/Core/BOOL.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/BOOL.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/BYTE.cs b/src/FancyMouse/Common/NativeMethods/Core/BYTE.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/BYTE.cs rename to src/FancyMouse/Common/NativeMethods/Core/BYTE.cs index 3e93cde..fe6d721 100644 --- a/src/FancyMouse/NativeMethods/Core/BYTE.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/BYTE.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/CRECT.cs b/src/FancyMouse/Common/NativeMethods/Core/CRECT.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/CRECT.cs rename to src/FancyMouse/Common/NativeMethods/Core/CRECT.cs index 1d0f418..49cf505 100644 --- a/src/FancyMouse/NativeMethods/Core/CRECT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/CRECT.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/DWORD.cs b/src/FancyMouse/Common/NativeMethods/Core/DWORD.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/DWORD.cs rename to src/FancyMouse/Common/NativeMethods/Core/DWORD.cs index d351392..665356f 100644 --- a/src/FancyMouse/NativeMethods/Core/DWORD.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/DWORD.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/GUID.cs b/src/FancyMouse/Common/NativeMethods/Core/GUID.cs similarity index 84% rename from src/FancyMouse/NativeMethods/Core/GUID.cs rename to src/FancyMouse/Common/NativeMethods/Core/GUID.cs index 71e8747..6b2441c 100644 --- a/src/FancyMouse/NativeMethods/Core/GUID.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/GUID.cs @@ -1,10 +1,4 @@ -// Copyright (c) Microsoft Corporation -// 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.Diagnostics.CodeAnalysis; - -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HANDLE.cs b/src/FancyMouse/Common/NativeMethods/Core/HANDLE.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HANDLE.cs rename to src/FancyMouse/Common/NativeMethods/Core/HANDLE.cs index 3eedc64..bc57e80 100644 --- a/src/FancyMouse/NativeMethods/Core/HANDLE.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HANDLE.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HBITMAP.cs b/src/FancyMouse/Common/NativeMethods/Core/HBITMAP.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HBITMAP.cs rename to src/FancyMouse/Common/NativeMethods/Core/HBITMAP.cs index 2de491a..af3650b 100644 --- a/src/FancyMouse/NativeMethods/Core/HBITMAP.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HBITMAP.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HBRUSH.cs b/src/FancyMouse/Common/NativeMethods/Core/HBRUSH.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HBRUSH.cs rename to src/FancyMouse/Common/NativeMethods/Core/HBRUSH.cs index f37b832..adf9a20 100644 --- a/src/FancyMouse/NativeMethods/Core/HBRUSH.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HBRUSH.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HCURSOR.cs b/src/FancyMouse/Common/NativeMethods/Core/HCURSOR.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/HCURSOR.cs rename to src/FancyMouse/Common/NativeMethods/Core/HCURSOR.cs index dd25260..0af3c88 100644 --- a/src/FancyMouse/NativeMethods/Core/HCURSOR.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HCURSOR.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HDC.cs b/src/FancyMouse/Common/NativeMethods/Core/HDC.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HDC.cs rename to src/FancyMouse/Common/NativeMethods/Core/HDC.cs index 7dc778a..33de336 100644 --- a/src/FancyMouse/NativeMethods/Core/HDC.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HDC.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HDESK.cs b/src/FancyMouse/Common/NativeMethods/Core/HDESK.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HDESK.cs rename to src/FancyMouse/Common/NativeMethods/Core/HDESK.cs index 9341ef5..0831ac1 100644 --- a/src/FancyMouse/NativeMethods/Core/HDESK.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HDESK.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HGDIOBJ.cs b/src/FancyMouse/Common/NativeMethods/Core/HGDIOBJ.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HGDIOBJ.cs rename to src/FancyMouse/Common/NativeMethods/Core/HGDIOBJ.cs index 9892e6a..0da2f0f 100644 --- a/src/FancyMouse/NativeMethods/Core/HGDIOBJ.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HGDIOBJ.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HICON.cs b/src/FancyMouse/Common/NativeMethods/Core/HICON.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/HICON.cs rename to src/FancyMouse/Common/NativeMethods/Core/HICON.cs index b8a4228..d681e96 100644 --- a/src/FancyMouse/NativeMethods/Core/HICON.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HICON.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HINSTANCE.cs b/src/FancyMouse/Common/NativeMethods/Core/HINSTANCE.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HINSTANCE.cs rename to src/FancyMouse/Common/NativeMethods/Core/HINSTANCE.cs index 8c762c9..77cb6f6 100644 --- a/src/FancyMouse/NativeMethods/Core/HINSTANCE.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HINSTANCE.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HMENU.cs b/src/FancyMouse/Common/NativeMethods/Core/HMENU.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/HMENU.cs rename to src/FancyMouse/Common/NativeMethods/Core/HMENU.cs index 92512ea..d1aa9b8 100644 --- a/src/FancyMouse/NativeMethods/Core/HMENU.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HMENU.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HMODULE.cs b/src/FancyMouse/Common/NativeMethods/Core/HMODULE.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HMODULE.cs rename to src/FancyMouse/Common/NativeMethods/Core/HMODULE.cs index 6d5bfaa..d6a8a53 100644 --- a/src/FancyMouse/NativeMethods/Core/HMODULE.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HMODULE.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HMONITOR.cs b/src/FancyMouse/Common/NativeMethods/Core/HMONITOR.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/HMONITOR.cs rename to src/FancyMouse/Common/NativeMethods/Core/HMONITOR.cs index b22093b..a4351aa 100644 --- a/src/FancyMouse/NativeMethods/Core/HMONITOR.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HMONITOR.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HWINSTA.cs b/src/FancyMouse/Common/NativeMethods/Core/HWINSTA.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HWINSTA.cs rename to src/FancyMouse/Common/NativeMethods/Core/HWINSTA.cs index 8407fb6..ead9822 100644 --- a/src/FancyMouse/NativeMethods/Core/HWINSTA.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HWINSTA.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/HWND.cs b/src/FancyMouse/Common/NativeMethods/Core/HWND.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/HWND.cs rename to src/FancyMouse/Common/NativeMethods/Core/HWND.cs index 392d81e..093f91c 100644 --- a/src/FancyMouse/NativeMethods/Core/HWND.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/HWND.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LONG.cs b/src/FancyMouse/Common/NativeMethods/Core/LONG.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/LONG.cs rename to src/FancyMouse/Common/NativeMethods/Core/LONG.cs index 8021844..86825a1 100644 --- a/src/FancyMouse/NativeMethods/Core/LONG.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LONG.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPARAM.cs b/src/FancyMouse/Common/NativeMethods/Core/LPARAM.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/LPARAM.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPARAM.cs index b629134..5971f78 100644 --- a/src/FancyMouse/NativeMethods/Core/LPARAM.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPARAM.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPCRECT.cs b/src/FancyMouse/Common/NativeMethods/Core/LPCRECT.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/LPCRECT.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPCRECT.cs index a43e77e..fc50ef4 100644 --- a/src/FancyMouse/NativeMethods/Core/LPCRECT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPCRECT.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPCWSTR.cs b/src/FancyMouse/Common/NativeMethods/Core/LPCWSTR.cs similarity index 97% rename from src/FancyMouse/NativeMethods/Core/LPCWSTR.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPCWSTR.cs index c8814fa..352c77b 100644 --- a/src/FancyMouse/NativeMethods/Core/LPCWSTR.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPCWSTR.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPDWORD.cs b/src/FancyMouse/Common/NativeMethods/Core/LPDWORD.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/LPDWORD.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPDWORD.cs index 278c4c9..72620b0 100644 --- a/src/FancyMouse/NativeMethods/Core/LPDWORD.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPDWORD.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPPOINT.cs b/src/FancyMouse/Common/NativeMethods/Core/LPPOINT.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/LPPOINT.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPPOINT.cs index 5e829ae..530635b 100644 --- a/src/FancyMouse/NativeMethods/Core/LPPOINT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPPOINT.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPRECT.cs b/src/FancyMouse/Common/NativeMethods/Core/LPRECT.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/LPRECT.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPRECT.cs index ac59c66..5d50fc5 100644 --- a/src/FancyMouse/NativeMethods/Core/LPRECT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPRECT.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPTSTR.cs b/src/FancyMouse/Common/NativeMethods/Core/LPTSTR.cs similarity index 97% rename from src/FancyMouse/NativeMethods/Core/LPTSTR.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPTSTR.cs index 3d947a3..b22916e 100644 --- a/src/FancyMouse/NativeMethods/Core/LPTSTR.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPTSTR.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LPVOID.cs b/src/FancyMouse/Common/NativeMethods/Core/LPVOID.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/LPVOID.cs rename to src/FancyMouse/Common/NativeMethods/Core/LPVOID.cs index b3f9b04..1b8eadb 100644 --- a/src/FancyMouse/NativeMethods/Core/LPVOID.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LPVOID.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/LRESULT.cs b/src/FancyMouse/Common/NativeMethods/Core/LRESULT.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/LRESULT.cs rename to src/FancyMouse/Common/NativeMethods/Core/LRESULT.cs index 60a1a4b..bb21310 100644 --- a/src/FancyMouse/NativeMethods/Core/LRESULT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/LRESULT.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/PCWSTR.cs b/src/FancyMouse/Common/NativeMethods/Core/PCWSTR.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/PCWSTR.cs rename to src/FancyMouse/Common/NativeMethods/Core/PCWSTR.cs index cdb4665..fa50b5e 100644 --- a/src/FancyMouse/NativeMethods/Core/PCWSTR.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/PCWSTR.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/POINT.cs b/src/FancyMouse/Common/NativeMethods/Core/POINT.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/POINT.cs rename to src/FancyMouse/Common/NativeMethods/Core/POINT.cs index e19bc5f..7bf71c7 100644 --- a/src/FancyMouse/NativeMethods/Core/POINT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/POINT.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/PVOID.cs b/src/FancyMouse/Common/NativeMethods/Core/PVOID.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/PVOID.cs rename to src/FancyMouse/Common/NativeMethods/Core/PVOID.cs index 3595201..efebc96 100644 --- a/src/FancyMouse/NativeMethods/Core/PVOID.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/PVOID.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/RECT.cs b/src/FancyMouse/Common/NativeMethods/Core/RECT.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Core/RECT.cs rename to src/FancyMouse/Common/NativeMethods/Core/RECT.cs index 76431ee..543c2f9 100644 --- a/src/FancyMouse/NativeMethods/Core/RECT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/RECT.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/UINT.cs b/src/FancyMouse/Common/NativeMethods/Core/UINT.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/UINT.cs rename to src/FancyMouse/Common/NativeMethods/Core/UINT.cs index 3d6c206..743d5c7 100644 --- a/src/FancyMouse/NativeMethods/Core/UINT.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/UINT.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/ULONG.cs b/src/FancyMouse/Common/NativeMethods/Core/ULONG.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/ULONG.cs rename to src/FancyMouse/Common/NativeMethods/Core/ULONG.cs index 0a83f36..9a016e8 100644 --- a/src/FancyMouse/NativeMethods/Core/ULONG.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/ULONG.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/ULONG_PTR.cs b/src/FancyMouse/Common/NativeMethods/Core/ULONG_PTR.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Core/ULONG_PTR.cs rename to src/FancyMouse/Common/NativeMethods/Core/ULONG_PTR.cs index 157526a..fee9197 100644 --- a/src/FancyMouse/NativeMethods/Core/ULONG_PTR.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/ULONG_PTR.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/WCHAR.cs b/src/FancyMouse/Common/NativeMethods/Core/WCHAR.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/WCHAR.cs rename to src/FancyMouse/Common/NativeMethods/Core/WCHAR.cs index cfd4013..42da862 100644 --- a/src/FancyMouse/NativeMethods/Core/WCHAR.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/WCHAR.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/WORD.cs b/src/FancyMouse/Common/NativeMethods/Core/WORD.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/WORD.cs rename to src/FancyMouse/Common/NativeMethods/Core/WORD.cs index 598709c..2be23fc 100644 --- a/src/FancyMouse/NativeMethods/Core/WORD.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/WORD.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Core/WPARAM.cs b/src/FancyMouse/Common/NativeMethods/Core/WPARAM.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Core/WPARAM.cs rename to src/FancyMouse/Common/NativeMethods/Core/WPARAM.cs index 0b23c13..007e619 100644 --- a/src/FancyMouse/NativeMethods/Core/WPARAM.cs +++ b/src/FancyMouse/Common/NativeMethods/Core/WPARAM.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Core { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Gdi32.COLOR16.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLOR16.cs similarity index 92% rename from src/FancyMouse/NativeMethods/Gdi32/Gdi32.COLOR16.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLOR16.cs index 7de803e..956160c 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Gdi32.COLOR16.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLOR16.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Gdi32.COLORREF.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLORREF.cs similarity index 82% rename from src/FancyMouse/NativeMethods/Gdi32/Gdi32.COLORREF.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLORREF.cs index 162bfe3..c05f8b8 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Gdi32.COLORREF.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Gdi32.COLORREF.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs similarity index 88% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs index 04110fe..8f60665 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleBitmap.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs similarity index 87% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs index 2003b14..8e6adf5 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateCompatibleDC.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs similarity index 67% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs index fae792f..fef26c5 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.CreateSolidBrush.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs index 700465c..4ed97c4 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GRADIENT_FILL.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs similarity index 88% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs index 2316ca4..c58090b 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.GradientFill.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs index 3025c93..5b69923 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.ROP_CODE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs index 3fe4b09..73eb01e 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.STRETCH_BLT_MODE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs similarity index 92% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs index 102b35d..73c2364 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SelectObject.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs similarity index 88% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs index 5525aa5..d6656c3 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.SetStretchBltMode.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs similarity index 91% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs index baf6932..8a3f444 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.StretchBlt.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs similarity index 90% rename from src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs rename to src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs index 33834d2..9dabe16 100644 --- a/src/FancyMouse/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs +++ b/src/FancyMouse/Common/NativeMethods/Gdi32/Graphics/Gdi/Gdi32.TRIVERTEX.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Gdi32 { diff --git a/src/FancyMouse/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs b/src/FancyMouse/Common/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs similarity index 87% rename from src/FancyMouse/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs rename to src/FancyMouse/Common/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs index c338bbf..90da2a7 100644 --- a/src/FancyMouse/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs +++ b/src/FancyMouse/Common/NativeMethods/Kernel32/ProcessesAndThreads/Kernel32.GetCurrentThreadId.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Kernel32 { diff --git a/src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs b/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs rename to src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs index 5835e33..b139c32 100644 --- a/src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs +++ b/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.LPSECURITY_ATTRIBUTES.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Kernel32 { diff --git a/src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs b/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs similarity index 95% rename from src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs rename to src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs index bfab2c2..40f929c 100644 --- a/src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs +++ b/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.QUEUE_FLAGS_STATUS.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Kernel32 { diff --git a/src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs b/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs similarity index 91% rename from src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs rename to src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs index 6ccdcdc..c15e0e9 100644 --- a/src/FancyMouse/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs +++ b/src/FancyMouse/Common/NativeMethods/Kernel32/Security/Kernel32.SECURITY_ATTRIBUTES.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Kernel32 { diff --git a/src/FancyMouse/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs b/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs similarity index 92% rename from src/FancyMouse/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs rename to src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs index a21c63e..082f039 100644 --- a/src/FancyMouse/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs +++ b/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.CreateEventW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Kernel32 { diff --git a/src/FancyMouse/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs b/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs similarity index 91% rename from src/FancyMouse/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs rename to src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs index 9b0d4a6..3417c50 100644 --- a/src/FancyMouse/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs +++ b/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.GetModuleHandleW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Kernel32 { diff --git a/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs b/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs new file mode 100644 index 0000000..9f93893 --- /dev/null +++ b/src/FancyMouse/Common/NativeMethods/Kernel32/SystemServices/Kernel32.SetEvent.cs @@ -0,0 +1,22 @@ +using System.Runtime.InteropServices; +using static FancyMouse.Common.NativeMethods.Core; + +namespace FancyMouse.Common.NativeMethods; + +internal static partial class Kernel32 +{ + /// + /// Sets the specified event object to the signaled state. + /// + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. + /// To get extended error information, call GetLastError. + /// + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdisplaymonitors + /// + [LibraryImport(Libraries.Kernel32, SetLastError = true)] + internal static partial BOOL SetEvent( + HANDLE hEvent); +} diff --git a/src/FancyMouse/NativeMethods/Libraries.cs b/src/FancyMouse/Common/NativeMethods/Libraries.cs similarity index 82% rename from src/FancyMouse/NativeMethods/Libraries.cs rename to src/FancyMouse/Common/NativeMethods/Libraries.cs index 6104451..73c68dd 100644 --- a/src/FancyMouse/NativeMethods/Libraries.cs +++ b/src/FancyMouse/Common/NativeMethods/Libraries.cs @@ -1,4 +1,4 @@ -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static class Libraries { diff --git a/src/FancyMouse/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs similarity index 97% rename from src/FancyMouse/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs rename to src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs index b36af8d..eff9165 100644 --- a/src/FancyMouse/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs +++ b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFYICONDATAW.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Shell32 { diff --git a/src/FancyMouse/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs similarity index 94% rename from src/FancyMouse/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs rename to src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs index 241c8af..80b9e90 100644 --- a/src/FancyMouse/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs +++ b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.NOTIFY_ICON_MESSAGE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Shell32 { diff --git a/src/FancyMouse/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs similarity index 96% rename from src/FancyMouse/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs rename to src/FancyMouse/Common/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs index 8c708d3..3af40e4 100644 --- a/src/FancyMouse/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs +++ b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.PNOTIFYICONDATAW.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Shell32 { diff --git a/src/FancyMouse/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs similarity index 88% rename from src/FancyMouse/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs rename to src/FancyMouse/Common/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs index d03fb0a..dbd7bac 100644 --- a/src/FancyMouse/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs +++ b/src/FancyMouse/Common/NativeMethods/Shell32/Shell32.Shell_NotifyIconW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class Shell32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs similarity index 92% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs index ee2df14..d2ffe4e 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.EnumDisplayMonitors.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs similarity index 88% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs index 589a379..007f1e4 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.FillRect.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs similarity index 87% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs index 607de38..1bd9a2f 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetMonitorInfoW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs similarity index 92% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs index 70f7737..9327768 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.GetWindowDC.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs similarity index 96% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs index bacbbcc..e79f991 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.LPMONITORINFO.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs similarity index 84% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs index 4775ebb..59b4db8 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORENUMPROC .cs @@ -1,6 +1,6 @@ -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs similarity index 92% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs index e9663ef..5aed764 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITORINFO.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs similarity index 95% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs index 20a1d82..cff4139 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_FROM_FLAGS.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; [SuppressMessage("SA1310", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Names match Win32 api")] internal static partial class User32 diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs similarity index 93% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs index 170dfdd..d143065 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MONITOR_INFO_FLAGS.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; [SuppressMessage("SA1310", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Names match Win32 api")] internal static partial class User32 diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs similarity index 89% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs index 59a25db..efda52d 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.MonitorFromPoint .cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs similarity index 89% rename from src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs rename to src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs index 641cd88..43821d9 100644 --- a/src/FancyMouse/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/Graphics/Gdi/User32.ReleaseDC.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs similarity index 91% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs index ee77906..bb10445 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HARDWAREINPUT.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs similarity index 96% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs index 52f07a7..465a5a8 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.HOT_KEY_MODIFIERS.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs similarity index 96% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs index 7f980cc..509f5e3 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs similarity index 94% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs index ca44b9d..691376a 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.INPUT_TYPE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; [SuppressMessage("SA1310", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Names match Win32 api")] internal static partial class User32 diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs similarity index 92% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs index 0a3f278..34b6ecb 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.KEYBDINPUT.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs similarity index 97% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs index 69e9938..63cc976 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.LPINPUT.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs similarity index 92% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs index 7a7369d..b1c4a04 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSEINPUT.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs similarity index 96% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs index 36ec74a..7f216f9 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.MOUSE_EVENT_FLAGS.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs similarity index 94% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs index 5611dfe..5305620 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.RegisterHotKey.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs similarity index 89% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs index 5de6959..175afd3 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.SendInput.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs similarity index 91% rename from src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs index 3028dff..e11bbf5 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/Input/KeyboardAndMouse/User32.UnregisterHotKey.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs similarity index 98% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs index 125dd83..b532b99 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.CreateWindowExW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs similarity index 93% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs index 7b8bb70..6084c64 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DefWindowProcW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs similarity index 91% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs index 3e97e43..f2942f5 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DestroyWindow.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs similarity index 90% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs index 4f99330..133fe66 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.DispatchMessageW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs similarity index 91% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs index af55fc5..ee07fce 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetClassInfoExW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs similarity index 86% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs index 4b00f46..f22c5a7 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetCursorPos.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs similarity index 86% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs index 9da883b..4bd47a0 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetDesktopWindow.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs similarity index 94% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs index e190869..9e91d53 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetMessageW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs similarity index 94% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs index b58f1fd..cc6a421 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.GetSystemMetrics.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs similarity index 96% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs index 15815ea..c3c896d 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPMSG.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs similarity index 96% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs index 8721f2c..3869829 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.LPWNDCLASSEXW.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs similarity index 99% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs index 735cef3..35ac313 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MESSAGE_TYPE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs similarity index 94% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs index 9a0fc21..b3b8432 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.MSG.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs similarity index 96% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs index 77381fa..bbac4dd 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PEEK_MESSAGE_REMOVE_TYPE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs similarity index 93% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs index 6b05ec0..9690b8d 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PeekMessageW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs similarity index 94% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs index 1da3d99..9050757 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostMessageW.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs similarity index 94% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs index 0e66a48..86e5f6d 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostQuitMessage.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs similarity index 93% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs index f71a2fc..8b39d3c 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.PostThreadMessageW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs similarity index 92% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs index bd8989f..9846fe1 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.RegisterClassExW.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs similarity index 98% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs index b14e143..0dae6b5 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SHOW_WINDOW_CMD.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs similarity index 98% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs index f94d430..65fc521 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs similarity index 92% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs index 09e9bf2..2f6586e 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SendMessageW.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { @@ -11,7 +11,7 @@ internal static partial class User32 /// procedure for the specified window and does not return until the window procedure has /// processed the message. /// - /// To send a message and return immediately, use the SendMessageCallback or SendNotifyMessag + /// To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage /// function. To post a message to a thread's message queue and return immediately, use the /// PostMessage or PostThreadMessage function. /// diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs similarity index 89% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs index 36fc018..b48c1de 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.SetCursorPos.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs similarity index 88% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs index 1379a2c..53b3873 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.ShowWindow.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs similarity index 91% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs index 0e2630f..c8b6377 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.TranslateMessage.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs similarity index 97% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs index 276bbb3..23d2940 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_EX_STYLE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs similarity index 99% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs index f1435eb..8c88e1d 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WINDOW_STYLE.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs similarity index 95% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs index ceb2d8a..782d181 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASSEXW.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs similarity index 99% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs index 5b87940..e8ce8e2 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDCLASS_STYLES.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs similarity index 91% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs index bd1ed6e..f491075 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WNDPROC.cs @@ -1,6 +1,6 @@ -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs similarity index 89% rename from src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs rename to src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs index 28c20c7..e4627dc 100644 --- a/src/FancyMouse/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/UI/WindowsAndMessaging/User32.WaitMessage.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; -using static FancyMouse.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.Core; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; internal static partial class User32 { diff --git a/src/FancyMouse/NativeMethods/User32/User32.cs b/src/FancyMouse/Common/NativeMethods/User32/User32.cs similarity index 85% rename from src/FancyMouse/NativeMethods/User32/User32.cs rename to src/FancyMouse/Common/NativeMethods/User32/User32.cs index 07e59db..67d8fc3 100644 --- a/src/FancyMouse/NativeMethods/User32/User32.cs +++ b/src/FancyMouse/Common/NativeMethods/User32/User32.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace FancyMouse.NativeMethods; +namespace FancyMouse.Common.NativeMethods; [SuppressMessage("SA1310", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Names match Win32 api")] internal static partial class User32 diff --git a/src/FancyMouse/Helpers/Screenshot/IScreenshotProvider.cs b/src/FancyMouse/Helpers/Screenshot/IScreenshotProvider.cs deleted file mode 100644 index b871bba..0000000 --- a/src/FancyMouse/Helpers/Screenshot/IScreenshotProvider.cs +++ /dev/null @@ -1,11 +0,0 @@ -using FancyMouse.Models.Drawing; - -namespace FancyMouse.Helpers.Screenshot; - -internal interface IScreenshotProvider -{ - void DrawScreenshot( - Graphics targetGraphics, - RectangleInfo sourceBounds, - RectangleInfo targetBounds); -} diff --git a/src/FancyMouse/HotKeys/HotKeyHelper.cs b/src/FancyMouse/HotKeys/HotKeyHelper.cs index 6c0e6bc..9635380 100644 --- a/src/FancyMouse/HotKeys/HotKeyHelper.cs +++ b/src/FancyMouse/HotKeys/HotKeyHelper.cs @@ -2,9 +2,9 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -using FancyMouse.NativeMethods; -using static FancyMouse.NativeMethods.Core; -using static FancyMouse.NativeMethods.User32; +using FancyMouse.Common.NativeMethods; +using static FancyMouse.Common.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.User32; namespace FancyMouse.HotKeys; diff --git a/src/FancyMouse/Hotkeys/HotKeyManager.cs b/src/FancyMouse/Hotkeys/HotKeyManager.cs index 2fb663e..4ca5d75 100644 --- a/src/FancyMouse/Hotkeys/HotKeyManager.cs +++ b/src/FancyMouse/Hotkeys/HotKeyManager.cs @@ -1,6 +1,6 @@ -using FancyMouse.NativeMethods; -using static FancyMouse.NativeMethods.Core; -using static FancyMouse.NativeMethods.User32; +using FancyMouse.Common.NativeMethods; +using static FancyMouse.Common.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.User32; namespace FancyMouse.HotKeys; diff --git a/src/FancyMouse/Hotkeys/KeyModifiers.cs b/src/FancyMouse/Hotkeys/KeyModifiers.cs index ee34b6c..add0949 100644 --- a/src/FancyMouse/Hotkeys/KeyModifiers.cs +++ b/src/FancyMouse/Hotkeys/KeyModifiers.cs @@ -1,4 +1,4 @@ -using FancyMouse.NativeMethods; +using FancyMouse.Common.NativeMethods; namespace FancyMouse.HotKeys; diff --git a/src/FancyMouse/Hotkeys/MessageLoop.cs b/src/FancyMouse/Hotkeys/MessageLoop.cs index 1dd07d0..311de76 100644 --- a/src/FancyMouse/Hotkeys/MessageLoop.cs +++ b/src/FancyMouse/Hotkeys/MessageLoop.cs @@ -1,8 +1,8 @@ using System.ComponentModel; using System.Runtime.InteropServices; -using FancyMouse.NativeMethods; -using static FancyMouse.NativeMethods.Core; -using static FancyMouse.NativeMethods.User32; +using FancyMouse.Common.NativeMethods; +using static FancyMouse.Common.NativeMethods.Core; +using static FancyMouse.Common.NativeMethods.User32; namespace FancyMouse.HotKeys; diff --git a/src/FancyMouse/Models/Settings/AppSettings.cs b/src/FancyMouse/Models/Settings/AppSettings.cs index cdeae1c..53d663a 100644 --- a/src/FancyMouse/Models/Settings/AppSettings.cs +++ b/src/FancyMouse/Models/Settings/AppSettings.cs @@ -1,5 +1,5 @@ -using FancyMouse.HotKeys; -using FancyMouse.Models.Styles; +using FancyMouse.Common.Models.Styles; +using FancyMouse.HotKeys; using Keys = FancyMouse.HotKeys.Keys; namespace FancyMouse.Models.Settings; @@ -36,7 +36,7 @@ internal sealed class AppSettings color2: Color.FromArgb(0xFF, 0x03, 0x44, 0xC0) ) ), - screenshotStyle: new( + screenStyle: new( marginStyle: new( all: 4 ), diff --git a/src/FancyMouse/Models/Settings/V1/SettingsConverter.cs b/src/FancyMouse/Models/Settings/V1/SettingsConverter.cs index f6a515d..4d85c4d 100644 --- a/src/FancyMouse/Models/Settings/V1/SettingsConverter.cs +++ b/src/FancyMouse/Models/Settings/V1/SettingsConverter.cs @@ -1,14 +1,14 @@ using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; +using FancyMouse.Common.Models.Styles; using FancyMouse.HotKeys; -using FancyMouse.Models.Styles; namespace FancyMouse.Models.Settings.V1; internal static class SettingsConverter { - public static AppSettings ParseAppSettings(string json) + public static Settings.AppSettings ParseAppSettings(string json) { var options = new JsonSerializerOptions { @@ -19,14 +19,14 @@ public static AppSettings ParseAppSettings(string json) ?? throw new InvalidOperationException(); var hotkey = SettingsConverter.ConvertToKeystroke(appConfig?.FancyMouse?.Hotkey); var previewStyle = SettingsConverter.ConvertToPreviewStyle(appConfig?.FancyMouse?.PreviewSize); - var appSettings = new AppSettings(hotkey, previewStyle); + var appSettings = new Settings.AppSettings(hotkey, previewStyle); return appSettings; } public static Keystroke ConvertToKeystroke(string? hotkey) { return (hotkey == null) - ? AppSettings.DefaultSettings.Hotkey + ? Settings.AppSettings.DefaultSettings.Hotkey : Keystroke.Parse(hotkey); } @@ -34,7 +34,7 @@ public static PreviewStyle ConvertToPreviewStyle(string? previewSize) { if (previewSize is null) { - return AppSettings.DefaultSettings.PreviewStyle; + return Settings.AppSettings.DefaultSettings.PreviewStyle; } var parts = previewSize.Split("x") @@ -46,7 +46,7 @@ public static PreviewStyle ConvertToPreviewStyle(string? previewSize) width: parts[0], height: parts[1] ), - canvasStyle: AppSettings.DefaultSettings.PreviewStyle.CanvasStyle, - screenshotStyle: AppSettings.DefaultSettings.PreviewStyle.ScreenshotStyle); + canvasStyle: Settings.AppSettings.DefaultSettings.PreviewStyle.CanvasStyle, + screenStyle: Settings.AppSettings.DefaultSettings.PreviewStyle.ScreenStyle); } } diff --git a/src/FancyMouse/Models/Settings/V1/_FancyMouse.json b/src/FancyMouse/Models/Settings/V1/_FancyMouse.json new file mode 100644 index 0000000..eacf1e1 --- /dev/null +++ b/src/FancyMouse/Models/Settings/V1/_FancyMouse.json @@ -0,0 +1,6 @@ +{ + "FancyMouse": { + "Hotkey": "CTRL + ALT + SHIFT + F", + "Preview": "1600 x 1200" + } +} \ No newline at end of file diff --git a/src/FancyMouse/Models/Settings/V2/AppConfig.cs b/src/FancyMouse/Models/Settings/V2/AppConfig.cs index 75bbaaf..73ad9af 100644 --- a/src/FancyMouse/Models/Settings/V2/AppConfig.cs +++ b/src/FancyMouse/Models/Settings/V2/AppConfig.cs @@ -1,4 +1,6 @@ -namespace FancyMouse.Models.Settings.V2; +using System.Text.Json.Serialization; + +namespace FancyMouse.Models.Settings.V2; /// /// Represents the configuration file format to allow for easier @@ -8,19 +10,32 @@ internal sealed class AppConfig { public AppConfig( + int? version, string? hotkey, - PreviewSettings? preview) + PreviewStyleSettings? preview) { + this.Version = version; this.Hotkey = hotkey; this.Preview = preview; } + [JsonPropertyName("version")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Version + { + get; + } + + [JsonPropertyName("hotkey")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? Hotkey { get; } - public PreviewSettings? Preview + [JsonPropertyName("preview")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public PreviewStyleSettings? Preview { get; } diff --git a/src/FancyMouse/Models/Settings/V2/BackgroundStyleSettings.cs b/src/FancyMouse/Models/Settings/V2/BackgroundStyleSettings.cs index 796b6ec..b830bc2 100644 --- a/src/FancyMouse/Models/Settings/V2/BackgroundStyleSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/BackgroundStyleSettings.cs @@ -1,4 +1,6 @@ -namespace FancyMouse.Models.Settings.V2; +using System.Text.Json.Serialization; + +namespace FancyMouse.Models.Settings.V2; /// /// Represents the background fill style for a drawing object. @@ -6,19 +8,23 @@ public sealed class BackgroundStyleSettings { public BackgroundStyleSettings( - string color1, - string color2) + string? color1, + string? color2) { this.Color1 = color1; this.Color2 = color2; } - public string Color1 + [JsonPropertyName("color1")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Color1 { get; } - public string Color2 + [JsonPropertyName("color2")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Color2 { get; } diff --git a/src/FancyMouse/Models/Settings/V2/BorderStyleSettings.cs b/src/FancyMouse/Models/Settings/V2/BorderStyleSettings.cs index 85660f8..42f8bab 100644 --- a/src/FancyMouse/Models/Settings/V2/BorderStyleSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/BorderStyleSettings.cs @@ -1,23 +1,29 @@ -namespace FancyMouse.Models.Settings.V2; +using System.Text.Json.Serialization; + +namespace FancyMouse.Models.Settings.V2; /// /// Represents the border style for a drawing object. /// public sealed class BorderStyleSettings { - public BorderStyleSettings(string color, decimal width, decimal depth) + public BorderStyleSettings(string? color, decimal? width, decimal? depth) { this.Color = color; this.Width = width; this.Depth = depth; } - public string Color + [JsonPropertyName("color")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Color { get; } - public decimal Width + [JsonPropertyName("width")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public decimal? Width { get; } @@ -25,7 +31,9 @@ public decimal Width /// /// Gets the "depth" of the 3d highlight and shadow effect on the border. /// - public decimal Depth + [JsonPropertyName("depth")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public decimal? Depth { get; } diff --git a/src/FancyMouse/Models/Settings/V2/CanvasSizeSettings.cs b/src/FancyMouse/Models/Settings/V2/CanvasSizeSettings.cs index 7c191bf..151bd59 100644 --- a/src/FancyMouse/Models/Settings/V2/CanvasSizeSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/CanvasSizeSettings.cs @@ -1,21 +1,27 @@ -namespace FancyMouse.Models.Settings.V2; +using System.Text.Json.Serialization; + +namespace FancyMouse.Models.Settings.V2; public sealed class CanvasSizeSettings { public CanvasSizeSettings( - int width, - int height) + int? width, + int? height) { this.Width = width; this.Height = height; } - public int Width + [JsonPropertyName("width")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Width { get; } - public int Height + [JsonPropertyName("height")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Height { get; } diff --git a/src/FancyMouse/Models/Settings/V2/CanvasStyleSettings.cs b/src/FancyMouse/Models/Settings/V2/CanvasStyleSettings.cs index cace5b6..544b5bf 100644 --- a/src/FancyMouse/Models/Settings/V2/CanvasStyleSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/CanvasStyleSettings.cs @@ -5,13 +5,13 @@ namespace FancyMouse.Models.Settings.V2; /// /// Doesn't have a MarginStyle setting like the BoxStyle class does - we don't /// support configuring this in app settings. -/// > +/// public sealed class CanvasStyleSettings { public CanvasStyleSettings( - BorderStyleSettings borderStyle, - PaddingStyleSettings paddingStyle, - BackgroundStyleSettings backgroundStyle) + BorderStyleSettings? borderStyle, + PaddingStyleSettings? paddingStyle, + BackgroundStyleSettings? backgroundStyle) { this.BorderStyle = borderStyle ?? throw new ArgumentNullException(nameof(borderStyle)); this.PaddingStyle = paddingStyle ?? throw new ArgumentNullException(nameof(paddingStyle)); @@ -19,19 +19,22 @@ public CanvasStyleSettings( } [JsonPropertyName("border")] - public BorderStyleSettings BorderStyle + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public BorderStyleSettings? BorderStyle { get; } [JsonPropertyName("padding")] - public PaddingStyleSettings PaddingStyle + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public PaddingStyleSettings? PaddingStyle { get; } [JsonPropertyName("background")] - public BackgroundStyleSettings BackgroundStyle + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public BackgroundStyleSettings? BackgroundStyle { get; } diff --git a/src/FancyMouse/Models/Settings/V2/Converters/ColorConverter.cs b/src/FancyMouse/Models/Settings/V2/Converters/ColorConverter.cs new file mode 100644 index 0000000..1757a9f --- /dev/null +++ b/src/FancyMouse/Models/Settings/V2/Converters/ColorConverter.cs @@ -0,0 +1,112 @@ +#nullable enable + +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace FancyMouse.Models.Settings.V2; + +/// +/// Converts a color string from the settings file into a color, and vice versa. +/// +/// +/// "Color.Red" => Color.Red +/// "SystemColors.Highlight" => SystemColors.Highlight +/// "#AABBCC" => Color.FromArgb(0xFF, 0xAA, 0xBB, 0xCC) +/// +internal sealed class ColorConverter : JsonConverter +{ + public override bool CanConvert(Type typeToConvert) + { + return typeToConvert == typeof(string); + } + + public override Color? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var value = reader.GetString(); + return ColorConverter.Deserialize(value); + } + + public override void Write(Utf8JsonWriter writer, Color? value, JsonSerializerOptions options) + { + var str = ColorConverter.Serialize(value); + if (str is null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(str); + } + } + + internal static string? Serialize(Color? value) + { + if (!value.HasValue) + { + return null; + } + + var color = value.Value; + return color switch + { + Color { IsNamedColor: true } => + $"{nameof(Color)}.{color.Name}", + Color { IsSystemColor: true } => + $"{nameof(SystemColors)}.{color.Name}", + _ => + $"#{color.R:X2}{color.G:X2}{color.B:X2}", + }; + } + + internal static Color? Deserialize(string? value) + { + if (string.IsNullOrEmpty(value)) + { + return null; + } + + // e.g. "#AABBCC" + if (value.StartsWith('#')) + { + var culture = CultureInfo.InvariantCulture; + if ((value.Length == 7) + && int.TryParse(value[1..3], NumberStyles.HexNumber, culture, out var r) + && int.TryParse(value[3..5], NumberStyles.HexNumber, culture, out var g) + && int.TryParse(value[5..7], NumberStyles.HexNumber, culture, out var b)) + { + return Color.FromArgb(0xFF, r, g, b); + } + } + + const StringComparison comparison = StringComparison.InvariantCulture; + + // e.g. "Color.Red" + const string colorPrefix = $"{nameof(Color)}."; + if (value.StartsWith(colorPrefix, comparison)) + { + var colorName = value[colorPrefix.Length..]; + var property = typeof(Color).GetProperties() + .SingleOrDefault(property => property.Name == colorName); + if (property is not null) + { + return (Color?)property.GetValue(null, null); + } + } + + // e.g. "SystemColors.Highlight" + const string systemColorPrefix = $"{nameof(SystemColors)}."; + if (value.StartsWith(systemColorPrefix, comparison)) + { + var colorName = value[systemColorPrefix.Length..]; + var property = typeof(SystemColors).GetProperties() + .SingleOrDefault(property => property.Name == colorName); + if (property is not null) + { + return (Color?)property.GetValue(null, null); + } + } + + return null; + } +} diff --git a/src/FancyMouse/Models/Settings/V2/MarginStyleSettings.cs b/src/FancyMouse/Models/Settings/V2/MarginStyleSettings.cs index 2523029..99b6b3c 100644 --- a/src/FancyMouse/Models/Settings/V2/MarginStyleSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/MarginStyleSettings.cs @@ -1,16 +1,20 @@ -namespace FancyMouse.Models.Settings.V2; +using System.Text.Json.Serialization; + +namespace FancyMouse.Models.Settings.V2; /// /// Represents the margin style for a drawing object. /// public sealed class MarginStyleSettings { - public MarginStyleSettings(decimal width) + public MarginStyleSettings(int? width) { this.Width = width; } - public decimal Width + [JsonPropertyName("width")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Width { get; } diff --git a/src/FancyMouse/Models/Settings/V2/PaddingStyleSettings.cs b/src/FancyMouse/Models/Settings/V2/PaddingStyleSettings.cs index 2f5e82b..fbe420d 100644 --- a/src/FancyMouse/Models/Settings/V2/PaddingStyleSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/PaddingStyleSettings.cs @@ -1,16 +1,20 @@ -namespace FancyMouse.Models.Settings.V2; +using System.Text.Json.Serialization; + +namespace FancyMouse.Models.Settings.V2; /// /// Represents the margin style for a drawing object. /// public sealed class PaddingStyleSettings { - public PaddingStyleSettings(decimal width) + public PaddingStyleSettings(int? width) { this.Width = width; } - public decimal Width + [JsonPropertyName("width")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Width { get; } diff --git a/src/FancyMouse/Models/Settings/V2/PreviewSettings.cs b/src/FancyMouse/Models/Settings/V2/PreviewStyleSettings.cs similarity index 57% rename from src/FancyMouse/Models/Settings/V2/PreviewSettings.cs rename to src/FancyMouse/Models/Settings/V2/PreviewStyleSettings.cs index 46cde5d..533f87c 100644 --- a/src/FancyMouse/Models/Settings/V2/PreviewSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/PreviewStyleSettings.cs @@ -2,32 +2,35 @@ namespace FancyMouse.Models.Settings.V2; -public class PreviewSettings +public class PreviewStyleSettings { - public PreviewSettings( + public PreviewStyleSettings( CanvasSizeSettings? canvasSize, CanvasStyleSettings? canvasStyle, - ScreenshotStyleSettings? screenshotStyle) + ScreenStyleSettings? screenStyle) { this.CanvasSize = canvasSize; this.CanvasStyle = canvasStyle; - this.ScreenshotStyle = screenshotStyle; + this.ScreenStyle = screenStyle; } [JsonPropertyName("size")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public CanvasSizeSettings? CanvasSize { get; } [JsonPropertyName("canvas")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public CanvasStyleSettings? CanvasStyle { get; } [JsonPropertyName("screenshot")] - public ScreenshotStyleSettings? ScreenshotStyle + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public ScreenStyleSettings? ScreenStyle { get; } diff --git a/src/FancyMouse/Models/Settings/V2/ScreenshotStyleSettings.cs b/src/FancyMouse/Models/Settings/V2/ScreenStyleSettings.cs similarity index 78% rename from src/FancyMouse/Models/Settings/V2/ScreenshotStyleSettings.cs rename to src/FancyMouse/Models/Settings/V2/ScreenStyleSettings.cs index ff4fe57..2d51087 100644 --- a/src/FancyMouse/Models/Settings/V2/ScreenshotStyleSettings.cs +++ b/src/FancyMouse/Models/Settings/V2/ScreenStyleSettings.cs @@ -6,9 +6,9 @@ namespace FancyMouse.Models.Settings.V2; /// Doesn't have a PaddingStyle setting like the BoxStyle class does - we don't /// support configuring this in app settings. /// > -public sealed class ScreenshotStyleSettings +public sealed class ScreenStyleSettings { - public ScreenshotStyleSettings( + public ScreenStyleSettings( MarginStyleSettings? marginStyle, BorderStyleSettings? borderStyle, BackgroundStyleSettings? backgroundStyle) @@ -19,18 +19,21 @@ public ScreenshotStyleSettings( } [JsonPropertyName("margin")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public MarginStyleSettings? MarginStyle { get; } [JsonPropertyName("border")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public BorderStyleSettings? BorderStyle { get; } [JsonPropertyName("background")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public BackgroundStyleSettings? BackgroundStyle { get; diff --git a/src/FancyMouse/Models/Settings/V2/SettingsConverter.cs b/src/FancyMouse/Models/Settings/V2/SettingsConverter.cs index b1265ac..a12e476 100644 --- a/src/FancyMouse/Models/Settings/V2/SettingsConverter.cs +++ b/src/FancyMouse/Models/Settings/V2/SettingsConverter.cs @@ -1,150 +1,180 @@ -using System.Globalization; -using System.Text.Json; -using System.Text.Json.Serialization; -using FancyMouse.Models.Styles; -using BorderStyle = FancyMouse.Models.Styles.BorderStyle; +using System.Text.Json; +using FancyMouse.Common.Models.Styles; +using BorderStyle = FancyMouse.Common.Models.Styles.BorderStyle; namespace FancyMouse.Models.Settings.V2; internal static class SettingsConverter { - public static AppSettings ParseAppSettings(string json) + public static Settings.AppSettings ParseAppSettings(string json) { var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, - Converters = { new JsonStringEnumConverter() }, }; var appConfig = JsonSerializer.Deserialize(json, options) ?? throw new InvalidOperationException(); var hotkey = V1.SettingsConverter.ConvertToKeystroke(appConfig.Hotkey); - var previewStyle = SettingsConverter.ConvertToPreviewStyle(appConfig.Preview); - var appSettings = new AppSettings(hotkey, previewStyle); + var previewStyle = SettingsConverter.MergePreviewStyles(appConfig.Preview, Settings.AppSettings.DefaultSettings.PreviewStyle); + var appSettings = new Settings.AppSettings(hotkey, previewStyle); return appSettings; } - public static PreviewStyle ConvertToPreviewStyle(PreviewSettings? previewSettings) + public static PreviewStyle MergePreviewStyles(PreviewStyleSettings? previewStyle, PreviewStyle defaultStyle) { - if (previewSettings is null) + if (previewStyle is null) { - return AppSettings.DefaultSettings.PreviewStyle; + return Settings.AppSettings.DefaultSettings.PreviewStyle; } - var defaultStyle = AppSettings.DefaultSettings.PreviewStyle; - var canvasStyle = AppSettings.DefaultSettings.PreviewStyle.CanvasStyle; - var screenshotStyle = AppSettings.DefaultSettings.PreviewStyle.ScreenshotStyle; return new PreviewStyle( canvasSize: new( - width: Math.Clamp( - value: previewSettings?.CanvasSize?.Width ?? defaultStyle.CanvasSize.Width, + width: SettingsConverter.Clamp( + value: previewStyle?.CanvasSize?.Width, + defaultValue: defaultStyle?.CanvasSize?.Width, min: 50, max: 99999), - height: Math.Clamp( - value: previewSettings?.CanvasSize?.Height ?? defaultStyle.CanvasSize.Height, + height: SettingsConverter.Clamp( + value: previewStyle?.CanvasSize?.Height, + defaultValue: defaultStyle?.CanvasSize?.Height, min: 50, max: 99999) ), canvasStyle: new( - marginStyle: MarginStyle.Empty, - borderStyle: SettingsConverter.ConvertToBorderStyle(previewSettings?.CanvasStyle?.BorderStyle, defaultStyle.CanvasStyle.BorderStyle), - paddingStyle: new( - all: Math.Clamp( - value: previewSettings?.CanvasStyle?.PaddingStyle?.Width ?? canvasStyle.PaddingStyle.Top, - min: 0, - max: 99) + marginStyle: new( + all: 0 ), + borderStyle: SettingsConverter.MergeBorderStyles( + borderStyle: previewStyle?.CanvasStyle?.BorderStyle, + defaultStyle: defaultStyle?.CanvasStyle?.BorderStyle), + paddingStyle: SettingsConverter.MergePaddingStyles( + paddingStyle: previewStyle?.CanvasStyle?.PaddingStyle, + defaultStyle: defaultStyle?.CanvasStyle?.PaddingStyle), backgroundStyle: new( - color1: SettingsConverter.ParseColorSettings( - value: previewSettings?.CanvasStyle?.BackgroundStyle?.Color1, - defaultValue: canvasStyle.BackgroundStyle.Color1), - color2: SettingsConverter.ParseColorSettings( - value: previewSettings?.CanvasStyle?.BackgroundStyle?.Color2, - defaultValue: canvasStyle.BackgroundStyle.Color2) + color1: SettingsConverter.MergeColors( + color: previewStyle?.CanvasStyle?.BackgroundStyle?.Color1, + defaultValue: defaultStyle?.CanvasStyle?.BackgroundStyle?.Color1), + color2: SettingsConverter.MergeColors( + color: previewStyle?.CanvasStyle?.BackgroundStyle?.Color2, + defaultValue: defaultStyle?.CanvasStyle?.BackgroundStyle?.Color2) ) ), - screenshotStyle: new( - marginStyle: new( - Math.Clamp( - value: previewSettings?.ScreenshotStyle?.MarginStyle?.Width ?? screenshotStyle.MarginStyle.Top, - min: 0, - max: 99) + screenStyle: new( + marginStyle: SettingsConverter.MergeMarginStyles( + marginStyle: previewStyle?.ScreenStyle?.MarginStyle, + defaultStyle: defaultStyle?.ScreenStyle?.MarginStyle), + borderStyle: SettingsConverter.MergeBorderStyles( + borderStyle: previewStyle?.ScreenStyle?.BorderStyle, + defaultStyle: defaultStyle?.ScreenStyle?.BorderStyle), + paddingStyle: new( + all: 0 ), - borderStyle: SettingsConverter.ConvertToBorderStyle(previewSettings?.ScreenshotStyle?.BorderStyle, defaultStyle.CanvasStyle.BorderStyle), - paddingStyle: PaddingStyle.Empty, backgroundStyle: new( - color1: SettingsConverter.ParseColorSettings( - previewSettings?.ScreenshotStyle?.BackgroundStyle?.Color1, - defaultValue: screenshotStyle.BackgroundStyle.Color1), - color2: SettingsConverter.ParseColorSettings( - value: previewSettings?.ScreenshotStyle?.BackgroundStyle?.Color2, - defaultValue: screenshotStyle.BackgroundStyle.Color2) + color1: SettingsConverter.MergeColors( + color: previewStyle?.ScreenStyle?.BackgroundStyle?.Color1, + defaultValue: defaultStyle?.ScreenStyle?.BackgroundStyle?.Color1), + color2: SettingsConverter.MergeColors( + color: previewStyle?.ScreenStyle?.BackgroundStyle?.Color2, + defaultValue: defaultStyle?.ScreenStyle?.BackgroundStyle?.Color2) ) )); } - private static BorderStyle ConvertToBorderStyle(BorderStyleSettings? settings, BorderStyle defaultStyle) + private static MarginStyle MergeMarginStyles(MarginStyleSettings? marginStyle, MarginStyle? defaultStyle) { return new( - color: settings?.Color is null - ? defaultStyle.Color - : SettingsConverter.ParseColorSettings( - value: settings.Color, - defaultValue: defaultStyle.Color), - all: Math.Clamp( - value: settings?.Width ?? defaultStyle.Top, + left: SettingsConverter.Clamp( + value: marginStyle?.Width, + defaultValue: defaultStyle?.Left, + min: 0, + max: 99), + top: SettingsConverter.Clamp( + value: marginStyle?.Width, + defaultValue: defaultStyle?.Top, min: 0, max: 99), - depth: Math.Clamp( - value: settings?.Depth ?? defaultStyle.Depth, + right: SettingsConverter.Clamp( + value: marginStyle?.Width, + defaultValue: defaultStyle?.Right, + min: 0, + max: 99), + bottom: SettingsConverter.Clamp( + value: marginStyle?.Width, + defaultValue: defaultStyle?.Bottom, min: 0, max: 99) ); } - private static Color ParseColorSettings(string? value, Color defaultValue) + private static BorderStyle MergeBorderStyles(BorderStyleSettings? borderStyle, BorderStyle? defaultStyle) { - if (string.IsNullOrEmpty(value)) - { - return defaultValue; - } - - var comparison = StringComparison.InvariantCulture; - if (value.StartsWith("#", comparison)) - { - var culture = CultureInfo.InvariantCulture; - if ((value.Length == 7) - && int.TryParse(value[1..3], NumberStyles.HexNumber, culture, out var r) - && int.TryParse(value[3..5], NumberStyles.HexNumber, culture, out var g) - && int.TryParse(value[5..7], NumberStyles.HexNumber, culture, out var b)) - { - return Color.FromArgb(0xff, r, g, b); - } - } + return new( + color: SettingsConverter.MergeColors( + color: borderStyle?.Color, + defaultValue: defaultStyle?.Color), + left: SettingsConverter.Clamp( + value: borderStyle?.Width, + defaultValue: defaultStyle?.Left, + min: 0, + max: 99), + top: SettingsConverter.Clamp( + value: borderStyle?.Width, + defaultValue: defaultStyle?.Top, + min: 0, + max: 99), + right: SettingsConverter.Clamp( + value: borderStyle?.Width, + defaultValue: defaultStyle?.Right, + min: 0, + max: 99), + bottom: SettingsConverter.Clamp( + value: borderStyle?.Width, + defaultValue: defaultStyle?.Bottom, + min: 0, + max: 99), + depth: SettingsConverter.Clamp( + value: borderStyle?.Depth, + defaultValue: defaultStyle?.Depth, + min: 0, + max: 99) + ); + } - if (value.StartsWith("Color.", comparison)) - { - var propertyName = value["Color.".Length..]; - var property = typeof(Color).GetProperties() - .SingleOrDefault(property => property.Name == propertyName); - if (property is not null) - { - var propertyValue = property.GetValue(null, null); - return (propertyValue is null) ? defaultValue : (Color)propertyValue; - } - } + private static PaddingStyle MergePaddingStyles(PaddingStyleSettings? paddingStyle, PaddingStyle? defaultStyle) + { + return new( + left: SettingsConverter.Clamp( + value: paddingStyle?.Width, + defaultValue: defaultStyle?.Left, + min: 0, + max: 99), + top: SettingsConverter.Clamp( + value: paddingStyle?.Width, + defaultValue: defaultStyle?.Top, + min: 0, + max: 99), + right: SettingsConverter.Clamp( + value: paddingStyle?.Width, + defaultValue: defaultStyle?.Right, + min: 0, + max: 99), + bottom: SettingsConverter.Clamp( + value: paddingStyle?.Width, + defaultValue: defaultStyle?.Bottom, + min: 0, + max: 99) + ); + } - if (value.StartsWith("SystemColors.", comparison)) - { - var propertyName = value["SystemColors.".Length..]; - var property = typeof(SystemColors).GetProperties() - .SingleOrDefault(property => property.Name == propertyName); - if (property is not null) - { - var propertyValue = property.GetValue(null, null); - return (propertyValue is null) ? defaultValue : (Color)propertyValue; - } - } + private static Color MergeColors(string? color, Color? defaultValue) + { + return ColorConverter.Deserialize(color) ?? defaultValue ?? throw new InvalidOperationException(); + } - return defaultValue; + private static decimal Clamp(decimal? value, decimal? defaultValue, decimal min, decimal max) + { + return (value.HasValue || defaultValue.HasValue) + ? Math.Clamp(value ?? defaultValue ?? throw new InvalidOperationException(), min, max) + : throw new InvalidOperationException(); } } diff --git a/src/FancyMouse/Models/Settings/V2/_FancyMouse.json b/src/FancyMouse/Models/Settings/V2/_FancyMouse.json new file mode 100644 index 0000000..ca1a679 --- /dev/null +++ b/src/FancyMouse/Models/Settings/V2/_FancyMouse.json @@ -0,0 +1,43 @@ +{ + + "version": 2, + + "hotkey": "CTRL + ALT + SHIFT + F", + + "preview": { + "name": "default", + "size": { + "width": 1600, + "height": 1200 + }, + "canvas": { + "border": { + "color": "SystemColors.Highlight", + "width": 6, + "depth": 0 + }, + "padding": { + "width": 6 + }, + "background": { + "color1": "#0D57D2", + "color2": "#0344C0" + } + }, + "screenshot": { + "margin": { + "width": 2 + }, + "border": { + "color": "#222222", + "width": 10, + "depth": 3 + }, + "background": { + "color1": "Color.MidnightBlue", + "color2": "Color.MidnightBlue" + } + } + } + +} diff --git a/src/FancyMouse/Properties/AssemblyInfo.cs b/src/FancyMouse/Properties/AssemblyInfo.cs index 98444a9..cf12ec4 100644 --- a/src/FancyMouse/Properties/AssemblyInfo.cs +++ b/src/FancyMouse/Properties/AssemblyInfo.cs @@ -1,4 +1,3 @@ using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("FancyMouse.PerfTests")] [assembly: InternalsVisibleTo("FancyMouse.UnitTests")] diff --git a/src/FancyMouse/UI/FancyMouseForm.cs b/src/FancyMouse/UI/FancyMouseForm.cs index e45873b..d96441e 100644 --- a/src/FancyMouse/UI/FancyMouseForm.cs +++ b/src/FancyMouse/UI/FancyMouseForm.cs @@ -1,8 +1,9 @@ using System.Diagnostics; +using FancyMouse.Common.Helpers; +using FancyMouse.Common.Imaging; +using FancyMouse.Common.Models.Drawing; +using FancyMouse.Common.Models.Layout; using FancyMouse.Helpers; -using FancyMouse.Helpers.Screenshot; -using FancyMouse.Models.Drawing; -using FancyMouse.Models.Layout; using NLog; namespace FancyMouse.UI; @@ -180,10 +181,10 @@ public void ShowPreview() this.PositionForm(this.PreviewLayout.FormBounds); - var screenshotProvider = new DesktopScreenshotProvider(); + var imageCopyService = new DesktopImageRegionCopyService(); DrawingHelper.RenderPreview( this.PreviewLayout, - screenshotProvider, + imageCopyService, this.OnPreviewImageCreated, this.OnPreviewImageUpdated);