SEB-Patcher/SEBPatcher.Monitoring/Display/patch_DisplayMonitor.cs
2024-10-16 21:19:33 +02:00

46 lines
2 KiB
C#

using MonoMod;
using SEBPatcherUtils;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.SystemComponents.Contracts;
using SafeExamBrowser.Monitoring.Contracts.Display;
using SafeExamBrowser.Settings.Monitoring;
using SafeExamBrowser.WindowsApi.Contracts;
namespace SafeExamBrowser.Monitoring.Display
{
#pragma warning disable IDE1006 // Naming Styles
public class patch_DisplayMonitor : DisplayMonitor
#pragma warning restore IDE1006 // Naming Styles
{
public PatchLogger patchlogger;
[MonoModIgnore] public patch_DisplayMonitor(ILogger logger, INativeMethods nativeMethods, ISystemInfo systemInfo) : base(logger, nativeMethods, systemInfo) { }
#pragma warning disable IDE1006 // Naming Styles
[MonoModOriginal] public extern void orig_DisplayMonitor(ILogger logger, INativeMethods nativeMethods, ISystemInfo systemInfo);
#pragma warning restore IDE1006 // Naming Styles
[MonoModConstructor] public void DisplayMonitor(ILogger logger, INativeMethods nativeMethods, ISystemInfo systemInfo)
{
orig_DisplayMonitor(logger, nativeMethods, systemInfo);
patchlogger = new PatchLogger("Monitoring.Display.DisplayMonitor");
}
#pragma warning disable IDE1006 // Naming Styles
[MonoModOriginal] public extern ValidationResult orig_ValidateConfiguration(DisplaySettings settings);
#pragma warning restore IDE1006 // Naming Styles
#pragma warning disable CS0108 // Member hides inherited member; missing new keyword
public ValidationResult ValidateConfiguration(DisplaySettings settings)
#pragma warning restore CS0108 // Member hides inherited member; missing new keyword
{
ValidationResult result = orig_ValidateConfiguration(settings);
patchlogger.Info($"SEB display validation result: {result}");
return new ValidationResult
{
ExternalDisplays = 0,
InternalDisplays = 1,
IsAllowed = true
};
}
}
}