48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
/*
|
|
* Copyright (c) 2019 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.Serialization;
|
|
using SafeExamBrowser.Contracts.Lockdown;
|
|
using SafeExamBrowser.Contracts.Logging;
|
|
|
|
namespace SafeExamBrowser.Lockdown.FeatureConfigurations
|
|
{
|
|
[Serializable]
|
|
internal abstract class FeatureConfiguration : IFeatureConfiguration
|
|
{
|
|
[NonSerialized]
|
|
protected ILogger logger;
|
|
|
|
public Guid Id { get; }
|
|
public Guid GroupId { get; }
|
|
|
|
public FeatureConfiguration(Guid groupId, ILogger logger)
|
|
{
|
|
this.GroupId = groupId;
|
|
this.Id = Guid.NewGuid();
|
|
this.logger = logger;
|
|
}
|
|
|
|
public abstract void DisableFeature();
|
|
public abstract void EnableFeature();
|
|
public abstract void Monitor();
|
|
public abstract void Restore();
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{GetType().Name} ({Id})";
|
|
}
|
|
|
|
[OnDeserialized]
|
|
private void OnDeserializedMethod(StreamingContext context)
|
|
{
|
|
logger = (context.Context as IModuleLogger).CloneFor(GetType().Name);
|
|
}
|
|
}
|
|
}
|