SEB-Patcher/SEBPatcher.Monitoring/patch_Clipboard.cs
2024-10-16 08:11:06 +02:00

41 lines
1.9 KiB
C#

using MonoMod;
using SEBPatcherUtils;
using SafeExamBrowser.Logging.Contracts;
namespace SafeExamBrowser.Monitoring
{
#pragma warning disable IDE1006 // Naming Styles
public class patch_Clipboard : Clipboard
#pragma warning restore IDE1006 // Naming Styles
{
public PatchLogger patchlogger;
[MonoModIgnore] public patch_Clipboard(ILogger logger, SafeExamBrowser.WindowsApi.Contracts.INativeMethods nativeMethods, int timeout_ms = 50) : base(logger, nativeMethods, timeout_ms) { }
[MonoModOriginal] public extern void orig_Clipboard(ILogger logger, SafeExamBrowser.WindowsApi.Contracts.INativeMethods nativeMethods, int timeout_ms = 50);
[MonoModConstructor] public void Clipboard(ILogger logger, SafeExamBrowser.WindowsApi.Contracts.INativeMethods nativeMethods, int timeout_ms = 50)
{
orig_Clipboard(logger, nativeMethods, timeout_ms);
patchlogger = new PatchLogger("Monitoring.Clipboard");
}
#pragma warning disable IDE0044 // Add readonly modifier
[MonoModIgnore] private ILogger logger;
#pragma warning restore IDE0044 // Add readonly modifier
#pragma warning disable CS0108 // Member hides inherited member; missing new keyword
public void Initialize(Settings.Security.ClipboardPolicy policy)
#pragma warning restore CS0108 // Member hides inherited member; missing new keyword
{
this.logger.Info(string.Format("Initialized clipboard for policy '{0}'.", policy));
patchlogger.Info($"SEB wants clipboard policy {policy} (won't get it though!)");
}
#pragma warning disable CS0108 // Member hides inherited member; missing new keyword
public void Terminate()
#pragma warning restore CS0108 // Member hides inherited member; missing new keyword
{
this.logger.Info("Finalized clipboard");
patchlogger.Info("Clipboard monitoring 'terminated' (didn't even exist in the first place ;D)");
}
}
}