Initial commit

This commit is contained in:
2024-11-22 21:13:17 -05:00
parent ae4cf9b7a1
commit 400bd791db
10 changed files with 179 additions and 88 deletions

View File

@@ -31,10 +31,7 @@ namespace undead_universal_patch_il2cpp.Patches
return true;
}
static MethodBase TargetMethod()
{
return targetMethod;
}
static MethodBase TargetMethod() => targetMethod;
[HarmonyPrefix]
static bool Prefix(ref object request)
@@ -46,7 +43,7 @@ namespace undead_universal_patch_il2cpp.Patches
return false;
}
var uriInstance = (Uri)uriProperty.GetValue(request, null);
var uriInstance = (Il2CppSystem.Uri)uriProperty.GetValue(request, null);
if (uriInstance == null)
{
Plugin.Log.LogFatal("BestHTTP_Unob failed: uriInstance was null.");
@@ -55,11 +52,11 @@ namespace undead_universal_patch_il2cpp.Patches
if (GenericConfig.LogAllRequests.Value) Plugin.Log.LogInfo($"BestHTTP_Unob request (Before) URL: {uriInstance.ToString()}");
Uri newUri = new(NameserverConfig.NewUrl.Value);
Il2CppSystem.Uri newUri = new(uriInstance.ToString().Contains("ns.rec.net") ? NameserverConfig.NewUrl.Value : uriInstance.ToString());
if (GenericConfig.LogAllRequests.Value) Plugin.Log.LogInfo($"BestHTTP_Unob request (After) URL: {newUri.ToString()}");
uriProperty.SetValue(request, NameserverConfig., null);
uriProperty.SetValue(request, NameserverConfig.Rewrite.Value ? newUri : uriInstance, null);
return true;
}
}