seb-win-refactoring/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs

51 lines
1.2 KiB
C#
Raw Normal View History

/*
* 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;
2019-12-20 10:03:47 +01:00
using SafeExamBrowser.Configuration.ConfigurationData.DataMapping;
using SafeExamBrowser.Settings;
namespace SafeExamBrowser.Configuration.ConfigurationData
{
internal class DataMapper
{
private readonly BaseDataMapper[] mappers =
2019-12-20 10:03:47 +01:00
{
new ApplicationDataMapper(),
new AudioDataMapper(),
new BrowserDataMapper(),
new ConfigurationFileDataMapper(),
new DisplayDataMapper(),
2019-12-20 10:03:47 +01:00
new GeneralDataMapper(),
new InputDataMapper(),
new ProctoringDataMapper(),
2019-12-20 10:03:47 +01:00
new SecurityDataMapper(),
new ServerDataMapper(),
new ServiceDataMapper(),
new SystemDataMapper(),
2019-12-20 10:03:47 +01:00
new UserInterfaceDataMapper()
};
internal void MapRawDataToSettings(IDictionary<string, object> rawData, AppSettings settings)
{
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-12-19 15:02:40 +01:00
2019-12-20 10:03:47 +01:00
foreach (var mapper in mappers)
{
2019-12-20 10:03:47 +01:00
mapper.MapGlobal(rawData, settings);
}
}
}
}