2017-10-10 10:17:28 +02:00
|
|
|
|
/*
|
2018-01-16 08:24:00 +01:00
|
|
|
|
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
|
2017-10-10 10:17:28 +02: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.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
2018-02-01 08:37:12 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Behaviour.Operations;
|
2017-10-10 10:17:28 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.I18n;
|
|
|
|
|
using SafeExamBrowser.Contracts.Logging;
|
|
|
|
|
using SafeExamBrowser.Contracts.UserInterface;
|
|
|
|
|
using SafeExamBrowser.Core.I18n;
|
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.Core.Behaviour.Operations
|
|
|
|
|
{
|
|
|
|
|
public class I18nOperation : IOperation
|
|
|
|
|
{
|
|
|
|
|
private ILogger logger;
|
|
|
|
|
private IText text;
|
|
|
|
|
|
2018-02-01 08:37:12 +01:00
|
|
|
|
public bool Abort { get; private set; }
|
2018-02-02 09:18:35 +01:00
|
|
|
|
public IProgressIndicator ProgressIndicator { private get; set; }
|
2017-10-10 10:17:28 +02:00
|
|
|
|
|
|
|
|
|
public I18nOperation(ILogger logger, IText text)
|
|
|
|
|
{
|
|
|
|
|
this.logger = logger;
|
|
|
|
|
this.text = text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Perform()
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"Loading default text data (the currently active culture is '{CultureInfo.CurrentCulture.Name}')...");
|
|
|
|
|
|
|
|
|
|
var location = Assembly.GetAssembly(typeof(XmlTextResource)).Location;
|
|
|
|
|
var path = Path.GetDirectoryName(location) + $@"\{nameof(I18n)}\Text.xml";
|
|
|
|
|
var textResource = new XmlTextResource(path);
|
|
|
|
|
|
|
|
|
|
text.Initialize(textResource);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-01 08:37:12 +01:00
|
|
|
|
public void Repeat()
|
|
|
|
|
{
|
|
|
|
|
// Nothing to do here...
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 10:17:28 +02:00
|
|
|
|
public void Revert()
|
|
|
|
|
{
|
|
|
|
|
// Nothing to do here...
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|