diff --git a/SafeExamBrowser.Client/Operations/ConfigurationOperation.cs b/SafeExamBrowser.Client/Operations/ConfigurationOperation.cs index 48b1379f..c6151e9e 100644 --- a/SafeExamBrowser.Client/Operations/ConfigurationOperation.cs +++ b/SafeExamBrowser.Client/Operations/ConfigurationOperation.cs @@ -16,8 +16,8 @@ namespace SafeExamBrowser.Client.Operations { internal class ConfigurationOperation : ClientOperation { - private ILogger logger; - private IRuntimeProxy runtime; + private readonly ILogger logger; + private readonly IRuntimeProxy runtime; public override event ActionRequiredEventHandler ActionRequired { add { } remove { } } public override event StatusChangedEventHandler StatusChanged; @@ -45,6 +45,8 @@ namespace SafeExamBrowser.Client.Operations logger.Info($" -> Runtime-ID: {Context.AppConfig.RuntimeId}"); logger.Info($" -> Session-ID: {Context.SessionId}"); + logger.Warn($"Power Supply Thresholds: Low = {configuration.Settings.PowerSupply.ChargeThresholdLow}, Critical = {configuration.Settings.PowerSupply.ChargeThresholdCritical}."); + return OperationResult.Success; } diff --git a/SafeExamBrowser.Configuration/ConfigurationRepository.cs b/SafeExamBrowser.Configuration/ConfigurationRepository.cs index 5d964664..d787264c 100644 --- a/SafeExamBrowser.Configuration/ConfigurationRepository.cs +++ b/SafeExamBrowser.Configuration/ConfigurationRepository.cs @@ -119,13 +119,17 @@ namespace SafeExamBrowser.Configuration public LoadStatus TryLoadSettings(Uri resource, out AppSettings settings, PasswordParameters password = null) { + var status = default(LoadStatus); + settings = LoadDefaultSettings(); logger.Info($"Initialized default settings, now attempting to load '{resource}'..."); + logger.Warn($"Power Supply Thresholds: Low = {settings.PowerSupply.ChargeThresholdLow}, Critical = {settings.PowerSupply.ChargeThresholdCritical}."); + try { - var status = TryLoadData(resource, out var stream); + status = TryLoadData(resource, out var stream); using (stream) { @@ -133,22 +137,28 @@ namespace SafeExamBrowser.Configuration { status = TryParseData(stream, out _, out _, out var data, password); + data.TryGetValue(Keys.UserInterface.SystemControls.PowerSupply.ChargeThresholdCritical, out var critical); + data.TryGetValue(Keys.UserInterface.SystemControls.PowerSupply.ChargeThresholdLow, out var low); + + logger.Warn($"Power Supply Thresholds: Low (raw) = {low}, Critical (raw) = {critical}."); + if (status == LoadStatus.Success) { dataMapper.MapRawDataToSettings(data, settings); dataProcessor.Process(data, settings); } } - - return status; } } catch (Exception e) { + status = LoadStatus.UnexpectedError; logger.Error($"Unexpected error while trying to load '{resource}'!", e); - - return LoadStatus.UnexpectedError; } + + logger.Warn($"Power Supply Thresholds: Low = {settings.PowerSupply.ChargeThresholdLow}, Critical = {settings.PowerSupply.ChargeThresholdCritical}."); + + return status; } private EncryptionParameters DetermineEncryptionForClientConfiguration(IDictionary data, EncryptionParameters encryption)