Restore SEBPatch
This commit is contained in:
@@ -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.SystemComponents.Contracts.Audio.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the volume of the system audio component has changed.
|
||||
/// </summary>
|
||||
public delegate void VolumeChangedEventHandler(double volume, bool muted);
|
||||
}
|
63
SafeExamBrowser.SystemComponents.Contracts/Audio/IAudio.cs
Normal file
63
SafeExamBrowser.SystemComponents.Contracts/Audio/IAudio.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.SystemComponents.Contracts.Audio.Events;
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the functionality of the audio system component.
|
||||
/// </summary>
|
||||
public interface IAudio : ISystemComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The full name of the audio device, or an empty string if not available.
|
||||
/// </summary>
|
||||
string DeviceFullName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The short audio device name, or an empty string if not available.
|
||||
/// </summary>
|
||||
string DeviceShortName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether an audio output device is available.
|
||||
/// </summary>
|
||||
bool HasOutputDevice { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the audio output is currently muted.
|
||||
/// </summary>
|
||||
bool OutputMuted { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The current audio output volume.
|
||||
/// </summary>
|
||||
double OutputVolume { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the volume of the audio device has changed.
|
||||
/// </summary>
|
||||
event VolumeChangedEventHandler VolumeChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Mutes the currently active audio device.
|
||||
/// </summary>
|
||||
void Mute();
|
||||
|
||||
/// <summary>
|
||||
/// Unmutes the currently active audio device.
|
||||
/// </summary>
|
||||
void Unmute();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the volume of the currently active audio device to the given value.
|
||||
/// </summary>
|
||||
void SetVolume(double value);
|
||||
}
|
||||
}
|
31
SafeExamBrowser.SystemComponents.Contracts/IFileSystem.cs
Normal file
31
SafeExamBrowser.SystemComponents.Contracts/IFileSystem.cs
Normal 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.SystemComponents.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to file system operations.
|
||||
/// </summary>
|
||||
public interface IFileSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates all directories and subdirectories defined by the given path.
|
||||
/// </summary>
|
||||
void CreateDirectory(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the item at the given path, if it exists. Directories will be completely deleted, including all subdirectories and files.
|
||||
/// </summary>
|
||||
void Delete(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the given content as a file under the specified path. If the file doesn't yet exist, it will be created, otherwise overwritten.
|
||||
/// </summary>
|
||||
void Save(string content, string path);
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the functionality of a system component (e.g. the power supply).
|
||||
/// </summary>
|
||||
public interface ISystemComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the resources and operations of the component.
|
||||
/// </summary>
|
||||
void Initialize();
|
||||
|
||||
/// <summary>
|
||||
/// Instructs the component to stop any running operations and releases all used resources.
|
||||
/// </summary>
|
||||
void Terminate();
|
||||
}
|
||||
}
|
74
SafeExamBrowser.SystemComponents.Contracts/ISystemInfo.cs
Normal file
74
SafeExamBrowser.SystemComponents.Contracts/ISystemInfo.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 System.IO;
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides access to information about the computer system.
|
||||
/// </summary>
|
||||
public interface ISystemInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The manufacturer and name of the BIOS.
|
||||
/// </summary>
|
||||
string BiosInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the CPU.
|
||||
/// </summary>
|
||||
string CpuName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Reveals whether the computer system contains a battery.
|
||||
/// </summary>
|
||||
bool HasBattery { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The MAC address of the network adapter.
|
||||
/// </summary>
|
||||
string MacAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The manufacturer name of the computer system.
|
||||
/// </summary>
|
||||
string Manufacturer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The model name of the computer system.
|
||||
/// </summary>
|
||||
string Model { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The machine name of the computer system.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Reveals the version of the currently running operating system.
|
||||
/// </summary>
|
||||
OperatingSystem OperatingSystem { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Provides detailed version information about the currently running operating system.
|
||||
/// </summary>
|
||||
string OperatingSystemInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Provides the device ID information of the user's Plug and Play devices.
|
||||
/// </summary>
|
||||
string[] PlugAndPlayDeviceIds { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all logical drives of the computer system.
|
||||
/// </summary>
|
||||
IEnumerable<DriveInfo> GetDrives();
|
||||
}
|
||||
}
|
31
SafeExamBrowser.SystemComponents.Contracts/IUserInfo.cs
Normal file
31
SafeExamBrowser.SystemComponents.Contracts/IUserInfo.cs
Normal 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.SystemComponents.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides information about the currently logged in user.
|
||||
/// </summary>
|
||||
public interface IUserInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the name of the currently logged in user.
|
||||
/// </summary>
|
||||
string GetUserName();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the security identifier of the currently logged in user.
|
||||
/// </summary>
|
||||
string GetUserSid();
|
||||
|
||||
/// <summary>
|
||||
/// Tries to retrieve the security identifier for the specified user name. Returns <c>true</c> if successful, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool TryGetSidForUser(string userName, out string sid);
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts.Keyboard.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the active keyboard layout has changed.
|
||||
/// </summary>
|
||||
public delegate void LayoutChangedEventHandler(IKeyboardLayout layout);
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.SystemComponents.Contracts.Keyboard.Events;
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts.Keyboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the functionality of the keyboard system component.
|
||||
/// </summary>
|
||||
public interface IKeyboard : ISystemComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Fired when the active keyboard layout changed.
|
||||
/// </summary>
|
||||
event LayoutChangedEventHandler LayoutChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Activates the keyboard layout with the given identifier.
|
||||
/// </summary>
|
||||
void ActivateLayout(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all currently available keyboard layouts.
|
||||
/// </summary>
|
||||
IEnumerable<IKeyboardLayout> GetLayouts();
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.SystemComponents.Contracts.Keyboard
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a keyboard layout which can be loaded by the application.
|
||||
/// </summary>
|
||||
public interface IKeyboardLayout
|
||||
{
|
||||
/// <summary>
|
||||
/// The three-letter ISO code of the culture to which this keyboard layout is associated.
|
||||
/// </summary>
|
||||
string CultureCode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The culture name of this keyboard layout.
|
||||
/// </summary>
|
||||
string CultureName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier of the keyboard layout.
|
||||
/// </summary>
|
||||
Guid Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether this is the currently active keyboard layout.
|
||||
/// </summary>
|
||||
bool IsCurrent { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of this keyboard layout.
|
||||
/// </summary>
|
||||
string LayoutName { get; }
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines all possible connection statuses which can be determined by the application.
|
||||
/// </summary>
|
||||
public enum ConnectionStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The connection status is not determinable.
|
||||
/// </summary>
|
||||
Undefined = 0,
|
||||
|
||||
/// <summary>
|
||||
/// A connection has been established.
|
||||
/// </summary>
|
||||
Connected,
|
||||
|
||||
/// <summary>
|
||||
/// A connection is being established.
|
||||
/// </summary>
|
||||
Connecting,
|
||||
|
||||
/// <summary>
|
||||
/// No connection is established.
|
||||
/// </summary>
|
||||
Disconnected
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines all possible connection types which can be determined by the application.
|
||||
/// </summary>
|
||||
public enum ConnectionType
|
||||
{
|
||||
/// <summary>
|
||||
/// The connection type cannot be determined.
|
||||
/// </summary>
|
||||
Undefined = 0,
|
||||
|
||||
/// <summary>
|
||||
/// A wired network connection.
|
||||
/// </summary>
|
||||
Wired,
|
||||
|
||||
/// <summary>
|
||||
/// A wireless network connection.
|
||||
/// </summary>
|
||||
Wireless
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts.Network.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the network adapter has changed.
|
||||
/// </summary>
|
||||
public delegate void ChangedEventHandler();
|
||||
}
|
@@ -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.SystemComponents.Contracts.Network.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// The event arguments for the <see cref="CredentialsRequiredEventHandler"/>.
|
||||
/// </summary>
|
||||
public class CredentialsRequiredEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the network which requires credentials.
|
||||
/// </summary>
|
||||
public string NetworkName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The password as specified by the user.
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the credentials could be successfully retrieved or not.
|
||||
/// </summary>
|
||||
public bool Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The username as specified by the user.
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts.Network.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that credentials are required to connect to a network.
|
||||
/// </summary>
|
||||
public delegate void CredentialsRequiredEventHandler(CredentialsRequiredEventArgs args);
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.SystemComponents.Contracts.Network.Events;
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the functionality of the network adapter system component.
|
||||
/// </summary>
|
||||
public interface INetworkAdapter : ISystemComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The connection status of the network adapter.
|
||||
/// </summary>
|
||||
ConnectionStatus Status { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the current network connection.
|
||||
/// </summary>
|
||||
ConnectionType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the network adapter has changed.
|
||||
/// </summary>
|
||||
event ChangedEventHandler Changed;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when credentials are required to connect to a network.
|
||||
/// </summary>
|
||||
event CredentialsRequiredEventHandler CredentialsRequired;
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to connect to the wireless network with the given name.
|
||||
/// </summary>
|
||||
void ConnectToWirelessNetwork(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all currently available wireless networks.
|
||||
/// </summary>
|
||||
IEnumerable<IWirelessNetwork> GetWirelessNetworks();
|
||||
|
||||
/// <summary>
|
||||
/// Starts periodically scanning the available wireless networks.
|
||||
/// </summary>
|
||||
void StartWirelessNetworkScanning();
|
||||
|
||||
/// <summary>
|
||||
/// Stops the periodical scanning of wireless networks.
|
||||
/// </summary>
|
||||
void StopWirelessNetworkScanning();
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a wireless network which can be connected to by the application.
|
||||
/// </summary>
|
||||
public interface IWirelessNetwork
|
||||
{
|
||||
/// <summary>
|
||||
/// The network name.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The signal strength of this network, from <c>0</c> (worst) to <c>100</c> (best).
|
||||
/// </summary>
|
||||
int SignalStrength { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The connection status of this network.
|
||||
/// </summary>
|
||||
ConnectionStatus Status { get; }
|
||||
}
|
||||
}
|
@@ -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/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines all operating systems supported by the application.
|
||||
/// </summary>
|
||||
public enum OperatingSystem
|
||||
{
|
||||
Unknown = 0,
|
||||
Windows7,
|
||||
Windows8,
|
||||
Windows8_1,
|
||||
Windows10,
|
||||
Windows11
|
||||
}
|
||||
}
|
@@ -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/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts.PowerSupply
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines all possible battery charge statuses which can be determined by the application.
|
||||
/// </summary>
|
||||
public enum BatteryChargeStatus
|
||||
{
|
||||
Undefined = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The battery charge is critical, i.e. below 20%.
|
||||
/// </summary>
|
||||
Critical,
|
||||
|
||||
/// <summary>
|
||||
/// The battery charge is low, i.e. below 35%.
|
||||
/// </summary>
|
||||
Low,
|
||||
|
||||
/// <summary>
|
||||
/// The battery charge is okay, i.e. above 35%.
|
||||
/// </summary>
|
||||
Okay
|
||||
}
|
||||
}
|
@@ -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.SystemComponents.Contracts.PowerSupply.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the status of the power supply for the system has changed.
|
||||
/// </summary>
|
||||
public delegate void StatusChangedEventHandler(IPowerSupplyStatus status);
|
||||
}
|
@@ -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.SystemComponents.Contracts.PowerSupply.Events;
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts.PowerSupply
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the functionality of the power supply.
|
||||
/// </summary>
|
||||
public interface IPowerSupply : ISystemComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Fired when the status of the power supply changed.
|
||||
/// </summary>
|
||||
event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the current status of the power supply.
|
||||
/// </summary>
|
||||
IPowerSupplyStatus GetStatus();
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.SystemComponents.Contracts.PowerSupply
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides data about the power supply of the system.
|
||||
/// </summary>
|
||||
public interface IPowerSupplyStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the current charge of the system battery: <c>0.0</c> means the battery is empty, <c>1.0</c> means it's fully charged.
|
||||
/// </summary>
|
||||
double BatteryCharge { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the current charge status of the system battery.
|
||||
/// </summary>
|
||||
BatteryChargeStatus BatteryChargeStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the time remaining until the battery is empty.
|
||||
/// </summary>
|
||||
TimeSpan BatteryTimeRemaining { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the system is connected to the power grid.
|
||||
/// </summary>
|
||||
bool IsOnline { get; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SafeExamBrowser.SystemComponents.Contracts")]
|
||||
[assembly: AssemblyDescription("Safe Exam Browser")]
|
||||
[assembly: AssemblyCompany("ETH Zürich")]
|
||||
[assembly: AssemblyProduct("SafeExamBrowser.SystemComponents.Contracts")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024 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
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("903129c6-e236-493b-9ad6-c6a57f647a3a")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.0")]
|
@@ -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.SystemComponents.Contracts.Registry.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that a registry value has changed.
|
||||
/// </summary>
|
||||
public delegate void RegistryValueChangedEventHandler(string key, string name, object oldValue, object newValue);
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.SystemComponents.Contracts.Registry.Events;
|
||||
|
||||
namespace SafeExamBrowser.SystemComponents.Contracts.Registry
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides functionality related to the Windows registry.
|
||||
/// </summary>
|
||||
public interface IRegistry
|
||||
{
|
||||
/// <summary>
|
||||
/// Fired when a registry value previously registred via <see cref="StartMonitoring(string, string)"/> has changed.
|
||||
/// </summary>
|
||||
event RegistryValueChangedEventHandler ValueChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Starts monitoring the specified registry value.
|
||||
/// </summary>
|
||||
void StartMonitoring(string key, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Stops the monitoring of all previously registered registry values.
|
||||
/// </summary>
|
||||
void StopMonitoring();
|
||||
|
||||
/// <summary>
|
||||
/// Stops the monitoring of the specified registry value.
|
||||
/// </summary>
|
||||
void StopMonitoring(string key, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to read the value of the given name under the specified registry key.
|
||||
/// </summary>
|
||||
bool TryRead(string key, string name, out object value);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to read the value names of the given registry key.
|
||||
/// </summary>
|
||||
bool TryGetNames(string key, out IEnumerable<string> names);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to read the subkey names of the given registry key.
|
||||
/// </summary>
|
||||
bool TryGetSubKeys(string key, out IEnumerable<string> subKeys);
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.SystemComponents.Contracts.Registry
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines registry values used in conjunction with <see cref="IRegistry"/>. Use the pattern "LogicalGroup_Key" resp. "LogicalGroup_Name" to
|
||||
/// allow for a better overview over all values and their usage (where applicable).
|
||||
/// </summary>
|
||||
public static class RegistryValue
|
||||
{
|
||||
/// <summary>
|
||||
/// All registry values located in the machine hive.
|
||||
/// </summary>
|
||||
public static class MachineHive
|
||||
{
|
||||
public const string AppPaths_Key = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";
|
||||
public const string EaseOfAccess_Key = @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Utilman.exe";
|
||||
public const string EaseOfAccess_Name = "Debugger";
|
||||
public const string HardwareConfig_Key = @"HKEY_LOCAL_MACHINE\SYSTEM\HardwareConfig";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All registry values located in the user hive.
|
||||
/// </summary>
|
||||
public static class UserHive
|
||||
{
|
||||
public const string Cursors_Key = @"HKEY_CURRENT_USER\Control Panel\Cursors";
|
||||
public const string Cursors_AppStarting_Name = "AppStarting";
|
||||
public const string Cursors_Arrow_Name = "Arrow";
|
||||
public const string Cursors_Crosshair_Name = "Crosshair";
|
||||
public const string Cursors_Hand_Name = "Hand";
|
||||
public const string Cursors_Help_Name = "Help";
|
||||
public const string Cursors_IBeam_Name = "IBeam";
|
||||
public const string Cursors_No_Name = "No";
|
||||
public const string Cursors_NWPen_Name = "NWPen";
|
||||
public const string Cursors_Person_Name = "Person";
|
||||
public const string Cursors_Pin_Name = "Pin";
|
||||
public const string Cursors_SizeAll_Name = "SizeAll";
|
||||
public const string Cursors_SizeNESW_Name = "SizeNESW";
|
||||
public const string Cursors_SizeNS_Name = "SizeNS";
|
||||
public const string Cursors_SizeNWSE_Name = "SizeNWSE";
|
||||
public const string Cursors_SizeWE_Name = "SizeWE";
|
||||
public const string Cursors_UpArrow_Name = "UpArrow";
|
||||
public const string Cursors_Wait_Name = "Wait";
|
||||
public const string DeviceCache_Key = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\TaskFlow\DeviceCache";
|
||||
public const string NoDrives_Key = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer";
|
||||
public const string NoDrives_Name = "NoDrives";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{903129C6-E236-493B-9AD6-C6A57F647A3A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SafeExamBrowser.SystemComponents.Contracts</RootNamespace>
|
||||
<AssemblyName>SafeExamBrowser.SystemComponents.Contracts</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Audio\Events\VolumeChangedEventHandler.cs" />
|
||||
<Compile Include="Audio\IAudio.cs" />
|
||||
<Compile Include="IFileSystem.cs" />
|
||||
<Compile Include="Network\Events\CredentialsRequiredEventArgs.cs" />
|
||||
<Compile Include="Network\Events\CredentialsRequiredEventHandler.cs" />
|
||||
<Compile Include="Registry\Events\RegistryValueChangedEventHandler.cs" />
|
||||
<Compile Include="Registry\IRegistry.cs" />
|
||||
<Compile Include="Network\ConnectionType.cs" />
|
||||
<Compile Include="PowerSupply\Events\StatusChangedEventHandler.cs" />
|
||||
<Compile Include="PowerSupply\IPowerSupply.cs" />
|
||||
<Compile Include="PowerSupply\BatteryChargeStatus.cs" />
|
||||
<Compile Include="Keyboard\Events\LayoutChangedEventHandler.cs" />
|
||||
<Compile Include="Keyboard\IKeyboard.cs" />
|
||||
<Compile Include="Keyboard\IKeyboardLayout.cs" />
|
||||
<Compile Include="ISystemComponent.cs" />
|
||||
<Compile Include="ISystemInfo.cs" />
|
||||
<Compile Include="IUserInfo.cs" />
|
||||
<Compile Include="Network\Events\ChangedEventHandler.cs" />
|
||||
<Compile Include="Network\INetworkAdapter.cs" />
|
||||
<Compile Include="Network\IWirelessNetwork.cs" />
|
||||
<Compile Include="OperatingSystem.cs" />
|
||||
<Compile Include="PowerSupply\IPowerSupplyStatus.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Network\ConnectionStatus.cs" />
|
||||
<Compile Include="Registry\RegistryValue.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Reference in New Issue
Block a user