diff --git a/Patches/BestHTTP.cs b/Patches/BestHTTP.cs index 3101703..231af25 100644 --- a/Patches/BestHTTP.cs +++ b/Patches/BestHTTP.cs @@ -13,6 +13,7 @@ static readonly Type targetType = AccessTools.TypeByName(TargetTypeName); static readonly Type requestType = AccessTools.TypeByName("BestHTTP.KGBBPEDECCO"); + // TODO: Reduce boilerplate static bool Prepare() { if (targetType == null) @@ -116,6 +117,7 @@ return false; } + // TODO: Not the most elegant way to patch out amplitude - find a better way if (uriInstance.Host.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false; Plugin.Log.LogInfo($"BestHTTP_MonoTwo request (Before) URL: {uriInstance.ToString()}"); diff --git a/Patches/UWRPatch-Str-Str-Rx-Tx.cs b/Patches/UWRPatch-Str-Str-Rx-Tx.cs index 634a374..a009262 100644 --- a/Patches/UWRPatch-Str-Str-Rx-Tx.cs +++ b/Patches/UWRPatch-Str-Str-Rx-Tx.cs @@ -25,6 +25,15 @@ return AccessTools.Constructor(targetType, [ typeof(string), typeof(string), rxType, txType ]); } + [HarmonyPrefix] + public static bool Prefix(ref string url) + { + // TODO: This is duplicated across all UWR patch files, reduce boilerplate + // TODO: This is not the most elegant way to patch out amplitude - find a better fix + if (url.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false; + else return true; + } + [HarmonyPostfix] static void Postfix(object __instance) => UWRPatchNoArg.InPostfix(__instance, UWRParams); } diff --git a/Patches/UWRPatch-Str-Str.cs b/Patches/UWRPatch-Str-Str.cs index f3e2442..69a7446 100644 --- a/Patches/UWRPatch-Str-Str.cs +++ b/Patches/UWRPatch-Str-Str.cs @@ -22,6 +22,15 @@ return AccessTools.Constructor(targetType, [ typeof(string), typeof(string) ]); } + [HarmonyPrefix] + public static bool Prefix(ref string url) + { + // TODO: This is duplicated across all UWR patch files, reduce boilerplate + // TODO: This is not the most elegant way to patch out amplitude - find a better fix + if (url.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false; + else return true; + } + [HarmonyPostfix] static void Postfix(object __instance) => UWRPatchNoArg.InPostfix(__instance, UWRParams); } diff --git a/Patches/UWRPatch-Str.cs b/Patches/UWRPatch-Str.cs index 31a381f..b6ad4d3 100644 --- a/Patches/UWRPatch-Str.cs +++ b/Patches/UWRPatch-Str.cs @@ -25,6 +25,8 @@ [HarmonyPrefix] public static bool Prefix(ref string url) { + // TODO: This is duplicated across all UWR patch files, reduce boilerplate + // TODO: This is not the most elegant way to patch out amplitude - find a better fix if (url.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false; else return true; } diff --git a/Patches/UWRPatchNoArg.cs b/Patches/UWRPatchNoArg.cs index e032da9..847acc1 100644 --- a/Patches/UWRPatchNoArg.cs +++ b/Patches/UWRPatchNoArg.cs @@ -35,6 +35,15 @@ return AccessTools.Constructor(targetType, []); } + [HarmonyPrefix] + public static bool Prefix(ref string url) + { + // TODO: This is duplicated across all UWR patch files, reduce boilerplate + // TODO: This is not the most elegant way to patch out amplitude - find a better fix + if (url.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false; + else return true; + } + [HarmonyPostfix] static void Postfix(object __instance) => InPostfix(__instance, UWRParams); diff --git a/undead-universal-patch-mono.csproj b/undead-universal-patch-mono.csproj index 0c9cdbe..16e250e 100644 --- a/undead-universal-patch-mono.csproj +++ b/undead-universal-patch-mono.csproj @@ -24,10 +24,4 @@ - - - - G:\rr\Cyberjunk-Build-Test\BepInEx\core\0Harmony.dll - -