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