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

44 lines
1.6 KiB
C#

using MonoMod;
using SEBPatcherUtils;
using SafeExamBrowser.Logging.Contracts;
namespace SafeExamBrowser.Monitoring
{
#pragma warning disable IDE1006 // Naming Styles
public class patch_RemoteSessionDetector : RemoteSessionDetector
#pragma warning restore IDE1006 // Naming Styles
{
public PatchLogger patchlogger;
[MonoModIgnore] public patch_RemoteSessionDetector(ILogger logger) : base(logger) { }
#pragma warning disable IDE1006 // Naming Styles
[MonoModOriginal] public extern void orig_RemoteSessionDetector(ILogger logger);
#pragma warning restore IDE1006 // Naming Styles
[MonoModConstructor] public void RemoteSessionDetector(ILogger logger)
{
orig_RemoteSessionDetector(logger);
patchlogger = new PatchLogger("Monitoring.RemoteSessionDetector");
}
#pragma warning disable IDE1006 // Naming Styles
[MonoModOriginal] public extern bool orig_IsRemoteSession();
#pragma warning restore IDE1006 // Naming Styles
#pragma warning disable CS0108 // Member hides inherited member; missing new keyword
public bool IsRemoteSession()
#pragma warning restore CS0108 // Member hides inherited member; missing new keyword
{
bool isRemoteSession = orig_IsRemoteSession();
if (isRemoteSession)
{
patchlogger.Info("SEB detected remote session on host! (will be ignored, ofcourse ;D)");
}
else
{
patchlogger.Info("SEB did not detect remote session on host");
}
return false;
}
}
}