SEB-Patcher/SEBPatcher.Monitoring/patch_RemoteSessionDetector.cs

45 lines
1.6 KiB
C#
Raw Normal View History

2024-10-16 08:11:06 +02:00
using MonoMod;
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_RemoteSessionDetector : RemoteSessionDetector
#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_RemoteSessionDetector(ILogger logger) : base(logger) { }
2024-10-16 08:11:06 +02:00
#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");
}
2024-10-14 21:35:33 +02:00
#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();
2024-10-16 08:11:06 +02:00
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");
}
2024-10-14 21:35:33 +02:00
return false;
}
}
}