diff --git a/SafeExamBrowser.ResetUtility/Procedure/Initialization.cs b/SafeExamBrowser.ResetUtility/Procedure/Initialization.cs index 0cbf5a99..75bfefad 100644 --- a/SafeExamBrowser.ResetUtility/Procedure/Initialization.cs +++ b/SafeExamBrowser.ResetUtility/Procedure/Initialization.cs @@ -22,7 +22,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure internal override ProcedureStepResult Execute() { - Initialize(); + InitializeConsole(); if (IsSingleInstance() && HasAdminPrivileges() && SebNotRunning()) { diff --git a/SafeExamBrowser.ResetUtility/Procedure/MainMenu.cs b/SafeExamBrowser.ResetUtility/Procedure/MainMenu.cs index b742e16f..7a130815 100644 --- a/SafeExamBrowser.ResetUtility/Procedure/MainMenu.cs +++ b/SafeExamBrowser.ResetUtility/Procedure/MainMenu.cs @@ -22,6 +22,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure { new Option { IsSelected = true, NextStep = new Restore(Context), Result = ProcedureStepResult.Continue, Text = "Restore system configuration via backup mechanism" }, new Option { NextStep = new Reset(Context), Result = ProcedureStepResult.Continue, Text = "Reset system configuration to default values" }, + new Option { NextStep = new ShowVersion(Context), Result = ProcedureStepResult.Continue, Text = "Show version information" }, new Option { NextStep = new ShowLog(Context), Result = ProcedureStepResult.Continue, Text = "Show application log" }, new Option { Result = ProcedureStepResult.Terminate, Text = "Exit" } }; @@ -50,7 +51,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure private void PrintMenu() { - Initialize(); + InitializeConsole(); Console.WriteLine("Please choose one of the following options:"); Console.WriteLine(); diff --git a/SafeExamBrowser.ResetUtility/Procedure/ProcedureStep.cs b/SafeExamBrowser.ResetUtility/Procedure/ProcedureStep.cs index 1d357de3..235be41f 100644 --- a/SafeExamBrowser.ResetUtility/Procedure/ProcedureStep.cs +++ b/SafeExamBrowser.ResetUtility/Procedure/ProcedureStep.cs @@ -26,7 +26,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure internal abstract ProcedureStepResult Execute(); internal abstract ProcedureStep GetNextStep(); - protected void Initialize() + protected void InitializeConsole() { var title = "SEB Reset Utility"; diff --git a/SafeExamBrowser.ResetUtility/Procedure/ShowLog.cs b/SafeExamBrowser.ResetUtility/Procedure/ShowLog.cs index 00c15539..1fc702c5 100644 --- a/SafeExamBrowser.ResetUtility/Procedure/ShowLog.cs +++ b/SafeExamBrowser.ResetUtility/Procedure/ShowLog.cs @@ -27,7 +27,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure { offset = UpdateOffset(key, offset, log.Count); - Initialize(); + InitializeConsole(); PrintInstructions(); PrintLogSection(log, offset); } @@ -135,7 +135,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure case LogLevel.Warning: return ConsoleColor.DarkYellow; default: - return ForegroundColor; + return ConsoleColor.DarkBlue; } } } diff --git a/SafeExamBrowser.ResetUtility/Procedure/ShowVersion.cs b/SafeExamBrowser.ResetUtility/Procedure/ShowVersion.cs new file mode 100644 index 00000000..5f854709 --- /dev/null +++ b/SafeExamBrowser.ResetUtility/Procedure/ShowVersion.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET) + * + * 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; +using System.Reflection; + +namespace SafeExamBrowser.ResetUtility.Procedure +{ + internal class ShowVersion : ProcedureStep + { + public ShowVersion(Context context) : base(context) + { + } + + internal override ProcedureStepResult Execute() + { + var executable = Assembly.GetExecutingAssembly(); + var build = executable.GetCustomAttribute().Version; + var copyright = executable.GetCustomAttribute().Copyright; + var version = executable.GetCustomAttribute().InformationalVersion; + + InitializeConsole(); + + Console.ForegroundColor = ConsoleColor.DarkBlue; + Console.WriteLine($"Safe Exam Browser, Version {version}"); + Console.WriteLine($"Build Version {build}"); + Console.WriteLine(copyright.Replace("©", "(c)")); + Console.WriteLine(); + Console.ForegroundColor = ForegroundColor; + Console.WriteLine("Press any key to return to the main menu."); + Console.ReadKey(); + + return ProcedureStepResult.Continue; + } + + internal override ProcedureStep GetNextStep() + { + return new MainMenu(Context); + } + } +} diff --git a/SafeExamBrowser.ResetUtility/SafeExamBrowser.ResetUtility.csproj b/SafeExamBrowser.ResetUtility/SafeExamBrowser.ResetUtility.csproj index 0cc505c1..bfff6036 100644 --- a/SafeExamBrowser.ResetUtility/SafeExamBrowser.ResetUtility.csproj +++ b/SafeExamBrowser.ResetUtility/SafeExamBrowser.ResetUtility.csproj @@ -70,6 +70,7 @@ +