SEBWIN-338: Introduced program build version.

This commit is contained in:
dbuechel 2019-08-13 10:02:05 +02:00
parent 6a1632ee48
commit b71529da31
19 changed files with 368 additions and 333 deletions

View file

@ -173,7 +173,7 @@ namespace SafeExamBrowser.Browser
private string InitializeUserAgent()
{
var osVersion = $"{Environment.OSVersion.Version.Major}.{Environment.OSVersion.Version.Minor}";
var sebVersion = $"SEB/{appConfig.ProgramVersion}";
var sebVersion = $"SEB/{appConfig.ProgramInformationalVersion}";
if (settings.UseCustomUserAgent)
{

View file

@ -48,7 +48,7 @@ namespace SafeExamBrowser.Browser.Handlers
var headers = new NameValueCollection(request.Headers);
var userAgent = request.Headers["User-Agent"];
headers["User-Agent"] = $"{userAgent} SEB/{appConfig.ProgramVersion}";
headers["User-Agent"] = $"{userAgent} SEB/{appConfig.ProgramInformationalVersion}";
request.Headers = headers;
}

View file

@ -56,7 +56,7 @@ namespace SafeExamBrowser.Configuration.UnitTests
fileSaver.Setup(f => f.CanSave(It.IsAny<Uri>())).Returns<Uri>(u => u.IsFile);
networkLoader.Setup(n => n.CanLoad(It.IsAny<Uri>())).Returns<Uri>(u => u.Scheme.Equals("http") || u.Scheme.Equals("seb"));
sut = new ConfigurationRepository(certificateStore.Object, hashAlgorithm.Object, logger.Object, executablePath, string.Empty, string.Empty, string.Empty);
sut = new ConfigurationRepository(certificateStore.Object, hashAlgorithm.Object, logger.Object, executablePath, string.Empty, string.Empty, string.Empty, string.Empty);
sut.InitializeAppConfig();
}

View file

@ -20,13 +20,20 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
private AppConfig appConfig;
private string executablePath;
private string programBuild;
private string programCopyright;
private string programTitle;
private string programVersion;
internal DataValues(string executablePath, string programCopyright, string programTitle, string programVersion)
internal DataValues(
string executablePath,
string programBuild,
string programCopyright,
string programTitle,
string programVersion)
{
this.executablePath = executablePath ?? string.Empty;
this.programBuild = programBuild ?? string.Empty;
this.programCopyright = programCopyright ?? string.Empty;
this.programTitle = programTitle ?? string.Empty;
this.programVersion = programVersion ?? string.Empty;
@ -57,10 +64,11 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
appConfig.ClientLogFilePath = Path.Combine(logFolder, $"{logFilePrefix}_Client.log");
appConfig.ConfigurationFileExtension = ".seb";
appConfig.DownloadDirectory = Path.Combine(appDataLocalFolder, "Downloads");
appConfig.ProgramBuildVersion = programBuild;
appConfig.ProgramCopyright = programCopyright;
appConfig.ProgramDataFilePath = Path.Combine(programDataFolder, DEFAULT_CONFIGURATION_NAME);
appConfig.ProgramTitle = programTitle;
appConfig.ProgramVersion = programVersion;
appConfig.ProgramInformationalVersion = programVersion;
appConfig.RuntimeId = Guid.NewGuid();
appConfig.RuntimeAddress = $"{AppConfig.BASE_ADDRESS}/runtime/{Guid.NewGuid()}";
appConfig.RuntimeLogFilePath = Path.Combine(logFolder, $"{logFilePrefix}_Runtime.log");

View file

@ -37,6 +37,7 @@ namespace SafeExamBrowser.Configuration
IHashAlgorithm hashAlgorithm,
IModuleLogger logger,
string executablePath,
string programBuild,
string programCopyright,
string programTitle,
string programVersion)
@ -48,7 +49,7 @@ namespace SafeExamBrowser.Configuration
dataParsers = new List<IDataParser>();
dataSerializers = new List<IDataSerializer>();
dataMapper = new DataMapper();
dataValues = new DataValues(executablePath, programCopyright, programTitle, programVersion);
dataValues = new DataValues(executablePath, programBuild, programCopyright, programTitle, programVersion);
resourceLoaders = new List<IResourceLoader>();
resourceSavers = new List<IResourceSaver>();
}

View file

@ -97,7 +97,12 @@ namespace SafeExamBrowser.Contracts.Configuration
public string DownloadDirectory { get; set; }
/// <summary>
/// The copyright information for the application (i.e. the executing assembly).
/// The build version of the application.
/// </summary>
public string ProgramBuildVersion { get; set; }
/// <summary>
/// The copyright information for the application.
/// </summary>
public string ProgramCopyright { get; set; }
@ -107,14 +112,14 @@ namespace SafeExamBrowser.Contracts.Configuration
public string ProgramDataFilePath { get; set; }
/// <summary>
/// The program title of the application (i.e. the executing assembly).
/// The program title of the application.
/// </summary>
public string ProgramTitle { get; set; }
/// <summary>
/// The program version of the application (i.e. the executing assembly).
/// The informational version of the application.
/// </summary>
public string ProgramVersion { get; set; }
public string ProgramInformationalVersion { get; set; }
/// <summary>
/// The communication address of the runtime component.

View file

@ -16,6 +16,7 @@ namespace SafeExamBrowser.Contracts.I18n
{
BrowserWindow_DeveloperConsoleMenuItem,
BrowserWindow_ZoomMenuItem,
Build,
LogWindow_Title,
MessageBox_ApplicationError,
MessageBox_ApplicationErrorTitle,

View file

@ -6,6 +6,9 @@
<Entry key="BrowserWindow_ZoomMenuItem">
Page Zoom
</Entry>
<Entry key="Build">
Build
</Entry>
<Entry key="LogWindow_Title">
Application Log
</Entry>

View file

@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using SafeExamBrowser.Communication.Hosts;
@ -106,7 +107,7 @@ namespace SafeExamBrowser.Runtime
internal void LogStartupInformation()
{
logger.Log($"/* {appConfig.ProgramTitle}, Version {appConfig.ProgramVersion}");
logger.Log($"/* {appConfig.ProgramTitle}, Version {appConfig.ProgramInformationalVersion}, Build {appConfig.ProgramBuildVersion}");
logger.Log($"/* {appConfig.ProgramCopyright}");
logger.Log($"/* ");
logger.Log($"/* Please visit https://www.github.com/SafeExamBrowser for more information.");
@ -125,6 +126,7 @@ namespace SafeExamBrowser.Runtime
private void InitializeConfiguration()
{
var executable = Assembly.GetExecutingAssembly();
var programBuild = FileVersionInfo.GetVersionInfo(executable.Location).FileVersion;
var programCopyright = executable.GetCustomAttribute<AssemblyCopyrightAttribute>().Copyright;
var programTitle = executable.GetCustomAttribute<AssemblyTitleAttribute>().Title;
var programVersion = executable.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
@ -143,6 +145,7 @@ namespace SafeExamBrowser.Runtime
new HashAlgorithm(),
repositoryLogger,
executable.Location,
programBuild,
programCopyright,
programTitle,
programVersion);

View file

@ -17,7 +17,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Grid.ColumnSpan="2" Source="pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/SplashScreen.png" Margin="0,5,0,0" />
<TextBlock x:Name="VersionInfo" Grid.Row="0" Grid.Column="1" Foreground="Gray" Margin="25,75,100,10" TextWrapping="Wrap" />
<TextBlock x:Name="VersionInfo" Grid.Row="0" Grid.Column="1" FontSize="10" Foreground="DimGray" Margin="25,70,100,10" TextWrapping="Wrap" />
<ScrollViewer Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto">
<TextBlock x:Name="MainText" Margin="10" FontSize="10" TextWrapping="Wrap">
This application is subject to the terms of the Mozilla Public License, version 2.0. If a copy of the MPL was not

View file

@ -8,6 +8,7 @@
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.UserInterface.Windows;
@ -44,10 +45,12 @@ namespace SafeExamBrowser.UserInterface.Desktop
private void InitializeAboutWindow()
{
Closing += (o, args) => closing?.Invoke();
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Version)} {appConfig.ProgramVersion}") { FontStyle = FontStyles.Italic });
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Version)} {appConfig.ProgramInformationalVersion}") { FontSize = 12 });
VersionInfo.Inlines.Add(new LineBreak());
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Build)} {appConfig.ProgramBuildVersion}") { FontSize = 8, Foreground = Brushes.Gray });
VersionInfo.Inlines.Add(new LineBreak());
VersionInfo.Inlines.Add(new LineBreak());
VersionInfo.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10 });
VersionInfo.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10, Foreground = Brushes.Gray });
}
}
}

View file

@ -46,7 +46,7 @@
<ColumnDefinition Width="400" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Grid.ColumnSpan="2" Margin="-25,0,0,0" Source="pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/SplashScreen.png" />
<TextBlock x:Name="InfoTextBlock" Grid.Column="1" Foreground="Gray" Margin="10,75,225,10" TextWrapping="Wrap" />
<TextBlock x:Name="InfoTextBlock" Grid.Column="1" FontSize="10" Foreground="DimGray" Margin="10,70,225,10" TextWrapping="Wrap" />
</Grid>
<ProgressBar x:Name="ProgressBar" Grid.Row="1" Background="WhiteSmoke" BorderThickness="0" Foreground="DodgerBlue"
IsIndeterminate="{Binding IsIndeterminate}" Maximum="{Binding MaxProgress}" Value="{Binding CurrentProgress}"

View file

@ -8,6 +8,7 @@
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.Logging;
@ -130,12 +131,14 @@ namespace SafeExamBrowser.UserInterface.Desktop
private void InitializeRuntimeWindow()
{
Title = $"{appConfig.ProgramTitle} - Version {appConfig.ProgramVersion}";
Title = $"{appConfig.ProgramTitle} - Version {appConfig.ProgramInformationalVersion}";
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramVersion}") { FontStyle = FontStyles.Italic });
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramInformationalVersion}") { FontSize = 12 });
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new Run($"Build {appConfig.ProgramBuildVersion}") { FontSize = 8, Foreground = Brushes.Gray });
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10 });
InfoTextBlock.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10, Foreground = Brushes.Gray });
model = new RuntimeWindowViewModel(LogTextBlock);
AnimatedBorder.DataContext = model;

View file

@ -8,6 +8,7 @@
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.UserInterface.Windows;
@ -122,7 +123,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
{
if (appConfig != null)
{
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramVersion}") { FontStyle = FontStyles.Italic });
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramInformationalVersion}") { Foreground = Brushes.DimGray });
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10 });

View file

@ -17,7 +17,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Grid.ColumnSpan="2" Source="pack://application:,,,/SafeExamBrowser.UserInterface.Mobile;component/Images/SplashScreen.png" Margin="0,5,0,0" />
<TextBlock x:Name="VersionInfo" Grid.Row="0" Grid.Column="1" Foreground="Gray" Margin="25,75,100,10" TextWrapping="Wrap" />
<TextBlock x:Name="VersionInfo" Grid.Row="0" Grid.Column="1" FontSize="10" Foreground="DimGray" Margin="25,70,100,10" TextWrapping="Wrap" />
<ScrollViewer Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto">
<TextBlock x:Name="MainText" Margin="10" FontSize="10" TextWrapping="Wrap">
This application is subject to the terms of the Mozilla Public License, version 2.0. If a copy of the MPL was not

View file

@ -8,6 +8,7 @@
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.UserInterface.Windows;
@ -44,10 +45,12 @@ namespace SafeExamBrowser.UserInterface.Mobile
private void InitializeAboutWindow()
{
Closing += (o, args) => closing?.Invoke();
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Version)} {appConfig.ProgramVersion}") { FontStyle = FontStyles.Italic });
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Version)} {appConfig.ProgramInformationalVersion}") { FontSize = 12 });
VersionInfo.Inlines.Add(new LineBreak());
VersionInfo.Inlines.Add(new Run($"{text.Get(TextKey.Build)} {appConfig.ProgramBuildVersion}") { FontSize = 8, Foreground = Brushes.Gray });
VersionInfo.Inlines.Add(new LineBreak());
VersionInfo.Inlines.Add(new LineBreak());
VersionInfo.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10 });
VersionInfo.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10, Foreground = Brushes.Gray });
}
}
}

View file

@ -46,7 +46,7 @@
<ColumnDefinition Width="400" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Grid.ColumnSpan="2" Margin="-25,0,0,0" Source="pack://application:,,,/SafeExamBrowser.UserInterface.Mobile;component/Images/SplashScreen.png" />
<TextBlock x:Name="InfoTextBlock" Grid.Column="1" Foreground="Gray" Margin="10,75,225,10" TextWrapping="Wrap" />
<TextBlock x:Name="InfoTextBlock" Grid.Column="1" FontSize="10" Foreground="DimGray" Margin="10,70,225,10" TextWrapping="Wrap" />
</Grid>
<ProgressBar x:Name="ProgressBar" Grid.Row="1" Background="WhiteSmoke" BorderThickness="0" Foreground="DodgerBlue"
IsIndeterminate="{Binding IsIndeterminate}" Maximum="{Binding MaxProgress}" Value="{Binding CurrentProgress}"

View file

@ -8,6 +8,7 @@
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.Logging;
@ -130,12 +131,14 @@ namespace SafeExamBrowser.UserInterface.Mobile
private void InitializeRuntimeWindow()
{
Title = $"{appConfig.ProgramTitle} - Version {appConfig.ProgramVersion}";
Title = $"{appConfig.ProgramTitle} - Version {appConfig.ProgramInformationalVersion}";
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramVersion}") { FontStyle = FontStyles.Italic });
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramInformationalVersion}") { FontSize = 12 });
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new Run($"Build {appConfig.ProgramBuildVersion}") { FontSize = 8, Foreground = Brushes.Gray });
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10 });
InfoTextBlock.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10, Foreground = Brushes.Gray });
model = new RuntimeWindowViewModel(LogTextBlock);
AnimatedBorder.DataContext = model;

View file

@ -8,6 +8,7 @@
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using SafeExamBrowser.Contracts.Configuration;
using SafeExamBrowser.Contracts.I18n;
using SafeExamBrowser.Contracts.UserInterface.Windows;
@ -122,7 +123,7 @@ namespace SafeExamBrowser.UserInterface.Mobile
{
if (appConfig != null)
{
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramVersion}") { FontStyle = FontStyles.Italic });
InfoTextBlock.Inlines.Add(new Run($"Version {appConfig.ProgramInformationalVersion}") { Foreground = Brushes.DimGray });
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new LineBreak());
InfoTextBlock.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 12 });