2017-07-06 18:18:39 +02:00
|
|
|
|
/*
|
2018-01-16 08:24:00 +01:00
|
|
|
|
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
|
2017-07-06 18:18:39 +02:00
|
|
|
|
*
|
|
|
|
|
* 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.IO;
|
2017-07-07 15:46:32 +02:00
|
|
|
|
using System.Reflection;
|
2017-07-28 14:52:15 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.Configuration.Settings;
|
2017-07-06 18:18:39 +02:00
|
|
|
|
|
2017-07-20 14:16:47 +02:00
|
|
|
|
namespace SafeExamBrowser.Configuration
|
2017-07-06 18:18:39 +02:00
|
|
|
|
{
|
2017-07-28 14:52:15 +02:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// TODO: Replace with proper implementation once configuration aspects are clear...
|
|
|
|
|
/// </remarks>
|
2017-08-11 08:28:17 +02:00
|
|
|
|
public class Settings : ISettings
|
2017-07-06 18:18:39 +02:00
|
|
|
|
{
|
2017-07-27 13:57:12 +02:00
|
|
|
|
private static readonly string LogFileDate = DateTime.Now.ToString("yyyy-MM-dd\\_HH\\hmm\\mss\\s");
|
2017-07-26 08:50:36 +02:00
|
|
|
|
|
2017-08-11 08:28:17 +02:00
|
|
|
|
public Settings()
|
2017-07-26 08:50:36 +02:00
|
|
|
|
{
|
2017-07-28 14:52:15 +02:00
|
|
|
|
Browser = new BrowserSettings(this);
|
2017-08-04 12:19:56 +02:00
|
|
|
|
Keyboard = new KeyboardSettings();
|
2017-08-04 15:20:33 +02:00
|
|
|
|
Mouse = new MouseSettings();
|
2017-11-09 10:27:55 +01:00
|
|
|
|
Taskbar = new TaskbarSettings();
|
2017-07-26 08:50:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-10 10:17:28 +02:00
|
|
|
|
public string AppDataFolderName => nameof(SafeExamBrowser);
|
2017-07-24 17:31:28 +02:00
|
|
|
|
|
2017-11-09 10:27:55 +01:00
|
|
|
|
public IBrowserSettings Browser { get; private set; }
|
|
|
|
|
public IKeyboardSettings Keyboard { get; private set; }
|
|
|
|
|
public IMouseSettings Mouse { get; private set; }
|
|
|
|
|
public ITaskbarSettings Taskbar { get; private set; }
|
|
|
|
|
|
2017-07-28 14:52:15 +02:00
|
|
|
|
public string ApplicationLogFile
|
2017-07-24 17:31:28 +02:00
|
|
|
|
{
|
2017-07-28 14:52:15 +02:00
|
|
|
|
get { return Path.Combine(LogFolderPath, $"{RuntimeIdentifier}_Application.txt"); }
|
2017-07-24 17:31:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-14 10:28:59 +02:00
|
|
|
|
public string LogFolderPath
|
2017-07-10 15:47:12 +02:00
|
|
|
|
{
|
2017-07-28 14:52:15 +02:00
|
|
|
|
get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppDataFolderName, "Logs"); }
|
2017-07-10 15:47:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-14 10:28:59 +02:00
|
|
|
|
public string ProgramCopyright
|
2017-07-06 18:18:39 +02:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-07-14 10:28:59 +02:00
|
|
|
|
var executable = Assembly.GetEntryAssembly();
|
|
|
|
|
var copyright = executable.GetCustomAttribute<AssemblyCopyrightAttribute>().Copyright;
|
|
|
|
|
|
|
|
|
|
return copyright;
|
2017-07-06 18:18:39 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-07-07 15:46:32 +02:00
|
|
|
|
|
2017-07-14 10:28:59 +02:00
|
|
|
|
public string ProgramTitle
|
2017-07-07 15:46:32 +02:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-07-10 15:47:12 +02:00
|
|
|
|
var executable = Assembly.GetEntryAssembly();
|
2017-07-07 15:46:32 +02:00
|
|
|
|
var title = executable.GetCustomAttribute<AssemblyTitleAttribute>().Title;
|
|
|
|
|
|
2017-07-14 10:28:59 +02:00
|
|
|
|
return title;
|
2017-07-10 15:47:12 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string ProgramVersion
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var executable = Assembly.GetEntryAssembly();
|
|
|
|
|
var version = executable.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
2017-07-07 15:46:32 +02:00
|
|
|
|
|
2017-07-10 15:47:12 +02:00
|
|
|
|
return version;
|
2017-07-07 15:46:32 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-07-28 14:52:15 +02:00
|
|
|
|
|
|
|
|
|
public string RuntimeIdentifier => LogFileDate;
|
2017-07-06 18:18:39 +02:00
|
|
|
|
}
|
|
|
|
|
}
|