SEBWIN-356: Changed I18n implementation to automatically load text data for current system language.
This commit is contained in:
parent
b465d498d0
commit
e5659632b9
17 changed files with 568 additions and 137 deletions
|
@ -9,8 +9,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using SafeExamBrowser.Applications;
|
||||
using SafeExamBrowser.Browser;
|
||||
using SafeExamBrowser.Client.Communication;
|
||||
|
@ -74,7 +72,6 @@ namespace SafeExamBrowser.Client
|
|||
private ITaskbar taskbar;
|
||||
private ITaskview taskview;
|
||||
private IText text;
|
||||
private ITextResource textResource;
|
||||
private IUserInterfaceFactory uiFactory;
|
||||
|
||||
internal IClientController ClientController { get; private set; }
|
||||
|
@ -83,18 +80,16 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
ValidateCommandLineArguments();
|
||||
|
||||
logger = new Logger();
|
||||
nativeMethods = new NativeMethods();
|
||||
systemInfo = new SystemInfo();
|
||||
|
||||
InitializeLogging();
|
||||
InitializeText();
|
||||
|
||||
actionCenter = BuildActionCenter();
|
||||
context = new ClientContext();
|
||||
messageBox = BuildMessageBox();
|
||||
nativeMethods = new NativeMethods();
|
||||
uiFactory = BuildUserInterfaceFactory();
|
||||
runtimeProxy = new RuntimeProxy(runtimeHostUri, new ProxyObjectFactory(), ModuleLogger(nameof(RuntimeProxy)), Interlocutor.Client);
|
||||
systemInfo = new SystemInfo();
|
||||
taskbar = BuildTaskbar();
|
||||
taskview = BuildTaskview();
|
||||
|
||||
|
@ -109,7 +104,7 @@ namespace SafeExamBrowser.Client
|
|||
|
||||
var operations = new Queue<IOperation>();
|
||||
|
||||
operations.Enqueue(new I18nOperation(logger, text, textResource));
|
||||
operations.Enqueue(new I18nOperation(logger, text));
|
||||
operations.Enqueue(new RuntimeConnectionOperation(context, logger, runtimeProxy, authenticationToken));
|
||||
operations.Enqueue(new ConfigurationOperation(context, logger, runtimeProxy));
|
||||
operations.Enqueue(new DelegateOperation(UpdateAppConfig));
|
||||
|
@ -187,17 +182,15 @@ namespace SafeExamBrowser.Client
|
|||
var logFileWriter = new LogFileWriter(new DefaultLogFormatter(), logFilePath);
|
||||
|
||||
logFileWriter.Initialize();
|
||||
|
||||
logger = new Logger();
|
||||
logger.LogLevel = logLevel;
|
||||
logger.Subscribe(logFileWriter);
|
||||
}
|
||||
|
||||
private void InitializeText()
|
||||
{
|
||||
var location = Assembly.GetAssembly(typeof(XmlTextResource)).Location;
|
||||
var path = $@"{Path.GetDirectoryName(location)}\Text.xml";
|
||||
|
||||
text = new Text(logger);
|
||||
textResource = new XmlTextResource(path);
|
||||
text = new Text(ModuleLogger(nameof(Text)));
|
||||
}
|
||||
|
||||
private IOperation BuildBrowserOperation()
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Operations;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Core.Operations;
|
||||
|
||||
namespace SafeExamBrowser.Core.UnitTests.Operations
|
||||
{
|
||||
|
@ -20,7 +20,6 @@ namespace SafeExamBrowser.Core.UnitTests.Operations
|
|||
{
|
||||
private Mock<ILogger> logger;
|
||||
private Mock<IText> text;
|
||||
private Mock<ITextResource> textResource;
|
||||
|
||||
private I18nOperation sut;
|
||||
|
||||
|
@ -29,9 +28,8 @@ namespace SafeExamBrowser.Core.UnitTests.Operations
|
|||
{
|
||||
logger = new Mock<ILogger>();
|
||||
text = new Mock<IText>();
|
||||
textResource = new Mock<ITextResource>();
|
||||
|
||||
sut = new I18nOperation(logger.Object, text.Object, textResource.Object);
|
||||
sut = new I18nOperation(logger.Object, text.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -39,7 +37,7 @@ namespace SafeExamBrowser.Core.UnitTests.Operations
|
|||
{
|
||||
var result = sut.Perform();
|
||||
|
||||
text.Verify(t => t.Initialize(It.Is<ITextResource>(r => r == textResource.Object)), Times.Once);
|
||||
text.Verify(t => t.Initialize(), Times.Once);
|
||||
|
||||
Assert.AreEqual(OperationResult.Success, result);
|
||||
}
|
||||
|
@ -48,7 +46,6 @@ namespace SafeExamBrowser.Core.UnitTests.Operations
|
|||
public void MustDoNothingOnRevert()
|
||||
{
|
||||
sut.Revert();
|
||||
|
||||
text.VerifyNoOtherCalls();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System.Globalization;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
|
@ -15,29 +14,27 @@ using SafeExamBrowser.Logging.Contracts;
|
|||
namespace SafeExamBrowser.Core.Operations
|
||||
{
|
||||
/// <summary>
|
||||
/// An operation to handle the initialization of an <see cref="IText"/> module with text data from the default directory.
|
||||
/// An operation to handle the initialization of an <see cref="IText"/> module with text data.
|
||||
/// </summary>
|
||||
public class I18nOperation : IOperation
|
||||
{
|
||||
private ILogger logger;
|
||||
private IText text;
|
||||
private ITextResource textResource;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged { add { } remove { } }
|
||||
|
||||
public I18nOperation(ILogger logger, IText text, ITextResource textResource)
|
||||
public I18nOperation(ILogger logger, IText text)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.text = text;
|
||||
this.textResource = textResource;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
{
|
||||
logger.Info($"Loading default text data (the currently active culture is '{CultureInfo.CurrentCulture.Name}')...");
|
||||
logger.Info($"Loading text data...");
|
||||
|
||||
text.Initialize(textResource);
|
||||
text.Initialize();
|
||||
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
|
|
@ -14,13 +14,12 @@ namespace SafeExamBrowser.I18n.Contracts
|
|||
public interface IText
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the text module, e.g. loads text data from the specified text resource.
|
||||
/// Initializes the text module, i.e. loads text data according to the currently active UI culture.
|
||||
/// </summary>
|
||||
void Initialize(ITextResource resource);
|
||||
void Initialize();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the text associated with the specified key. If the key was not found, a default text indicating
|
||||
/// that the given key is not configured will be returned.
|
||||
/// Gets the text associated with the specified key. If the key was not found, an error message indicating the missing key will be returned.
|
||||
/// </summary>
|
||||
string Get(TextKey key);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace SafeExamBrowser.I18n.Contracts
|
|||
public enum TextKey
|
||||
{
|
||||
AboutWindow_LicenseInfo,
|
||||
AboutWindow_Title,
|
||||
Browser_BlockedContentMessage,
|
||||
Browser_BlockedPageButton,
|
||||
Browser_BlockedPageMessage,
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.I18n;
|
||||
|
||||
namespace SafeExamBrowser.I18n.UnitTests
|
||||
{
|
||||
|
@ -20,59 +18,29 @@ namespace SafeExamBrowser.I18n.UnitTests
|
|||
public class TextTests
|
||||
{
|
||||
private Mock<ILogger> loggerMock;
|
||||
private Text sut;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
loggerMock = new Mock<ILogger>();
|
||||
sut = new Text(loggerMock.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MustNeverReturnNull()
|
||||
{
|
||||
var sut = new Text(loggerMock.Object);
|
||||
var text = sut.Get((TextKey)(-1));
|
||||
|
||||
Assert.IsNotNull(text);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void MustNotAllowNullResource()
|
||||
public void MustNotFailToInitializeWhenDataNotFound()
|
||||
{
|
||||
var sut = new Text(loggerMock.Object);
|
||||
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
|
||||
|
||||
sut.Initialize(null);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MustNotFailWhenGettingNullFromResource()
|
||||
{
|
||||
var resource = new Mock<ITextResource>();
|
||||
var sut = new Text(loggerMock.Object);
|
||||
|
||||
resource.Setup(r => r.LoadText()).Returns<IDictionary<TextKey, string>>(null);
|
||||
sut.Initialize(resource.Object);
|
||||
|
||||
var text = sut.Get((TextKey)(-1));
|
||||
|
||||
Assert.IsNotNull(text);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void MustNotFailWhenResourceThrowsException()
|
||||
{
|
||||
var resource = new Mock<ITextResource>();
|
||||
var sut = new Text(loggerMock.Object);
|
||||
|
||||
resource.Setup(r => r.LoadText()).Throws<Exception>();
|
||||
sut.Initialize(resource.Object);
|
||||
|
||||
var text = sut.Get((TextKey)(-1));
|
||||
|
||||
loggerMock.Verify(l => l.Error(It.IsAny<string>(), It.IsAny<Exception>()), Times.AtLeastOnce);
|
||||
|
||||
Assert.IsNotNull(text);
|
||||
sut.Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace SafeExamBrowser.I18n.UnitTests
|
|||
{
|
||||
var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location;
|
||||
var path = $@"{Path.GetDirectoryName(location)}\Text_Valid.xml";
|
||||
var sut = new XmlTextResource(path);
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var sut = new XmlTextResource(stream);
|
||||
|
||||
var text = sut.LoadText();
|
||||
|
||||
|
@ -39,7 +40,8 @@ namespace SafeExamBrowser.I18n.UnitTests
|
|||
{
|
||||
var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location;
|
||||
var path = $@"{Path.GetDirectoryName(location)}\Text_Invalid.txt";
|
||||
var sut = new XmlTextResource(path);
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var sut = new XmlTextResource(stream);
|
||||
|
||||
sut.LoadText();
|
||||
}
|
||||
|
@ -49,7 +51,8 @@ namespace SafeExamBrowser.I18n.UnitTests
|
|||
{
|
||||
var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location;
|
||||
var path = $@"{Path.GetDirectoryName(location)}\Text_Incompatible.xml";
|
||||
var sut = new XmlTextResource(path);
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var sut = new XmlTextResource(stream);
|
||||
|
||||
var text = sut.LoadText();
|
||||
|
||||
|
@ -62,7 +65,8 @@ namespace SafeExamBrowser.I18n.UnitTests
|
|||
{
|
||||
var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location;
|
||||
var path = $@"{Path.GetDirectoryName(location)}\Text_Valid.xml";
|
||||
var sut = new XmlTextResource(path);
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var sut = new XmlTextResource(stream);
|
||||
|
||||
var text = sut.LoadText();
|
||||
|
||||
|
@ -70,13 +74,6 @@ namespace SafeExamBrowser.I18n.UnitTests
|
|||
Assert.AreEqual(string.Empty, text[TextKey.Notification_LogTooltip]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void MustNotAcceptInvalidPath()
|
||||
{
|
||||
new XmlTextResource("This is not a valid path");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void MustNotAcceptNullAsPath()
|
||||
|
@ -89,7 +86,8 @@ namespace SafeExamBrowser.I18n.UnitTests
|
|||
{
|
||||
var location = Assembly.GetAssembly(typeof(XmlTextResourceTests)).Location;
|
||||
var path = $@"{Path.GetDirectoryName(location)}\Text_Valid.xml";
|
||||
var sut = new XmlTextResource(path);
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var sut = new XmlTextResource(stream);
|
||||
|
||||
var text = sut.LoadText();
|
||||
|
||||
|
|
465
SafeExamBrowser.I18n/Data/de.xml
Normal file
465
SafeExamBrowser.I18n/Data/de.xml
Normal file
|
@ -0,0 +1,465 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Text>
|
||||
<Entry key="AboutWindow_LicenseInfo">
|
||||
Diese Applikation unterliegt den Auflagen der Mozilla Public License, Version 2.0. Safe Exam Browser benutzt die folgenden Frameworks und Drittanbieter-Bibliotheken:
|
||||
</Entry>
|
||||
<Entry key="AboutWindow_Title">
|
||||
Informationen zu Version & Lizenz
|
||||
</Entry>
|
||||
<Entry key="Browser_BlockedContentMessage">
|
||||
Inhalt blockiert
|
||||
</Entry>
|
||||
<Entry key="Browser_BlockedPageButton">
|
||||
Zurück zur vorherigen Seite
|
||||
</Entry>
|
||||
<Entry key="Browser_BlockedPageMessage">
|
||||
Zugriff auf diese Seite ist nicht erlaubt gemäss der aktiven Konfiguration.
|
||||
</Entry>
|
||||
<Entry key="Browser_BlockedPageTitle">
|
||||
Seite blockiert
|
||||
</Entry>
|
||||
<Entry key="Browser_Name">
|
||||
Browser
|
||||
</Entry>
|
||||
<Entry key="Browser_Tooltip">
|
||||
Browser Applikation
|
||||
</Entry>
|
||||
<Entry key="BrowserWindow_DeveloperConsoleMenuItem">
|
||||
Entwickler-Konsole
|
||||
</Entry>
|
||||
<Entry key="BrowserWindow_Downloading">
|
||||
Lade herunter...
|
||||
</Entry>
|
||||
<Entry key="BrowserWindow_DownloadCancelled">
|
||||
Abgebrochen.
|
||||
</Entry>
|
||||
<Entry key="BrowserWindow_DownloadComplete">
|
||||
Heruntergeladen.
|
||||
</Entry>
|
||||
<Entry key="BrowserWindow_ZoomMenuItem">
|
||||
Seiten-Zoom
|
||||
</Entry>
|
||||
<Entry key="Build">
|
||||
Build
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_Cancel">
|
||||
Abbrechen
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_LoadError">
|
||||
Fehler beim Laden der Daten!
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_Loading">
|
||||
Lade...
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_OpenFileMessage">
|
||||
Bitte Datei zum Öffnen auswählen.
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_OpenFolderMessage">
|
||||
Bitte Ordner auswählen.
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_OverwriteWarning">
|
||||
Die ausgewählte Datei existiert bereits! Wollen Sie diese wirklich überschreiben?
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_OverwriteWarningTitle">
|
||||
Überschreiben?
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_SaveAs">
|
||||
Speichern als:
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_SaveFileMessage">
|
||||
Bitte wählen Sie einen Ort zum Speichern der Datei.
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_SaveFolderMessage">
|
||||
Bitte wählen Sie einen Ort zum Speichern des Ordners.
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_Select">
|
||||
Auswählen
|
||||
</Entry>
|
||||
<Entry key="FileSystemDialog_Title">
|
||||
Dateisystem-Zugriff
|
||||
</Entry>
|
||||
<Entry key="FolderDialog_ApplicationLocation">
|
||||
Applikation "%%NAME%%" konnte nicht gefunden werden auf dem System! Bitte geben Sie an, wo die ausführbare Datei "%%EXECUTABLE%%" liegt.
|
||||
</Entry>
|
||||
<Entry key="LockScreen_AllowOption">
|
||||
Verbotene Applikationen temporär erlauben. Dies gilt nur für die momentan laufenden Instanzen der aktuellen Sitzung!
|
||||
</Entry>
|
||||
<Entry key="LockScreen_Message">
|
||||
Die unten aufgelisteten, verbotenen Applikationen wurden gestartet und konnten nicht automatisch beendet werden! Bitte wählen Sie eine der verfügbaren Optionen aus und geben Sie das korrekte Passwort ein, um SEB zu entsperren.
|
||||
</Entry>
|
||||
<Entry key="LockScreen_TerminateOption">
|
||||
Safe Exam Browser beenden. WARNUNG: Sie werden keine Möglichkeit haben, Daten zu speichern oder weitere Aktionen auszuführen, SEB wird sofort beendet!
|
||||
</Entry>
|
||||
<Entry key="LockScreen_Title">
|
||||
SEB GESPERRT
|
||||
</Entry>
|
||||
<Entry key="LockScreen_UnlockButton">
|
||||
Entsperren
|
||||
</Entry>
|
||||
<Entry key="LogWindow_AlwaysOnTop">
|
||||
Immer zuoberst
|
||||
</Entry>
|
||||
<Entry key="LogWindow_AutoScroll">
|
||||
Inhalt automatisch scrollen
|
||||
</Entry>
|
||||
<Entry key="LogWindow_Title">
|
||||
Applikations-Protokoll
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationAutoTerminationQuestion">
|
||||
Die unten aufgelisteten Applikationen müssen beendet werden bevor eine neue Sitzung gestartet werden kann. Sollen diese nun automatisch beendet werden?
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationAutoTerminationQuestionTitle">
|
||||
Laufende Applikationen erkannt
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationAutoTerminationDataLossWarning">
|
||||
WARNUNG: Ungespeicherte Applikationsdaten können möglicherweise verloren gehen!
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationError">
|
||||
Ein schwerwiegender Fehler ist aufgetreten! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen. SEB wird sich nun beenden...
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationErrorTitle">
|
||||
Applikations-Fehler
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationInitializationFailure">
|
||||
Applikation %%NAME%% konnte nicht initialisiert werden und wird darum nicht verfügbar sein in der neuen Sitzung! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationInitializationFailureTitle">
|
||||
Applikations-Initialisierung fehlgeschlagen
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationNotFound">
|
||||
Applikation %%NAME%% konnte nicht gefunden werden auf dem System und wird darum nicht verfügbar sein in der neuen Sitzung! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationNotFoundTitle">
|
||||
Applikation nicht gefunden
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationTerminationFailure">
|
||||
Die unten aufgelisteten Applikationen konnten nicht beendet werden! Bitte beenden Sie diese manuell und probieren Sie es erneut...
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationTerminationFailureTitle">
|
||||
Automatisches Beenden fehlgeschlagen
|
||||
</Entry>
|
||||
<Entry key="MessageBox_BrowserNavigationBlocked">
|
||||
Zugriff auf "%%URL%%" is gemäss der aktiven Konfiguration nicht erlaubt.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_BrowserNavigationBlockedTitle">
|
||||
Seite blockiert
|
||||
</Entry>
|
||||
<Entry key="MessageBox_BrowserQuitUrlConfirmation">
|
||||
Die Browser-Applikation hat eine Quit-URL erkannt! Möchten Sie SEB nun beenden?
|
||||
</Entry>
|
||||
<Entry key="MessageBox_BrowserQuitUrlConfirmationTitle">
|
||||
Quit-URL erkannt
|
||||
</Entry>
|
||||
<Entry key="MessageBox_CancelButton">
|
||||
Abbrechen
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ClientConfigurationError">
|
||||
Die Einrichtung der lokalen Konfiguration ist gescheitert! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen. SEB wird sich nun beenden...
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ClientConfigurationErrorTitle">
|
||||
Konfiguration gescheitert
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ClientConfigurationQuestion">
|
||||
Die lokale Konfiguration wurde gespeichert und wird benutzt wenn Sie SEB das nächste Mal starten. Möchten Sie nun beenden?
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ClientConfigurationQuestionTitle">
|
||||
Konfiguration erfolgreich
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ConfigurationDownloadError">
|
||||
Konnte neue Konfiguration nicht herunterladen. Bitte versuchen Sie es erneut oder kontaktieren Sie technischen Support.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ConfigurationDownloadErrorTitle">
|
||||
Fehler beim Herunterladen
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidConfigurationData">
|
||||
Die Konfigurations-Ressource "%%URI%%" enthält ungültige Daten!
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidConfigurationDataTitle">
|
||||
Konfigurations-Fehler
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidPasswordError">
|
||||
Sie haben 5 mal das falsche Passwort eingegeben. SEB wird sich nun beenden...
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidPasswordErrorTitle">
|
||||
Ungültiges Passwort
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidQuitPassword">
|
||||
SEB kann nur durch Eingabe des korrekten Passworts beendet werden.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidQuitPasswordTitle">
|
||||
Ungültiges Quit-Passwort
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidUnlockPassword">
|
||||
SEB kann nur durch Eingabe des korrekten Passworts entsperrt werden.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_InvalidUnlockPasswordTitle">
|
||||
Ungültiges Entsperrungs-Passwort
|
||||
</Entry>
|
||||
<Entry key="MessageBox_NoButton">
|
||||
Nein
|
||||
</Entry>
|
||||
<Entry key="MessageBox_NotSupportedConfigurationResource">
|
||||
Die Konfigurations-Ressource "%%URI%%" wird nicht unterstützt!
|
||||
</Entry>
|
||||
<Entry key="MessageBox_NotSupportedConfigurationResourceTitle">
|
||||
Konfigurations-Fehler
|
||||
</Entry>
|
||||
<Entry key="MessageBox_OkButton">
|
||||
OK
|
||||
</Entry>
|
||||
<Entry key="MessageBox_Quit">
|
||||
Möchten Sie SEB beenden?
|
||||
</Entry>
|
||||
<Entry key="MessageBox_QuitTitle">
|
||||
Beenden?
|
||||
</Entry>
|
||||
<Entry key="MessageBox_QuitError">
|
||||
Der Client konnte die Anfrage zum Beenden nicht an die Runtime senden!
|
||||
</Entry>
|
||||
<Entry key="MessageBox_QuitErrorTitle">
|
||||
Fehler beim Beenden
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ReconfigurationDenied">
|
||||
Es ist Ihnen nicht erlaubt, SEB zu rekonfigurieren.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ReconfigurationDeniedTitle">
|
||||
Rekonfiguration abgelehnt
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ReconfigurationError">
|
||||
Der Client konnte die Anfrage zur Rekonfiguration nicht an die Runtime senden!
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ReconfigurationErrorTitle">
|
||||
Fehler bei der Rekonfiguration
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ReloadConfirmation">
|
||||
Möchten Sie die aktuelle Seite neu laden?
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ReloadConfirmationTitle">
|
||||
Neu laden?
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ServiceUnavailableError">
|
||||
Fehler beim Initialisieren des SEB-Service! SEB wird sich nun beenden da der Service als obligatorisch konfiguriert ist.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ServiceUnavailableErrorTitle">
|
||||
Service nicht verfügbar
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ServiceUnavailableWarning">
|
||||
Fehler beim Initialisieren des SEB-Service! SEB wird mit der Initialisierung fortfahren da der Service als optional konfiguriert ist.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ServiceUnavailableWarningTitle">
|
||||
Service nicht verfügbar
|
||||
</Entry>
|
||||
<Entry key="MessageBox_SessionStartError">
|
||||
SEB konnte keine neue Sitzung starten! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_SessionStartErrorTitle">
|
||||
Fehler beim Starten der Sitzung
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ShutdownError">
|
||||
Beim Beenden ist ein unerwarteter Fehler aufgetreten! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ShutdownErrorTitle">
|
||||
Fehler beim Beenden
|
||||
</Entry>
|
||||
<Entry key="MessageBox_StartupError">
|
||||
Beim Starten ist ein unerwarteter Fehler aufgetreten! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_StartupErrorTitle">
|
||||
Fehler beim Starten
|
||||
</Entry>
|
||||
<Entry key="MessageBox_UnexpectedConfigurationError">
|
||||
Beim Laden der Konfigurations-Ressource "%%URI%%" ist ein unerwarteter Fehler aufgetreten! Bitte konsultieren Sie das Applikations-Protokoll für mehr Informationen.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_UnexpectedConfigurationErrorTitle">
|
||||
Konfigurations-Fehler
|
||||
</Entry>
|
||||
<Entry key="MessageBox_VirtualMachineNotAllowed">
|
||||
Dieser Computer scheint eine virtuelle Maschine zu sein. Die ausgewählte Konfiguration erlaubt es nicht, SEB in einer virtuellen Maschine auszuführen.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_VirtualMachineNotAllowedTitle">
|
||||
Virtuelle Maschine erkannt
|
||||
</Entry>
|
||||
<Entry key="MessageBox_YesButton">
|
||||
Ja
|
||||
</Entry>
|
||||
<Entry key="Notification_AboutTooltip">
|
||||
Informationen über SEB
|
||||
</Entry>
|
||||
<Entry key="Notification_LogTooltip">
|
||||
Applikations-Protokoll
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_CloseRuntimeConnection">
|
||||
Schliesse Verbindung zur Runtime
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_EmptyClipboard">
|
||||
Lösche Zwischenablage
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_FinalizeApplications">
|
||||
Beende Applikationen
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_FinalizeServiceSession">
|
||||
Beende Service-Sitzung
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeApplications">
|
||||
Initialisiere Applikationen
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeBrowser">
|
||||
Initialisiere Browser
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeConfiguration">
|
||||
Initialisiere Konfiguration
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeKioskMode">
|
||||
Initialisiere Kiosk-Modus
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeRuntimeConnection">
|
||||
Initialisiere Verbindung zur Runtime
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeServiceSession">
|
||||
Initialisiere Service-Sitzung
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeSession">
|
||||
Initialisiere neue Sitzung
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeShell">
|
||||
Initialisiere Benutzeroberfläche
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_InitializeWorkingArea">
|
||||
Initialisiere Arbeitsbereich
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_RestartCommunicationHost">
|
||||
Starte Kommunikations-Host neu
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_RestoreWorkingArea">
|
||||
Stelle Arbeitsbereich wieder her
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_RevertKioskMode">
|
||||
Beende Kiosk-Modus
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StartClient">
|
||||
Starte Client
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StartCommunicationHost">
|
||||
Starte Kommunikations-Host
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StartKeyboardInterception">
|
||||
Starte Tastatur-Überwachung
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StartMouseInterception">
|
||||
Starte Maus-Überwachung
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StopClient">
|
||||
Beende Client
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StopCommunicationHost">
|
||||
Beende Kommunikations-Host
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StopKeyboardInterception">
|
||||
Beende Tastatur-Überwachung
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_StopMouseInterception">
|
||||
Beende Maus-Überwachung
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_TerminateBrowser">
|
||||
Beende Browser
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_TerminateShell">
|
||||
Beende Benutzeroberfläche
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_ValidateVirtualMachinePolicy">
|
||||
Validiere Richtlinie für virtuelle Maschinen
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_WaitExplorerStartup">
|
||||
Warte bis Windows Explorer gestartet ist
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_WaitExplorerTermination">
|
||||
Warte bis Windows Explorer beendet ist
|
||||
</Entry>
|
||||
<Entry key="OperationStatus_WaitRuntimeDisconnection">
|
||||
Warte bis Runtime Verbindung trennt
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_Cancel">
|
||||
Abbrechen
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_Confirm">
|
||||
Bestätigen
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_LocalAdminPasswordRequired">
|
||||
Bitte geben Sie das Administrator-Passwort für die lokale Konfiguration ein:
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_LocalAdminPasswordRequiredTitle">
|
||||
Administrator-Passwort erforderlich
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_LocalSettingsPasswordRequired">
|
||||
Bitte geben Sie das Passwort für die lokale Konfiguration ein:
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_LocalSettingsPasswordRequiredTitle">
|
||||
Passwort erforderlich
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_QuitPasswordRequired">
|
||||
Bitte geben Sie das Quit-Passwort ein um SEB zu beenden:
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_QuitPasswordRequiredTitle">
|
||||
Quit-Passwort erforderlich
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_SettingsPasswordRequired">
|
||||
Bitte geben Sie das Passwort für die ausgewählte Konfiguration ein:
|
||||
</Entry>
|
||||
<Entry key="PasswordDialog_SettingsPasswordRequiredTitle">
|
||||
Passwort erforderlich
|
||||
</Entry>
|
||||
<Entry key="RuntimeWindow_ApplicationRunning">
|
||||
SEB wird ausgeführt.
|
||||
</Entry>
|
||||
<Entry key="Shell_QuitButton">
|
||||
Sitzung beenden
|
||||
</Entry>
|
||||
<Entry key="SystemControl_AudioDeviceInfo">
|
||||
%%NAME%%: %%VOLUME%%%
|
||||
</Entry>
|
||||
<Entry key="SystemControl_AudioDeviceInfoMuted">
|
||||
%%NAME%%: Ton aus
|
||||
</Entry>
|
||||
<Entry key="SystemControl_AudioDeviceMuteTooltip">
|
||||
Klicken um Ton auszuschalten
|
||||
</Entry>
|
||||
<Entry key="SystemControl_AudioDeviceNotFound">
|
||||
Kein aktives Audio-Gerät gefunden
|
||||
</Entry>
|
||||
<Entry key="SystemControl_AudioDeviceUnmuteTooltip">
|
||||
Klicken um Ton einzuschalten
|
||||
</Entry>
|
||||
<Entry key="SystemControl_BatteryCharging">
|
||||
Angeschlossen, lade... (%%CHARGE%%%)
|
||||
</Entry>
|
||||
<Entry key="SystemControl_BatteryCharged">
|
||||
Aufgeladen (%%CHARGE%%%)
|
||||
</Entry>
|
||||
<Entry key="SystemControl_BatteryChargeCriticalWarning">
|
||||
Der Akku ist in kritischem Zustand. Bitte schliessen Sie den Computer an eine Stromquelle an!
|
||||
</Entry>
|
||||
<Entry key="SystemControl_BatteryChargeLowInfo">
|
||||
Der Akku nähert sich dem kritischen Zustand. Bitte schliessen Sie den Computer rechtzeitig an eine Stromquelle an...
|
||||
</Entry>
|
||||
<Entry key="SystemControl_BatteryRemainingCharge">
|
||||
%%HOURS%%h %%MINUTES%%min verbleiben (%%CHARGE%%%)
|
||||
</Entry>
|
||||
<Entry key="SystemControl_KeyboardLayoutTooltip">
|
||||
Das aktuelle Tastatur-Layout ist "%%LAYOUT%%"
|
||||
</Entry>
|
||||
<Entry key="SystemControl_WirelessConnected">
|
||||
Verbunden mit "%%NAME%%"
|
||||
</Entry>
|
||||
<Entry key="SystemControl_WirelessConnecting">
|
||||
Verbinde...
|
||||
</Entry>
|
||||
<Entry key="SystemControl_WirelessDisconnected">
|
||||
Getrennt
|
||||
</Entry>
|
||||
<Entry key="SystemControl_WirelessNotAvailable">
|
||||
Kein WLAN-Netzwerkadapter verfügbar oder eingestellt
|
||||
</Entry>
|
||||
<Entry key="Version">
|
||||
Version
|
||||
</Entry>
|
||||
</Text>
|
|
@ -3,6 +3,9 @@
|
|||
<Entry key="AboutWindow_LicenseInfo">
|
||||
This application is subject to the terms of the Mozilla Public License, version 2.0. Safe Exam Browser uses the following frameworks and third-party libraries:
|
||||
</Entry>
|
||||
<Entry key="AboutWindow_Title">
|
||||
Version & License Information
|
||||
</Entry>
|
||||
<Entry key="Browser_BlockedContentMessage">
|
||||
Content blocked
|
||||
</Entry>
|
||||
|
@ -109,7 +112,7 @@
|
|||
Running Applications Detected
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationAutoTerminationDataLossWarning">
|
||||
IMPORTANT: Any unsaved application data might be lost!
|
||||
WARNING: Any unsaved application data might be lost!
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ApplicationError">
|
||||
An unrecoverable error has occurred! Please consult the log files for more information. SEB will now shut down...
|
||||
|
@ -154,7 +157,7 @@
|
|||
The local client configuration has failed! Please consult the log files for more information. SEB will now shut down...
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ClientConfigurationErrorTitle">
|
||||
Client Configuration Error
|
||||
Configuration Error
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ClientConfigurationQuestion">
|
||||
The client configuration has been saved and will be used when you start SEB the next time. Do you want to quit for now?
|
||||
|
@ -247,25 +250,25 @@
|
|||
Service Unavailable
|
||||
</Entry>
|
||||
<Entry key="MessageBox_SessionStartError">
|
||||
SEB failed to start a new session! Please consult the log files for more information...
|
||||
SEB failed to start a new session! Please consult the log files for more information.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_SessionStartErrorTitle">
|
||||
Session Start Error
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ShutdownError">
|
||||
An unexpected error occurred during the shutdown procedure! Please consult the log files for more information...
|
||||
An unexpected error occurred during the shutdown procedure! Please consult the log files for more information.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_ShutdownErrorTitle">
|
||||
Shutdown Error
|
||||
</Entry>
|
||||
<Entry key="MessageBox_StartupError">
|
||||
An unexpected error occurred during the startup procedure! Please consult the log files for more information...
|
||||
An unexpected error occurred during the startup procedure! Please consult the log files for more information.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_StartupErrorTitle">
|
||||
Startup Error
|
||||
</Entry>
|
||||
<Entry key="MessageBox_UnexpectedConfigurationError">
|
||||
An unexpected error occurred while trying to load configuration resource "%%URI%%"! Please consult the log files for more information...
|
||||
An unexpected error occurred while trying to load configuration resource "%%URI%%"! Please consult the log files for more information.
|
||||
</Entry>
|
||||
<Entry key="MessageBox_UnexpectedConfigurationErrorTitle">
|
||||
Configuration Error
|
|
@ -62,10 +62,9 @@
|
|||
<Compile Include="XmlTextResource.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Text.xml">
|
||||
<EmbeddedResource Include="Data\en.xml">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SafeExamBrowser.I18n.Contracts\SafeExamBrowser.I18n.Contracts.csproj">
|
||||
|
@ -77,5 +76,10 @@
|
|||
<Name>SafeExamBrowser.Logging.Contracts</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Data\de.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -8,43 +8,69 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.I18n
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IText"/> module.
|
||||
/// Default implementation of <see cref="IText"/>.
|
||||
/// </summary>
|
||||
public class Text : IText
|
||||
{
|
||||
private IDictionary<TextKey, string> cache = new Dictionary<TextKey, string>();
|
||||
private ILogger logger;
|
||||
private IDictionary<TextKey, string> text;
|
||||
|
||||
public Text(ILogger logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.text = new Dictionary<TextKey, string>();
|
||||
}
|
||||
|
||||
public string Get(TextKey key)
|
||||
{
|
||||
return cache.ContainsKey(key) ? cache[key] : $"Could not find string for key '{key}'!";
|
||||
return text.ContainsKey(key) ? text[key] : $"Could not find text for key '{key}'!";
|
||||
}
|
||||
|
||||
public void Initialize(ITextResource resource)
|
||||
public void Initialize()
|
||||
{
|
||||
if (resource == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(resource));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cache = resource.LoadText() ?? new Dictionary<TextKey, string>();
|
||||
var assembly = Assembly.GetAssembly(typeof(Text));
|
||||
var data = default(Stream);
|
||||
var language = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.ToLower();
|
||||
var path = $"{typeof(Text).Namespace}.Data";
|
||||
var resource = default(ITextResource);
|
||||
|
||||
try
|
||||
{
|
||||
logger.Debug($"System language is '{language}', trying to load data...");
|
||||
data = assembly.GetManifestResourceStream($"{path}.{language}.xml");
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
}
|
||||
|
||||
if (data == default(Stream))
|
||||
{
|
||||
logger.Warn($"Could not find data for language '{language}'! Loading default language 'en'...");
|
||||
data = assembly.GetManifestResourceStream($"{path}.en.xml");
|
||||
}
|
||||
|
||||
using (data)
|
||||
{
|
||||
resource = new XmlTextResource(data);
|
||||
text = resource.LoadText();
|
||||
}
|
||||
|
||||
logger.Debug("Data successfully loaded.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error("Failed to load text data from provided resource!", e);
|
||||
logger.Error("Failed to initialize data!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,35 +15,24 @@ using SafeExamBrowser.I18n.Contracts;
|
|||
namespace SafeExamBrowser.I18n
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of <see cref="ITextResource"/> to load text data from XML files.
|
||||
/// Default implementation of an <see cref="ITextResource"/> for text data in XML.
|
||||
/// </summary>
|
||||
public class XmlTextResource : ITextResource
|
||||
{
|
||||
private string path;
|
||||
private Stream data;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new text resource for an XML file located at the specified path.
|
||||
/// Initializes a new text resource for an XML data stream.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">If the specifed file does not exist.</exception>
|
||||
/// <exception cref="ArgumentNullException">If the given path is null.</exception>
|
||||
public XmlTextResource(string path)
|
||||
/// <exception cref="ArgumentNullException">If the given stream is null.</exception>
|
||||
public XmlTextResource(Stream data)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
throw new ArgumentException("The specified file does not exist!");
|
||||
}
|
||||
|
||||
this.path = path;
|
||||
this.data = data ?? throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
|
||||
public IDictionary<TextKey, string> LoadText()
|
||||
{
|
||||
var xml = XDocument.Load(path);
|
||||
var xml = XDocument.Load(data);
|
||||
var text = new Dictionary<TextKey, string>();
|
||||
|
||||
foreach (var definition in xml.Root.Descendants())
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Hosts;
|
||||
using SafeExamBrowser.Communication.Proxies;
|
||||
|
@ -44,7 +42,6 @@ namespace SafeExamBrowser.Runtime
|
|||
private ILogger logger;
|
||||
private ISystemInfo systemInfo;
|
||||
private IText text;
|
||||
private ITextResource textResource;
|
||||
|
||||
internal IRuntimeController RuntimeController { get; private set; }
|
||||
|
||||
|
@ -53,9 +50,6 @@ namespace SafeExamBrowser.Runtime
|
|||
const int FIVE_SECONDS = 5000;
|
||||
const int THIRTY_SECONDS = 30000;
|
||||
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
var nativeMethods = new NativeMethods();
|
||||
|
||||
logger = new Logger();
|
||||
systemInfo = new SystemInfo();
|
||||
|
||||
|
@ -63,7 +57,9 @@ namespace SafeExamBrowser.Runtime
|
|||
InitializeLogging();
|
||||
InitializeText();
|
||||
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
var messageBox = new MessageBox(text);
|
||||
var nativeMethods = new NativeMethods();
|
||||
var uiFactory = new UserInterfaceFactory(text);
|
||||
var desktopFactory = new DesktopFactory(ModuleLogger(nameof(DesktopFactory)));
|
||||
var explorerShell = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods);
|
||||
|
@ -80,7 +76,7 @@ namespace SafeExamBrowser.Runtime
|
|||
var bootstrapOperations = new Queue<IOperation>();
|
||||
var sessionOperations = new Queue<IRepeatableOperation>();
|
||||
|
||||
bootstrapOperations.Enqueue(new I18nOperation(logger, text, textResource));
|
||||
bootstrapOperations.Enqueue(new I18nOperation(logger, text));
|
||||
bootstrapOperations.Enqueue(new CommunicationHostOperation(runtimeHost, logger));
|
||||
|
||||
sessionOperations.Enqueue(new SessionInitializationOperation(configuration, logger, runtimeHost, sessionContext));
|
||||
|
@ -176,11 +172,7 @@ namespace SafeExamBrowser.Runtime
|
|||
|
||||
private void InitializeText()
|
||||
{
|
||||
var location = Assembly.GetAssembly(typeof(XmlTextResource)).Location;
|
||||
var path = $@"{Path.GetDirectoryName(location)}\Text.xml";
|
||||
|
||||
text = new Text(logger);
|
||||
textResource = new XmlTextResource(path);
|
||||
text = new Text(ModuleLogger(nameof(Text)));
|
||||
}
|
||||
|
||||
private IModuleLogger ModuleLogger(string moduleInfo)
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop"
|
||||
mc:Ignorable="d" Title="Version & License Information" Background="White" Height="350" Width="575" ResizeMode="NoResize"
|
||||
Icon="./Images/SafeExamBrowser.ico" ShowInTaskbar="False" WindowStartupLocation="CenterScreen">
|
||||
mc:Ignorable="d" Background="White" Height="350" Width="575" ResizeMode="NoResize" Icon="./Images/SafeExamBrowser.ico" ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace SafeExamBrowser.UserInterface.Desktop
|
|||
private void InitializeAboutWindow()
|
||||
{
|
||||
Closing += (o, args) => closing?.Invoke();
|
||||
|
||||
MainText.Inlines.InsertBefore(MainText.Inlines.FirstInline, new Run(text.Get(TextKey.AboutWindow_LicenseInfo)));
|
||||
Title = text.Get(TextKey.AboutWindow_Title);
|
||||
|
||||
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Version)} {appConfig.ProgramInformationalVersion}") { FontSize = 12 });
|
||||
VersionInfo.Inlines.Add(new LineBreak());
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Mobile"
|
||||
mc:Ignorable="d"
|
||||
Title="Version & License Information" Background="White" Height="450" Width="675" ResizeMode="NoResize" Icon="./Images/SafeExamBrowser.ico"
|
||||
FontSize="16" ShowInTaskbar="False" WindowStartupLocation="CenterScreen">
|
||||
mc:Ignorable="d" Background="White" Height="450" Width="675" ResizeMode="NoResize" Icon="./Images/SafeExamBrowser.ico" FontSize="16"
|
||||
ShowInTaskbar="False" WindowStartupLocation="CenterScreen">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace SafeExamBrowser.UserInterface.Mobile
|
|||
private void InitializeAboutWindow()
|
||||
{
|
||||
Closing += (o, args) => closing?.Invoke();
|
||||
|
||||
MainText.Inlines.InsertBefore(MainText.Inlines.FirstInline, new Run(text.Get(TextKey.AboutWindow_LicenseInfo)));
|
||||
Title = text.Get(TextKey.AboutWindow_Title);
|
||||
|
||||
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Version)} {appConfig.ProgramInformationalVersion}"));
|
||||
VersionInfo.Inlines.Add(new LineBreak());
|
||||
|
|
Loading…
Reference in a new issue