SEBWIN-219: Working on IPC mechanics.
This commit is contained in:
		
							parent
							
								
									e214973dc7
								
							
						
					
					
						commit
						d935407ecb
					
				
					 79 changed files with 297 additions and 566 deletions
				
			
		|  | @ -4,5 +4,7 @@ See https://github.com/SafeExamBrowser/seb-win/releases for the current, officia | |||
| 
 | ||||
| ### Project Status | ||||
| [](https://ci.appveyor.com/project/dbuechel/seb-win-refactoring) | ||||
| [](https://codecov.io/gh/SafeExamBrowser/seb-win-refactoring) | ||||
| [](https://ci.appveyor.com/project/dbuechel/seb-win-refactoring/build/tests) | ||||
| [](https://codecov.io/gh/SafeExamBrowser/seb-win-refactoring) | ||||
| 
 | ||||
| Latest build: https://ci.appveyor.com/project/dbuechel/seb-win-refactoring/build/artifacts | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ using SafeExamBrowser.Contracts.Configuration; | |||
| using SafeExamBrowser.Contracts.I18n; | ||||
| using SafeExamBrowser.Contracts.UserInterface; | ||||
| using SafeExamBrowser.Contracts.UserInterface.Taskbar; | ||||
| using IBrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.IBrowserSettings; | ||||
| using BrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.BrowserSettings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Browser | ||||
| { | ||||
|  | @ -23,14 +23,14 @@ namespace SafeExamBrowser.Browser | |||
| 	{ | ||||
| 		private IApplicationButton button; | ||||
| 		private IList<IApplicationInstance> instances = new List<IApplicationInstance>(); | ||||
| 		private IBrowserSettings settings; | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private BrowserSettings settings; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IUserInterfaceFactory uiFactory; | ||||
| 		private IText text; | ||||
| 
 | ||||
| 		public BrowserApplicationController( | ||||
| 			IBrowserSettings settings, | ||||
| 			IRuntimeInfo runtimeInfo, | ||||
| 			BrowserSettings settings, | ||||
| 			RuntimeInfo runtimeInfo, | ||||
| 			IText text, | ||||
| 			IUserInterfaceFactory uiFactory) | ||||
| 		{ | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ namespace SafeExamBrowser.Browser | |||
| 		public event TerminatedEventHandler Terminated; | ||||
| 		public event NameChangedEventHandler NameChanged; | ||||
| 
 | ||||
| 		public BrowserApplicationInstance(IBrowserSettings settings, IText text, IUserInterfaceFactory uiFactory, bool isMainInstance) | ||||
| 		public BrowserApplicationInstance(BrowserSettings settings, IText text, IUserInterfaceFactory uiFactory, bool isMainInstance) | ||||
| 		{ | ||||
| 			Id = Guid.NewGuid(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,14 +11,14 @@ using CefSharp.WinForms; | |||
| using SafeExamBrowser.Browser.Handlers; | ||||
| using SafeExamBrowser.Contracts.I18n; | ||||
| using SafeExamBrowser.Contracts.UserInterface; | ||||
| using IBrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.IBrowserSettings; | ||||
| using BrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.BrowserSettings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Browser | ||||
| { | ||||
| 	class BrowserControl : ChromiumWebBrowser, IBrowserControl | ||||
| 	{ | ||||
| 		private AddressChangedEventHandler addressChanged; | ||||
| 		private IBrowserSettings settings; | ||||
| 		private BrowserSettings settings; | ||||
| 		private TitleChangedEventHandler titleChanged; | ||||
| 		private IText text; | ||||
| 
 | ||||
|  | @ -34,7 +34,7 @@ namespace SafeExamBrowser.Browser | |||
| 			remove { titleChanged -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public BrowserControl(IBrowserSettings settings, IText text) : base(settings.StartUrl) | ||||
| 		public BrowserControl(BrowserSettings settings, IText text) : base(settings.StartUrl) | ||||
| 		{ | ||||
| 			this.settings = settings; | ||||
| 			this.text = text; | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| using CefSharp; | ||||
| using SafeExamBrowser.Contracts.I18n; | ||||
| using IBrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.IBrowserSettings; | ||||
| using BrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.BrowserSettings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Browser.Handlers | ||||
| { | ||||
|  | @ -19,10 +19,10 @@ namespace SafeExamBrowser.Browser.Handlers | |||
| 	{ | ||||
| 		private const int DEV_CONSOLE_COMMAND = (int) CefMenuCommand.UserFirst + 1; | ||||
| 
 | ||||
| 		private IBrowserSettings settings; | ||||
| 		private BrowserSettings settings; | ||||
| 		private IText text; | ||||
| 
 | ||||
| 		public BrowserContextMenuHandler(IBrowserSettings settings, IText text) | ||||
| 		public BrowserContextMenuHandler(BrowserSettings settings, IText text) | ||||
| 		{ | ||||
| 			this.settings = settings; | ||||
| 			this.text = text; | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| using System.Windows.Forms; | ||||
| using CefSharp; | ||||
| using IBrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.IBrowserSettings; | ||||
| using BrowserSettings = SafeExamBrowser.Contracts.Configuration.Settings.BrowserSettings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Browser.Handlers | ||||
| { | ||||
|  | @ -17,9 +17,9 @@ namespace SafeExamBrowser.Browser.Handlers | |||
| 	/// </remarks> | ||||
| 	internal class BrowserKeyboardHandler : IKeyboardHandler | ||||
| 	{ | ||||
| 		private IBrowserSettings settings; | ||||
| 		private BrowserSettings settings; | ||||
| 
 | ||||
| 		public BrowserKeyboardHandler(IBrowserSettings settings) | ||||
| 		public BrowserKeyboardHandler(BrowserSettings settings) | ||||
| 		{ | ||||
| 			this.settings = settings; | ||||
| 		} | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations | |||
| 	public class TaskbarOperationTests | ||||
| 	{ | ||||
| 		private Mock<ILogger> loggerMock; | ||||
| 		private Mock<ITaskbarSettings> settingsMock; | ||||
| 		private Mock<TaskbarSettings> settingsMock; | ||||
| 		private Mock<ISystemComponent<ISystemKeyboardLayoutControl>> keyboardLayoutMock; | ||||
| 		private Mock<ISystemComponent<ISystemPowerSupplyControl>> powerSupplyMock; | ||||
| 		private Mock<ISystemComponent<ISystemWirelessNetworkControl>> wirelessNetworkMock; | ||||
|  | @ -38,7 +38,7 @@ namespace SafeExamBrowser.Client.UnitTests.Behaviour.Operations | |||
| 		public void Initialize() | ||||
| 		{ | ||||
| 			loggerMock = new Mock<ILogger>(); | ||||
| 			settingsMock = new Mock<ITaskbarSettings>(); | ||||
| 			settingsMock = new Mock<TaskbarSettings>(); | ||||
| 			keyboardLayoutMock = new Mock<ISystemComponent<ISystemKeyboardLayoutControl>>(); | ||||
| 			powerSupplyMock = new Mock<ISystemComponent<ISystemPowerSupplyControl>>(); | ||||
| 			wirelessNetworkMock = new Mock<ISystemComponent<ISystemWirelessNetworkControl>>(); | ||||
|  |  | |||
|  | @ -18,13 +18,13 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications | |||
| 	[TestClass] | ||||
| 	public class AboutNotificationControllerTests | ||||
| 	{ | ||||
| 		private Mock<IRuntimeInfo> runtimeInfoMock; | ||||
| 		private Mock<RuntimeInfo> runtimeInfoMock; | ||||
| 		private Mock<IUserInterfaceFactory> uiFactoryMock; | ||||
| 
 | ||||
| 		[TestInitialize] | ||||
| 		public void Initialize() | ||||
| 		{ | ||||
| 			runtimeInfoMock = new Mock<IRuntimeInfo>(); | ||||
| 			runtimeInfoMock = new Mock<RuntimeInfo>(); | ||||
| 			uiFactoryMock = new Mock<IUserInterfaceFactory>(); | ||||
| 		} | ||||
| 
 | ||||
|  | @ -35,7 +35,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications | |||
| 			var window = new Mock<IWindow>(); | ||||
| 			var sut = new AboutNotificationController(runtimeInfoMock.Object, uiFactoryMock.Object); | ||||
| 
 | ||||
| 			uiFactoryMock.Setup(u => u.CreateAboutWindow(It.IsAny<IRuntimeInfo>())).Returns(window.Object); | ||||
| 			uiFactoryMock.Setup(u => u.CreateAboutWindow(It.IsAny<RuntimeInfo>())).Returns(window.Object); | ||||
| 			sut.RegisterNotification(button); | ||||
| 			button.Click(); | ||||
| 			sut.Terminate(); | ||||
|  | @ -50,7 +50,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications | |||
| 			var window = new Mock<IWindow>(); | ||||
| 			var sut = new AboutNotificationController(runtimeInfoMock.Object, uiFactoryMock.Object); | ||||
| 
 | ||||
| 			uiFactoryMock.Setup(u => u.CreateAboutWindow(It.IsAny<IRuntimeInfo>())).Returns(window.Object); | ||||
| 			uiFactoryMock.Setup(u => u.CreateAboutWindow(It.IsAny<RuntimeInfo>())).Returns(window.Object); | ||||
| 			sut.RegisterNotification(button); | ||||
| 			button.Click(); | ||||
| 			button.Click(); | ||||
|  | @ -58,7 +58,7 @@ namespace SafeExamBrowser.Client.UnitTests.Notifications | |||
| 			button.Click(); | ||||
| 			button.Click(); | ||||
| 
 | ||||
| 			uiFactoryMock.Verify(u => u.CreateAboutWindow(It.IsAny<IRuntimeInfo>()), Times.Once); | ||||
| 			uiFactoryMock.Verify(u => u.CreateAboutWindow(It.IsAny<RuntimeInfo>()), Times.Once); | ||||
| 			window.Verify(u => u.Show(), Times.Once); | ||||
| 			window.Verify(u => u.BringToForeground(), Times.Exactly(4)); | ||||
| 		} | ||||
|  |  | |||
|  | @ -18,14 +18,14 @@ namespace SafeExamBrowser.Client.Behaviour.Operations | |||
| { | ||||
| 	internal class ConfigurationOperation : IOperation | ||||
| 	{ | ||||
| 		private IClientConfiguration configuration; | ||||
| 		private ClientConfiguration configuration; | ||||
| 		private ILogger logger; | ||||
| 		private IRuntimeProxy runtime; | ||||
| 
 | ||||
| 		public bool Abort { get; private set; } | ||||
| 		public IProgressIndicator ProgressIndicator { private get; set; } | ||||
| 
 | ||||
| 		public ConfigurationOperation(IClientConfiguration configuration, ILogger logger, IRuntimeProxy runtime) | ||||
| 		public ConfigurationOperation(ClientConfiguration configuration, ILogger logger, IRuntimeProxy runtime) | ||||
| 		{ | ||||
| 			this.configuration = configuration; | ||||
| 			this.logger = logger; | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ namespace SafeExamBrowser.Client.Behaviour.Operations | |||
| 	{ | ||||
| 		private ILogger logger; | ||||
| 		private INotificationController logController; | ||||
| 		private ITaskbarSettings settings; | ||||
| 		private TaskbarSettings settings; | ||||
| 		private ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout; | ||||
| 		private ISystemComponent<ISystemPowerSupplyControl> powerSupply; | ||||
| 		private ISystemComponent<ISystemWirelessNetworkControl> wirelessNetwork; | ||||
|  | @ -37,7 +37,7 @@ namespace SafeExamBrowser.Client.Behaviour.Operations | |||
| 
 | ||||
| 		public TaskbarOperation( | ||||
| 			ILogger logger, | ||||
| 			ITaskbarSettings settings, | ||||
| 			TaskbarSettings settings, | ||||
| 			ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout, | ||||
| 			ISystemComponent<ISystemPowerSupplyControl> powerSupply, | ||||
| 			ISystemComponent<ISystemWirelessNetworkControl> wirelessNetwork, | ||||
|  |  | |||
|  | @ -33,13 +33,13 @@ namespace SafeExamBrowser.Client.Communication | |||
| 			// TODO | ||||
| 		} | ||||
| 
 | ||||
| 		protected override IResponse OnReceive(IMessage message) | ||||
| 		protected override Response OnReceive(Message message) | ||||
| 		{ | ||||
| 			// TODO | ||||
| 			return null; | ||||
| 		} | ||||
| 
 | ||||
| 		protected override IResponse OnReceive(Message message) | ||||
| 		protected override Response OnReceive(MessagePurport message) | ||||
| 		{ | ||||
| 			// TODO | ||||
| 			return null; | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ namespace SafeExamBrowser.Client | |||
| { | ||||
| 	internal class CompositionRoot | ||||
| 	{ | ||||
| 		private IClientConfiguration configuration; | ||||
| 		private ClientConfiguration configuration; | ||||
| 		private ILogger logger; | ||||
| 		private INativeMethods nativeMethods; | ||||
| 		private ISystemInfo systemInfo; | ||||
|  | @ -92,9 +92,9 @@ namespace SafeExamBrowser.Client | |||
| 
 | ||||
| 		private void Validate(string[] args) | ||||
| 		{ | ||||
| 			var hasFourParameters = args?.Length == 4; | ||||
| 			var hasFour = args?.Length == 4; | ||||
| 
 | ||||
| 			if (hasFourParameters) | ||||
| 			if (hasFour) | ||||
| 			{ | ||||
| 				var hasLogfilePath = Uri.TryCreate(args?[1], UriKind.Absolute, out Uri filePath) && filePath.IsFile; | ||||
| 				var hasHostUri = Uri.TryCreate(args?[2], UriKind.Absolute, out Uri hostUri) && hostUri.IsWellFormedOriginalString(); | ||||
|  |  | |||
|  | @ -17,11 +17,11 @@ namespace SafeExamBrowser.Client.Notifications | |||
| 	internal class AboutNotificationController : INotificationController | ||||
| 	{ | ||||
| 		private INotificationButton notification; | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IUserInterfaceFactory uiFactory; | ||||
| 		private IWindow window; | ||||
| 
 | ||||
| 		public AboutNotificationController(IRuntimeInfo runtimeInfo, IUserInterfaceFactory uiFactory) | ||||
| 		public AboutNotificationController(RuntimeInfo runtimeInfo, IUserInterfaceFactory uiFactory) | ||||
| 		{ | ||||
| 			this.runtimeInfo = runtimeInfo; | ||||
| 			this.uiFactory = uiFactory; | ||||
|  |  | |||
|  | @ -1,22 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Configuration; | ||||
| using SafeExamBrowser.Contracts.Configuration.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration | ||||
| { | ||||
| 	[Serializable] | ||||
| 	public class ClientConfiguration : IClientConfiguration | ||||
| 	{ | ||||
| 		public Guid SessionId { get; set; } | ||||
| 		public ISettings Settings { get; set; } | ||||
| 		public IRuntimeInfo RuntimeInfo { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -19,9 +19,9 @@ namespace SafeExamBrowser.Configuration | |||
| 		private RuntimeInfo runtimeInfo; | ||||
| 
 | ||||
| 		public ISession CurrentSession { get; private set; } | ||||
| 		public ISettings CurrentSettings { get; private set; } | ||||
| 		public Settings CurrentSettings { get; private set; } | ||||
| 
 | ||||
| 		public IRuntimeInfo RuntimeInfo | ||||
| 		public RuntimeInfo RuntimeInfo | ||||
| 		{ | ||||
| 			get | ||||
| 			{ | ||||
|  | @ -47,7 +47,7 @@ namespace SafeExamBrowser.Configuration | |||
| 			return session; | ||||
| 		} | ||||
| 
 | ||||
| 		public IClientConfiguration BuildClientConfiguration() | ||||
| 		public ClientConfiguration BuildClientConfiguration() | ||||
| 		{ | ||||
| 			return new ClientConfiguration | ||||
| 			{ | ||||
|  | @ -57,21 +57,23 @@ namespace SafeExamBrowser.Configuration | |||
| 			}; | ||||
| 		} | ||||
| 
 | ||||
| 		public ISettings LoadSettings(Uri path) | ||||
| 		public Settings LoadSettings(Uri path) | ||||
| 		{ | ||||
| 			// TODO | ||||
| 
 | ||||
| 			return LoadDefaultSettings(); | ||||
| 		} | ||||
| 
 | ||||
| 		public ISettings LoadDefaultSettings() | ||||
| 		public Settings LoadDefaultSettings() | ||||
| 		{ | ||||
| 			var settings = new Settings.Settings | ||||
| 			var settings = new Settings() | ||||
| 			{ | ||||
| 				// TODO | ||||
| 				ServicePolicy = ServicePolicy.Optional | ||||
| 			}; | ||||
| 
 | ||||
| 			settings.Browser.StartUrl = "https://www.duckduckgo.com"; | ||||
| 
 | ||||
| 			CurrentSettings = settings; | ||||
| 
 | ||||
| 			return settings; | ||||
|  |  | |||
|  | @ -1,35 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Configuration; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration | ||||
| { | ||||
| 	[Serializable] | ||||
| 	public class RuntimeInfo : IRuntimeInfo | ||||
| 	{ | ||||
| 		public string AppDataFolder { get; set; } | ||||
| 		public DateTime ApplicationStartTime { get; set; } | ||||
| 		public string BrowserCachePath { get; set; } | ||||
| 		public string BrowserLogFile { get; set; } | ||||
| 		public string ClientAddress { get; set; } | ||||
| 		public string ClientExecutablePath { get; set; } | ||||
| 		public Guid ClientId { get; set; } | ||||
| 		public string ClientLogFile { get; set; } | ||||
| 		public string DefaultSettingsFileName { get; set; } | ||||
| 		public string ProgramCopyright { get; set; } | ||||
| 		public string ProgramDataFolder { get; set; } | ||||
| 		public string ProgramTitle { get; set; } | ||||
| 		public string ProgramVersion { get; set; } | ||||
| 		public string RuntimeAddress { get; set; } | ||||
| 		public Guid RuntimeId { get; set; } | ||||
| 		public string RuntimeLogFile { get; set; } | ||||
| 		public string ServiceAddress { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -53,17 +53,10 @@ | |||
|     <Reference Include="Microsoft.CSharp" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="ClientConfiguration.cs" /> | ||||
|     <Compile Include="RuntimeInfo.cs" /> | ||||
|     <Compile Include="Session.cs" /> | ||||
|     <Compile Include="Settings\BrowserSettings.cs" /> | ||||
|     <Compile Include="Settings\KeyboardSettings.cs" /> | ||||
|     <Compile Include="Settings\MouseSettings.cs" /> | ||||
|     <Compile Include="Settings\Settings.cs" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> | ||||
|     <Compile Include="ConfigurationRepository.cs" /> | ||||
|     <Compile Include="SystemInfo.cs" /> | ||||
|     <Compile Include="Settings\TaskbarSettings.cs" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\SafeExamBrowser.Contracts\SafeExamBrowser.Contracts.csproj"> | ||||
|  |  | |||
|  | @ -1,27 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Configuration.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration.Settings | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class BrowserSettings : IBrowserSettings | ||||
| 	{ | ||||
| 		public bool AllowAddressBar => true; | ||||
| 		public bool AllowBackwardNavigation => true; | ||||
| 		public bool AllowDeveloperConsole => true; | ||||
| 		public bool AllowForwardNavigation => true; | ||||
| 		public bool AllowReloading => true; | ||||
| 		public string CachePath { get; set; } | ||||
| 		public bool FullScreenMode => false; | ||||
| 		public string LogFile { get; set; } | ||||
| 		public string StartUrl => "www.duckduckgo.com"; | ||||
| 	} | ||||
| } | ||||
|  | @ -1,23 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Configuration.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration.Settings | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class KeyboardSettings : IKeyboardSettings | ||||
| 	{ | ||||
| 		public bool AllowAltTab => false; | ||||
| 
 | ||||
| 		public bool AllowEsc => false; | ||||
| 
 | ||||
| 		public bool AllowF5 => true; | ||||
| 	} | ||||
| } | ||||
|  | @ -1,21 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Configuration.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration.Settings | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class MouseSettings : IMouseSettings | ||||
| 	{ | ||||
| 		public bool AllowMiddleButton => false; | ||||
| 
 | ||||
| 		public bool AllowRightButton => true; | ||||
| 	} | ||||
| } | ||||
|  | @ -1,34 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Configuration.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration.Settings | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class Settings : ISettings | ||||
| 	{ | ||||
| 		public ConfigurationMode ConfigurationMode { get; set; } | ||||
| 		public KioskMode KioskMode { get; set; } | ||||
| 		public ServicePolicy ServicePolicy { get; set; } | ||||
| 
 | ||||
| 		public IBrowserSettings Browser { get; set; } | ||||
| 		public IKeyboardSettings Keyboard { get; set; } | ||||
| 		public IMouseSettings Mouse { get; set; } | ||||
| 		public ITaskbarSettings Taskbar { get; set; } | ||||
| 
 | ||||
| 		public Settings() | ||||
| 		{ | ||||
| 			Browser = new BrowserSettings(); | ||||
| 			Keyboard = new KeyboardSettings(); | ||||
| 			Mouse = new MouseSettings(); | ||||
| 			Taskbar = new TaskbarSettings(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -1,21 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Configuration.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Configuration.Settings | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class TaskbarSettings : ITaskbarSettings | ||||
| 	{ | ||||
| 		public bool AllowApplicationLog => true; | ||||
| 		public bool AllowKeyboardLayout => true; | ||||
| 		public bool AllowWirelessNetwork => true; | ||||
| 	} | ||||
| } | ||||
|  | @ -15,6 +15,6 @@ namespace SafeExamBrowser.Contracts.Communication | |||
| 		/// <summary> | ||||
| 		/// Instructs the client to submit its authentication data. | ||||
| 		/// </summary> | ||||
| 		IAuthenticationResponse RequestAuthentication(); | ||||
| 		AuthenticationResponse RequestAuthentication(); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -10,10 +10,15 @@ using System; | |||
| using System.ServiceModel; | ||||
| using SafeExamBrowser.Contracts.Communication.Messages; | ||||
| using SafeExamBrowser.Contracts.Communication.Responses; | ||||
| using SafeExamBrowser.Contracts.Configuration; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication | ||||
| { | ||||
| 	[ServiceContract(SessionMode = SessionMode.Required)] | ||||
| 	[ServiceKnownType(typeof(SimpleMessage))] | ||||
| 	[ServiceKnownType(typeof(AuthenticationResponse))] | ||||
| 	[ServiceKnownType(typeof(ConfigurationResponse))] | ||||
| 	[ServiceKnownType(typeof(ClientConfiguration))] | ||||
| 	public interface ICommunication | ||||
| 	{ | ||||
| 		/// <summary> | ||||
|  | @ -21,18 +26,18 @@ namespace SafeExamBrowser.Contracts.Communication | |||
| 		/// specified. Returns a response indicating whether the connection request was successful or not. | ||||
| 		/// </summary> | ||||
| 		[OperationContract(IsInitiating = true)] | ||||
| 		IConnectionResponse Connect(Guid? token = null); | ||||
| 		ConnectionResponse Connect(Guid? token = null); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Closes a connection. Returns a response indicating whether the disconnection request was successful or not. | ||||
| 		/// </summary> | ||||
| 		[OperationContract(IsInitiating = false, IsTerminating = true)] | ||||
| 		IDisconnectionResponse Disconnect(IDisconnectionMessage message); | ||||
| 		DisconnectionResponse Disconnect(DisconnectionMessage message); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Sends a message, optionally returning a response. If no response is expected, <c>null</c> will be returned. | ||||
| 		/// </summary> | ||||
| 		[OperationContract(IsInitiating = false)] | ||||
| 		IResponse Send(IMessage message); | ||||
| 		Response Send(Message message); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ namespace SafeExamBrowser.Contracts.Communication | |||
| 		/// <summary> | ||||
| 		/// Retrieves the application configuration from the runtime. | ||||
| 		/// </summary> | ||||
| 		IClientConfiguration GetConfiguration(); | ||||
| 		ClientConfiguration GetConfiguration(); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Informs the runtime that the client is ready. | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ namespace SafeExamBrowser.Contracts.Communication | |||
| 		/// <summary> | ||||
| 		/// Instructs the service to start a new session according to the given parameters. | ||||
| 		/// </summary> | ||||
| 		void StartSession(Guid sessionId, ISettings settings); | ||||
| 		void StartSession(Guid sessionId, Settings settings); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Instructs the service to stop the specified session. | ||||
|  |  | |||
|  | @ -6,9 +6,12 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Messages | ||||
| { | ||||
| 	public interface IDisconnectionMessage : IMessage | ||||
| 	[Serializable] | ||||
| 	public class DisconnectionMessage : Message | ||||
| 	{ | ||||
| 	} | ||||
| } | ||||
|  | @ -6,23 +6,16 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Messages | ||||
| { | ||||
| 	public enum Message | ||||
| 	[Serializable] | ||||
| 	public class Message | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// Requests an interlocutor to submit data for authentication. | ||||
| 		/// The communication token needed for authentication. | ||||
| 		/// </summary> | ||||
| 		Authenticate = 1, | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Sent from the client to the runtime to indicate that the client is ready to operate. | ||||
| 		/// </summary> | ||||
| 		ClientIsReady, | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Sent from the client to the runtime to ask for the client configuration. | ||||
| 		/// </summary> | ||||
| 		ConfigurationNeeded, | ||||
| 		public Guid CommunicationToken { get; set; } | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -10,11 +10,22 @@ using System; | |||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Messages | ||||
| { | ||||
| 	public interface IMessage | ||||
| 	[Serializable] | ||||
| 	public enum MessagePurport | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The communication token needed for authentication. | ||||
| 		/// Requests an interlocutor to submit data for authentication. | ||||
| 		/// </summary> | ||||
| 		Guid CommunicationToken { get; set; } | ||||
| 		Authenticate = 1, | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Sent from the client to the runtime to indicate that the client is ready to operate. | ||||
| 		/// </summary> | ||||
| 		ClientIsReady, | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Sent from the client to the runtime to ask for the client configuration. | ||||
| 		/// </summary> | ||||
| 		ConfigurationNeeded, | ||||
| 	} | ||||
| } | ||||
|  | @ -6,13 +6,16 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Messages | ||||
| { | ||||
| 	public interface ISimpleMessage : IMessage | ||||
| 	[Serializable] | ||||
| 	public class SimpleMessage : Message | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The purport of the message. | ||||
| 		/// </summary> | ||||
| 		Message Purport { get; } | ||||
| 		public MessagePurport Purport { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,13 +6,16 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Responses | ||||
| { | ||||
| 	public interface IAuthenticationResponse : IResponse | ||||
| 	[Serializable] | ||||
| 	public class AuthenticationResponse : Response | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The process identifier used for authentication. | ||||
| 		/// </summary> | ||||
| 		int ProcessId { get; } | ||||
| 		public int ProcessId { get; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,15 +6,17 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using SafeExamBrowser.Contracts.Configuration; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Responses | ||||
| { | ||||
| 	public interface IConfigurationResponse : IResponse | ||||
| 	[Serializable] | ||||
| 	public class ConfigurationResponse : Response | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The configuration to be used by the client. | ||||
| 		/// </summary> | ||||
| 		IClientConfiguration Configuration { get; } | ||||
| 		public ClientConfiguration Configuration { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -10,16 +10,17 @@ using System; | |||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Responses | ||||
| { | ||||
| 	public interface IConnectionResponse : IResponse | ||||
| 	[Serializable] | ||||
| 	public class ConnectionResponse : Response | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The communication token needed for authentication. Is <c>null</c> if a connection was refused. | ||||
| 		/// </summary> | ||||
| 		Guid? CommunicationToken { get; } | ||||
| 		public Guid? CommunicationToken { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Indicates whether the connection request has been accepted. | ||||
| 		/// </summary> | ||||
| 		bool ConnectionEstablished { get; } | ||||
| 		public bool ConnectionEstablished { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,13 +6,16 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Responses | ||||
| { | ||||
| 	public interface IDisconnectionResponse : IResponse | ||||
| 	[Serializable] | ||||
| 	public class DisconnectionResponse : Response | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// Indicates whether the connection has been terminated. | ||||
| 		/// </summary> | ||||
| 		bool ConnectionTerminated { get; } | ||||
| 		public bool ConnectionTerminated { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,9 +6,12 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Communication.Responses | ||||
| { | ||||
| 	public interface IResponse | ||||
| 	[Serializable] | ||||
| 	public class Response | ||||
| 	{ | ||||
| 	} | ||||
| } | ||||
|  | @ -7,25 +7,25 @@ | |||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using SafeExamBrowser.Contracts.Configuration.Settings; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Configuration | ||||
| { | ||||
| 	public interface IClientConfiguration | ||||
| 	[Serializable] | ||||
| 	public class ClientConfiguration | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The unique identifier for the current session. | ||||
| 		/// </summary> | ||||
| 		Guid SessionId { get; set; } | ||||
| 		public Guid SessionId { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The application settings to be used by the client. | ||||
| 		/// </summary> | ||||
| 		ISettings Settings { get; set; } | ||||
| 		public Settings.Settings Settings { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The information about the current runtime. | ||||
| 		/// </summary> | ||||
| 		IRuntimeInfo RuntimeInfo { get; set; } | ||||
| 		public RuntimeInfo RuntimeInfo { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -23,17 +23,17 @@ namespace SafeExamBrowser.Contracts.Configuration | |||
| 		/// Retrieves the current settings, i.e. the last ones which were loaded. If no settings have been loaded yet, this property will | ||||
| 		/// be <c>null</c>! | ||||
| 		/// </summary> | ||||
| 		ISettings CurrentSettings { get; } | ||||
| 		Settings.Settings CurrentSettings { get; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The runtime information for the currently running application instance. | ||||
| 		/// </summary> | ||||
| 		IRuntimeInfo RuntimeInfo { get; } | ||||
| 		RuntimeInfo RuntimeInfo { get; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Builds a configuration for the client component, given the currently loaded settings, session and runtime information. | ||||
| 		/// </summary> | ||||
| 		IClientConfiguration BuildClientConfiguration(); | ||||
| 		ClientConfiguration BuildClientConfiguration(); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Initializes all relevant data for a new session. | ||||
|  | @ -44,11 +44,11 @@ namespace SafeExamBrowser.Contracts.Configuration | |||
| 		/// Attempts to load settings from the specified path. | ||||
| 		/// </summary> | ||||
| 		/// <exception cref="ArgumentException">Thrown if the given path cannot be resolved to a settings file.</exception> | ||||
| 		ISettings LoadSettings(Uri path); | ||||
| 		Settings.Settings LoadSettings(Uri path); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Loads the default settings. | ||||
| 		/// </summary> | ||||
| 		ISettings LoadDefaultSettings(); | ||||
| 		Settings.Settings LoadDefaultSettings(); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -10,27 +10,28 @@ using System; | |||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Configuration | ||||
| { | ||||
| 	public interface IRuntimeInfo | ||||
| 	[Serializable] | ||||
| 	public class RuntimeInfo | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The path of the application data folder. | ||||
| 		/// </summary> | ||||
| 		string AppDataFolder { get; } | ||||
| 		public string AppDataFolder { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The point in time when the application was started. | ||||
| 		/// </summary> | ||||
| 		DateTime ApplicationStartTime { get; } | ||||
| 		public DateTime ApplicationStartTime { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The path where the browser cache is to be stored. | ||||
| 		/// </summary> | ||||
| 		string BrowserCachePath { get; } | ||||
| 		public string BrowserCachePath { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The file path under which the log of the browser component is to be stored. | ||||
| 		/// </summary> | ||||
| 		string BrowserLogFile { get; } | ||||
| 		public string BrowserLogFile { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The communication address of the client component. | ||||
|  | @ -38,12 +39,12 @@ namespace SafeExamBrowser.Contracts.Configuration | |||
| 		/// TODO: Will need to be updated for each new client instance! | ||||
| 		///  | ||||
| 		/// </summary> | ||||
| 		string ClientAddress { get; } | ||||
| 		public string ClientAddress { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The executable path of the client compontent. | ||||
| 		/// </summary> | ||||
| 		string ClientExecutablePath { get; } | ||||
| 		public string ClientExecutablePath { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The unique identifier for the currently running client instance. | ||||
|  | @ -51,42 +52,42 @@ namespace SafeExamBrowser.Contracts.Configuration | |||
| 		/// TODO: Will need to be updated for each new client instance! -> Remove if unused! | ||||
| 		///  | ||||
| 		/// </summary> | ||||
| 		Guid ClientId { get; } | ||||
| 		public Guid ClientId { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The file path under which the log of the client component is to be stored. | ||||
| 		/// </summary> | ||||
| 		string ClientLogFile { get; } | ||||
| 		public string ClientLogFile { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The default file name for application settings. | ||||
| 		/// </summary> | ||||
| 		string DefaultSettingsFileName { get; } | ||||
| 		public string DefaultSettingsFileName { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The copyright information for the application (i.e. the executing assembly). | ||||
| 		/// </summary> | ||||
| 		string ProgramCopyright { get; } | ||||
| 		public string ProgramCopyright { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The path of the program data folder. | ||||
| 		/// </summary> | ||||
| 		string ProgramDataFolder { get; } | ||||
| 		public string ProgramDataFolder { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The program title of the application (i.e. the executing assembly). | ||||
| 		/// </summary> | ||||
| 		string ProgramTitle { get; } | ||||
| 		public string ProgramTitle { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The program version of the application (i.e. the executing assembly). | ||||
| 		/// </summary> | ||||
| 		string ProgramVersion { get; } | ||||
| 		public string ProgramVersion { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The communication address of the runtime component. | ||||
| 		/// </summary> | ||||
| 		string RuntimeAddress { get; } | ||||
| 		public string RuntimeAddress { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The unique identifier for the currently running runtime instance. | ||||
|  | @ -94,16 +95,16 @@ namespace SafeExamBrowser.Contracts.Configuration | |||
| 		/// TODO: Remove if unused! | ||||
| 		///  | ||||
| 		/// </summary> | ||||
| 		Guid RuntimeId { get; } | ||||
| 		public Guid RuntimeId { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The file path under which the log of the runtime component is to be stored. | ||||
| 		/// </summary> | ||||
| 		string RuntimeLogFile { get; } | ||||
| 		public string RuntimeLogFile { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The communication address of the service component. | ||||
| 		/// </summary> | ||||
| 		string ServiceAddress { get; } | ||||
| 		public string ServiceAddress { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,43 +6,46 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Configuration.Settings | ||||
| { | ||||
| 	public interface IBrowserSettings | ||||
| 	[Serializable] | ||||
| 	public class BrowserSettings | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user should be allowed to change the URL of a browser window. | ||||
| 		/// </summary> | ||||
| 		bool AllowAddressBar { get; } | ||||
| 		public bool AllowAddressBar { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user should be allowed to navigate backwards in a browser window. | ||||
| 		/// </summary> | ||||
| 		bool AllowBackwardNavigation { get; } | ||||
| 		public bool AllowBackwardNavigation { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user should be allowed to open the developer console of a browser window. | ||||
| 		/// </summary> | ||||
| 		bool AllowDeveloperConsole { get; } | ||||
| 		public bool AllowDeveloperConsole { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user should be allowed to navigate forwards in a browser window. | ||||
| 		/// </summary> | ||||
| 		bool AllowForwardNavigation { get; } | ||||
| 		public bool AllowForwardNavigation { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user should be allowed to reload webpages. | ||||
| 		/// </summary> | ||||
| 		bool AllowReloading { get; } | ||||
| 		public bool AllowReloading { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the main browser window should be rendered in fullscreen mode, i.e. without window frame. | ||||
| 		/// </summary> | ||||
| 		bool FullScreenMode { get; } | ||||
| 		public bool FullScreenMode { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The start URL with which a new browser window should be loaded. | ||||
| 		/// </summary> | ||||
| 		string StartUrl { get; } | ||||
| 		public string StartUrl { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,23 +6,26 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Configuration.Settings | ||||
| { | ||||
| 	public interface IKeyboardSettings | ||||
| 	[Serializable] | ||||
| 	public class KeyboardSettings | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may use the ALT+TAB shortcut. | ||||
| 		/// </summary> | ||||
| 		bool AllowAltTab { get; } | ||||
| 		public bool AllowAltTab { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may use the escape key. | ||||
| 		/// </summary> | ||||
| 		bool AllowEsc { get; } | ||||
| 		public bool AllowEsc { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may use the F5 key. | ||||
| 		/// </summary> | ||||
| 		bool AllowF5 { get; } | ||||
| 		public bool AllowF5 { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,18 +6,21 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Configuration.Settings | ||||
| { | ||||
| 	public interface IMouseSettings | ||||
| 	[Serializable] | ||||
| 	public class MouseSettings | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may use the middle mouse button. | ||||
| 		/// </summary> | ||||
| 		bool AllowMiddleButton { get; } | ||||
| 		public bool AllowMiddleButton { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may use the right mouse button. | ||||
| 		/// </summary> | ||||
| 		bool AllowRightButton { get; } | ||||
| 		public bool AllowRightButton { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -6,43 +6,54 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Configuration.Settings | ||||
| { | ||||
| 	public interface ISettings | ||||
| 	[Serializable] | ||||
| 	public class Settings | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// The mode which determines the configuration behaviour. | ||||
| 		/// </summary> | ||||
| 		ConfigurationMode ConfigurationMode { get; } | ||||
| 		public ConfigurationMode ConfigurationMode { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// All browser-related settings. | ||||
| 		/// </summary> | ||||
| 		IBrowserSettings Browser { get; } | ||||
| 		public BrowserSettings Browser { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// All keyboard-related settings. | ||||
| 		/// </summary> | ||||
| 		IKeyboardSettings Keyboard { get; } | ||||
| 		public KeyboardSettings Keyboard { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The kiosk mode which determines how the computer is locked down. | ||||
| 		/// </summary> | ||||
| 		KioskMode KioskMode { get; } | ||||
| 		public KioskMode KioskMode { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// All mouse-related settings. | ||||
| 		/// </summary> | ||||
| 		IMouseSettings Mouse { get; } | ||||
| 		public MouseSettings Mouse { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// The active policy for the service component. | ||||
| 		/// </summary> | ||||
| 		ServicePolicy ServicePolicy { get; } | ||||
| 		public ServicePolicy ServicePolicy { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// All taskbar-related settings. | ||||
| 		/// </summary> | ||||
| 		ITaskbarSettings Taskbar { get; } | ||||
| 		public TaskbarSettings Taskbar { get; set; } | ||||
| 
 | ||||
| 		public Settings() | ||||
| 		{ | ||||
| 			Browser = new BrowserSettings(); | ||||
| 			Keyboard = new KeyboardSettings(); | ||||
| 			Mouse = new MouseSettings(); | ||||
| 			Taskbar = new TaskbarSettings(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -6,23 +6,26 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Contracts.Configuration.Settings | ||||
| { | ||||
| 	public interface ITaskbarSettings | ||||
| 	[Serializable] | ||||
| 	public class TaskbarSettings | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may switch the keyboard layout during runtime. | ||||
| 		/// </summary> | ||||
| 		bool AllowKeyboardLayout { get; } | ||||
| 		public bool AllowKeyboardLayout { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may access the application log during runtime. | ||||
| 		/// </summary> | ||||
| 		bool AllowApplicationLog { get; } | ||||
| 		public bool AllowApplicationLog { get; set; } | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Determines whether the user may control the wireless network connection during runtime. | ||||
| 		/// </summary> | ||||
| 		bool AllowWirelessNetwork { get; } | ||||
| 		public bool AllowWirelessNetwork { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -64,17 +64,17 @@ | |||
|     <Compile Include="Communication\IRuntimeHost.cs" /> | ||||
|     <Compile Include="Communication\IRuntimeProxy.cs" /> | ||||
|     <Compile Include="Communication\IServiceProxy.cs" /> | ||||
|     <Compile Include="Communication\Messages\IDisconnectionMessage.cs" /> | ||||
|     <Compile Include="Communication\Messages\IMessage.cs" /> | ||||
|     <Compile Include="Communication\Messages\ISimpleMessage.cs" /> | ||||
|     <Compile Include="Communication\Messages\Message.cs" /> | ||||
|     <Compile Include="Communication\Responses\IAuthenticationResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\IConfigurationResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\IDisconnectionResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\IResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\IConnectionResponse.cs" /> | ||||
|     <Compile Include="Configuration\IClientConfiguration.cs" /> | ||||
|     <Compile Include="Configuration\IRuntimeInfo.cs" /> | ||||
|     <Compile Include="Communication\Messages\DisconnectionMessage.cs" /> | ||||
|     <Compile Include="Communication\Messages\MessagePurport.cs" /> | ||||
|     <Compile Include="Communication\Messages\SimpleMessage.cs" /> | ||||
|     <Compile Include="Communication\Responses\AuthenticationResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\ConfigurationResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\ConnectionResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\DisconnectionResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\Response.cs" /> | ||||
|     <Compile Include="Configuration\ClientConfiguration.cs" /> | ||||
|     <Compile Include="Configuration\RuntimeInfo.cs" /> | ||||
|     <Compile Include="Configuration\ISession.cs" /> | ||||
|     <Compile Include="Configuration\Settings\ConfigurationMode.cs" /> | ||||
|     <Compile Include="Behaviour\INotificationController.cs" /> | ||||
|  | @ -86,12 +86,12 @@ | |||
|     <Compile Include="Configuration\INotificationInfo.cs" /> | ||||
|     <Compile Include="Configuration\ISystemInfo.cs" /> | ||||
|     <Compile Include="Configuration\OperatingSystem.cs" /> | ||||
|     <Compile Include="Configuration\Settings\IBrowserSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\IKeyboardSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\IMouseSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\ISettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\BrowserSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\KeyboardSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\MouseSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\Settings.cs" /> | ||||
|     <Compile Include="Configuration\IConfigurationRepository.cs" /> | ||||
|     <Compile Include="Configuration\Settings\ITaskbarSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\TaskbarSettings.cs" /> | ||||
|     <Compile Include="Configuration\Settings\KioskMode.cs" /> | ||||
|     <Compile Include="Configuration\Settings\ServicePolicy.cs" /> | ||||
|     <Compile Include="I18n\IText.cs" /> | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ namespace SafeExamBrowser.Contracts.UserInterface | |||
| 		/// <summary> | ||||
| 		/// Creates a new about window displaying information about the currently running application version. | ||||
| 		/// </summary> | ||||
| 		IWindow CreateAboutWindow(IRuntimeInfo runtimeInfo); | ||||
| 		IWindow CreateAboutWindow(RuntimeInfo runtimeInfo); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Creates a taskbar button, initialized with the given application information. | ||||
|  | @ -28,7 +28,7 @@ namespace SafeExamBrowser.Contracts.UserInterface | |||
| 		/// <summary> | ||||
| 		/// Creates a new browser window loaded with the given browser control and settings. | ||||
| 		/// </summary> | ||||
| 		IBrowserWindow CreateBrowserWindow(IBrowserControl control, IBrowserSettings settings); | ||||
| 		IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Creates a new log window which runs on its own thread. | ||||
|  | @ -54,12 +54,12 @@ namespace SafeExamBrowser.Contracts.UserInterface | |||
| 		/// Creates a new runtime window which runs on its own thread. | ||||
| 		/// </summary> | ||||
| 		/// <returns></returns> | ||||
| 		IRuntimeWindow CreateRuntimeWindow(IRuntimeInfo runtimeInfo); | ||||
| 		IRuntimeWindow CreateRuntimeWindow(RuntimeInfo runtimeInfo); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Creates a new splash screen which runs on its own thread. | ||||
| 		/// </summary> | ||||
| 		ISplashScreen CreateSplashScreen(IRuntimeInfo runtimeInfo); | ||||
| 		ISplashScreen CreateSplashScreen(RuntimeInfo runtimeInfo); | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// Creates a system control which allows to change the wireless network connection of the computer. | ||||
|  |  | |||
|  | @ -12,7 +12,6 @@ using SafeExamBrowser.Contracts.Communication; | |||
| using SafeExamBrowser.Contracts.Communication.Messages; | ||||
| using SafeExamBrowser.Contracts.Communication.Responses; | ||||
| using SafeExamBrowser.Contracts.Logging; | ||||
| using SafeExamBrowser.Core.Communication.Responses; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Core.Communication | ||||
| { | ||||
|  | @ -39,10 +38,10 @@ namespace SafeExamBrowser.Core.Communication | |||
| 
 | ||||
| 		protected abstract bool OnConnect(Guid? token); | ||||
| 		protected abstract void OnDisconnect(); | ||||
| 		protected abstract IResponse OnReceive(IMessage message); | ||||
| 		protected abstract IResponse OnReceive(Message message); | ||||
| 		protected abstract Response OnReceive(Message message); | ||||
| 		protected abstract Response OnReceive(MessagePurport message); | ||||
| 
 | ||||
| 		public IConnectionResponse Connect(Guid? token = null) | ||||
| 		public ConnectionResponse Connect(Guid? token = null) | ||||
| 		{ | ||||
| 			logger.Debug($"Received connection request with authentication token '{token}'."); | ||||
| 
 | ||||
|  | @ -60,7 +59,7 @@ namespace SafeExamBrowser.Core.Communication | |||
| 			return response; | ||||
| 		} | ||||
| 
 | ||||
| 		public IDisconnectionResponse Disconnect(IDisconnectionMessage message) | ||||
| 		public DisconnectionResponse Disconnect(DisconnectionMessage message) | ||||
| 		{ | ||||
| 			var response = new DisconnectionResponse(); | ||||
| 
 | ||||
|  | @ -78,17 +77,17 @@ namespace SafeExamBrowser.Core.Communication | |||
| 			return response; | ||||
| 		} | ||||
| 
 | ||||
| 		public IResponse Send(IMessage message) | ||||
| 		public Response Send(Message message) | ||||
| 		{ | ||||
| 			IResponse response = null; | ||||
| 			Response response = null; | ||||
| 
 | ||||
| 			logger.Debug($"Received message '{message}'."); | ||||
| 
 | ||||
| 			if (IsAuthorized(message?.CommunicationToken)) | ||||
| 			{ | ||||
| 				if (message is ISimpleMessage) | ||||
| 				if (message is SimpleMessage) | ||||
| 				{ | ||||
| 					response = OnReceive((message as ISimpleMessage).Purport); | ||||
| 					response = OnReceive((message as SimpleMessage).Purport); | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
|  |  | |||
|  | @ -12,7 +12,6 @@ using SafeExamBrowser.Contracts.Communication; | |||
| using SafeExamBrowser.Contracts.Communication.Messages; | ||||
| using SafeExamBrowser.Contracts.Communication.Responses; | ||||
| using SafeExamBrowser.Contracts.Logging; | ||||
| using SafeExamBrowser.Core.Communication.Messages; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Core.Communication | ||||
| { | ||||
|  | @ -41,10 +40,12 @@ namespace SafeExamBrowser.Core.Communication | |||
| 			(channel as ICommunicationObject).Opened += BaseProxy_Opened; | ||||
| 			(channel as ICommunicationObject).Opening += BaseProxy_Opening; | ||||
| 
 | ||||
| 			Logger.Debug($"Trying to connect to endpoint {address} with authentication token '{token}'..."); | ||||
| 
 | ||||
| 			var response = channel.Connect(token); | ||||
| 
 | ||||
| 			communicationToken = response.CommunicationToken; | ||||
| 			Logger.Debug($"Tried to connect to {address}, connection was {(response.ConnectionEstablished ? "established" : "refused")}."); | ||||
| 			Logger.Debug($"Connection was {(response.ConnectionEstablished ? "established" : "refused")}."); | ||||
| 
 | ||||
| 			return response.ConnectionEstablished; | ||||
| 		} | ||||
|  | @ -61,7 +62,7 @@ namespace SafeExamBrowser.Core.Communication | |||
| 			return response.ConnectionTerminated; | ||||
| 		} | ||||
| 
 | ||||
| 		protected IResponse Send(IMessage message) | ||||
| 		protected Response Send(Message message) | ||||
| 		{ | ||||
| 			FailIfNotConnected(nameof(Send)); | ||||
| 
 | ||||
|  | @ -74,7 +75,7 @@ namespace SafeExamBrowser.Core.Communication | |||
| 			return response; | ||||
| 		} | ||||
| 
 | ||||
| 		protected IResponse Send(Message purport) | ||||
| 		protected Response Send(MessagePurport purport) | ||||
| 		{ | ||||
| 			FailIfNotConnected(nameof(Send)); | ||||
| 
 | ||||
|  | @ -129,12 +130,12 @@ namespace SafeExamBrowser.Core.Communication | |||
| 			return channel == null ? "null" : $"in state '{(channel as ICommunicationObject).State}'"; | ||||
| 		} | ||||
| 
 | ||||
| 		private string ToString(IMessage message) | ||||
| 		private string ToString(Message message) | ||||
| 		{ | ||||
| 			return message != null ? $"message of type '{message.GetType()}'" : "no message"; | ||||
| 		} | ||||
| 
 | ||||
| 		private string ToString(IResponse response) | ||||
| 		private string ToString(Response response) | ||||
| 		{ | ||||
| 			return response != null ? $"response of type '{response.GetType()}'" : "no response"; | ||||
| 		} | ||||
|  |  | |||
|  | @ -19,9 +19,9 @@ namespace SafeExamBrowser.Core.Communication | |||
| 		{ | ||||
| 		} | ||||
| 
 | ||||
| 		public IAuthenticationResponse RequestAuthentication() | ||||
| 		public AuthenticationResponse RequestAuthentication() | ||||
| 		{ | ||||
| 			return (IAuthenticationResponse) Send(Message.ClientIsReady); | ||||
| 			return (AuthenticationResponse) Send(MessagePurport.ClientIsReady); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -1,19 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Communication.Messages; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Core.Communication.Messages | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class BaseMessage : IMessage | ||||
| 	{ | ||||
| 		public Guid CommunicationToken { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -1,18 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Communication.Messages; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Core.Communication.Messages | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class DisconnectionMessage : BaseMessage, IDisconnectionMessage | ||||
| 	{ | ||||
| 	} | ||||
| } | ||||
|  | @ -1,19 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Communication.Messages; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Core.Communication.Messages | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class SimpleMessage : BaseMessage, ISimpleMessage | ||||
| 	{ | ||||
| 		public Message Purport { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -1,20 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Communication.Responses; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Core.Communication.Responses | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class ConnectionResponse : IConnectionResponse | ||||
| 	{ | ||||
| 		public Guid? CommunicationToken { get; set; } | ||||
| 		public bool ConnectionEstablished { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -1,19 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Communication.Responses; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Core.Communication.Responses | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class DisconnectionResponse : IDisconnectionResponse | ||||
| 	{ | ||||
| 		public bool ConnectionTerminated { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -20,14 +20,14 @@ namespace SafeExamBrowser.Core.Communication | |||
| 		{ | ||||
| 		} | ||||
| 
 | ||||
| 		public IClientConfiguration GetConfiguration() | ||||
| 		public ClientConfiguration GetConfiguration() | ||||
| 		{ | ||||
| 			return ((IConfigurationResponse) Send(Message.ConfigurationNeeded)).Configuration; | ||||
| 			return ((ConfigurationResponse) Send(MessagePurport.ConfigurationNeeded)).Configuration; | ||||
| 		} | ||||
| 
 | ||||
| 		public void InformClientReady() | ||||
| 		{ | ||||
| 			Send(Message.ClientIsReady); | ||||
| 			Send(MessagePurport.ClientIsReady); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ namespace SafeExamBrowser.Core.Communication | |||
| 		{ | ||||
| 		} | ||||
| 
 | ||||
| 		public override bool Connect(Guid? token) | ||||
| 		public override bool Connect(Guid? token = null) | ||||
| 		{ | ||||
| 			if (IgnoreOperation(nameof(Connect))) | ||||
| 			{ | ||||
|  | @ -41,7 +41,7 @@ namespace SafeExamBrowser.Core.Communication | |||
| 			return base.Disconnect(); | ||||
| 		} | ||||
| 
 | ||||
| 		public void StartSession(Guid sessionId, ISettings settings) | ||||
| 		public void StartSession(Guid sessionId, Settings settings) | ||||
| 		{ | ||||
| 			if (IgnoreOperation(nameof(StartSession))) | ||||
| 			{ | ||||
|  |  | |||
|  | @ -62,11 +62,6 @@ | |||
|     <Compile Include="Communication\BaseProxy.cs" /> | ||||
|     <Compile Include="Communication\BaseHost.cs" /> | ||||
|     <Compile Include="Communication\ClientProxy.cs" /> | ||||
|     <Compile Include="Communication\Messages\DisconnectionMessage.cs" /> | ||||
|     <Compile Include="Communication\Messages\BaseMessage.cs" /> | ||||
|     <Compile Include="Communication\Messages\SimpleMessage.cs" /> | ||||
|     <Compile Include="Communication\Responses\ConnectionResponse.cs" /> | ||||
|     <Compile Include="Communication\Responses\DisconnectionResponse.cs" /> | ||||
|     <Compile Include="Communication\RuntimeProxy.cs" /> | ||||
|     <Compile Include="Communication\ServiceProxy.cs" /> | ||||
|     <Compile Include="Logging\DefaultLogFormatter.cs" /> | ||||
|  |  | |||
|  | @ -17,10 +17,10 @@ namespace SafeExamBrowser.Monitoring.Keyboard | |||
| { | ||||
| 	public class KeyboardInterceptor : IKeyboardInterceptor | ||||
| 	{ | ||||
| 		private IKeyboardSettings settings; | ||||
| 		private KeyboardSettings settings; | ||||
| 		private ILogger logger; | ||||
| 
 | ||||
| 		public KeyboardInterceptor(IKeyboardSettings settings, ILogger logger) | ||||
| 		public KeyboardInterceptor(KeyboardSettings settings, ILogger logger) | ||||
| 		{ | ||||
| 			this.logger = logger; | ||||
| 			this.settings = settings; | ||||
|  |  | |||
|  | @ -15,9 +15,9 @@ namespace SafeExamBrowser.Monitoring.Mouse | |||
| 	public class MouseInterceptor : IMouseInterceptor | ||||
| 	{ | ||||
| 		private ILogger logger; | ||||
| 		private IMouseSettings settings; | ||||
| 		private MouseSettings settings; | ||||
| 
 | ||||
| 		public MouseInterceptor(ILogger logger, IMouseSettings settings) | ||||
| 		public MouseInterceptor(ILogger logger, MouseSettings settings) | ||||
| 		{ | ||||
| 			this.logger = logger; | ||||
| 			this.settings = settings; | ||||
|  |  | |||
|  | @ -23,9 +23,9 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations | |||
| 	public class ConfigurationOperationTests | ||||
| 	{ | ||||
| 		private Mock<ILogger> logger; | ||||
| 		private Mock<IRuntimeInfo> info; | ||||
| 		private Mock<RuntimeInfo> info; | ||||
| 		private Mock<IConfigurationRepository> repository; | ||||
| 		private Mock<ISettings> settings; | ||||
| 		private Mock<Settings> settings; | ||||
| 		private Mock<IText> text; | ||||
| 		private Mock<IUserInterfaceFactory> uiFactory; | ||||
| 		private ConfigurationOperation sut; | ||||
|  | @ -34,9 +34,9 @@ namespace SafeExamBrowser.Runtime.UnitTests.Behaviour.Operations | |||
| 		public void Initialize() | ||||
| 		{ | ||||
| 			logger = new Mock<ILogger>(); | ||||
| 			info = new Mock<IRuntimeInfo>(); | ||||
| 			info = new Mock<RuntimeInfo>(); | ||||
| 			repository = new Mock<IConfigurationRepository>(); | ||||
| 			settings = new Mock<ISettings>(); | ||||
| 			settings = new Mock<Settings>(); | ||||
| 			text = new Mock<IText>(); | ||||
| 			uiFactory = new Mock<IUserInterfaceFactory>(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations | |||
| 	{ | ||||
| 		private IConfigurationRepository repository; | ||||
| 		private ILogger logger; | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IText text; | ||||
| 		private IUserInterfaceFactory uiFactory; | ||||
| 		private string[] commandLineArgs; | ||||
|  | @ -32,7 +32,7 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations | |||
| 		public ConfigurationOperation( | ||||
| 			IConfigurationRepository repository, | ||||
| 			ILogger logger, | ||||
| 			IRuntimeInfo runtimeInfo, | ||||
| 			RuntimeInfo runtimeInfo, | ||||
| 			IText text, | ||||
| 			IUserInterfaceFactory uiFactory, | ||||
| 			string[] commandLineArgs) | ||||
|  | @ -50,7 +50,7 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations | |||
| 			logger.Info("Initializing application configuration..."); | ||||
| 			ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_InitializeConfiguration); | ||||
| 
 | ||||
| 			ISettings settings; | ||||
| 			Settings settings; | ||||
| 			var isValidUri = TryGetSettingsUri(out Uri uri); | ||||
| 
 | ||||
| 			if (isValidUri) | ||||
|  |  | |||
|  | @ -102,35 +102,47 @@ namespace SafeExamBrowser.Runtime.Behaviour.Operations | |||
| 
 | ||||
| 		private void StartClient() | ||||
| 		{ | ||||
| 			const int TEN_SECONDS = 10000; | ||||
| 
 | ||||
| 			var clientReady = new AutoResetEvent(false); | ||||
| 			var clientReadyHandler = new CommunicationEventHandler(() => clientReady.Set()); | ||||
| 			var clientExecutable = configuration.RuntimeInfo.ClientExecutablePath; | ||||
| 			var clientLogFile = $"{'"' + configuration.RuntimeInfo.ClientLogFile + '"'}";
 | ||||
| 			var hostUri = configuration.RuntimeInfo.RuntimeAddress; | ||||
| 			var token = session.StartupToken.ToString("D"); | ||||
| 
 | ||||
| 			runtimeHost.ClientReady += clientReadyHandler; | ||||
| 			session.ClientProcess = processFactory.StartNew(clientExecutable, hostUri, token); | ||||
| 			session.ClientProcess = processFactory.StartNew(clientExecutable, clientLogFile, hostUri, token); | ||||
| 
 | ||||
| 			var clientStarted = clientReady.WaitOne(TEN_SECONDS); | ||||
| 
 | ||||
| 			clientReady.WaitOne(); | ||||
| 			runtimeHost.ClientReady -= clientReadyHandler; | ||||
| 
 | ||||
| 			if (client.Connect(session.StartupToken)) | ||||
| 			// TODO: Check if client process alive! | ||||
| 			if (clientStarted) | ||||
| 			{ | ||||
| 				var response = client.RequestAuthentication(); | ||||
| 
 | ||||
| 				// TODO: Further integrity checks necessary? | ||||
| 				if (session.ClientProcess.Id == response.ProcessId) | ||||
| 				if (client.Connect(session.StartupToken)) | ||||
| 				{ | ||||
| 					sessionRunning = true; | ||||
| 					var response = client.RequestAuthentication(); | ||||
| 
 | ||||
| 					// TODO: Further integrity checks necessary? | ||||
| 					if (session.ClientProcess.Id == response.ProcessId) | ||||
| 					{ | ||||
| 						sessionRunning = true; | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						logger.Error("Failed to verify client integrity!"); | ||||
| 					} | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					logger.Error("Failed to verify client integrity!"); | ||||
| 					logger.Error("Failed to connect to client!"); | ||||
| 				} | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				logger.Error("Failed to connect to client!"); | ||||
| 				logger.Error($"Failed to start client within {TEN_SECONDS / 1000} seconds!"); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ namespace SafeExamBrowser.Runtime.Behaviour | |||
| 		private IOperationSequence bootstrapSequence; | ||||
| 		private IOperationSequence sessionSequence; | ||||
| 		private IRuntimeHost runtimeHost; | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IRuntimeWindow runtimeWindow; | ||||
| 		private IServiceProxy service; | ||||
| 		private ISplashScreen splashScreen; | ||||
|  | @ -42,7 +42,7 @@ namespace SafeExamBrowser.Runtime.Behaviour | |||
| 			IOperationSequence bootstrapSequence, | ||||
| 			IOperationSequence sessionSequence, | ||||
| 			IRuntimeHost runtimeHost, | ||||
| 			IRuntimeInfo runtimeInfo, | ||||
| 			RuntimeInfo runtimeInfo, | ||||
| 			IServiceProxy service, | ||||
| 			Action shutdown, | ||||
| 			IUserInterfaceFactory uiFactory) | ||||
|  | @ -140,6 +140,7 @@ namespace SafeExamBrowser.Runtime.Behaviour | |||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				// TODO: Not when user chose to terminate after reconfiguration! Probably needs IOperationSequenceResult or alike... | ||||
| 				uiFactory.Show(TextKey.MessageBox_SessionStartError, TextKey.MessageBox_SessionStartErrorTitle, icon: MessageBoxIcon.Error); | ||||
| 
 | ||||
| 				if (!initial) | ||||
|  |  | |||
|  | @ -1,20 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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 SafeExamBrowser.Contracts.Communication.Responses; | ||||
| using SafeExamBrowser.Contracts.Configuration; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Runtime.Communication.Responses | ||||
| { | ||||
| 	[Serializable] | ||||
| 	internal class ConfigurationResponse : IConfigurationResponse | ||||
| 	{ | ||||
| 		public IClientConfiguration Configuration { get; set; } | ||||
| 	} | ||||
| } | ||||
|  | @ -7,13 +7,13 @@ | |||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using SafeExamBrowser.Contracts.Communication; | ||||
| using SafeExamBrowser.Contracts.Communication.Messages; | ||||
| using SafeExamBrowser.Contracts.Communication.Responses; | ||||
| using SafeExamBrowser.Contracts.Configuration; | ||||
| using SafeExamBrowser.Contracts.Logging; | ||||
| using SafeExamBrowser.Core.Communication; | ||||
| using SafeExamBrowser.Runtime.Communication.Responses; | ||||
| 
 | ||||
| namespace SafeExamBrowser.Runtime.Communication | ||||
| { | ||||
|  | @ -40,20 +40,20 @@ namespace SafeExamBrowser.Runtime.Communication | |||
| 			// TODO | ||||
| 		} | ||||
| 
 | ||||
| 		protected override IResponse OnReceive(IMessage message) | ||||
| 		protected override Response OnReceive(Message message) | ||||
| 		{ | ||||
| 			// TODO | ||||
| 			return null; | ||||
| 		} | ||||
| 
 | ||||
| 		protected override IResponse OnReceive(Message message) | ||||
| 		protected override Response OnReceive(MessagePurport message) | ||||
| 		{ | ||||
| 			switch (message) | ||||
| 			{ | ||||
| 				case Message.ClientIsReady: | ||||
| 				case MessagePurport.ClientIsReady: | ||||
| 					ClientReady?.Invoke(); | ||||
| 					break; | ||||
| 				case Message.ConfigurationNeeded: | ||||
| 				case MessagePurport.ConfigurationNeeded: | ||||
| 					return new ConfigurationResponse { Configuration = configuration.BuildClientConfiguration() }; | ||||
| 			} | ||||
| 
 | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ namespace SafeExamBrowser.Runtime | |||
| 	internal class CompositionRoot | ||||
| 	{ | ||||
| 		private ILogger logger; | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private ISystemInfo systemInfo; | ||||
| 
 | ||||
| 		internal IRuntimeController RuntimeController { get; private set; } | ||||
|  |  | |||
|  | @ -93,7 +93,6 @@ | |||
|     <Compile Include="Behaviour\Operations\SessionSequenceEndOperation.cs" /> | ||||
|     <Compile Include="Behaviour\Operations\SessionSequenceOperation.cs" /> | ||||
|     <Compile Include="Behaviour\Operations\SessionSequenceStartOperation.cs" /> | ||||
|     <Compile Include="Communication\Responses\ConfigurationResponse.cs" /> | ||||
|     <Compile Include="Communication\RuntimeHost.cs" /> | ||||
|     <Compile Include="CompositionRoot.cs" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.cs"> | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| { | ||||
| 	public partial class AboutWindow : Window, IWindow | ||||
| 	{ | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IText text; | ||||
| 		private WindowClosingEventHandler closing; | ||||
| 
 | ||||
|  | @ -26,7 +26,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			remove { closing -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public AboutWindow(IRuntimeInfo runtimeInfo, IText text) | ||||
| 		public AboutWindow(RuntimeInfo runtimeInfo, IText text) | ||||
| 		{ | ||||
| 			this.runtimeInfo = runtimeInfo; | ||||
| 			this.text = text; | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 	public partial class BrowserWindow : Window, IBrowserWindow | ||||
| 	{ | ||||
| 		private bool isMainWindow; | ||||
| 		private IBrowserSettings settings; | ||||
| 		private BrowserSettings settings; | ||||
| 		public WindowClosingEventHandler closing; | ||||
| 
 | ||||
| 		public bool IsMainWindow | ||||
|  | @ -45,7 +45,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			remove { closing -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public BrowserWindow(IBrowserControl browserControl, IBrowserSettings settings) | ||||
| 		public BrowserWindow(IBrowserControl browserControl, BrowserSettings settings) | ||||
| 		{ | ||||
| 			this.settings = settings; | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 	{ | ||||
| 		private bool allowClose; | ||||
| 		private ILogContentFormatter formatter; | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IText text; | ||||
| 		private RuntimeWindowViewModel model; | ||||
| 		private WindowClosingEventHandler closing; | ||||
|  | @ -32,7 +32,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			remove { closing -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public RuntimeWindow(ILogContentFormatter formatter, IRuntimeInfo runtimeInfo, IText text) | ||||
| 		public RuntimeWindow(ILogContentFormatter formatter, RuntimeInfo runtimeInfo, IText text) | ||||
| 		{ | ||||
| 			this.formatter = formatter; | ||||
| 			this.runtimeInfo = runtimeInfo; | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 	{ | ||||
| 		private bool allowClose; | ||||
| 		private ProgressIndicatorViewModel model = new ProgressIndicatorViewModel(); | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IText text; | ||||
| 		private WindowClosingEventHandler closing; | ||||
| 
 | ||||
|  | @ -29,7 +29,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			remove { closing -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public SplashScreen(IRuntimeInfo runtimeInfo, IText text) | ||||
| 		public SplashScreen(RuntimeInfo runtimeInfo, IText text) | ||||
| 		{ | ||||
| 			this.runtimeInfo = runtimeInfo; | ||||
| 			this.text = text; | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			this.text = text; | ||||
| 		} | ||||
| 
 | ||||
| 		public IWindow CreateAboutWindow(IRuntimeInfo runtimeInfo) | ||||
| 		public IWindow CreateAboutWindow(RuntimeInfo runtimeInfo) | ||||
| 		{ | ||||
| 			return new AboutWindow(runtimeInfo, text); | ||||
| 		} | ||||
|  | @ -39,7 +39,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			return new ApplicationButton(info); | ||||
| 		} | ||||
| 
 | ||||
| 		public IBrowserWindow CreateBrowserWindow(IBrowserControl control, IBrowserSettings settings) | ||||
| 		public IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings) | ||||
| 		{ | ||||
| 			return new BrowserWindow(control, settings); | ||||
| 		} | ||||
|  | @ -84,7 +84,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			return new PowerSupplyControl(); | ||||
| 		} | ||||
| 
 | ||||
| 		public IRuntimeWindow CreateRuntimeWindow(IRuntimeInfo runtimeInfo) | ||||
| 		public IRuntimeWindow CreateRuntimeWindow(RuntimeInfo runtimeInfo) | ||||
| 		{ | ||||
| 			RuntimeWindow runtimeWindow = null; | ||||
| 			var windowReadyEvent = new AutoResetEvent(false); | ||||
|  | @ -108,7 +108,7 @@ namespace SafeExamBrowser.UserInterface.Classic | |||
| 			return runtimeWindow; | ||||
| 		} | ||||
| 
 | ||||
| 		public ISplashScreen CreateSplashScreen(IRuntimeInfo runtimeInfo) | ||||
| 		public ISplashScreen CreateSplashScreen(RuntimeInfo runtimeInfo) | ||||
| 		{ | ||||
| 			SplashScreen splashScreen = null; | ||||
| 			var splashReadyEvent = new AutoResetEvent(false); | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| { | ||||
| 	public partial class AboutWindow : Window, IWindow | ||||
| 	{ | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IText text; | ||||
| 		private WindowClosingEventHandler closing; | ||||
| 
 | ||||
|  | @ -26,7 +26,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 			remove { closing -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public AboutWindow(IRuntimeInfo runtimeInfo, IText text) | ||||
| 		public AboutWindow(RuntimeInfo runtimeInfo, IText text) | ||||
| 		{ | ||||
| 			this.runtimeInfo = runtimeInfo; | ||||
| 			this.text = text; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 	public partial class BrowserWindow : Window, IBrowserWindow | ||||
| 	{ | ||||
| 		private bool isMainWindow; | ||||
| 		private IBrowserSettings settings; | ||||
| 		private BrowserSettings settings; | ||||
| 		public WindowClosingEventHandler closing; | ||||
| 
 | ||||
| 		public bool IsMainWindow | ||||
|  | @ -43,7 +43,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 			remove { closing -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public BrowserWindow(IBrowserControl browserControl, IBrowserSettings settings) | ||||
| 		public BrowserWindow(IBrowserControl browserControl, BrowserSettings settings) | ||||
| 		{ | ||||
| 			this.settings = settings; | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 	{ | ||||
| 		private bool allowClose; | ||||
| 		private SplashScreenViewModel model = new SplashScreenViewModel(); | ||||
| 		private IRuntimeInfo runtimeInfo; | ||||
| 		private RuntimeInfo runtimeInfo; | ||||
| 		private IText text; | ||||
| 		private WindowClosingEventHandler closing; | ||||
| 
 | ||||
|  | @ -29,7 +29,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 			remove { closing -= value; } | ||||
| 		} | ||||
| 
 | ||||
| 		public SplashScreen(IRuntimeInfo runtimeInfo, IText text) | ||||
| 		public SplashScreen(RuntimeInfo runtimeInfo, IText text) | ||||
| 		{ | ||||
| 			this.runtimeInfo = runtimeInfo; | ||||
| 			this.text = text; | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 			this.text = text; | ||||
| 		} | ||||
| 
 | ||||
| 		public IWindow CreateAboutWindow(IRuntimeInfo runtimeInfo) | ||||
| 		public IWindow CreateAboutWindow(RuntimeInfo runtimeInfo) | ||||
| 		{ | ||||
| 			return new AboutWindow(runtimeInfo, text); | ||||
| 		} | ||||
|  | @ -38,7 +38,7 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 			return new ApplicationButton(info); | ||||
| 		} | ||||
| 
 | ||||
| 		public IBrowserWindow CreateBrowserWindow(IBrowserControl control, IBrowserSettings settings) | ||||
| 		public IBrowserWindow CreateBrowserWindow(IBrowserControl control, BrowserSettings settings) | ||||
| 		{ | ||||
| 			return new BrowserWindow(control, settings); | ||||
| 		} | ||||
|  | @ -84,13 +84,13 @@ namespace SafeExamBrowser.UserInterface.Windows10 | |||
| 			return new PowerSupplyControl(); | ||||
| 		} | ||||
| 
 | ||||
| 		public IRuntimeWindow CreateRuntimeWindow(IRuntimeInfo runtimeInfo) | ||||
| 		public IRuntimeWindow CreateRuntimeWindow(RuntimeInfo runtimeInfo) | ||||
| 		{ | ||||
| 			// TODO | ||||
| 			throw new System.NotImplementedException(); | ||||
| 		} | ||||
| 
 | ||||
| 		public ISplashScreen CreateSplashScreen(IRuntimeInfo runtimeInfo) | ||||
| 		public ISplashScreen CreateSplashScreen(RuntimeInfo runtimeInfo) | ||||
| 		{ | ||||
| 			SplashScreen splashScreen = null; | ||||
| 			var splashReadyEvent = new AutoResetEvent(false); | ||||
|  |  | |||
|  | @ -21,14 +21,14 @@ namespace SafeExamBrowser.WindowsApi | |||
| 		internal static extern bool CreateProcess( | ||||
| 			string lpApplicationName, | ||||
| 			string lpCommandLine, | ||||
| 			ref SECURITY_ATTRIBUTES lpProcessAttributes, | ||||
| 			ref SECURITY_ATTRIBUTES lpThreadAttributes, | ||||
| 			IntPtr lpProcessAttributes, | ||||
| 			IntPtr lpThreadAttributes, | ||||
| 			bool bInheritHandles, | ||||
| 			uint dwCreationFlags, | ||||
| 			IntPtr lpEnvironment, | ||||
| 			string lpCurrentDirectory, | ||||
| 			[In] ref STARTUPINFO lpStartupInfo, | ||||
| 			out PROCESS_INFORMATION lpProcessInformation); | ||||
| 			ref PROCESS_INFORMATION lpProcessInformation); | ||||
| 
 | ||||
| 		[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] | ||||
| 		internal static extern IntPtr GetModuleHandle(string lpModuleName); | ||||
|  |  | |||
|  | @ -29,15 +29,15 @@ namespace SafeExamBrowser.WindowsApi | |||
| 
 | ||||
| 		public IProcess StartNew(string path, params string[] args) | ||||
| 		{ | ||||
| 			var commandLine = $"{'"' + path + '"'} {String.Join(" ", args)}";
 | ||||
| 			var processInfo = new PROCESS_INFORMATION(); | ||||
| 			var pAttr = new SECURITY_ATTRIBUTES(); | ||||
| 			var tAttr = new SECURITY_ATTRIBUTES(); | ||||
| 			var startupInfo = new STARTUPINFO(); | ||||
| 
 | ||||
| 			startupInfo.cb = Marshal.SizeOf(startupInfo); | ||||
| 			startupInfo.lpDesktop = desktop.CurrentName; | ||||
| 			// TODO: | ||||
| 			//startupInfo.lpDesktop = desktop.CurrentName; | ||||
| 
 | ||||
| 			var success = Kernel32.CreateProcess(null, path, ref pAttr, ref tAttr, true, Constant.NORMAL_PRIORITY_CLASS, IntPtr.Zero, null, ref startupInfo, out processInfo); | ||||
| 			var success = Kernel32.CreateProcess(null, commandLine, IntPtr.Zero, IntPtr.Zero, true, Constant.NORMAL_PRIORITY_CLASS, IntPtr.Zero, null, ref startupInfo, ref processInfo); | ||||
| 
 | ||||
| 			if (!success) | ||||
| 			{ | ||||
|  |  | |||
|  | @ -74,7 +74,6 @@ | |||
|     <Compile Include="Types\POINT.cs" /> | ||||
|     <Compile Include="Types\PROCESS_INFORMATION.cs" /> | ||||
|     <Compile Include="Types\RECT.cs" /> | ||||
|     <Compile Include="Types\SECURITY_ATTRIBUTES.cs" /> | ||||
|     <Compile Include="Types\STARTUPINFO.cs" /> | ||||
|     <Compile Include="User32.cs" /> | ||||
|   </ItemGroup> | ||||
|  |  | |||
|  | @ -1,25 +0,0 @@ | |||
| /* | ||||
|  * Copyright (c) 2018 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.Runtime.InteropServices; | ||||
| 
 | ||||
| namespace SafeExamBrowser.WindowsApi.Types | ||||
| { | ||||
| 	/// <remarks> | ||||
| 	/// See http://pinvoke.net/default.aspx/Structures/SECURITY_ATTRIBUTES.html. | ||||
| 	/// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa379560(v=vs.85).aspx. | ||||
| 	/// </remarks> | ||||
| 	[StructLayout(LayoutKind.Sequential)] | ||||
| 	internal struct SECURITY_ATTRIBUTES | ||||
| 	{ | ||||
| 		public int nLength; | ||||
| 		public IntPtr lpSecurityDescriptor; | ||||
| 		public int bInheritHandle; | ||||
| 	} | ||||
| } | ||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 dbuechel
						dbuechel