SEBWIN-320: Implemented version step for reset utility.
This commit is contained in:
parent
a27723dc35
commit
fbe6f45d78
6 changed files with 53 additions and 5 deletions
|
@ -22,7 +22,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure
|
||||||
|
|
||||||
internal override ProcedureStepResult Execute()
|
internal override ProcedureStepResult Execute()
|
||||||
{
|
{
|
||||||
Initialize();
|
InitializeConsole();
|
||||||
|
|
||||||
if (IsSingleInstance() && HasAdminPrivileges() && SebNotRunning())
|
if (IsSingleInstance() && HasAdminPrivileges() && SebNotRunning())
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 { 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 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 { NextStep = new ShowLog(Context), Result = ProcedureStepResult.Continue, Text = "Show application log" },
|
||||||
new Option { Result = ProcedureStepResult.Terminate, Text = "Exit" }
|
new Option { Result = ProcedureStepResult.Terminate, Text = "Exit" }
|
||||||
};
|
};
|
||||||
|
@ -50,7 +51,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure
|
||||||
|
|
||||||
private void PrintMenu()
|
private void PrintMenu()
|
||||||
{
|
{
|
||||||
Initialize();
|
InitializeConsole();
|
||||||
|
|
||||||
Console.WriteLine("Please choose one of the following options:");
|
Console.WriteLine("Please choose one of the following options:");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure
|
||||||
internal abstract ProcedureStepResult Execute();
|
internal abstract ProcedureStepResult Execute();
|
||||||
internal abstract ProcedureStep GetNextStep();
|
internal abstract ProcedureStep GetNextStep();
|
||||||
|
|
||||||
protected void Initialize()
|
protected void InitializeConsole()
|
||||||
{
|
{
|
||||||
var title = "SEB Reset Utility";
|
var title = "SEB Reset Utility";
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure
|
||||||
{
|
{
|
||||||
offset = UpdateOffset(key, offset, log.Count);
|
offset = UpdateOffset(key, offset, log.Count);
|
||||||
|
|
||||||
Initialize();
|
InitializeConsole();
|
||||||
PrintInstructions();
|
PrintInstructions();
|
||||||
PrintLogSection(log, offset);
|
PrintLogSection(log, offset);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ namespace SafeExamBrowser.ResetUtility.Procedure
|
||||||
case LogLevel.Warning:
|
case LogLevel.Warning:
|
||||||
return ConsoleColor.DarkYellow;
|
return ConsoleColor.DarkYellow;
|
||||||
default:
|
default:
|
||||||
return ForegroundColor;
|
return ConsoleColor.DarkBlue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
46
SafeExamBrowser.ResetUtility/Procedure/ShowVersion.cs
Normal file
46
SafeExamBrowser.ResetUtility/Procedure/ShowVersion.cs
Normal file
|
@ -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<AssemblyFileVersionAttribute>().Version;
|
||||||
|
var copyright = executable.GetCustomAttribute<AssemblyCopyrightAttribute>().Copyright;
|
||||||
|
var version = executable.GetCustomAttribute<AssemblyInformationalVersionAttribute>().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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,6 +70,7 @@
|
||||||
<Compile Include="Procedure\Reset.cs" />
|
<Compile Include="Procedure\Reset.cs" />
|
||||||
<Compile Include="Procedure\Restore.cs" />
|
<Compile Include="Procedure\Restore.cs" />
|
||||||
<Compile Include="Procedure\ShowLog.cs" />
|
<Compile Include="Procedure\ShowLog.cs" />
|
||||||
|
<Compile Include="Procedure\ShowVersion.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Reference in a new issue