public static bool Patch(HarmonyInstance harmonyInstance) { var patches = new List <PatchHelper.PatchClass>(); var beCheck = new PatchHelper.PatchClass { Class = typeof(EFT.UI.PocketMapTile), PatchWithClass = typeof(ZoomFix) }; var classMethods = beCheck.Class.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); foreach (var method in classMethods) { var isPublicVirtual = method.IsPublic && method.IsVirtual; if (method.IsPrivate && !isPublicVirtual) { continue; } if (method.ReturnType.ToString() != "System.Void") { continue; } var p = method.GetParameters(); if (p.Length != 0) { continue; } var b = method.GetMethodBody(); if (b is null) { continue; } var v = b.LocalVariables; if (v.Count != 1) { continue; } if (v[0].LocalType.Name != "Texture") { continue; } beCheck.Method = method; break; } patches.Add(beCheck); return(PatchHelper.PatchMethods(harmonyInstance, patches, Extensions.GetMethodInfo(() => ZoomFix.Prefix(null)))); }
public static bool Patch(HarmonyInstance harmonyInstance) { var patches = new List <PatchHelper.PatchClass>(); var asm = AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == "Assembly-CSharp"); var beCheck = new PatchHelper.PatchClass() { PatchWithClass = typeof(BattlEye) }; foreach (var _class in asm.GetTypes()) { /*if (_class.Name == "Class893") * { * Logger.Trace("properties " + _class.GetProperties().Length); * Logger.Trace("fields " + _class.GetFields().Length); * Logger.Trace("methods " + _class.GetMethods().Length); * Logger.Trace("properties " + _class.GetProperties().Length); * Logger.Trace("{0}", _class.ToJson()); * }*/ if (!IsObfuscatedClass(_class) && !IsDeobfuscatedClass(_class)) { continue; } foreach (var method in _class.GetMethods()) { if (!IsMethod(method)) { continue; } beCheck.Method = method; break; } if (beCheck.Method is null) { continue; } beCheck.Class = _class; break; } patches.Add(beCheck); return(PatchHelper.PatchMethods(harmonyInstance, patches, Extensions.GetMethodInfo(() => BattlEye.Prefix("", true)))); }
public static bool Patch(HarmonyInstance harmonyInstance) { var patches = new List <PatchHelper.PatchClass>(); var beCheck = new PatchHelper.PatchClass() { Class = typeof(EFT.MainApplication), PatchWithClass = typeof(Login) }; var classMethods = beCheck.Class.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); foreach (var method in classMethods) { var isPublicVirtual = method.IsPublic && method.IsVirtual; if (!method.IsPrivate && !isPublicVirtual) { continue; } if (method.ReturnType.ToString() != "System.Void") { continue; } var p = method.GetParameters(); if (p.Length != 0) { continue; } var v = method.GetMethodBody().LocalVariables; if (v.Count != 4) { continue; } // if (v[0].LocalType.Name != "EFT.Login") continue; beCheck.Method = method; break; } patches.Add(beCheck); return(PatchHelper.PatchMethods(harmonyInstance, patches, Extensions.GetMethodInfo(() => Login.Prefix()))); }