Restore SEBPatch
This commit is contained in:
258
SafeExamBrowser.Communication/Hosts/BaseHost.cs
Normal file
258
SafeExamBrowser.Communication/Hosts/BaseHost.cs
Normal file
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.Collections.Generic;
|
||||
using System.ServiceModel;
|
||||
using System.Threading;
|
||||
using SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Data;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Hosts
|
||||
{
|
||||
/// <summary>
|
||||
/// The base implementation of an <see cref="ICommunicationHost"/>. Runs the host on a new, separate thread.
|
||||
/// </summary>
|
||||
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
|
||||
public abstract class BaseHost : ICommunication, ICommunicationHost
|
||||
{
|
||||
private readonly object @lock = new object();
|
||||
|
||||
private string address;
|
||||
private IHostObject host;
|
||||
private IHostObjectFactory factory;
|
||||
private Thread hostThread;
|
||||
private int timeout_ms;
|
||||
|
||||
protected IList<Guid> CommunicationToken { get; private set; }
|
||||
protected ILogger Logger { get; private set; }
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
return host?.State == CommunicationState.Opened;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BaseHost(string address, IHostObjectFactory factory, ILogger logger, int timeout_ms)
|
||||
{
|
||||
this.address = address;
|
||||
this.CommunicationToken = new List<Guid>();
|
||||
this.factory = factory;
|
||||
this.Logger = logger;
|
||||
this.timeout_ms = timeout_ms;
|
||||
}
|
||||
|
||||
protected abstract bool OnConnect(Guid? token);
|
||||
protected abstract void OnDisconnect(Interlocutor interlocutor);
|
||||
protected abstract Response OnReceive(Message message);
|
||||
protected abstract Response OnReceive(SimpleMessagePurport message);
|
||||
|
||||
public ConnectionResponse Connect(Guid? token = null)
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
Logger.Debug($"Received connection request {(token.HasValue ? $"with authentication token '{token}'" : "without authentication token")}.");
|
||||
|
||||
var response = new ConnectionResponse();
|
||||
var connected = OnConnect(token);
|
||||
|
||||
if (connected)
|
||||
{
|
||||
var communicationToken = Guid.NewGuid();
|
||||
|
||||
response.CommunicationToken = communicationToken;
|
||||
response.ConnectionEstablished = true;
|
||||
|
||||
CommunicationToken.Add(communicationToken);
|
||||
}
|
||||
|
||||
Logger.Debug($"{(connected ? "Accepted" : "Denied")} connection request.");
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public DisconnectionResponse Disconnect(DisconnectionMessage message)
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
var response = new DisconnectionResponse();
|
||||
|
||||
Logger.Debug($"Received disconnection request with message '{ToString(message)}'.");
|
||||
|
||||
if (IsAuthorized(message?.CommunicationToken))
|
||||
{
|
||||
OnDisconnect(message.Interlocutor);
|
||||
|
||||
response.ConnectionTerminated = true;
|
||||
CommunicationToken.Remove(message.CommunicationToken);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public Response Send(Message message)
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
var response = new SimpleResponse(SimpleResponsePurport.Unauthorized) as Response;
|
||||
|
||||
if (IsAuthorized(message?.CommunicationToken))
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case SimpleMessage simpleMessage when simpleMessage.Purport == SimpleMessagePurport.Ping:
|
||||
response = new SimpleResponse(SimpleResponsePurport.Acknowledged);
|
||||
break;
|
||||
case SimpleMessage simpleMessage:
|
||||
response = OnReceive(simpleMessage.Purport);
|
||||
break;
|
||||
default:
|
||||
response = OnReceive(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Debug($"Received message '{ToString(message)}', sending response '{ToString(response)}'.");
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
var exception = default(Exception);
|
||||
var startedEvent = new AutoResetEvent(false);
|
||||
|
||||
hostThread = new Thread(() => TryStartHost(startedEvent, out exception));
|
||||
hostThread.SetApartmentState(ApartmentState.STA);
|
||||
hostThread.IsBackground = true;
|
||||
hostThread.Start();
|
||||
|
||||
var success = startedEvent.WaitOne(timeout_ms);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
throw new CommunicationException($"Failed to start communication host for endpoint '{address}' within {timeout_ms / 1000} seconds!", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
var success = TryStopHost(out Exception exception);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug($"Terminated communication host for endpoint '{address}'.");
|
||||
}
|
||||
else if (exception != null)
|
||||
{
|
||||
throw new CommunicationException($"Failed to terminate communication host for endpoint '{address}'!", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsAuthorized(Guid? token)
|
||||
{
|
||||
return token.HasValue && CommunicationToken.Contains(token.Value);
|
||||
}
|
||||
|
||||
private void TryStartHost(AutoResetEvent startedEvent, out Exception exception)
|
||||
{
|
||||
exception = null;
|
||||
|
||||
try
|
||||
{
|
||||
host = factory.CreateObject(address, this);
|
||||
|
||||
host.Closed += Host_Closed;
|
||||
host.Closing += Host_Closing;
|
||||
host.Faulted += Host_Faulted;
|
||||
host.Opened += Host_Opened;
|
||||
host.Opening += Host_Opening;
|
||||
|
||||
host.Open();
|
||||
Logger.Debug($"Successfully started communication host for endpoint '{address}'.");
|
||||
|
||||
startedEvent.Set();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryStopHost(out Exception exception)
|
||||
{
|
||||
var success = false;
|
||||
|
||||
exception = null;
|
||||
|
||||
try
|
||||
{
|
||||
host?.Close();
|
||||
success = hostThread?.Join(timeout_ms) == true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e;
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
private void Host_Closed(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication host has been closed.");
|
||||
}
|
||||
|
||||
private void Host_Closing(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication host is closing...");
|
||||
}
|
||||
|
||||
private void Host_Faulted(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Error("Communication host has faulted!");
|
||||
}
|
||||
|
||||
private void Host_Opened(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication host has been opened.");
|
||||
}
|
||||
|
||||
private void Host_Opening(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication host is opening...");
|
||||
}
|
||||
|
||||
private string ToString(Message message)
|
||||
{
|
||||
return message != null ? message.ToString() : "<null>";
|
||||
}
|
||||
|
||||
private string ToString(Response response)
|
||||
{
|
||||
return response != null ? response.ToString() : "<null>";
|
||||
}
|
||||
}
|
||||
}
|
37
SafeExamBrowser.Communication/Hosts/HostObjectFactory.cs
Normal file
37
SafeExamBrowser.Communication/Hosts/HostObjectFactory.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.ServiceModel;
|
||||
using SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Hosts
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IHostObjectFactory"/> utilizing WCF (<see cref="ServiceHost"/>).
|
||||
/// </summary>
|
||||
public class HostObjectFactory : IHostObjectFactory
|
||||
{
|
||||
public IHostObject CreateObject(string address, ICommunication communicationObject)
|
||||
{
|
||||
var host = new Host(communicationObject);
|
||||
|
||||
host.AddServiceEndpoint(typeof(ICommunication), new NetNamedPipeBinding(NetNamedPipeSecurityMode.Transport), address);
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
private class Host : ServiceHost, IHostObject
|
||||
{
|
||||
internal Host(object singletonInstance, params Uri[] baseAddresses) : base(singletonInstance, baseAddresses)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
SafeExamBrowser.Communication/Properties/AssemblyInfo.cs
Normal file
33
SafeExamBrowser.Communication/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SafeExamBrowser.Communication")]
|
||||
[assembly: AssemblyDescription("Safe Exam Browser")]
|
||||
[assembly: AssemblyCompany("ETH Zürich")]
|
||||
[assembly: AssemblyProduct("SafeExamBrowser.Communication")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024 ETH Zürich, IT Services")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("c9416a62-0623-4d38-96aa-92516b32f02f")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.0")]
|
293
SafeExamBrowser.Communication/Proxies/BaseProxy.cs
Normal file
293
SafeExamBrowser.Communication/Proxies/BaseProxy.cs
Normal file
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.ServiceModel;
|
||||
using System.Timers;
|
||||
using SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Data;
|
||||
using SafeExamBrowser.Communication.Contracts.Events;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Proxies
|
||||
{
|
||||
/// <summary>
|
||||
/// Base implementation of an <see cref="ICommunicationProxy"/>.
|
||||
/// </summary>
|
||||
public abstract class BaseProxy : ICommunicationProxy
|
||||
{
|
||||
private const int ONE_MINUTE = 60000;
|
||||
private readonly object @lock = new object();
|
||||
|
||||
private string address;
|
||||
private Interlocutor owner;
|
||||
private IProxyObject proxy;
|
||||
private IProxyObjectFactory factory;
|
||||
private Guid? communicationToken;
|
||||
private Timer timer;
|
||||
|
||||
protected ILogger Logger { get; }
|
||||
public bool IsConnected => communicationToken.HasValue;
|
||||
|
||||
public event CommunicationEventHandler ConnectionLost;
|
||||
|
||||
public BaseProxy(string address, IProxyObjectFactory factory, ILogger logger, Interlocutor owner)
|
||||
{
|
||||
this.address = address;
|
||||
this.factory = factory;
|
||||
this.Logger = logger;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public virtual bool Connect(Guid? token = null, bool autoPing = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Debug($"Trying to connect to endpoint '{address}'{(token.HasValue ? $" with authentication token '{token}'" : string.Empty)}...");
|
||||
|
||||
InitializeProxyObject();
|
||||
|
||||
var response = proxy.Connect(token);
|
||||
var success = response.ConnectionEstablished;
|
||||
|
||||
communicationToken = response.CommunicationToken;
|
||||
Logger.Debug($"Connection was {(success ? "established" : "refused")}.");
|
||||
|
||||
if (success && autoPing)
|
||||
{
|
||||
StartAutoPing();
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
catch (EndpointNotFoundException)
|
||||
{
|
||||
Logger.Warn($"Endpoint '{address}' could not be found!");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to connect to endpoint '{address}'!", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool Disconnect()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!IsConnected)
|
||||
{
|
||||
Logger.Warn($"Cannot disconnect from endpoint '{address}' before being connected!");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
StopAutoPing();
|
||||
|
||||
var message = new DisconnectionMessage
|
||||
{
|
||||
CommunicationToken = communicationToken.Value,
|
||||
Interlocutor = owner
|
||||
};
|
||||
var response = proxy.Disconnect(message);
|
||||
var success = response.ConnectionTerminated;
|
||||
|
||||
Logger.Debug($"{(success ? "Disconnected" : "Failed to disconnect")} from '{address}'.");
|
||||
|
||||
if (success)
|
||||
{
|
||||
communicationToken = null;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to disconnect from endpoint '{address}'!", e);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the given message, optionally returning a response. If no response is expected, <c>null</c> will be returned.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException">If the given message is <c>null</c>.</exception>
|
||||
/// <exception cref="InvalidOperationException">If no connection has been established yet or the connection is corrupted.</exception>
|
||||
protected virtual Response Send(Message message)
|
||||
{
|
||||
FailIfNull(message);
|
||||
FailIfNotConnected();
|
||||
|
||||
message.CommunicationToken = communicationToken.Value;
|
||||
Logger.Debug($"Sending message '{ToString(message)}'...");
|
||||
|
||||
var response = proxy.Send(message);
|
||||
|
||||
Logger.Debug($"Received response '{ToString(response)}' for message '{ToString(message)}'.");
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the given purport as <see cref="SimpleMessage"/>.
|
||||
/// </summary>
|
||||
protected Response Send(SimpleMessagePurport purport)
|
||||
{
|
||||
return Send(new SimpleMessage(purport));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the given response is a <see cref="SimpleResponse"/> with purport <see cref="SimpleResponsePurport.Acknowledged"/>.
|
||||
/// </summary>
|
||||
protected bool IsAcknowledged(Response response)
|
||||
{
|
||||
return response is SimpleResponse simpleResponse && simpleResponse.Purport == SimpleResponsePurport.Acknowledged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests whether the connection to the host is alive by sending a ping message. If the transmission of the message fails or it is
|
||||
/// not acknowledged, the <see cref="ConnectionLost"/> event is fired and the auto-ping timer stopped (if it was initialized).
|
||||
/// </summary>
|
||||
protected void TestConnection()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(SimpleMessagePurport.Ping);
|
||||
|
||||
if (IsAcknowledged(response))
|
||||
{
|
||||
Logger.Info("Pinged host, connection is alive.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Host did not acknowledge ping message! Received: {ToString(response)}.");
|
||||
timer?.Stop();
|
||||
ConnectionLost?.Invoke();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error("Failed to ping host!", e);
|
||||
timer?.Stop();
|
||||
ConnectionLost?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the string representation of the given <see cref="Message"/>, or indicates that a message is <c>null</c>.
|
||||
/// </summary>
|
||||
protected string ToString(Message message)
|
||||
{
|
||||
return message != null ? message.ToString() : "<null>";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the string representation of the given <see cref="Response"/>, or indicates that a response is <c>null</c>.
|
||||
/// </summary>
|
||||
protected string ToString(Response response)
|
||||
{
|
||||
return response != null ? response.ToString() : "<null>";
|
||||
}
|
||||
|
||||
private void InitializeProxyObject()
|
||||
{
|
||||
proxy = factory.CreateObject(address);
|
||||
|
||||
proxy.Closed += BaseProxy_Closed;
|
||||
proxy.Closing += BaseProxy_Closing;
|
||||
proxy.Faulted += BaseProxy_Faulted;
|
||||
proxy.Opened += BaseProxy_Opened;
|
||||
proxy.Opening += BaseProxy_Opening;
|
||||
}
|
||||
|
||||
private void BaseProxy_Closed(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication channel has been closed.");
|
||||
}
|
||||
|
||||
private void BaseProxy_Closing(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication channel is closing...");
|
||||
}
|
||||
|
||||
private void BaseProxy_Faulted(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Warn("Communication channel has faulted!");
|
||||
timer?.Stop();
|
||||
ConnectionLost?.Invoke();
|
||||
}
|
||||
|
||||
private void BaseProxy_Opened(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication channel has been opened.");
|
||||
}
|
||||
|
||||
private void BaseProxy_Opening(object sender, EventArgs e)
|
||||
{
|
||||
Logger.Debug("Communication channel is opening...");
|
||||
}
|
||||
|
||||
private void FailIfNull(Message message)
|
||||
{
|
||||
if (message == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(message));
|
||||
}
|
||||
}
|
||||
|
||||
private void FailIfNotConnected()
|
||||
{
|
||||
if (!IsConnected)
|
||||
{
|
||||
throw new InvalidOperationException($"Cannot send message before being connected to endpoint '{address}'!");
|
||||
}
|
||||
|
||||
if (proxy == null || proxy.State != CommunicationState.Opened)
|
||||
{
|
||||
throw new InvalidOperationException($"Tried to send message, but channel was {GetChannelState()}!");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetChannelState()
|
||||
{
|
||||
return proxy == null ? "null" : $"in state '{proxy.State}'";
|
||||
}
|
||||
|
||||
private void StartAutoPing()
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
timer = new Timer(ONE_MINUTE) { AutoReset = true };
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void StopAutoPing()
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
timer?.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void Timer_Elapsed(object sender, ElapsedEventArgs args)
|
||||
{
|
||||
lock (@lock)
|
||||
{
|
||||
if (timer.Enabled)
|
||||
{
|
||||
TestConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
235
SafeExamBrowser.Communication/Proxies/ClientProxy.cs
Normal file
235
SafeExamBrowser.Communication/Proxies/ClientProxy.cs
Normal file
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.Collections.Generic;
|
||||
using SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Data;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Proxies
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IClientProxy"/>, to be used for communication with the client application component.
|
||||
/// </summary>
|
||||
public class ClientProxy : BaseProxy, IClientProxy
|
||||
{
|
||||
public ClientProxy(string address, IProxyObjectFactory factory, ILogger logger, Interlocutor owner) : base(address, factory, logger, owner)
|
||||
{
|
||||
}
|
||||
|
||||
public CommunicationResult InformReconfigurationAborted()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new SimpleMessage(SimpleMessagePurport.ReconfigurationAborted));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Client acknowledged reconfiguration abortion.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Client did not acknowledge reconfiguration abortion! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(InformReconfigurationAborted)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult InformReconfigurationDenied(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new ReconfigurationDeniedMessage(filePath));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Client acknowledged reconfiguration denial.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Client did not acknowledge reconfiguration denial! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(InformReconfigurationDenied)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult InitiateShutdown()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(SimpleMessagePurport.Shutdown);
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Client acknowledged shutdown request.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Client did not acknowledge shutdown request! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(InitiateShutdown)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult<AuthenticationResponse> RequestAuthentication()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(SimpleMessagePurport.Authenticate);
|
||||
var success = response is AuthenticationResponse;
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Received authentication response.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Did not receive authentication response! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult<AuthenticationResponse>(success, response as AuthenticationResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(RequestAuthentication)}'", e);
|
||||
|
||||
return new CommunicationResult<AuthenticationResponse>(false, default(AuthenticationResponse));
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult RequestExamSelection(IEnumerable<(string id, string lms, string name, string url)> exams, Guid requestId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new ExamSelectionRequestMessage(exams, requestId));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Client acknowledged server exam selection request.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Client did not acknowledge server exam selection request! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(RequestExamSelection)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult RequestPassword(PasswordRequestPurpose purpose, Guid requestId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new PasswordRequestMessage(purpose, requestId));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Client acknowledged password request.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Client did not acknowledge password request! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(RequestPassword)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult RequestServerFailureAction(string message, bool showFallback, Guid requestId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new ServerFailureActionRequestMessage(message, showFallback, requestId));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Client acknowledged server failure action request.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Client did not acknowledge server failure action request! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(RequestServerFailureAction)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult ShowMessage(string message, string title, int action, int icon, Guid requestId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new MessageBoxRequestMessage(action, icon, message, requestId, title));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Client acknowledged message box request.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Client did not acknowledge message box request! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(ShowMessage)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
SafeExamBrowser.Communication/Proxies/ProxyFactory.cs
Normal file
34
SafeExamBrowser.Communication/Proxies/ProxyFactory.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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 SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Proxies
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IProxyFactory"/>, creating instances of the default proxy implementations.
|
||||
/// </summary>
|
||||
public class ProxyFactory : IProxyFactory
|
||||
{
|
||||
private IProxyObjectFactory factory;
|
||||
private IModuleLogger logger;
|
||||
|
||||
public ProxyFactory(IProxyObjectFactory factory, IModuleLogger logger)
|
||||
{
|
||||
this.factory = factory;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public IClientProxy CreateClientProxy(string address, Interlocutor owner)
|
||||
{
|
||||
return new ClientProxy(address, factory, logger.CloneFor(nameof(ClientProxy)), owner);
|
||||
}
|
||||
}
|
||||
}
|
27
SafeExamBrowser.Communication/Proxies/ProxyObjectFactory.cs
Normal file
27
SafeExamBrowser.Communication/Proxies/ProxyObjectFactory.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.ServiceModel;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Proxies
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IProxyObjectFactory"/> utilizing WCF (<see cref="ChannelFactory"/>).
|
||||
/// </summary>
|
||||
public class ProxyObjectFactory : IProxyObjectFactory
|
||||
{
|
||||
public IProxyObject CreateObject(string address)
|
||||
{
|
||||
var endpoint = new EndpointAddress(address);
|
||||
var channel = ChannelFactory<IProxyObject>.CreateChannel(new NetNamedPipeBinding(NetNamedPipeSecurityMode.Transport), endpoint);
|
||||
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
}
|
234
SafeExamBrowser.Communication/Proxies/RuntimeProxy.cs
Normal file
234
SafeExamBrowser.Communication/Proxies/RuntimeProxy.cs
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Data;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Proxies
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IRuntimeProxy"/>, to be used for communication with the runtime application component.
|
||||
/// </summary>
|
||||
public class RuntimeProxy : BaseProxy, IRuntimeProxy
|
||||
{
|
||||
public RuntimeProxy(string address, IProxyObjectFactory factory, ILogger logger, Interlocutor owner) : base(address, factory, logger, owner)
|
||||
{
|
||||
}
|
||||
|
||||
public CommunicationResult<ConfigurationResponse> GetConfiguration()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(SimpleMessagePurport.ConfigurationNeeded);
|
||||
var success = response is ConfigurationResponse;
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Received configuration response.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Did not retrieve configuration response! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult<ConfigurationResponse>(success, response as ConfigurationResponse);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(GetConfiguration)}'", e);
|
||||
|
||||
return new CommunicationResult<ConfigurationResponse>(false, default(ConfigurationResponse));
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult InformClientReady()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(SimpleMessagePurport.ClientIsReady);
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Runtime acknowledged that the client is ready.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Runtime did not acknowledge that the client is ready! Response: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(InformClientReady)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult RequestReconfiguration(string filePath, string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new ReconfigurationMessage(filePath, url));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Runtime acknowledged reconfiguration request.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Runtime did not acknowledge reconfiguration request! Response: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(RequestReconfiguration)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult RequestShutdown()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(SimpleMessagePurport.RequestShutdown);
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Runtime acknowledged shutdown request.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Runtime did not acknowledge shutdown request! Response: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(RequestShutdown)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult SubmitExamSelectionResult(Guid requestId, bool success, string selectedExamId = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new ExamSelectionReplyMessage(requestId, success, selectedExamId));
|
||||
var acknowledged = IsAcknowledged(response);
|
||||
|
||||
if (acknowledged)
|
||||
{
|
||||
Logger.Debug("Runtime acknowledged server exam selection transmission.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Runtime did not acknowledge server exam selection transmission! Response: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(acknowledged);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(SubmitExamSelectionResult)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult SubmitMessageBoxResult(Guid requestId, int result)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new MessageBoxReplyMessage(requestId, result));
|
||||
var acknowledged = IsAcknowledged(response);
|
||||
|
||||
if (acknowledged)
|
||||
{
|
||||
Logger.Debug("Runtime acknowledged message box result transmission.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Runtime did not acknowledge message box result transmission! Response: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(acknowledged);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(SubmitMessageBoxResult)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult SubmitPassword(Guid requestId, bool success, string password = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new PasswordReplyMessage(requestId, success, password));
|
||||
var acknowledged = IsAcknowledged(response);
|
||||
|
||||
if (acknowledged)
|
||||
{
|
||||
Logger.Debug("Runtime acknowledged password transmission.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Runtime did not acknowledge password transmission! Response: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(acknowledged);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(SubmitPassword)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult SubmitServerFailureActionResult(Guid requestId, bool abort, bool fallback, bool retry)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new ServerFailureActionReplyMessage(abort, fallback, retry, requestId));
|
||||
var acknowledged = IsAcknowledged(response);
|
||||
|
||||
if (acknowledged)
|
||||
{
|
||||
Logger.Debug("Runtime acknowledged server failure action transmission.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Runtime did not acknowledge server failure action transmission! Response: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(acknowledged);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(SubmitServerFailureActionResult)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
105
SafeExamBrowser.Communication/Proxies/ServiceProxy.cs
Normal file
105
SafeExamBrowser.Communication/Proxies/ServiceProxy.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Data;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Communication.Proxies
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the <see cref="IServiceProxy"/>, to be used for communication with the service application component.
|
||||
/// </summary>
|
||||
public class ServiceProxy : BaseProxy, IServiceProxy
|
||||
{
|
||||
public ServiceProxy(string address, IProxyObjectFactory factory, ILogger logger, Interlocutor owner) : base(address, factory, logger, owner)
|
||||
{
|
||||
}
|
||||
|
||||
public CommunicationResult RunSystemConfigurationUpdate()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(SimpleMessagePurport.UpdateSystemConfiguration);
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Service acknowledged system configuration update.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Service did not acknowledge system configuration update! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(RunSystemConfigurationUpdate)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult StartSession(ServiceConfiguration configuration)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new SessionStartMessage(configuration));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Service acknowledged session start.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Service did not acknowledge session start! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(StartSession)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public CommunicationResult StopSession(Guid sessionId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = Send(new SessionStopMessage(sessionId));
|
||||
var success = IsAcknowledged(response);
|
||||
|
||||
if (success)
|
||||
{
|
||||
Logger.Debug("Service acknowledged session stop.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error($"Service did not acknowledge session stop! Received: {ToString(response)}.");
|
||||
}
|
||||
|
||||
return new CommunicationResult(success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Failed to perform '{nameof(StopSession)}'", e);
|
||||
|
||||
return new CommunicationResult(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C9416A62-0623-4D38-96AA-92516B32F02F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SafeExamBrowser.Communication</RootNamespace>
|
||||
<AssemblyName>SafeExamBrowser.Communication</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Hosts\BaseHost.cs" />
|
||||
<Compile Include="Hosts\HostObjectFactory.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Proxies\BaseProxy.cs" />
|
||||
<Compile Include="Proxies\ClientProxy.cs" />
|
||||
<Compile Include="Proxies\ProxyFactory.cs" />
|
||||
<Compile Include="Proxies\ProxyObjectFactory.cs" />
|
||||
<Compile Include="Proxies\RuntimeProxy.cs" />
|
||||
<Compile Include="Proxies\ServiceProxy.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Communication.Contracts\SafeExamBrowser.Communication.Contracts.csproj">
|
||||
<Project>{0cd2c5fe-711a-4c32-afe0-bb804fe8b220}</Project>
|
||||
<Name>SafeExamBrowser.Communication.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Configuration.Contracts\SafeExamBrowser.Configuration.Contracts.csproj">
|
||||
<Project>{7d74555e-63e1-4c46-bd0a-8580552368c8}</Project>
|
||||
<Name>SafeExamBrowser.Configuration.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Logging.Contracts\SafeExamBrowser.Logging.Contracts.csproj">
|
||||
<Project>{64ea30fb-11d4-436a-9c2b-88566285363e}</Project>
|
||||
<Name>SafeExamBrowser.Logging.Contracts</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Reference in New Issue
Block a user