SEBWIN-917: Consolidated detectors in monitoring assembly.

This commit is contained in:
Damian Büchel 2024-07-25 15:30:56 +02:00
parent 6a77a41564
commit a350949b1b
13 changed files with 19 additions and 16 deletions

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
namespace SafeExamBrowser.SystemComponents.Contracts namespace SafeExamBrowser.Monitoring.Contracts
{ {
/// <summary> /// <summary>
/// Provides functionality related to remote session detection. /// Provides functionality related to remote session detection.

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
namespace SafeExamBrowser.SystemComponents.Contracts namespace SafeExamBrowser.Monitoring.Contracts
{ {
/// <summary> /// <summary>
/// Provides functionality related to virtual machine detection. /// Provides functionality related to virtual machine detection.

View file

@ -65,6 +65,8 @@
<Compile Include="Display\IDisplayMonitor.cs" /> <Compile Include="Display\IDisplayMonitor.cs" />
<Compile Include="Display\ValidationResult.cs" /> <Compile Include="Display\ValidationResult.cs" />
<Compile Include="IClipboard.cs" /> <Compile Include="IClipboard.cs" />
<Compile Include="IRemoteSessionDetector.cs" />
<Compile Include="IVirtualMachineDetector.cs" />
<Compile Include="Keyboard\IKeyboardInterceptor.cs" /> <Compile Include="Keyboard\IKeyboardInterceptor.cs" />
<Compile Include="Mouse\IMouseInterceptor.cs" /> <Compile Include="Mouse\IMouseInterceptor.cs" />
<Compile Include="Applications\InitializationResult.cs" /> <Compile Include="Applications\InitializationResult.cs" />

View file

@ -8,9 +8,9 @@
using System.Windows.Forms; using System.Windows.Forms;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.SystemComponents.Contracts; using SafeExamBrowser.Monitoring.Contracts;
namespace SafeExamBrowser.SystemComponents namespace SafeExamBrowser.Monitoring
{ {
public class RemoteSessionDetector : IRemoteSessionDetector public class RemoteSessionDetector : IRemoteSessionDetector
{ {

View file

@ -67,11 +67,13 @@
<Compile Include="Mouse\MouseInterceptor.cs" /> <Compile Include="Mouse\MouseInterceptor.cs" />
<Compile Include="Applications\ApplicationMonitor.cs" /> <Compile Include="Applications\ApplicationMonitor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RemoteSessionDetector.cs" />
<Compile Include="System\Components\Cursors.cs" /> <Compile Include="System\Components\Cursors.cs" />
<Compile Include="System\Components\EaseOfAccess.cs" /> <Compile Include="System\Components\EaseOfAccess.cs" />
<Compile Include="System\Components\StickyKeys.cs" /> <Compile Include="System\Components\StickyKeys.cs" />
<Compile Include="System\Components\SystemEvents.cs" /> <Compile Include="System\Components\SystemEvents.cs" />
<Compile Include="System\SystemSentinel.cs" /> <Compile Include="System\SystemSentinel.cs" />
<Compile Include="VirtualMachineDetector.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SafeExamBrowser.Logging.Contracts\SafeExamBrowser.Logging.Contracts.csproj"> <ProjectReference Include="..\SafeExamBrowser.Logging.Contracts\SafeExamBrowser.Logging.Contracts.csproj">

View file

@ -6,12 +6,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
using System;
using System.Linq; using System.Linq;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring.Contracts;
using SafeExamBrowser.SystemComponents.Contracts; using SafeExamBrowser.SystemComponents.Contracts;
using SafeExamBrowser.SystemComponents.Contracts.Registry; using SafeExamBrowser.SystemComponents.Contracts.Registry;
namespace SafeExamBrowser.SystemComponents namespace SafeExamBrowser.Monitoring
{ {
public class VirtualMachineDetector : IVirtualMachineDetector public class VirtualMachineDetector : IVirtualMachineDetector
{ {
@ -135,7 +137,7 @@ namespace SafeExamBrowser.SystemComponents
private bool HasLocalVirtualMachineDeviceCache() private bool HasLocalVirtualMachineDeviceCache()
{ {
var deviceName = System.Environment.GetEnvironmentVariable("COMPUTERNAME"); var deviceName = Environment.GetEnvironmentVariable("COMPUTERNAME");
var hasDeviceCache = false; var hasDeviceCache = false;
var hasDeviceCacheKeys = registry.TryGetSubKeys(RegistryValue.UserHive.DeviceCache_Key, out var deviceCacheKeys); var hasDeviceCacheKeys = registry.TryGetSubKeys(RegistryValue.UserHive.DeviceCache_Key, out var deviceCacheKeys);

View file

@ -11,10 +11,10 @@ using Moq;
using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring.Contracts;
using SafeExamBrowser.Runtime.Operations; using SafeExamBrowser.Runtime.Operations;
using SafeExamBrowser.Runtime.Operations.Events; using SafeExamBrowser.Runtime.Operations.Events;
using SafeExamBrowser.Settings; using SafeExamBrowser.Settings;
using SafeExamBrowser.SystemComponents.Contracts;
namespace SafeExamBrowser.Runtime.UnitTests.Operations namespace SafeExamBrowser.Runtime.UnitTests.Operations
{ {

View file

@ -11,10 +11,10 @@ using Moq;
using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Core.Contracts.OperationModel; using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring.Contracts;
using SafeExamBrowser.Runtime.Operations; using SafeExamBrowser.Runtime.Operations;
using SafeExamBrowser.Settings; using SafeExamBrowser.Settings;
using SafeExamBrowser.Settings.Security; using SafeExamBrowser.Settings.Security;
using SafeExamBrowser.SystemComponents.Contracts;
namespace SafeExamBrowser.Runtime.UnitTests.Operations namespace SafeExamBrowser.Runtime.UnitTests.Operations
{ {

View file

@ -25,6 +25,7 @@ using SafeExamBrowser.I18n;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging; using SafeExamBrowser.Logging;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring;
using SafeExamBrowser.Monitoring.Display; using SafeExamBrowser.Monitoring.Display;
using SafeExamBrowser.Monitoring.System; using SafeExamBrowser.Monitoring.System;
using SafeExamBrowser.Runtime.Communication; using SafeExamBrowser.Runtime.Communication;

View file

@ -10,8 +10,8 @@ using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.Core.Contracts.OperationModel.Events;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring.Contracts;
using SafeExamBrowser.Runtime.Operations.Events; using SafeExamBrowser.Runtime.Operations.Events;
using SafeExamBrowser.SystemComponents.Contracts;
using SafeExamBrowser.UserInterface.Contracts.MessageBox; using SafeExamBrowser.UserInterface.Contracts.MessageBox;
namespace SafeExamBrowser.Runtime.Operations namespace SafeExamBrowser.Runtime.Operations

View file

@ -10,17 +10,17 @@ using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Core.Contracts.OperationModel.Events; using SafeExamBrowser.Core.Contracts.OperationModel.Events;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Monitoring.Contracts;
using SafeExamBrowser.Runtime.Operations.Events; using SafeExamBrowser.Runtime.Operations.Events;
using SafeExamBrowser.Settings.Security; using SafeExamBrowser.Settings.Security;
using SafeExamBrowser.SystemComponents.Contracts;
using SafeExamBrowser.UserInterface.Contracts.MessageBox; using SafeExamBrowser.UserInterface.Contracts.MessageBox;
namespace SafeExamBrowser.Runtime.Operations namespace SafeExamBrowser.Runtime.Operations
{ {
internal class VirtualMachineOperation : SessionOperation internal class VirtualMachineOperation : SessionOperation
{ {
private IVirtualMachineDetector detector; private readonly IVirtualMachineDetector detector;
private ILogger logger; private readonly ILogger logger;
public override event ActionRequiredEventHandler ActionRequired; public override event ActionRequiredEventHandler ActionRequired;
public override event StatusChangedEventHandler StatusChanged; public override event StatusChangedEventHandler StatusChanged;

View file

@ -62,8 +62,6 @@
<Compile Include="Network\Events\CredentialsRequiredEventHandler.cs" /> <Compile Include="Network\Events\CredentialsRequiredEventHandler.cs" />
<Compile Include="Registry\Events\RegistryValueChangedEventHandler.cs" /> <Compile Include="Registry\Events\RegistryValueChangedEventHandler.cs" />
<Compile Include="Registry\IRegistry.cs" /> <Compile Include="Registry\IRegistry.cs" />
<Compile Include="IRemoteSessionDetector.cs" />
<Compile Include="IVirtualMachineDetector.cs" />
<Compile Include="Network\ConnectionType.cs" /> <Compile Include="Network\ConnectionType.cs" />
<Compile Include="PowerSupply\Events\StatusChangedEventHandler.cs" /> <Compile Include="PowerSupply\Events\StatusChangedEventHandler.cs" />
<Compile Include="PowerSupply\IPowerSupply.cs" /> <Compile Include="PowerSupply\IPowerSupply.cs" />

View file

@ -65,10 +65,8 @@
<Compile Include="PowerSupply\PowerSupplyStatus.cs" /> <Compile Include="PowerSupply\PowerSupplyStatus.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Registry\Registry.cs" /> <Compile Include="Registry\Registry.cs" />
<Compile Include="RemoteSessionDetector.cs" />
<Compile Include="SystemInfo.cs" /> <Compile Include="SystemInfo.cs" />
<Compile Include="UserInfo.cs" /> <Compile Include="UserInfo.cs" />
<Compile Include="VirtualMachineDetector.cs" />
<Compile Include="Network\NetworkAdapter.cs" /> <Compile Include="Network\NetworkAdapter.cs" />
<Compile Include="Network\WirelessNetwork.cs" /> <Compile Include="Network\WirelessNetwork.cs" />
</ItemGroup> </ItemGroup>