diff --git a/SafeExamBrowser.Runtime.UnitTests/RuntimeControllerTests.cs b/SafeExamBrowser.Runtime.UnitTests/RuntimeControllerTests.cs index 4160a4ad..f1749879 100644 --- a/SafeExamBrowser.Runtime.UnitTests/RuntimeControllerTests.cs +++ b/SafeExamBrowser.Runtime.UnitTests/RuntimeControllerTests.cs @@ -491,7 +491,7 @@ namespace SafeExamBrowser.Runtime.UnitTests sut.Terminate(); - messageBox.Verify(m => m.Show(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.AtLeastOnce); + messageBox.Verify(m => m.Show(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.AtLeastOnce); } [TestMethod] diff --git a/SafeExamBrowser.Runtime/RuntimeController.cs b/SafeExamBrowser.Runtime/RuntimeController.cs index 3776d02c..ecf95006 100644 --- a/SafeExamBrowser.Runtime/RuntimeController.cs +++ b/SafeExamBrowser.Runtime/RuntimeController.cs @@ -7,6 +7,7 @@ */ using System; +using System.IO; using System.Linq; using System.Threading; using SafeExamBrowser.Communication.Contracts.Data; @@ -115,7 +116,7 @@ namespace SafeExamBrowser.Runtime logger.Info("Application startup aborted!"); logger.Log(string.Empty); - messageBox.Show(TextKey.MessageBox_StartupError, TextKey.MessageBox_StartupErrorTitle, icon: MessageBoxIcon.Error, parent: splashScreen); + messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_StartupError), text.Get(TextKey.MessageBox_StartupErrorTitle), icon: MessageBoxIcon.Error, parent: splashScreen); } return initialized && SessionIsRunning; @@ -151,7 +152,7 @@ namespace SafeExamBrowser.Runtime logger.Info("Shutdown procedure failed!"); logger.Log(string.Empty); - messageBox.Show(TextKey.MessageBox_ShutdownError, TextKey.MessageBox_ShutdownErrorTitle, icon: MessageBoxIcon.Error, parent: splashScreen); + messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_ShutdownError), text.Get(TextKey.MessageBox_ShutdownErrorTitle), icon: MessageBoxIcon.Error, parent: splashScreen); } splashScreen.Close(); @@ -212,14 +213,14 @@ namespace SafeExamBrowser.Runtime { StopSession(); - messageBox.Show(TextKey.MessageBox_SessionStartError, TextKey.MessageBox_SessionStartErrorTitle, icon: MessageBoxIcon.Error, parent: runtimeWindow); + messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_SessionStartError), text.Get(TextKey.MessageBox_SessionStartErrorTitle), icon: MessageBoxIcon.Error, parent: runtimeWindow); logger.Info("Terminating application..."); shutdown.Invoke(); } else { - messageBox.Show(TextKey.MessageBox_SessionStartError, TextKey.MessageBox_SessionStartErrorTitle, icon: MessageBoxIcon.Error, parent: runtimeWindow); + messageBox.Show(AppendLogFilePaths(TextKey.MessageBox_SessionStartError), text.Get(TextKey.MessageBox_SessionStartErrorTitle), icon: MessageBoxIcon.Error, parent: runtimeWindow); } } @@ -700,5 +701,32 @@ namespace SafeExamBrowser.Runtime return $"### {dashesLeft} {message} {dashesRight} ###"; } + + private string AppendLogFilePaths(TextKey key) + { + var message = text.Get(key); + + if (File.Exists(appConfig.BrowserLogFilePath)) + { + message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.BrowserLogFilePath}"; + } + + if (File.Exists(appConfig.ClientLogFilePath)) + { + message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.ClientLogFilePath}"; + } + + if (File.Exists(appConfig.RuntimeLogFilePath)) + { + message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.RuntimeLogFilePath}"; + } + + if (File.Exists(appConfig.ServiceLogFilePath)) + { + message += $"{Environment.NewLine}{Environment.NewLine}{appConfig.ServiceLogFilePath}"; + } + + return message; + } } }