2018-12-21 11:36:20 +01:00
|
|
|
|
/*
|
2022-01-21 16:33:52 +01:00
|
|
|
|
* Copyright (c) 2022 ETH Zürich, Educational Development and Technology (LET)
|
2018-12-21 11:36:20 +01:00
|
|
|
|
*
|
|
|
|
|
* 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;
|
2019-12-20 10:03:47 +01:00
|
|
|
|
using SafeExamBrowser.Configuration.ConfigurationData.DataMapping;
|
2019-09-06 09:39:28 +02:00
|
|
|
|
using SafeExamBrowser.Settings;
|
2018-12-21 11:36:20 +01:00
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.Configuration.ConfigurationData
|
|
|
|
|
{
|
2019-12-20 17:06:28 +01:00
|
|
|
|
internal class DataMapper
|
2018-12-21 11:36:20 +01:00
|
|
|
|
{
|
2019-12-20 10:03:47 +01:00
|
|
|
|
private BaseDataMapper[] mappers =
|
|
|
|
|
{
|
|
|
|
|
new ApplicationDataMapper(),
|
|
|
|
|
new AudioDataMapper(),
|
|
|
|
|
new BrowserDataMapper(),
|
|
|
|
|
new ConfigurationFileDataMapper(),
|
2021-05-30 20:04:44 +02:00
|
|
|
|
new DisplayDataMapper(),
|
2019-12-20 10:03:47 +01:00
|
|
|
|
new GeneralDataMapper(),
|
|
|
|
|
new InputDataMapper(),
|
2021-02-10 00:49:32 +01:00
|
|
|
|
new ProctoringDataMapper(),
|
2019-12-20 10:03:47 +01:00
|
|
|
|
new SecurityDataMapper(),
|
2020-07-22 18:11:51 +02:00
|
|
|
|
new ServerDataMapper(),
|
2020-02-28 15:00:17 +01:00
|
|
|
|
new ServiceDataMapper(),
|
2019-12-20 10:03:47 +01:00
|
|
|
|
new UserInterfaceDataMapper()
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-01 11:30:53 +02:00
|
|
|
|
internal void MapRawDataToSettings(IDictionary<string, object> rawData, AppSettings settings)
|
2018-12-21 11:36:20 +01:00
|
|
|
|
{
|
|
|
|
|
foreach (var item in rawData)
|
|
|
|
|
{
|
2019-12-20 10:03:47 +01:00
|
|
|
|
foreach (var mapper in mappers)
|
|
|
|
|
{
|
|
|
|
|
mapper.Map(item.Key, item.Value, settings);
|
|
|
|
|
}
|
2019-05-08 09:56:34 +02:00
|
|
|
|
}
|
2019-12-19 15:02:40 +01:00
|
|
|
|
|
2019-12-20 10:03:47 +01:00
|
|
|
|
foreach (var mapper in mappers)
|
2019-05-08 09:56:34 +02:00
|
|
|
|
{
|
2019-12-20 10:03:47 +01:00
|
|
|
|
mapper.MapGlobal(rawData, settings);
|
2018-12-21 11:36:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|