Restore SEBPatch

This commit is contained in:
2025-06-01 11:44:20 +02:00
commit 8c656e3137
1297 changed files with 142172 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the purpose of a <see cref="ICredentialsDialog"/>.
/// </summary>
public enum CredentialsDialogPurpose
{
/// <summary>
/// Credentials for generic purposes.
/// </summary>
Generic,
/// <summary>
/// Credentials for wireless network authentication.
/// </summary>
WirelessNetwork
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="ICredentialsDialog"/>.
/// </summary>
public class CredentialsDialogResult
{
/// <summary>
/// The password entered by the user, or <c>default(string)</c> if the interaction was unsuccessful.
/// </summary>
public string Password { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
/// <summary>
/// The username entered by the user, or <c>default(string)</c> if no username is required or the interaction was unsuccessful.
/// </summary>
public string Username { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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.Server.Contracts.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="IExamSelectionDialog"/>.
/// </summary>
public class ExamSelectionDialogResult
{
/// <summary>
/// The exam selected by the user.
/// </summary>
public Exam SelectedExam { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
/*
* 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;
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines an option for the user to select on the <see cref="ILockScreen"/>.
/// </summary>
public class LockScreenOption
{
/// <summary>
/// The unique identifier for this option.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// The text to be displayed to the user.
/// </summary>
public string Text { get; set; }
public LockScreenOption()
{
Id = Guid.NewGuid();
}
}
}

View File

@@ -0,0 +1,33 @@
/*
* 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;
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the result of a lock screen interaction by the user.
/// </summary>
public class LockScreenResult
{
/// <summary>
/// Indicates that the lock screen has been canceled (e.g. via a server instruction).
/// </summary>
public bool Canceled { get; set; }
/// <summary>
/// The identifier of the option selected by the user, if available.
/// </summary>
public Guid? OptionId { get; set; }
/// <summary>
/// The password entered by the user.
/// </summary>
public string Password { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
/*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="IPasswordDialog"/>.
/// </summary>
public class PasswordDialogResult
{
/// <summary>
/// The password entered by the user, or <c>null</c> if the interaction was unsuccessful.
/// </summary>
public string Password { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Data
{
/// <summary>
/// Defines the user interaction result of an <see cref="IServerFailureDialog"/>.
/// </summary>
public class ServerFailureDialogResult
{
/// <summary>
/// Indicates whether the user wants to abort the operation.
/// </summary>
public bool Abort { get; set; }
/// <summary>
/// Indicates whether the user wants to performa a fallback.
/// </summary>
public bool Fallback { get; set; }
/// <summary>
/// Indicates whether the user wants to retry the operation.
/// </summary>
public bool Retry { get; set; }
/// <summary>
/// Indicates whether the user confirmed the dialog or not.
/// </summary>
public bool Success { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
/*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Events
{
/// <summary>
/// Indicates that a window has been closed.
/// </summary>
public delegate void WindowClosedEventHandler();
}

View File

@@ -0,0 +1,15 @@
/*
* 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/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Windows.Events
{
/// <summary>
/// Indicates that a window is about to be closed.
/// </summary>
public delegate void WindowClosingEventHandler();
}

View File

@@ -0,0 +1,23 @@
/*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a dialog to retrieve user credentials.
/// </summary>
public interface ICredentialsDialog : IWindow
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
CredentialsDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,23 @@
/*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// The dialog shown to let the user select which server exam to start.
/// </summary>
public interface IExamSelectionDialog
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
ExamSelectionDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,33 @@
/*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a lock screen which covers all active displays and prevents the user from continuing their work.
/// </summary>
public interface ILockScreen : IWindow
{
/// <summary>
/// Cancels the <see cref="WaitForResult"/> operation and closes the lock screen.
/// </summary>
void Cancel();
/// <summary>
/// Expands the lock screen across all active displays and resizes it accordingly.
/// </summary>
void InitializeBounds();
/// <summary>
/// Waits for the user to provide the required input to unlock the application.
/// </summary>
LockScreenResult WaitForResult();
}
}

View File

@@ -0,0 +1,23 @@
/*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a password dialog.
/// </summary>
public interface IPasswordDialog : IWindow
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
PasswordDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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.Logging.Contracts;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// The main window of the runtime application component. It is controlled by the <see cref="Behaviour.IRuntimeController"/> and serves
/// first of all as progress indicator for the user (e.g. during application startup &amp; shutdown).
/// </summary>
public interface IRuntimeWindow : ILogObserver, IProgressIndicator, IWindow
{
/// <summary>
/// Determines whether the application log is visible.
/// </summary>
bool ShowLog { set; }
/// <summary>
/// Determines whether the progress bar is visible.
/// </summary>
bool ShowProgressBar { set; }
/// <summary>
/// Determines whether the window will stay on top of other windows.
/// </summary>
bool TopMost { set; }
}
}

View File

@@ -0,0 +1,23 @@
/*
* 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.UserInterface.Contracts.Windows.Data;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// The dialog shown in case a communication failure with a server occurs.
/// </summary>
public interface IServerFailureDialog
{
/// <summary>
/// Shows the dialog as topmost window. If a parent window is specified, the dialog is rendered modally for the given parent.
/// </summary>
ServerFailureDialogResult Show(IWindow parent = null);
}
}

View File

@@ -0,0 +1,23 @@
/*
* 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.Configuration.Contracts;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a splash screen.
/// </summary>
public interface ISplashScreen : IProgressIndicator, IWindow
{
/// <summary>
/// The global configuration used to display version and copyright information. Can be updated during the execution of a procedure.
/// </summary>
AppConfig AppConfig { set; }
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.UserInterface.Contracts.Windows.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Windows
{
/// <summary>
/// Defines the functionality of a window.
/// </summary>
public interface IWindow
{
/// <summary>
/// Event fired when the window has been closed;
/// </summary>
event WindowClosedEventHandler Closed;
/// <summary>
/// Event fired when the window is closing.
/// </summary>
event WindowClosingEventHandler Closing;
/// <summary>
/// Brings the window to the foreground.
/// </summary>
void BringToForeground();
/// <summary>
/// Closes the window.
/// </summary>
void Close();
/// <summary>
/// Hides the window.
/// </summary>
void Hide();
/// <summary>
/// Shows the window to the user.
/// </summary>
void Show();
}
}