2024-01-18 18:02:21 +01:00
|
|
|
|
/*
|
2024-03-05 18:37:42 +01:00
|
|
|
|
* Copyright (c) 2024 ETH Zürich, IT Services
|
2024-01-18 18:02:21 +01:00
|
|
|
|
*
|
|
|
|
|
* 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/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2024-02-13 11:04:36 +01:00
|
|
|
|
using SafeExamBrowser.Browser.Contracts;
|
2024-01-18 18:02:21 +01:00
|
|
|
|
using SafeExamBrowser.Configuration.Contracts;
|
|
|
|
|
using SafeExamBrowser.I18n.Contracts;
|
|
|
|
|
using SafeExamBrowser.Logging.Contracts;
|
2024-02-13 11:04:36 +01:00
|
|
|
|
using SafeExamBrowser.Monitoring.Contracts.Applications;
|
2024-02-01 17:36:11 +01:00
|
|
|
|
using SafeExamBrowser.Proctoring.ScreenProctoring;
|
|
|
|
|
using SafeExamBrowser.Proctoring.ScreenProctoring.Service;
|
2024-01-18 18:02:21 +01:00
|
|
|
|
using SafeExamBrowser.Settings.Proctoring;
|
|
|
|
|
using SafeExamBrowser.SystemComponents.Contracts;
|
|
|
|
|
using SafeExamBrowser.UserInterface.Contracts;
|
2024-02-06 10:45:45 +01:00
|
|
|
|
using SafeExamBrowser.WindowsApi.Contracts;
|
2024-01-18 18:02:21 +01:00
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.Proctoring
|
|
|
|
|
{
|
|
|
|
|
internal class ProctoringFactory
|
|
|
|
|
{
|
|
|
|
|
private readonly AppConfig appConfig;
|
2024-02-13 11:04:36 +01:00
|
|
|
|
private readonly IApplicationMonitor applicationMonitor;
|
|
|
|
|
private readonly IBrowserApplication browser;
|
2024-01-18 18:02:21 +01:00
|
|
|
|
private readonly IFileSystem fileSystem;
|
|
|
|
|
private readonly IModuleLogger logger;
|
2024-02-06 10:45:45 +01:00
|
|
|
|
private readonly INativeMethods nativeMethods;
|
2024-01-18 18:02:21 +01:00
|
|
|
|
private readonly IText text;
|
|
|
|
|
private readonly IUserInterfaceFactory uiFactory;
|
|
|
|
|
|
2024-02-06 10:45:45 +01:00
|
|
|
|
public ProctoringFactory(
|
|
|
|
|
AppConfig appConfig,
|
2024-02-13 11:04:36 +01:00
|
|
|
|
IApplicationMonitor applicationMonitor,
|
|
|
|
|
IBrowserApplication browser,
|
2024-02-06 10:45:45 +01:00
|
|
|
|
IFileSystem fileSystem,
|
|
|
|
|
IModuleLogger logger,
|
|
|
|
|
INativeMethods nativeMethods,
|
|
|
|
|
IText text,
|
|
|
|
|
IUserInterfaceFactory uiFactory)
|
2024-01-18 18:02:21 +01:00
|
|
|
|
{
|
|
|
|
|
this.appConfig = appConfig;
|
2024-02-13 11:04:36 +01:00
|
|
|
|
this.applicationMonitor = applicationMonitor;
|
|
|
|
|
this.browser = browser;
|
2024-01-18 18:02:21 +01:00
|
|
|
|
this.fileSystem = fileSystem;
|
|
|
|
|
this.logger = logger;
|
2024-02-06 10:45:45 +01:00
|
|
|
|
this.nativeMethods = nativeMethods;
|
2024-01-18 18:02:21 +01:00
|
|
|
|
this.text = text;
|
|
|
|
|
this.uiFactory = uiFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal IEnumerable<ProctoringImplementation> CreateAllActive(ProctoringSettings settings)
|
|
|
|
|
{
|
|
|
|
|
var implementations = new List<ProctoringImplementation>();
|
|
|
|
|
|
2024-02-01 17:36:11 +01:00
|
|
|
|
if (settings.ScreenProctoring.Enabled)
|
|
|
|
|
{
|
|
|
|
|
var logger = this.logger.CloneFor(nameof(ScreenProctoring));
|
|
|
|
|
var service = new ServiceProxy(logger.CloneFor(nameof(ServiceProxy)));
|
|
|
|
|
|
2024-02-21 18:37:23 +01:00
|
|
|
|
implementations.Add(new ScreenProctoringImplementation(appConfig, applicationMonitor, browser, logger, nativeMethods, service, settings, text));
|
2024-01-18 18:02:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return implementations;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|