Update Safe Exam Browser Patch to 3.10.0.826
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NAudio.CoreAudioApi;
|
||||
using SafeExamBrowser.Settings.SystemComponents;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Settings.SystemComponents;
|
||||
using SafeExamBrowser.SystemComponents.Contracts.Audio;
|
||||
using SafeExamBrowser.SystemComponents.Contracts.Audio.Events;
|
||||
|
||||
@@ -18,12 +18,14 @@ namespace SafeExamBrowser.SystemComponents.Audio
|
||||
{
|
||||
public class Audio : IAudio
|
||||
{
|
||||
private AudioSettings settings;
|
||||
private readonly ILogger logger;
|
||||
private readonly AudioSettings settings;
|
||||
|
||||
private MMDevice audioDevice;
|
||||
private string audioDeviceFullName;
|
||||
private string audioDeviceShortName;
|
||||
private bool originallyMuted;
|
||||
private float originalVolume;
|
||||
private ILogger logger;
|
||||
|
||||
public string DeviceFullName => audioDeviceFullName ?? string.Empty;
|
||||
public string DeviceShortName => audioDeviceShortName ?? string.Empty;
|
||||
@@ -130,6 +132,7 @@ namespace SafeExamBrowser.SystemComponents.Audio
|
||||
|
||||
if (settings.MuteAudio)
|
||||
{
|
||||
originallyMuted = audioDevice.AudioEndpointVolume.Mute;
|
||||
audioDevice.AudioEndpointVolume.Mute = true;
|
||||
logger.Info("Muted audio device.");
|
||||
}
|
||||
@@ -145,8 +148,8 @@ namespace SafeExamBrowser.SystemComponents.Audio
|
||||
|
||||
if (settings.MuteAudio)
|
||||
{
|
||||
audioDevice.AudioEndpointVolume.Mute = false;
|
||||
logger.Info("Unmuted audio device.");
|
||||
audioDevice.AudioEndpointVolume.Mute = originallyMuted;
|
||||
logger.Info($"Reverted audio device to {(originallyMuted ? "muted" : "unmuted")}.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -109,6 +109,30 @@ namespace SafeExamBrowser.SystemComponents.Network
|
||||
logger.Info("Started monitoring the network adapter.");
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Requesting access is required as of fall 2024 and must be granted manually by the user, otherwise all wireless functionality will
|
||||
/// be denied by the system (see also https://learn.microsoft.com/en-us/windows/win32/nativewifi/wi-fi-access-location-changes).
|
||||
/// </remarks>
|
||||
public bool RequestAccess()
|
||||
{
|
||||
var granted = false;
|
||||
|
||||
try
|
||||
{
|
||||
var task = WiFiAdapter.RequestAccessAsync().AsTask();
|
||||
var status = task.GetAwaiter().GetResult();
|
||||
|
||||
granted = status == WiFiAccessStatus.Allowed;
|
||||
logger.Debug($"Requested access to wireless networking functionality: {status}.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error("Failed to request access to wireless networking functionality!", e);
|
||||
}
|
||||
|
||||
return granted;
|
||||
}
|
||||
|
||||
public void StartWirelessNetworkScanning()
|
||||
{
|
||||
timer?.Start();
|
||||
@@ -209,8 +233,6 @@ namespace SafeExamBrowser.SystemComponents.Network
|
||||
{
|
||||
try
|
||||
{
|
||||
// Requesting access is required as of fall 2024 and must be granted manually by the user, otherwise all wireless functionality will
|
||||
// be denied by the system (see also https://learn.microsoft.com/en-us/windows/win32/nativewifi/wi-fi-access-location-changes).
|
||||
var task = WiFiAdapter.RequestAccessAsync().AsTask();
|
||||
var status = task.GetAwaiter().GetResult();
|
||||
|
||||
|
@@ -96,7 +96,7 @@
|
||||
<Version>5.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Windows.SDK.Contracts">
|
||||
<Version>10.0.26100.1742</Version>
|
||||
<Version>10.0.26100.4948</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NAudio">
|
||||
<Version>2.2.1</Version>
|
||||
|
Reference in New Issue
Block a user