Restore SEBPatch
This commit is contained in:
@@ -13,6 +13,14 @@
|
||||
<assemblyIdentity name="Microsoft.Win32.Registry" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="KGySoft.CoreLibraries" publicKeyToken="b45eba277439ddfe" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.3.0.0" newVersion="8.3.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="KGySoft.Drawing.Core" publicKeyToken="b45eba277439ddfe" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.2.0.0" newVersion="8.2.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -10,13 +10,20 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Applications.Contracts;
|
||||
using SafeExamBrowser.Browser.Contracts;
|
||||
using SafeExamBrowser.Client.Responsibilities;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
||||
using SafeExamBrowser.Configuration.Contracts.Integrity;
|
||||
using SafeExamBrowser.Core.Contracts.ResponsibilityModel;
|
||||
using SafeExamBrowser.Proctoring.Contracts;
|
||||
using SafeExamBrowser.Server.Contracts;
|
||||
using SafeExamBrowser.Settings;
|
||||
using SafeExamBrowser.UserInterface.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Shell;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Windows;
|
||||
|
||||
namespace SafeExamBrowser.Client
|
||||
{
|
||||
@@ -50,16 +57,41 @@ namespace SafeExamBrowser.Client
|
||||
/// </summary>
|
||||
internal IClientHost ClientHost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The hash algorithm.
|
||||
/// </summary>
|
||||
internal IHashAlgorithm HashAlgorithm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The integrity module.
|
||||
/// </summary>
|
||||
internal IIntegrityModule IntegrityModule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The currently active lock screen, or <c>default</c> if no lock screen is active.
|
||||
/// </summary>
|
||||
internal ILockScreen LockScreen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The message box.
|
||||
/// </summary>
|
||||
internal IMessageBox MessageBox { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The proctoring controller to be used if the current session has proctoring enabled.
|
||||
/// </summary>
|
||||
internal IProctoringController Proctoring { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The client responsibilities.
|
||||
/// </summary>
|
||||
internal IResponsibilityCollection<ClientTask> Responsibilities { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The runtime communication proxy.
|
||||
/// </summary>
|
||||
internal IRuntimeProxy Runtime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The server proxy to be used if the current session mode is <see cref="SessionMode.Server"/>.
|
||||
/// </summary>
|
||||
@@ -75,6 +107,11 @@ namespace SafeExamBrowser.Client
|
||||
/// </summary>
|
||||
internal AppSettings Settings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user interface factory.
|
||||
/// </summary>
|
||||
internal IUserInterfaceFactory UserInterfaceFactory { get; set; }
|
||||
|
||||
internal ClientContext()
|
||||
{
|
||||
Activators = new List<IActivator>();
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -11,10 +11,13 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using SafeExamBrowser.Applications;
|
||||
using SafeExamBrowser.Applications.Contracts;
|
||||
using SafeExamBrowser.Browser;
|
||||
using SafeExamBrowser.Client.Communication;
|
||||
using SafeExamBrowser.Client.Contracts;
|
||||
using SafeExamBrowser.Client.Notifications;
|
||||
using SafeExamBrowser.Client.Operations;
|
||||
using SafeExamBrowser.Client.Responsibilities;
|
||||
using SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Communication.Hosts;
|
||||
@@ -22,14 +25,17 @@ using SafeExamBrowser.Communication.Proxies;
|
||||
using SafeExamBrowser.Configuration.Cryptography;
|
||||
using SafeExamBrowser.Configuration.Integrity;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.OperationModel;
|
||||
using SafeExamBrowser.Core.Operations;
|
||||
using SafeExamBrowser.Core.ResponsibilityModel;
|
||||
using SafeExamBrowser.I18n;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Monitoring;
|
||||
using SafeExamBrowser.Monitoring.Applications;
|
||||
using SafeExamBrowser.Monitoring.Contracts;
|
||||
using SafeExamBrowser.Monitoring.Contracts.Display;
|
||||
using SafeExamBrowser.Monitoring.Contracts.System;
|
||||
using SafeExamBrowser.Monitoring.Display;
|
||||
using SafeExamBrowser.Monitoring.Keyboard;
|
||||
using SafeExamBrowser.Monitoring.Mouse;
|
||||
@@ -51,6 +57,7 @@ using SafeExamBrowser.UserInterface.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts.FileSystemDialog;
|
||||
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Shell;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Windows;
|
||||
using SafeExamBrowser.UserInterface.Shared.Activators;
|
||||
using SafeExamBrowser.WindowsApi;
|
||||
using SafeExamBrowser.WindowsApi.Contracts;
|
||||
@@ -78,8 +85,8 @@ namespace SafeExamBrowser.Client
|
||||
private IMessageBox messageBox;
|
||||
private INativeMethods nativeMethods;
|
||||
private INetworkAdapter networkAdapter;
|
||||
private ISplashScreen splashScreen;
|
||||
private IPowerSupply powerSupply;
|
||||
private IRuntimeProxy runtimeProxy;
|
||||
private ISystemInfo systemInfo;
|
||||
private ITaskbar taskbar;
|
||||
private ITaskview taskview;
|
||||
@@ -97,7 +104,6 @@ namespace SafeExamBrowser.Client
|
||||
InitializeText();
|
||||
|
||||
var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory)));
|
||||
var registry = new Registry(ModuleLogger(nameof(Registry)));
|
||||
|
||||
uiFactory = BuildUserInterfaceFactory();
|
||||
actionCenter = uiFactory.CreateActionCenter();
|
||||
@@ -106,8 +112,8 @@ namespace SafeExamBrowser.Client
|
||||
nativeMethods = new NativeMethods();
|
||||
applicationMonitor = new ApplicationMonitor(TWO_SECONDS, ModuleLogger(nameof(ApplicationMonitor)), nativeMethods, processFactory);
|
||||
networkAdapter = new NetworkAdapter(ModuleLogger(nameof(NetworkAdapter)), nativeMethods);
|
||||
runtimeProxy = new RuntimeProxy(runtimeHostUri, new ProxyObjectFactory(), ModuleLogger(nameof(RuntimeProxy)), Interlocutor.Client);
|
||||
systemInfo = new SystemInfo(registry);
|
||||
splashScreen = uiFactory.CreateSplashScreen();
|
||||
systemInfo = new SystemInfo(new Registry(ModuleLogger(nameof(Registry))));
|
||||
taskbar = uiFactory.CreateTaskbar(ModuleLogger("Taskbar"));
|
||||
taskview = uiFactory.CreateTaskview();
|
||||
userInfo = new UserInfo(ModuleLogger(nameof(UserInfo)));
|
||||
@@ -118,10 +124,39 @@ namespace SafeExamBrowser.Client
|
||||
var displayMonitor = new DisplayMonitor(ModuleLogger(nameof(DisplayMonitor)), nativeMethods, systemInfo);
|
||||
var explorerShell = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods);
|
||||
var fileSystemDialog = BuildFileSystemDialog();
|
||||
var hashAlgorithm = new HashAlgorithm();
|
||||
var sentinel = new SystemSentinel(ModuleLogger(nameof(SystemSentinel)), nativeMethods, registry);
|
||||
var splashScreen = uiFactory.CreateSplashScreen();
|
||||
var runtimeProxy = new RuntimeProxy(runtimeHostUri, new ProxyObjectFactory(), ModuleLogger(nameof(RuntimeProxy)), Interlocutor.Client);
|
||||
var sentinel = new SystemSentinel(ModuleLogger(nameof(SystemSentinel)), nativeMethods, new Registry(ModuleLogger(nameof(Registry))));
|
||||
|
||||
var operations = BuildOperations(applicationFactory, clipboard, displayMonitor, fileSystemDialog, runtimeProxy);
|
||||
var responsibilities = BuildResponsibilities(coordinator, displayMonitor, explorerShell, runtimeProxy, sentinel, shutdown);
|
||||
|
||||
context.HashAlgorithm = new HashAlgorithm();
|
||||
context.MessageBox = messageBox;
|
||||
context.Responsibilities = responsibilities;
|
||||
context.Runtime = runtimeProxy;
|
||||
context.UserInterfaceFactory = uiFactory;
|
||||
|
||||
ClientController = new ClientController(context, logger, operations, responsibilities, runtimeProxy, splashScreen);
|
||||
}
|
||||
|
||||
internal void LogStartupInformation()
|
||||
{
|
||||
logger.Log($"# New client instance started at {DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}");
|
||||
logger.Log(string.Empty);
|
||||
}
|
||||
|
||||
internal void LogShutdownInformation()
|
||||
{
|
||||
logger?.Log($"# Client instance terminated at {DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}");
|
||||
}
|
||||
|
||||
private ClientOperationSequence BuildOperations(
|
||||
IApplicationFactory applicationFactory,
|
||||
IClipboard clipboard,
|
||||
IDisplayMonitor displayMonitor,
|
||||
IFileSystemDialog fileSystemDialog,
|
||||
IRuntimeProxy runtimeProxy)
|
||||
{
|
||||
var operations = new Queue<IOperation>();
|
||||
|
||||
operations.Enqueue(new I18nOperation(logger, text));
|
||||
@@ -134,7 +169,7 @@ namespace SafeExamBrowser.Client
|
||||
operations.Enqueue(new ClientHostDisconnectionOperation(context, logger, FIVE_SECONDS));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildKeyboardInterceptorOperation));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildMouseInterceptorOperation));
|
||||
operations.Enqueue(new ApplicationOperation(context, applicationFactory, applicationMonitor, logger, text));
|
||||
operations.Enqueue(new ApplicationOperation(context, applicationFactory, fileSystemDialog, logger, messageBox, applicationMonitor, splashScreen, text));
|
||||
operations.Enqueue(new DisplayMonitorOperation(context, displayMonitor, logger, taskbar));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildShellOperation));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildBrowserOperation));
|
||||
@@ -142,39 +177,30 @@ namespace SafeExamBrowser.Client
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildProctoringOperation));
|
||||
operations.Enqueue(new ClipboardOperation(context, clipboard, logger));
|
||||
|
||||
var sequence = new OperationSequence(logger, operations);
|
||||
|
||||
ClientController = new ClientController(
|
||||
actionCenter,
|
||||
applicationMonitor,
|
||||
context,
|
||||
coordinator,
|
||||
displayMonitor,
|
||||
explorerShell,
|
||||
fileSystemDialog,
|
||||
hashAlgorithm,
|
||||
logger,
|
||||
messageBox,
|
||||
networkAdapter,
|
||||
sequence,
|
||||
runtimeProxy,
|
||||
shutdown,
|
||||
splashScreen,
|
||||
sentinel,
|
||||
taskbar,
|
||||
text,
|
||||
uiFactory);
|
||||
return new ClientOperationSequence(logger, operations, splashScreen);
|
||||
}
|
||||
|
||||
internal void LogStartupInformation()
|
||||
private ResponsibilityCollection<ClientTask> BuildResponsibilities(
|
||||
ICoordinator coordinator,
|
||||
IDisplayMonitor displayMonitor,
|
||||
IExplorerShell explorerShell,
|
||||
IRuntimeProxy runtimeProxy,
|
||||
ISystemSentinel sentinel,
|
||||
Action shutdown)
|
||||
{
|
||||
logger.Log($"# New client instance started at {DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}");
|
||||
logger.Log(string.Empty);
|
||||
}
|
||||
var responsibilities = new Queue<ClientResponsibility>();
|
||||
|
||||
internal void LogShutdownInformation()
|
||||
{
|
||||
logger?.Log($"# Client instance terminated at {DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}");
|
||||
responsibilities.Enqueue(new ApplicationsResponsibility(context, ModuleLogger(nameof(ApplicationsResponsibility))));
|
||||
responsibilities.Enqueue(new BrowserResponsibility(context, coordinator, ModuleLogger(nameof(BrowserResponsibility)), messageBox, runtimeProxy, splashScreen, taskbar));
|
||||
responsibilities.Enqueue(new CommunicationResponsibility(context, coordinator, ModuleLogger(nameof(CommunicationResponsibility)), messageBox, runtimeProxy, shutdown, splashScreen, text, uiFactory));
|
||||
responsibilities.Enqueue(new IntegrityResponsibility(context, ModuleLogger(nameof(IntegrityResponsibility)), text));
|
||||
responsibilities.Enqueue(new MonitoringResponsibility(actionCenter, applicationMonitor, context, coordinator, displayMonitor, explorerShell, ModuleLogger(nameof(MonitoringResponsibility)), sentinel, taskbar, text));
|
||||
responsibilities.Enqueue(new NetworkResponsibility(context, ModuleLogger(nameof(NetworkResponsibility)), networkAdapter, text, uiFactory));
|
||||
responsibilities.Enqueue(new ProctoringResponsibility(context, ModuleLogger(nameof(ProctoringResponsibility)), uiFactory));
|
||||
responsibilities.Enqueue(new ServerResponsibility(context, coordinator, ModuleLogger(nameof(ServerResponsibility)), text));
|
||||
responsibilities.Enqueue(new ShellResponsibility(actionCenter, context, new HashAlgorithm(), ModuleLogger(nameof(ShellResponsibility)), messageBox, taskbar, uiFactory));
|
||||
|
||||
return new ResponsibilityCollection<ClientTask>(logger, responsibilities);
|
||||
}
|
||||
|
||||
private void ValidateCommandLineArguments()
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
|
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SafeExamBrowser.Applications.Contracts;
|
||||
using SafeExamBrowser.Client.Operations.Events;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
@@ -17,29 +17,40 @@ using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Monitoring.Contracts.Applications;
|
||||
using SafeExamBrowser.Settings.Applications;
|
||||
using SafeExamBrowser.Settings.Security;
|
||||
using SafeExamBrowser.UserInterface.Contracts.FileSystemDialog;
|
||||
using SafeExamBrowser.UserInterface.Contracts.MessageBox;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Windows;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class ApplicationOperation : ClientOperation
|
||||
{
|
||||
private IApplicationFactory factory;
|
||||
private ILogger logger;
|
||||
private IApplicationMonitor monitor;
|
||||
private IText text;
|
||||
private readonly IApplicationFactory factory;
|
||||
private readonly IFileSystemDialog fileSystemDialog;
|
||||
private readonly ILogger logger;
|
||||
private readonly IMessageBox messageBox;
|
||||
private readonly IApplicationMonitor monitor;
|
||||
private readonly ISplashScreen splashScreen;
|
||||
private readonly IText text;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired;
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ApplicationOperation(
|
||||
ClientContext context,
|
||||
IApplicationFactory factory,
|
||||
IApplicationMonitor monitor,
|
||||
IFileSystemDialog fileSystemDialog,
|
||||
ILogger logger,
|
||||
IMessageBox messageBox,
|
||||
IApplicationMonitor monitor,
|
||||
ISplashScreen splashScreen,
|
||||
IText text) : base(context)
|
||||
{
|
||||
this.factory = factory;
|
||||
this.monitor = monitor;
|
||||
this.fileSystemDialog = fileSystemDialog;
|
||||
this.logger = logger;
|
||||
this.messageBox = messageBox;
|
||||
this.monitor = monitor;
|
||||
this.splashScreen = splashScreen;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@@ -100,13 +111,9 @@ namespace SafeExamBrowser.Client.Operations
|
||||
|
||||
while (result == FactoryResult.NotFound && settings.AllowCustomPath)
|
||||
{
|
||||
var args = new ApplicationNotFoundEventArgs(settings.DisplayName, settings.ExecutableName);
|
||||
|
||||
ActionRequired?.Invoke(args);
|
||||
|
||||
if (args.Success)
|
||||
if (TryAskForApplicationPath(settings.DisplayName, settings.ExecutableName, out var customPath))
|
||||
{
|
||||
settings.ExecutablePath = args.CustomPath;
|
||||
settings.ExecutablePath = customPath;
|
||||
result = factory.TryCreate(settings, out application);
|
||||
}
|
||||
else
|
||||
@@ -122,7 +129,7 @@ namespace SafeExamBrowser.Client.Operations
|
||||
else
|
||||
{
|
||||
logger.Error($"Failed to initialize application '{settings.DisplayName}' ({settings.ExecutableName}). Reason: {result}.");
|
||||
ActionRequired?.Invoke(new ApplicationInitializationFailedEventArgs(settings.DisplayName, settings.ExecutableName, result));
|
||||
InformAboutFailedApplicationInitialization(settings.DisplayName, settings.ExecutableName, result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +144,7 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private OperationResult HandleAutoTerminationFailure(IList<RunningApplication> applications)
|
||||
{
|
||||
logger.Error($"{applications.Count} application(s) could not be automatically terminated: {string.Join(", ", applications.Select(a => a.Name))}");
|
||||
ActionRequired?.Invoke(new ApplicationTerminationFailedEventArgs(applications));
|
||||
InformAboutFailedApplicationTermination(applications);
|
||||
|
||||
return OperationResult.Failed;
|
||||
}
|
||||
@@ -158,20 +165,18 @@ namespace SafeExamBrowser.Client.Operations
|
||||
}
|
||||
}
|
||||
|
||||
private OperationResult TryTerminate(IEnumerable<RunningApplication> runningApplications)
|
||||
private OperationResult TryTerminate(IEnumerable<RunningApplication> applications)
|
||||
{
|
||||
var args = new ApplicationTerminationEventArgs(runningApplications);
|
||||
var failed = new List<RunningApplication>();
|
||||
var result = OperationResult.Success;
|
||||
|
||||
logger.Info($"The following applications need to be terminated: {string.Join(", ", runningApplications.Select(a => a.Name))}.");
|
||||
ActionRequired?.Invoke(args);
|
||||
logger.Info($"The following applications need to be terminated: {string.Join(", ", applications.Select(a => a.Name))}.");
|
||||
|
||||
if (args.TerminateProcesses)
|
||||
if (TryAskForAutomaticApplicationTermination(applications))
|
||||
{
|
||||
logger.Info($"The user chose to automatically terminate all running applications.");
|
||||
|
||||
foreach (var application in runningApplications)
|
||||
foreach (var application in applications)
|
||||
{
|
||||
var success = monitor.TryTerminate(application);
|
||||
|
||||
@@ -195,10 +200,58 @@ namespace SafeExamBrowser.Client.Operations
|
||||
|
||||
if (failed.Any())
|
||||
{
|
||||
ActionRequired?.Invoke(new ApplicationTerminationFailedEventArgs(failed));
|
||||
InformAboutFailedApplicationTermination(failed);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void InformAboutFailedApplicationInitialization(string displayName, string executableName, FactoryResult result)
|
||||
{
|
||||
var messageKey = TextKey.MessageBox_ApplicationInitializationFailure;
|
||||
var titleKey = TextKey.MessageBox_ApplicationInitializationFailureTitle;
|
||||
|
||||
if (result == FactoryResult.NotFound)
|
||||
{
|
||||
messageKey = TextKey.MessageBox_ApplicationNotFound;
|
||||
titleKey = TextKey.MessageBox_ApplicationNotFoundTitle;
|
||||
}
|
||||
|
||||
var message = text.Get(messageKey).Replace("%%NAME%%", $"'{displayName}' ({executableName})");
|
||||
var title = text.Get(titleKey);
|
||||
|
||||
messageBox.Show(message, title, icon: MessageBoxIcon.Error, parent: splashScreen);
|
||||
}
|
||||
|
||||
private void InformAboutFailedApplicationTermination(IEnumerable<RunningApplication> applications)
|
||||
{
|
||||
var applicationList = string.Join(Environment.NewLine, applications.Select(a => a.Name));
|
||||
var message = $"{text.Get(TextKey.MessageBox_ApplicationTerminationFailure)}{Environment.NewLine}{Environment.NewLine}{applicationList}";
|
||||
var title = text.Get(TextKey.MessageBox_ApplicationTerminationFailureTitle);
|
||||
|
||||
messageBox.Show(message, title, icon: MessageBoxIcon.Error, parent: splashScreen);
|
||||
}
|
||||
|
||||
private bool TryAskForApplicationPath(string displayName, string executableName, out string customPath)
|
||||
{
|
||||
var message = text.Get(TextKey.FolderDialog_ApplicationLocation).Replace("%%NAME%%", displayName).Replace("%%EXECUTABLE%%", executableName);
|
||||
var result = fileSystemDialog.Show(FileSystemElement.Folder, FileSystemOperation.Open, message: message, parent: splashScreen);
|
||||
|
||||
customPath = result.FullPath;
|
||||
|
||||
return result.Success;
|
||||
}
|
||||
|
||||
private bool TryAskForAutomaticApplicationTermination(IEnumerable<RunningApplication> applications)
|
||||
{
|
||||
var nl = Environment.NewLine;
|
||||
var applicationList = string.Join(Environment.NewLine, applications.Select(a => a.Name));
|
||||
var warning = text.Get(TextKey.MessageBox_ApplicationAutoTerminationDataLossWarning);
|
||||
var message = $"{text.Get(TextKey.MessageBox_ApplicationAutoTerminationQuestion)}{nl}{nl}{warning}{nl}{nl}{applicationList}";
|
||||
var title = text.Get(TextKey.MessageBox_ApplicationAutoTerminationQuestionTitle);
|
||||
var result = messageBox.Show(message, title, MessageBoxAction.YesNo, MessageBoxIcon.Question, parent: splashScreen);
|
||||
|
||||
return result == MessageBoxResult.Yes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -23,7 +23,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private readonly ITaskview taskview;
|
||||
private readonly IUserInterfaceFactory uiFactory;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public BrowserOperation(
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -21,10 +21,9 @@ namespace SafeExamBrowser.Client.Operations
|
||||
/// </summary>
|
||||
internal class ClientHostDisconnectionOperation : ClientOperation
|
||||
{
|
||||
private ILogger logger;
|
||||
private int timeout_ms;
|
||||
private readonly ILogger logger;
|
||||
private readonly int timeout_ms;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ClientHostDisconnectionOperation(ClientContext context, ILogger logger, int timeout_ms) : base(context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -18,7 +18,11 @@ namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
protected ClientContext Context { get; private set; }
|
||||
|
||||
public abstract event ActionRequiredEventHandler ActionRequired;
|
||||
/// <summary>
|
||||
/// TODO: In case this event is neither used by the runtime, either remove it completely or then move it to a separate interface!
|
||||
/// </summary>
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
|
||||
public abstract event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ClientOperation(ClientContext context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -19,7 +19,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private readonly IClipboard clipboard;
|
||||
private readonly ILogger logger;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ClipboardOperation(ClientContext context, IClipboard clipboard, ILogger logger) : base(context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -19,7 +19,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private readonly ILogger logger;
|
||||
private readonly IRuntimeProxy runtime;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ConfigurationOperation(ClientContext context, ILogger logger, IRuntimeProxy runtime) : base(context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -21,7 +21,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private readonly ILogger logger;
|
||||
private readonly ITaskbar taskbar;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public DisplayMonitorOperation(ClientContext context, IDisplayMonitor displayMonitor, ILogger logger, ITaskbar taskbar) : base(context)
|
||||
|
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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 SafeExamBrowser.Applications.Contracts;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations.Events
|
||||
{
|
||||
internal class ApplicationInitializationFailedEventArgs : ActionRequiredEventArgs
|
||||
{
|
||||
internal string DisplayName { get; }
|
||||
internal string ExecutableName { get; }
|
||||
internal FactoryResult Result { get; }
|
||||
|
||||
internal ApplicationInitializationFailedEventArgs(string displayName, string executableName, FactoryResult result)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
ExecutableName = executableName;
|
||||
Result = result;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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 SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations.Events
|
||||
{
|
||||
internal class ApplicationNotFoundEventArgs : ActionRequiredEventArgs
|
||||
{
|
||||
internal string CustomPath { get; set; }
|
||||
internal string DisplayName { get; }
|
||||
internal string ExecutableName { get; }
|
||||
internal bool Success { get; set; }
|
||||
|
||||
internal ApplicationNotFoundEventArgs(string displayName, string executableName)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
ExecutableName = executableName;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.Monitoring.Contracts.Applications;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations.Events
|
||||
{
|
||||
internal class ApplicationTerminationEventArgs : ActionRequiredEventArgs
|
||||
{
|
||||
internal IEnumerable<RunningApplication> RunningApplications { get; }
|
||||
internal bool TerminateProcesses { get; set; }
|
||||
|
||||
internal ApplicationTerminationEventArgs(IEnumerable<RunningApplication> runningApplications)
|
||||
{
|
||||
RunningApplications = runningApplications;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.Monitoring.Contracts.Applications;
|
||||
|
||||
namespace SafeExamBrowser.Client.Operations.Events
|
||||
{
|
||||
internal class ApplicationTerminationFailedEventArgs : ActionRequiredEventArgs
|
||||
{
|
||||
internal IEnumerable<RunningApplication> Applications { get; }
|
||||
|
||||
internal ApplicationTerminationFailedEventArgs(IEnumerable<RunningApplication> applications)
|
||||
{
|
||||
Applications = applications;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -16,10 +16,9 @@ namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class KeyboardInterceptorOperation : ClientOperation
|
||||
{
|
||||
private IKeyboardInterceptor keyboardInterceptor;
|
||||
private ILogger logger;
|
||||
private readonly IKeyboardInterceptor keyboardInterceptor;
|
||||
private readonly ILogger logger;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public KeyboardInterceptorOperation(ClientContext context, IKeyboardInterceptor keyboardInterceptor, ILogger logger) : base(context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -16,10 +16,9 @@ namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class MouseInterceptorOperation : ClientOperation
|
||||
{
|
||||
private ILogger logger;
|
||||
private IMouseInterceptor mouseInterceptor;
|
||||
private readonly ILogger logger;
|
||||
private readonly IMouseInterceptor mouseInterceptor;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public MouseInterceptorOperation(ClientContext context, ILogger logger, IMouseInterceptor mouseInterceptor) : base(context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -25,7 +25,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private readonly ITaskbar taskbar;
|
||||
private readonly IUserInterfaceFactory uiFactory;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ProctoringOperation(
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -17,11 +17,10 @@ namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class RuntimeConnectionOperation : ClientOperation
|
||||
{
|
||||
private ILogger logger;
|
||||
private IRuntimeProxy runtime;
|
||||
private readonly ILogger logger;
|
||||
private readonly IRuntimeProxy runtime;
|
||||
private Guid token;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public RuntimeConnectionOperation(ClientContext context, ILogger logger, IRuntimeProxy runtime, Guid token) : base(context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -20,7 +20,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private readonly ILogger logger;
|
||||
private readonly IServerProxy server;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ServerOperation(ClientContext context, ILogger logger, IServerProxy server) : base(context)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
* Copyright (c) 2025 ETH Zürich, IT Services
|
||||
*
|
||||
* 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
|
||||
@@ -40,7 +40,6 @@ namespace SafeExamBrowser.Client.Operations
|
||||
private readonly IText text;
|
||||
private readonly IUserInterfaceFactory uiFactory;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ShellOperation(
|
||||
|
@@ -10,7 +10,7 @@ using System.Windows;
|
||||
[assembly: AssemblyDescription("Safe Exam Browser")]
|
||||
[assembly: AssemblyCompany("ETH Zürich")]
|
||||
[assembly: AssemblyProduct("SafeExamBrowser.Client")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024 ETH Zürich, IT Services")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025 ETH Zürich, IT Services")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
@@ -51,6 +51,6 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("3.8.0.742")]
|
||||
[assembly: AssemblyFileVersion("3.8.0.742")]
|
||||
[assembly: AssemblyInformationalVersion("3.8.0.742")]
|
||||
[assembly: AssemblyVersion("3.9.0.787")]
|
||||
[assembly: AssemblyFileVersion("3.9.0.787")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.0")]
|
||||
|
@@ -78,11 +78,8 @@
|
||||
<Compile Include="Coordinator.cs" />
|
||||
<Compile Include="Operations\ClientHostDisconnectionOperation.cs" />
|
||||
<Compile Include="Operations\ClientOperation.cs" />
|
||||
<Compile Include="Operations\ClientOperationSequence.cs" />
|
||||
<Compile Include="Operations\ConfigurationOperation.cs" />
|
||||
<Compile Include="Operations\Events\ApplicationNotFoundEventArgs.cs" />
|
||||
<Compile Include="Operations\Events\ApplicationInitializationFailedEventArgs.cs" />
|
||||
<Compile Include="Operations\Events\ApplicationTerminationEventArgs.cs" />
|
||||
<Compile Include="Operations\Events\ApplicationTerminationFailedEventArgs.cs" />
|
||||
<Compile Include="Operations\ProctoringOperation.cs" />
|
||||
<Compile Include="Operations\RuntimeConnectionOperation.cs" />
|
||||
<Compile Include="Communication\ClientHost.cs" />
|
||||
@@ -110,6 +107,17 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Responsibilities\ApplicationsResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\BrowserResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\CommunicationResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\ClientResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\IntegrityResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\MonitoringResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\NetworkResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\ProctoringResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\ClientTask.cs" />
|
||||
<Compile Include="Responsibilities\ServerResponsibility.cs" />
|
||||
<Compile Include="Responsibilities\ShellResponsibility.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
Reference in New Issue
Block a user