SEBWIN-342: Separated monitoring contracts into individual namespaces.

This commit is contained in:
dbuechel 2019-09-05 09:00:41 +02:00
parent c282623eb4
commit db390aebaf
35 changed files with 86 additions and 57 deletions

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
{

View file

@ -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
{

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
{

View file

@ -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
{

View file

@ -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
{
/// <summary>
/// Indicates that the configuration of a display has changed.

View file

@ -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
{
/// <summary>
/// Monitors the displays of the computer for (setup) changes and provides access to display-related functionality.

View file

@ -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
{
/// <summary>
/// Intercepts all keyboard input (except the Secure Attention Sequence: https://en.wikipedia.org/wiki/Secure_attention_key).

View file

@ -8,7 +8,7 @@
using System;
namespace SafeExamBrowser.Monitoring.Contracts
namespace SafeExamBrowser.Monitoring.Contracts.Keyboard
{
/// <summary>
/// The key modifiers which can be detected by the <see cref="IKeyboardInterceptor"/>.

View file

@ -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
{
/// <summary>
/// The key states which can be detected by the <see cref="IKeyboardInterceptor"/> or <see cref="IMouseInterceptor"/>.
/// The key states which can be detected by the <see cref="IKeyboardInterceptor"/>.
/// </summary>
public enum KeyState
{

View file

@ -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
{
/// <summary>
/// Intercepts all mouse input.
@ -16,6 +16,6 @@ namespace SafeExamBrowser.Monitoring.Contracts
/// <summary>
/// Returns <c>true</c> if the given button should be blocked, otherwise <c>false</c>.
/// </summary>
bool Block(MouseButton button, KeyState state);
bool Block(MouseButton button, MouseButtonState state);
}
}

View file

@ -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
{
/// <summary>
/// The mouse buttons which can be detected by the <see cref="IMouseInterceptor"/>.

View file

@ -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
{
/// <summary>
/// The mouse button states which can be detected by the <see cref="IMouseInterceptor"/>.
/// </summary>
public enum MouseButtonState
{
Unknown = 0,
Pressed,
Released
}
}

View file

@ -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
{
/// <summary>
/// Indicates that the Windows explorer process has started.

View file

@ -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
{
/// <summary>
/// Monitors the processes running on the computer and provides access to process-related functionality.

View file

@ -53,17 +53,18 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Events\DisplayChangedEventHandler.cs" />
<Compile Include="Events\ExplorerStartedEventHandler.cs" />
<Compile Include="Events\WindowChangedEventHandler.cs" />
<Compile Include="IDisplayMonitor.cs" />
<Compile Include="IKeyboardInterceptor.cs" />
<Compile Include="IMouseInterceptor.cs" />
<Compile Include="IProcessMonitor.cs" />
<Compile Include="IWindowMonitor.cs" />
<Compile Include="KeyModifier.cs" />
<Compile Include="KeyState.cs" />
<Compile Include="MouseButton.cs" />
<Compile Include="Display\Events\DisplayChangedEventHandler.cs" />
<Compile Include="Processes\Events\ExplorerStartedEventHandler.cs" />
<Compile Include="Windows\Events\WindowChangedEventHandler.cs" />
<Compile Include="Display\IDisplayMonitor.cs" />
<Compile Include="Keyboard\IKeyboardInterceptor.cs" />
<Compile Include="Mouse\MouseButtonState.cs" />
<Compile Include="Mouse\IMouseInterceptor.cs" />
<Compile Include="Processes\IProcessMonitor.cs" />
<Compile Include="Windows\IWindowMonitor.cs" />
<Compile Include="Keyboard\KeyModifier.cs" />
<Compile Include="Keyboard\KeyState.cs" />
<Compile Include="Mouse\MouseButton.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View file

@ -8,7 +8,7 @@
using System;
namespace SafeExamBrowser.Monitoring.Contracts.Events
namespace SafeExamBrowser.Monitoring.Contracts.Windows.Events
{
/// <summary>
/// Indicates that the input focus has changed to the window with the specified handle.

View file

@ -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
{
/// <summary>
/// Monitors the windows associated with the current desktop and provides window-related functionality.

View file

@ -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;

View file

@ -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
{

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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;
}
}
}

View file

@ -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;