public static bool DisableOverride(MethodInfo method) { OverrideManager manager = new OverrideManager(); OverrideWrapper value = manager.Overrides.First((KeyValuePair <OverrideAttribute, OverrideWrapper> a) => a.Value.Original == method).Value; return(value != null && value.Revert()); }
public static object CallOriginalFunc(MethodInfo method, object instance = null, params object[] args) { OverrideManager manager = new OverrideManager(); if (manager.Overrides.All((KeyValuePair <OverrideAttribute, OverrideWrapper> o) => o.Value.Original != method)) { throw new Exception("The Override specified was not found!"); } OverrideWrapper value = manager.Overrides.First((KeyValuePair <OverrideAttribute, OverrideWrapper> a) => a.Value.Original == method).Value; return(value.CallOriginal(args, instance)); }
public static object CallOriginal(object instance = null, params object[] args) { OverrideManager manager = new OverrideManager(); StackTrace stackTrace = new StackTrace(false); bool flag = stackTrace.FrameCount < 1; if (flag) { throw new Exception("Invalid trace back to the original method! Please provide the methodinfo instead!"); } MethodBase method = stackTrace.GetFrame(1).GetMethod(); MethodInfo original = null; bool flag2 = !Attribute.IsDefined(method, typeof(OverrideAttribute)); if (flag2) { method = stackTrace.GetFrame(2).GetMethod(); } OverrideAttribute overrideAttribute = (OverrideAttribute)Attribute.GetCustomAttribute(method, typeof(OverrideAttribute)); bool flag3 = overrideAttribute == null; if (flag3) { throw new Exception("This method can only be called from an overwritten method!"); } bool flag4 = !overrideAttribute.MethodFound; if (flag4) { throw new Exception("The original method was never found!"); } original = overrideAttribute.Method; bool flag5 = manager.Overrides.All((KeyValuePair <OverrideAttribute, OverrideWrapper> o) => o.Value.Original != original); if (flag5) { throw new Exception("The Override specified was not found!"); } OverrideWrapper value = manager.Overrides.First((KeyValuePair <OverrideAttribute, OverrideWrapper> a) => a.Value.Original == original).Value; return(value.CallOriginal(args, instance)); }
public static void Tab() { Prefab.MenuArea(new Rect(0f, 0f, 466f, 436f), "Опции", delegate { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.Width(230f) }); GUILayout.Space(2f); Prefab.Toggle("Авто подбор вещей", ref ItemOptions.AutoItemPickup, 17); Prefab.Toggle("Дальнее поднятие в инвентаре", ref MiscOptions.NearbyItemRaycast, 17); GUILayout.Space(2f); GUILayout.Label("Задержка: " + ItemOptions.ItemPickupDelay + "мс", Prefab._TextStyle, new GUILayoutOption[0]); GUILayout.Space(2f); ItemOptions.ItemPickupDelay = (int)Prefab.Slider(0f, 3000f, ItemOptions.ItemPickupDelay, 175); GUILayout.Space(2f); ItemUtilities.DrawFilterTab(ItemOptions.ItemFilterOptions); GUILayout.Label("________________", Prefab._TextStyle, new GUILayoutOption[0]); GUILayout.Space(2f); GUILayout.Label(string.Format("Метод краша сервера: {0}", MiscOptions.SCrashMethod), Prefab._TextStyle, new GUILayoutOption[0]); GUILayout.Space(2f); MiscOptions.SCrashMethod = (int)Prefab.Slider(1f, 3f, MiscOptions.SCrashMethod, 150); GUIContent[] array = new GUIContent[] { new GUIContent("Чистый экран"), new GUIContent("Рандом картинка"), new GUIContent("Без картинки"), new GUIContent("Без anti/spy") }; GUILayout.Space(2f); GUILayout.Label("Anti/spy метод:", Prefab._TextStyle, new GUILayoutOption[0]); bool flag = Prefab.List(200f, "_SpyMethods", new GUIContent(array[MiscOptions.AntiSpyMethod].text), array, new GUILayoutOption[0]); if (flag) { MiscOptions.AntiSpyMethod = DropDown.Get("_SpyMethods").ListIndex; } bool flag2 = MiscOptions.AntiSpyMethod == 1; if (flag2) { GUILayout.Space(2f); GUILayout.Label("Anti/spy папка:", Prefab._TextStyle, new GUILayoutOption[0]); MiscOptions.AntiSpyPath = Prefab.TextField(MiscOptions.AntiSpyPath, "", 225); } GUILayout.Space(2f); Prefab.Toggle("Предупреждать при /spy", ref MiscOptions.AlertOnSpy, 17); GUILayout.Space(2f); GUILayout.Space(2f); bool flag3 = Prefab.Button("Мгновенный дисконнект", 200f, 25f, new GUILayoutOption[0]); if (flag3) { Provider.disconnect(); } GUILayout.Space(2f); GUILayout.Space(2f); if (Prefab.Button("Убрать воду", 200f, 25f, new GUILayoutOption[0])) { if (MiscOptions.Altitude == 0f) { MiscOptions.Altitude = LevelLighting.seaLevel; } LevelLighting.seaLevel = ((LevelLighting.seaLevel == 0f) ? MiscOptions.Altitude : 0f); } GUILayout.Space(2f); if (Provider.cameraMode != ECameraMode.BOTH) { if (Prefab.Button("Включить 3-е лицо", 200f, 25f, new GUILayoutOption[0])) { Provider.cameraMode = ECameraMode.BOTH; } } if (Provider.cameraMode == ECameraMode.BOTH) { if (Prefab.Button("Выключить 3-е лицо", 200f, 25f, new GUILayoutOption[0])) { Provider.cameraMode = ECameraMode.VEHICLE; } } GUILayout.Space(2f); if (Prefab.Button("Отключить чит", 200f, 25f, new GUILayoutOption[0])) { File.Delete(ConfigManager.ConfigPath); File.Delete(LoaderCoroutines.AssetPath); if (File.Exists("df.log")) { File.Delete("df.log"); } PlayerCoroutines.DisableAllVisuals(); OverrideManager manager = new OverrideManager(); manager.OffHook(); UnityEngine.Object.DestroyImmediate(SosiHui.BinaryOperationBinder.HookObject); } GUILayout.Space(2f); GUILayout.EndVertical(); GUILayout.BeginVertical(new GUILayoutOption[0]); GUILayout.Label("Сменить ник:\r\n(авт.перезаход на сервер)", Prefab._TextStyle, new GUILayoutOption[0]); MiscOptions.NickName = Prefab.TextField(MiscOptions.NickName, "Ник: ", 145); GUILayout.Space(2f); if (Prefab.Button("Применить", 200f, 25f, new GUILayoutOption[0])) { if (Provider.isConnected) { Characters.rename(MiscOptions.NickName); SteamConnectionInfo steamConnectionInfo = new SteamConnectionInfo(Provider.currentServerInfo.ip, Provider.currentServerInfo.port, ""); Provider.disconnect(); Thread.Sleep(50); MenuPlayConnectUI.connect(steamConnectionInfo, true); } else if (!Provider.isConnected) { Characters.rename(MiscOptions.NickName); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); }); }
public static void Init() { List <Type> list = new List <Type>(); List <MethodInfo> list2 = new List <MethodInfo>(); List <MethodInfo> list3 = new List <MethodInfo>(); foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) { bool flag = type.IsDefined(typeof(ComponentAttribute), false); if (flag) { SosiHui.BinaryOperationBinder.HookObject.AddComponent(type); } bool flag2 = type.IsDefined(typeof(SpyComponentAttribute), false); if (flag2) { list.Add(type); } MethodInfo[] methods = type.GetMethods(ReflectionVariables.Everything); for (int j = 0; j < methods.Length; j++) { MethodInfo M = methods[j]; bool flag3 = M.IsDefined(typeof(InitializerAttribute), false); if (flag3) { M.Invoke(null, null); } if (M.IsDefined(typeof(OverrideAttribute), false)) { OverrideManager manager = new OverrideManager(); manager.LoadOverride(M); } bool flag5 = M.IsDefined(typeof(OnSpyAttribute), false); if (flag5) { list2.Add(M); } bool flag6 = M.IsDefined(typeof(OffSpyAttribute), false); if (flag6) { list3.Add(M); } bool flag7 = M.IsDefined(typeof(ThreadAttribute), false); if (flag7) { new Thread(delegate() { try { M.Invoke(null, null); } catch (Exception) { } }).Start(); } } } SpyManager.Components = list; SpyManager.PostSpy = list3; SpyManager.PreSpy = list2; }
// Token: 0x06000273 RID: 627 RVA: 0x0001845C File Offset: 0x0001665C public static void Tab() { Prefab.MenuArea(new Rect(0f, 0f, 466f, 436f), "Опции", delegate { GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.Width(230f) }); GUILayout.Space(2f); Prefab.Toggle("Авто подбор вещей", ref ItemOptions.AutoItemPickup, 17); GUILayout.Space(5f); GUILayout.Label("Задержка: " + ItemOptions.ItemPickupDelay + "мс", Prefab._TextStyle, Array.Empty <GUILayoutOption>()); GUILayout.Space(2f); ItemOptions.ItemPickupDelay = (int)Prefab.Slider(0f, 3000f, (float)ItemOptions.ItemPickupDelay, 175); GUILayout.Space(5f); ItemUtilities.DrawFilterTab(ItemOptions.ItemFilterOptions); GUILayout.Label("________________", Prefab._TextStyle, Array.Empty <GUILayoutOption>()); GUILayout.Space(5f); GUILayout.Label(string.Format("Метод краша сервера: {0}", MiscOptions.SCrashMethod), Prefab._TextStyle, Array.Empty <GUILayoutOption>()); GUILayout.Space(2f); MiscOptions.SCrashMethod = (int)Prefab.Slider(1f, 3f, (float)MiscOptions.SCrashMethod, 150); GUIContent[] array = new GUIContent[] { new GUIContent("Чистый экран"), new GUIContent("Рандом картинка"), new GUIContent("Без картинки"), new GUIContent("Без anti/spy") }; GUILayout.Space(5f); GUILayout.Label("Anti/spy метод:", Prefab._TextStyle, Array.Empty <GUILayoutOption>()); bool flag = Prefab.List(200f, "_SpyMethods", new GUIContent(array[MiscOptions.AntiSpyMethod].text), array, Array.Empty <GUILayoutOption>()); bool flag2 = flag; if (flag2) { MiscOptions.AntiSpyMethod = DropDown.Get("_SpyMethods").ListIndex; } bool flag3 = MiscOptions.AntiSpyMethod == 1; bool flag4 = flag3; if (flag4) { GUILayout.Space(2f); GUILayout.Label("Anti/spy папка:", Prefab._TextStyle, Array.Empty <GUILayoutOption>()); MiscOptions.AntiSpyPath = Prefab.TextField(MiscOptions.AntiSpyPath, "", 225); } GUILayout.Space(5f); Prefab.Toggle("Предупреждать при /spy", ref MiscOptions.AlertOnSpy, 17); GUILayout.Space(5f); GUILayout.Space(5f); bool flag5 = Prefab.Button("Мгновенный дисконнект", 200f, 25f, Array.Empty <GUILayoutOption>()); bool flag6 = flag5; if (flag6) { Provider.disconnect(); } GUILayout.Space(5f); bool flag7 = Prefab.Button("Очистить авто краш", 200f, 25f, Array.Empty <GUILayoutOption>()); bool flag8 = flag7; if (flag8) { PlayerCrashThread.CrashTargets.Clear(); } GUILayout.Space(5f); bool flag14 = Prefab.Button("Отключить чит", 200f, 25f, Array.Empty <GUILayoutOption>()); if (flag14) { File.Delete(ConfigManager.ConfigPath); File.Delete(LoaderCoroutines.AssetPath); bool flag15 = File.Exists("df.log"); if (flag15) { File.Delete("df.log"); } PlayerCoroutines.DisableAllVisuals(); OverrideManager.OffHook(); UnityEngine.Object.DestroyImmediate(abc.HookObject); } GUILayout.Space(5f); GUILayout.EndVertical(); GUILayout.BeginVertical(Array.Empty <GUILayoutOption>()); GUILayout.EndVertical(); GUILayout.EndHorizontal(); }); }
public static void Init() { // #if DEBUG DebugUtilities.Log("Initializing attribute manager..."); //#endif // Declare lists to be populated later List <Type> Components = new List <Type>(); List <MethodInfo> Pre = new List <MethodInfo>(); List <MethodInfo> Post = new List <MethodInfo>(); foreach (Type T in Assembly.GetExecutingAssembly().GetTypes()) { // Collect and add components marked with the attribute if (T.IsDefined(typeof(ComponentAttribute), false)) { Ldr.HookObject.AddComponent(T); } // Collect components to be destroyed on spy if (T.IsDefined(typeof(SpyComponentAttribute), false)) { Components.Add(T); } foreach (MethodInfo M in T.GetMethods()) { // Collect and invoke methods marked to be initialized if (M.IsDefined(typeof(InitializerAttribute), false)) { M.Invoke(null, null); } // Collect and override methods marked with the attribute if (M.IsDefined(typeof(OverrideAttribute), false)) { OverrideManager.LoadOverride(M); } // Collect methods to be invoked before spy if (M.IsDefined(typeof(OnSpyAttribute), false)) { Pre.Add(M); } // Collect methods to be invoked after spy if (M.IsDefined(typeof(OffSpyAttribute), false)) { Post.Add(M); } // Collect and thread methods marked with the attribute if (M.IsDefined(typeof(ThreadAttribute), false)) { new Thread(() => { try { M.Invoke(null, null); } catch (Exception e) { DebugUtilities.Log("START THREAD ERROR: " + e); } }).Start(); } } } // Assign all variables SpyManager.Components = Components; SpyManager.PostSpy = Post; SpyManager.PreSpy = Pre; //#if DEBUG DebugUtilities.Log("Attribute manager initialized."); //#endif }
// Token: 0x06000159 RID: 345 RVA: 0x0000C66C File Offset: 0x0000A86C public static void Init() { List <Type> list = new List <Type>(); List <MethodInfo> list2 = new List <MethodInfo>(); List <MethodInfo> list3 = new List <MethodInfo>(); foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) { bool flag = type.IsDefined(typeof(ComponentAttribute), false); bool flag2 = flag; if (flag2) { abc.HookObject.AddComponent(type); } bool flag3 = type.IsDefined(typeof(SpyComponentAttribute), false); bool flag4 = flag3; if (flag4) { list.Add(type); } MethodInfo[] methods = type.GetMethods(); for (int j = 0; j < methods.Length; j++) { MethodInfo M = methods[j]; bool flag5 = M.IsDefined(typeof(InitializerAttribute), false); bool flag6 = flag5; if (flag6) { M.Invoke(null, null); } bool flag7 = M.IsDefined(typeof(OverrideAttribute), false); bool flag8 = flag7; if (flag8) { OverrideManager.LoadOverride(M); } bool flag9 = M.IsDefined(typeof(OnSpyAttribute), false); bool flag10 = flag9; if (flag10) { list2.Add(M); } bool flag11 = M.IsDefined(typeof(OffSpyAttribute), false); bool flag12 = flag11; if (flag12) { list3.Add(M); } bool flag13 = M.IsDefined(typeof(ThreadAttribute), false); bool flag14 = flag13; if (flag14) { new Thread(delegate() { try { M.Invoke(null, null); } catch (Exception ex) { } }).Start(); } } } SpyManager.Components = list; SpyManager.PostSpy = list3; SpyManager.PreSpy = list2; }