SEB-Patcher/SEBPatcher.Monitoring/patch_Clipboard.cs

44 lines
2 KiB
C#
Raw Normal View History

2024-10-14 21:35:33 +02:00
using MonoMod;
2024-10-16 08:11:06 +02:00
using SEBPatcherUtils;
2024-10-14 21:35:33 +02:00
using SafeExamBrowser.Logging.Contracts;
namespace SafeExamBrowser.Monitoring
{
#pragma warning disable IDE1006 // Naming Styles
public class patch_Clipboard : Clipboard
#pragma warning restore IDE1006 // Naming Styles
{
2024-10-16 08:11:06 +02:00
public PatchLogger patchlogger;
2024-10-14 21:35:33 +02:00
[MonoModIgnore] public patch_Clipboard(ILogger logger, SafeExamBrowser.WindowsApi.Contracts.INativeMethods nativeMethods, int timeout_ms = 50) : base(logger, nativeMethods, timeout_ms) { }
2024-10-16 21:19:33 +02:00
#pragma warning disable IDE1006 // Naming Styles
2024-10-16 08:11:06 +02:00
[MonoModOriginal] public extern void orig_Clipboard(ILogger logger, SafeExamBrowser.WindowsApi.Contracts.INativeMethods nativeMethods, int timeout_ms = 50);
2024-10-16 21:19:33 +02:00
#pragma warning restore IDE1006 // Naming Styles
2024-10-16 08:11:06 +02:00
[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");
}
2024-10-14 21:35:33 +02:00
#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));
2024-10-16 08:11:06 +02:00
patchlogger.Info($"SEB wants clipboard policy {policy} (won't get it though!)");
2024-10-14 21:35:33 +02:00
}
#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");
2024-10-16 08:11:06 +02:00
patchlogger.Info("Clipboard monitoring 'terminated' (didn't even exist in the first place ;D)");
2024-10-14 21:35:33 +02:00
}
}
}