0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/Aki.Core/Patches/SslCertificatePatch.cs
Deadly Alden dc4aee0e6b Refactor ValidationUtil functionality (!76)
**Description**
As of right now `ValidationUtil.cs` does not perform it's intended function, and the callers of it are not properly using the result.
Removed the redundant calls and implemented `GameValidationPatch.cs` to properly implement this behavior.

If the check fails;
1. All interface elements are disabled.
2. Notification popup is sent.
3. Logs are sent to the `Console`, `Server` and `BepInEx`.

**Related**
Closes: SPT-AKI/Issues#435

**Showcase**
https://streamable.com/2ra4sa

Co-authored-by: Deadly <info.saddiki@gmail.com>
Reviewed-on: SPT-AKI/Modules#76
Co-authored-by: Deadly Alden <deadly@noreply.dev.sp-tarkov.com>
Co-committed-by: Deadly Alden <deadly@noreply.dev.sp-tarkov.com>
2024-02-08 09:10:34 +00:00

24 lines
579 B
C#

using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using Aki.Reflection.Patching;
using Aki.Core.Utils;
using HarmonyLib;
namespace Aki.Core.Patches
{
public class SslCertificatePatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(SslCertPatchClass), nameof(SslCertPatchClass.ValidateCertificate), new[] { typeof(X509Certificate) });
}
[PatchPrefix]
private static bool PatchPrefix(ref bool __result)
{
__result = true;
return false; // Skip original
}
}
}