From db390aebaf934721f2be47a7bf0e3701eb7230af Mon Sep 17 00:00:00 2001 From: dbuechel Date: Thu, 5 Sep 2019 09:00:41 +0200 Subject: [PATCH] SEBWIN-342: Separated monitoring contracts into individual namespaces. --- .../ClientControllerTests.cs | 3 +++ .../DisplayMonitorOperationTests.cs | 2 +- .../KeyboardInterceptorOperationTests.cs | 2 +- .../MouseInterceptorOperationTests.cs | 2 +- .../ProcessMonitorOperationTests.cs | 2 +- .../Operations/WindowMonitorOperationTests.cs | 2 +- SafeExamBrowser.Client/ClientController.cs | 4 +++- SafeExamBrowser.Client/CompositionRoot.cs | 3 ++- .../Operations/DisplayMonitorOperation.cs | 2 +- .../KeyboardInterceptorOperation.cs | 2 +- .../Operations/MouseInterceptorOperation.cs | 2 +- .../Operations/ProcessMonitorOperation.cs | 2 +- .../Operations/WindowMonitorOperation.cs | 2 +- .../Events/DisplayChangedEventHandler.cs | 2 +- .../{ => Display}/IDisplayMonitor.cs | 4 ++-- .../{ => Keyboard}/IKeyboardInterceptor.cs | 2 +- .../{ => Keyboard}/KeyModifier.cs | 2 +- .../{ => Keyboard}/KeyState.cs | 4 ++-- .../{ => Mouse}/IMouseInterceptor.cs | 4 ++-- .../{ => Mouse}/MouseButton.cs | 2 +- .../Mouse/MouseButtonState.cs | 20 ++++++++++++++++ .../Events/ExplorerStartedEventHandler.cs | 2 +- .../{ => Processes}/IProcessMonitor.cs | 4 ++-- ...afeExamBrowser.Monitoring.Contracts.csproj | 23 ++++++++++--------- .../Events/WindowChangedEventHandler.cs | 2 +- .../{ => Windows}/IWindowMonitor.cs | 4 ++-- .../Display/DisplayMonitor.cs | 4 ++-- .../Keyboard/KeyboardInterceptor.cs | 2 +- .../Mouse/MouseInterceptor.cs | 4 ++-- .../Processes/ProcessMonitor.cs | 4 ++-- .../Windows/WindowMonitor.cs | 4 ++-- .../INativeMethods.cs | 3 ++- .../Hooks/KeyboardHook.cs | 2 +- SafeExamBrowser.WindowsApi/Hooks/MouseHook.cs | 10 ++++---- SafeExamBrowser.WindowsApi/NativeMethods.cs | 5 ++-- 35 files changed, 86 insertions(+), 57 deletions(-) rename SafeExamBrowser.Monitoring.Contracts/{ => Display}/Events/DisplayChangedEventHandler.cs (87%) rename SafeExamBrowser.Monitoring.Contracts/{ => Display}/IDisplayMonitor.cs (92%) rename SafeExamBrowser.Monitoring.Contracts/{ => Keyboard}/IKeyboardInterceptor.cs (92%) rename SafeExamBrowser.Monitoring.Contracts/{ => Keyboard}/KeyModifier.cs (90%) rename SafeExamBrowser.Monitoring.Contracts/{ => Keyboard}/KeyState.cs (81%) rename SafeExamBrowser.Monitoring.Contracts/{ => Mouse}/IMouseInterceptor.cs (82%) rename SafeExamBrowser.Monitoring.Contracts/{ => Mouse}/MouseButton.cs (90%) create mode 100644 SafeExamBrowser.Monitoring.Contracts/Mouse/MouseButtonState.cs rename SafeExamBrowser.Monitoring.Contracts/{ => Processes}/Events/ExplorerStartedEventHandler.cs (87%) rename SafeExamBrowser.Monitoring.Contracts/{ => Processes}/IProcessMonitor.cs (91%) rename SafeExamBrowser.Monitoring.Contracts/{ => Windows}/Events/WindowChangedEventHandler.cs (88%) rename SafeExamBrowser.Monitoring.Contracts/{ => Windows}/IWindowMonitor.cs (92%) diff --git a/SafeExamBrowser.Client.UnitTests/ClientControllerTests.cs b/SafeExamBrowser.Client.UnitTests/ClientControllerTests.cs index 914d746b..5bc7d4e9 100644 --- a/SafeExamBrowser.Client.UnitTests/ClientControllerTests.cs +++ b/SafeExamBrowser.Client.UnitTests/ClientControllerTests.cs @@ -22,6 +22,9 @@ using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Display; +using SafeExamBrowser.Monitoring.Contracts.Processes; +using SafeExamBrowser.Monitoring.Contracts.Windows; using SafeExamBrowser.UserInterface.Contracts; using SafeExamBrowser.UserInterface.Contracts.MessageBox; using SafeExamBrowser.UserInterface.Contracts.Shell; diff --git a/SafeExamBrowser.Client.UnitTests/Operations/DisplayMonitorOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/DisplayMonitorOperationTests.cs index cc471a1c..bcbc722b 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/DisplayMonitorOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/DisplayMonitorOperationTests.cs @@ -10,7 +10,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using SafeExamBrowser.Client.Operations; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Display; using SafeExamBrowser.UserInterface.Contracts.Shell; namespace SafeExamBrowser.Client.UnitTests.Operations diff --git a/SafeExamBrowser.Client.UnitTests/Operations/KeyboardInterceptorOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/KeyboardInterceptorOperationTests.cs index b64f17e4..e49cd135 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/KeyboardInterceptorOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/KeyboardInterceptorOperationTests.cs @@ -10,7 +10,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using SafeExamBrowser.Client.Operations; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Keyboard; using SafeExamBrowser.WindowsApi.Contracts; namespace SafeExamBrowser.Client.UnitTests.Operations diff --git a/SafeExamBrowser.Client.UnitTests/Operations/MouseInterceptorOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/MouseInterceptorOperationTests.cs index 4d75c32f..73800b1f 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/MouseInterceptorOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/MouseInterceptorOperationTests.cs @@ -10,7 +10,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using SafeExamBrowser.Client.Operations; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Mouse; using SafeExamBrowser.WindowsApi.Contracts; namespace SafeExamBrowser.Client.UnitTests.Operations diff --git a/SafeExamBrowser.Client.UnitTests/Operations/ProcessMonitorOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/ProcessMonitorOperationTests.cs index 306c035c..16d2219b 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/ProcessMonitorOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/ProcessMonitorOperationTests.cs @@ -11,7 +11,7 @@ using Moq; using SafeExamBrowser.Client.Operations; using SafeExamBrowser.Configuration.Contracts.Settings; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Processes; namespace SafeExamBrowser.Client.UnitTests.Operations { diff --git a/SafeExamBrowser.Client.UnitTests/Operations/WindowMonitorOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/WindowMonitorOperationTests.cs index 68921a22..84b89dcf 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/WindowMonitorOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/WindowMonitorOperationTests.cs @@ -11,7 +11,7 @@ using Moq; using SafeExamBrowser.Client.Operations; using SafeExamBrowser.Configuration.Contracts.Settings; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Windows; namespace SafeExamBrowser.Client.UnitTests.Operations { diff --git a/SafeExamBrowser.Client/ClientController.cs b/SafeExamBrowser.Client/ClientController.cs index 11636d23..2a401992 100644 --- a/SafeExamBrowser.Client/ClientController.cs +++ b/SafeExamBrowser.Client/ClientController.cs @@ -21,7 +21,9 @@ using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Display; +using SafeExamBrowser.Monitoring.Contracts.Processes; +using SafeExamBrowser.Monitoring.Contracts.Windows; using SafeExamBrowser.UserInterface.Contracts; using SafeExamBrowser.UserInterface.Contracts.MessageBox; using SafeExamBrowser.UserInterface.Contracts.Shell; diff --git a/SafeExamBrowser.Client/CompositionRoot.cs b/SafeExamBrowser.Client/CompositionRoot.cs index 7445e23b..52c28851 100644 --- a/SafeExamBrowser.Client/CompositionRoot.cs +++ b/SafeExamBrowser.Client/CompositionRoot.cs @@ -32,7 +32,8 @@ using SafeExamBrowser.I18n; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Processes; +using SafeExamBrowser.Monitoring.Contracts.Windows; using SafeExamBrowser.Monitoring.Display; using SafeExamBrowser.Monitoring.Keyboard; using SafeExamBrowser.Monitoring.Mouse; diff --git a/SafeExamBrowser.Client/Operations/DisplayMonitorOperation.cs b/SafeExamBrowser.Client/Operations/DisplayMonitorOperation.cs index 58f7ec2e..1c4b5d75 100644 --- a/SafeExamBrowser.Client/Operations/DisplayMonitorOperation.cs +++ b/SafeExamBrowser.Client/Operations/DisplayMonitorOperation.cs @@ -10,7 +10,7 @@ using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Display; using SafeExamBrowser.UserInterface.Contracts.Shell; namespace SafeExamBrowser.Client.Operations diff --git a/SafeExamBrowser.Client/Operations/KeyboardInterceptorOperation.cs b/SafeExamBrowser.Client/Operations/KeyboardInterceptorOperation.cs index 3697f7d3..c43dddd6 100644 --- a/SafeExamBrowser.Client/Operations/KeyboardInterceptorOperation.cs +++ b/SafeExamBrowser.Client/Operations/KeyboardInterceptorOperation.cs @@ -10,7 +10,7 @@ using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Keyboard; using SafeExamBrowser.WindowsApi.Contracts; namespace SafeExamBrowser.Client.Operations diff --git a/SafeExamBrowser.Client/Operations/MouseInterceptorOperation.cs b/SafeExamBrowser.Client/Operations/MouseInterceptorOperation.cs index 494828d7..1c352fa0 100644 --- a/SafeExamBrowser.Client/Operations/MouseInterceptorOperation.cs +++ b/SafeExamBrowser.Client/Operations/MouseInterceptorOperation.cs @@ -10,7 +10,7 @@ using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Mouse; using SafeExamBrowser.WindowsApi.Contracts; namespace SafeExamBrowser.Client.Operations diff --git a/SafeExamBrowser.Client/Operations/ProcessMonitorOperation.cs b/SafeExamBrowser.Client/Operations/ProcessMonitorOperation.cs index 546cc481..a3cb8008 100644 --- a/SafeExamBrowser.Client/Operations/ProcessMonitorOperation.cs +++ b/SafeExamBrowser.Client/Operations/ProcessMonitorOperation.cs @@ -11,7 +11,7 @@ using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Processes; namespace SafeExamBrowser.Client.Operations { diff --git a/SafeExamBrowser.Client/Operations/WindowMonitorOperation.cs b/SafeExamBrowser.Client/Operations/WindowMonitorOperation.cs index a161ddb0..e8d50948 100644 --- a/SafeExamBrowser.Client/Operations/WindowMonitorOperation.cs +++ b/SafeExamBrowser.Client/Operations/WindowMonitorOperation.cs @@ -11,7 +11,7 @@ using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Windows; namespace SafeExamBrowser.Client.Operations { diff --git a/SafeExamBrowser.Monitoring.Contracts/Events/DisplayChangedEventHandler.cs b/SafeExamBrowser.Monitoring.Contracts/Display/Events/DisplayChangedEventHandler.cs similarity index 87% rename from SafeExamBrowser.Monitoring.Contracts/Events/DisplayChangedEventHandler.cs rename to SafeExamBrowser.Monitoring.Contracts/Display/Events/DisplayChangedEventHandler.cs index 3bb1dd6f..2cf9453d 100644 --- a/SafeExamBrowser.Monitoring.Contracts/Events/DisplayChangedEventHandler.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Display/Events/DisplayChangedEventHandler.cs @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -namespace SafeExamBrowser.Monitoring.Contracts.Events +namespace SafeExamBrowser.Monitoring.Contracts.Display.Events { /// /// Indicates that the configuration of a display has changed. diff --git a/SafeExamBrowser.Monitoring.Contracts/IDisplayMonitor.cs b/SafeExamBrowser.Monitoring.Contracts/Display/IDisplayMonitor.cs similarity index 92% rename from SafeExamBrowser.Monitoring.Contracts/IDisplayMonitor.cs rename to SafeExamBrowser.Monitoring.Contracts/Display/IDisplayMonitor.cs index 1b24ec82..a7a128b8 100644 --- a/SafeExamBrowser.Monitoring.Contracts/IDisplayMonitor.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Display/IDisplayMonitor.cs @@ -6,9 +6,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -using SafeExamBrowser.Monitoring.Contracts.Events; +using SafeExamBrowser.Monitoring.Contracts.Display.Events; -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Display { /// /// Monitors the displays of the computer for (setup) changes and provides access to display-related functionality. diff --git a/SafeExamBrowser.Monitoring.Contracts/IKeyboardInterceptor.cs b/SafeExamBrowser.Monitoring.Contracts/Keyboard/IKeyboardInterceptor.cs similarity index 92% rename from SafeExamBrowser.Monitoring.Contracts/IKeyboardInterceptor.cs rename to SafeExamBrowser.Monitoring.Contracts/Keyboard/IKeyboardInterceptor.cs index 02450ecc..2f40ffc6 100644 --- a/SafeExamBrowser.Monitoring.Contracts/IKeyboardInterceptor.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Keyboard/IKeyboardInterceptor.cs @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Keyboard { /// /// Intercepts all keyboard input (except the Secure Attention Sequence: https://en.wikipedia.org/wiki/Secure_attention_key). diff --git a/SafeExamBrowser.Monitoring.Contracts/KeyModifier.cs b/SafeExamBrowser.Monitoring.Contracts/Keyboard/KeyModifier.cs similarity index 90% rename from SafeExamBrowser.Monitoring.Contracts/KeyModifier.cs rename to SafeExamBrowser.Monitoring.Contracts/Keyboard/KeyModifier.cs index 19f1b06e..ca905929 100644 --- a/SafeExamBrowser.Monitoring.Contracts/KeyModifier.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Keyboard/KeyModifier.cs @@ -8,7 +8,7 @@ using System; -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Keyboard { /// /// The key modifiers which can be detected by the . diff --git a/SafeExamBrowser.Monitoring.Contracts/KeyState.cs b/SafeExamBrowser.Monitoring.Contracts/Keyboard/KeyState.cs similarity index 81% rename from SafeExamBrowser.Monitoring.Contracts/KeyState.cs rename to SafeExamBrowser.Monitoring.Contracts/Keyboard/KeyState.cs index 73173536..ee005c53 100644 --- a/SafeExamBrowser.Monitoring.Contracts/KeyState.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Keyboard/KeyState.cs @@ -6,10 +6,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Keyboard { /// - /// The key states which can be detected by the or . + /// The key states which can be detected by the . /// public enum KeyState { diff --git a/SafeExamBrowser.Monitoring.Contracts/IMouseInterceptor.cs b/SafeExamBrowser.Monitoring.Contracts/Mouse/IMouseInterceptor.cs similarity index 82% rename from SafeExamBrowser.Monitoring.Contracts/IMouseInterceptor.cs rename to SafeExamBrowser.Monitoring.Contracts/Mouse/IMouseInterceptor.cs index 52df9526..8df646bf 100644 --- a/SafeExamBrowser.Monitoring.Contracts/IMouseInterceptor.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Mouse/IMouseInterceptor.cs @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Mouse { /// /// Intercepts all mouse input. @@ -16,6 +16,6 @@ namespace SafeExamBrowser.Monitoring.Contracts /// /// Returns true if the given button should be blocked, otherwise false. /// - bool Block(MouseButton button, KeyState state); + bool Block(MouseButton button, MouseButtonState state); } } diff --git a/SafeExamBrowser.Monitoring.Contracts/MouseButton.cs b/SafeExamBrowser.Monitoring.Contracts/Mouse/MouseButton.cs similarity index 90% rename from SafeExamBrowser.Monitoring.Contracts/MouseButton.cs rename to SafeExamBrowser.Monitoring.Contracts/Mouse/MouseButton.cs index 58e2382f..0b3d29f6 100644 --- a/SafeExamBrowser.Monitoring.Contracts/MouseButton.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Mouse/MouseButton.cs @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Mouse { /// /// The mouse buttons which can be detected by the . diff --git a/SafeExamBrowser.Monitoring.Contracts/Mouse/MouseButtonState.cs b/SafeExamBrowser.Monitoring.Contracts/Mouse/MouseButtonState.cs new file mode 100644 index 00000000..9af16397 --- /dev/null +++ b/SafeExamBrowser.Monitoring.Contracts/Mouse/MouseButtonState.cs @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +namespace SafeExamBrowser.Monitoring.Contracts.Mouse +{ + /// + /// The mouse button states which can be detected by the . + /// + public enum MouseButtonState + { + Unknown = 0, + Pressed, + Released + } +} diff --git a/SafeExamBrowser.Monitoring.Contracts/Events/ExplorerStartedEventHandler.cs b/SafeExamBrowser.Monitoring.Contracts/Processes/Events/ExplorerStartedEventHandler.cs similarity index 87% rename from SafeExamBrowser.Monitoring.Contracts/Events/ExplorerStartedEventHandler.cs rename to SafeExamBrowser.Monitoring.Contracts/Processes/Events/ExplorerStartedEventHandler.cs index 92af6e9b..75e25062 100644 --- a/SafeExamBrowser.Monitoring.Contracts/Events/ExplorerStartedEventHandler.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Processes/Events/ExplorerStartedEventHandler.cs @@ -6,7 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -namespace SafeExamBrowser.Monitoring.Contracts.Events +namespace SafeExamBrowser.Monitoring.Contracts.Processes.Events { /// /// Indicates that the Windows explorer process has started. diff --git a/SafeExamBrowser.Monitoring.Contracts/IProcessMonitor.cs b/SafeExamBrowser.Monitoring.Contracts/Processes/IProcessMonitor.cs similarity index 91% rename from SafeExamBrowser.Monitoring.Contracts/IProcessMonitor.cs rename to SafeExamBrowser.Monitoring.Contracts/Processes/IProcessMonitor.cs index 0abffe4b..edfaecb1 100644 --- a/SafeExamBrowser.Monitoring.Contracts/IProcessMonitor.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Processes/IProcessMonitor.cs @@ -7,9 +7,9 @@ */ using System; -using SafeExamBrowser.Monitoring.Contracts.Events; +using SafeExamBrowser.Monitoring.Contracts.Processes.Events; -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Processes { /// /// Monitors the processes running on the computer and provides access to process-related functionality. diff --git a/SafeExamBrowser.Monitoring.Contracts/SafeExamBrowser.Monitoring.Contracts.csproj b/SafeExamBrowser.Monitoring.Contracts/SafeExamBrowser.Monitoring.Contracts.csproj index b7c662a3..050dac20 100644 --- a/SafeExamBrowser.Monitoring.Contracts/SafeExamBrowser.Monitoring.Contracts.csproj +++ b/SafeExamBrowser.Monitoring.Contracts/SafeExamBrowser.Monitoring.Contracts.csproj @@ -53,17 +53,18 @@ - - - - - - - - - - - + + + + + + + + + + + + diff --git a/SafeExamBrowser.Monitoring.Contracts/Events/WindowChangedEventHandler.cs b/SafeExamBrowser.Monitoring.Contracts/Windows/Events/WindowChangedEventHandler.cs similarity index 88% rename from SafeExamBrowser.Monitoring.Contracts/Events/WindowChangedEventHandler.cs rename to SafeExamBrowser.Monitoring.Contracts/Windows/Events/WindowChangedEventHandler.cs index 200184f1..b3d34b3d 100644 --- a/SafeExamBrowser.Monitoring.Contracts/Events/WindowChangedEventHandler.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Windows/Events/WindowChangedEventHandler.cs @@ -8,7 +8,7 @@ using System; -namespace SafeExamBrowser.Monitoring.Contracts.Events +namespace SafeExamBrowser.Monitoring.Contracts.Windows.Events { /// /// Indicates that the input focus has changed to the window with the specified handle. diff --git a/SafeExamBrowser.Monitoring.Contracts/IWindowMonitor.cs b/SafeExamBrowser.Monitoring.Contracts/Windows/IWindowMonitor.cs similarity index 92% rename from SafeExamBrowser.Monitoring.Contracts/IWindowMonitor.cs rename to SafeExamBrowser.Monitoring.Contracts/Windows/IWindowMonitor.cs index ba3d5e23..4b09ff44 100644 --- a/SafeExamBrowser.Monitoring.Contracts/IWindowMonitor.cs +++ b/SafeExamBrowser.Monitoring.Contracts/Windows/IWindowMonitor.cs @@ -7,9 +7,9 @@ */ using System; -using SafeExamBrowser.Monitoring.Contracts.Events; +using SafeExamBrowser.Monitoring.Contracts.Windows.Events; -namespace SafeExamBrowser.Monitoring.Contracts +namespace SafeExamBrowser.Monitoring.Contracts.Windows { /// /// Monitors the windows associated with the current desktop and provides window-related functionality. diff --git a/SafeExamBrowser.Monitoring/Display/DisplayMonitor.cs b/SafeExamBrowser.Monitoring/Display/DisplayMonitor.cs index a91b3382..9c300204 100644 --- a/SafeExamBrowser.Monitoring/Display/DisplayMonitor.cs +++ b/SafeExamBrowser.Monitoring/Display/DisplayMonitor.cs @@ -10,8 +10,8 @@ using System; using System.Windows.Forms; using Microsoft.Win32; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; -using SafeExamBrowser.Monitoring.Contracts.Events; +using SafeExamBrowser.Monitoring.Contracts.Display; +using SafeExamBrowser.Monitoring.Contracts.Display.Events; using SafeExamBrowser.SystemComponents.Contracts; using SafeExamBrowser.WindowsApi.Contracts; using OperatingSystem = SafeExamBrowser.SystemComponents.Contracts.OperatingSystem; diff --git a/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs b/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs index 364a6210..7a81cae9 100644 --- a/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs +++ b/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs @@ -11,7 +11,7 @@ using System.Linq; using System.Windows.Input; using SafeExamBrowser.Configuration.Contracts.Settings; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Keyboard; namespace SafeExamBrowser.Monitoring.Keyboard { diff --git a/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs b/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs index 6344bff0..aa3fce69 100644 --- a/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs +++ b/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs @@ -8,7 +8,7 @@ using SafeExamBrowser.Configuration.Contracts.Settings; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Mouse; namespace SafeExamBrowser.Monitoring.Mouse { @@ -23,7 +23,7 @@ namespace SafeExamBrowser.Monitoring.Mouse this.settings = settings; } - public bool Block(MouseButton button, KeyState state) + public bool Block(MouseButton button, MouseButtonState state) { var block = false; diff --git a/SafeExamBrowser.Monitoring/Processes/ProcessMonitor.cs b/SafeExamBrowser.Monitoring/Processes/ProcessMonitor.cs index c6a6779d..4d4f175c 100644 --- a/SafeExamBrowser.Monitoring/Processes/ProcessMonitor.cs +++ b/SafeExamBrowser.Monitoring/Processes/ProcessMonitor.cs @@ -10,8 +10,8 @@ using System; using System.Diagnostics; using System.Management; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; -using SafeExamBrowser.Monitoring.Contracts.Events; +using SafeExamBrowser.Monitoring.Contracts.Processes; +using SafeExamBrowser.Monitoring.Contracts.Processes.Events; using SafeExamBrowser.WindowsApi.Contracts; namespace SafeExamBrowser.Monitoring.Processes diff --git a/SafeExamBrowser.Monitoring/Windows/WindowMonitor.cs b/SafeExamBrowser.Monitoring/Windows/WindowMonitor.cs index 4c6c3866..90bc26cb 100644 --- a/SafeExamBrowser.Monitoring/Windows/WindowMonitor.cs +++ b/SafeExamBrowser.Monitoring/Windows/WindowMonitor.cs @@ -8,8 +8,8 @@ using System; using SafeExamBrowser.Logging.Contracts; -using SafeExamBrowser.Monitoring.Contracts; -using SafeExamBrowser.Monitoring.Contracts.Events; +using SafeExamBrowser.Monitoring.Contracts.Windows; +using SafeExamBrowser.Monitoring.Contracts.Windows.Events; using SafeExamBrowser.WindowsApi.Contracts; namespace SafeExamBrowser.Monitoring.Windows diff --git a/SafeExamBrowser.WindowsApi.Contracts/INativeMethods.cs b/SafeExamBrowser.WindowsApi.Contracts/INativeMethods.cs index 803da077..040217c9 100644 --- a/SafeExamBrowser.WindowsApi.Contracts/INativeMethods.cs +++ b/SafeExamBrowser.WindowsApi.Contracts/INativeMethods.cs @@ -8,7 +8,8 @@ using System; using System.Collections.Generic; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Keyboard; +using SafeExamBrowser.Monitoring.Contracts.Mouse; using SafeExamBrowser.WindowsApi.Contracts.Events; namespace SafeExamBrowser.WindowsApi.Contracts diff --git a/SafeExamBrowser.WindowsApi/Hooks/KeyboardHook.cs b/SafeExamBrowser.WindowsApi/Hooks/KeyboardHook.cs index 2bfd4db7..c99a1f2a 100644 --- a/SafeExamBrowser.WindowsApi/Hooks/KeyboardHook.cs +++ b/SafeExamBrowser.WindowsApi/Hooks/KeyboardHook.cs @@ -8,7 +8,7 @@ using System; using System.Runtime.InteropServices; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Keyboard; using SafeExamBrowser.WindowsApi.Constants; using SafeExamBrowser.WindowsApi.Delegates; using SafeExamBrowser.WindowsApi.Types; diff --git a/SafeExamBrowser.WindowsApi/Hooks/MouseHook.cs b/SafeExamBrowser.WindowsApi/Hooks/MouseHook.cs index c13e6c4e..532ecebc 100644 --- a/SafeExamBrowser.WindowsApi/Hooks/MouseHook.cs +++ b/SafeExamBrowser.WindowsApi/Hooks/MouseHook.cs @@ -8,7 +8,7 @@ using System; using System.Runtime.InteropServices; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Mouse; using SafeExamBrowser.WindowsApi.Constants; using SafeExamBrowser.WindowsApi.Delegates; using SafeExamBrowser.WindowsApi.Types; @@ -90,7 +90,7 @@ namespace SafeExamBrowser.WindowsApi.Hooks } } - private KeyState GetState(int wParam) + private MouseButtonState GetState(int wParam) { switch (wParam) { @@ -98,14 +98,14 @@ namespace SafeExamBrowser.WindowsApi.Hooks case Constant.WM_MBUTTONDOWN: case Constant.WM_RBUTTONDOWN: case Constant.WM_XBUTTONDOWN: - return KeyState.Pressed; + return MouseButtonState.Pressed; case Constant.WM_LBUTTONUP: case Constant.WM_MBUTTONUP: case Constant.WM_RBUTTONUP: case Constant.WM_XBUTTONUP: - return KeyState.Released; + return MouseButtonState.Released; default: - return KeyState.Unknown; + return MouseButtonState.Unknown; } } } diff --git a/SafeExamBrowser.WindowsApi/NativeMethods.cs b/SafeExamBrowser.WindowsApi/NativeMethods.cs index f0f24dec..09eac477 100644 --- a/SafeExamBrowser.WindowsApi/NativeMethods.cs +++ b/SafeExamBrowser.WindowsApi/NativeMethods.cs @@ -14,10 +14,11 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading; -using SafeExamBrowser.Monitoring.Contracts; +using SafeExamBrowser.Monitoring.Contracts.Keyboard; +using SafeExamBrowser.Monitoring.Contracts.Mouse; +using SafeExamBrowser.WindowsApi.Constants; using SafeExamBrowser.WindowsApi.Contracts; using SafeExamBrowser.WindowsApi.Contracts.Events; -using SafeExamBrowser.WindowsApi.Constants; using SafeExamBrowser.WindowsApi.Hooks; using SafeExamBrowser.WindowsApi.Types;