Esempio n. 1
0
        public static void DisableHook()
        {
            if (!hookEnabled)
            {
                return;
            }

            RedirectionHelper.RevertRedirect(typeof(UnityEngine.Debug).GetMethod("Log", new[] { typeof(object) }), log);
            RedirectionHelper.RevertRedirect(typeof(UnityEngine.Debug).GetMethod("LogFormat", new[] { typeof(string), typeof(object[]) }), logFormat);
            RedirectionHelper.RevertRedirect(typeof(UnityEngine.Debug).GetMethod("LogWarning", new[] { typeof(object) }), logWarning);
            RedirectionHelper.RevertRedirect(typeof(UnityEngine.Debug).GetMethod("LogWarningFormat", new[] { typeof(string), typeof(object[]) }), logWarningFormat);
            RedirectionHelper.RevertRedirect(typeof(UnityEngine.Debug).GetMethod("LogError", new[] { typeof(object) }), logError);
            RedirectionHelper.RevertRedirect(typeof(UnityEngine.Debug).GetMethod("LogErrorFormat", new[] { typeof(string), typeof(object[]) }), logErrorFormat);
            RedirectionHelper.RevertRedirect(typeof(UnityEngine.Debug).GetMethod("LogException", new[] { typeof(Exception) }), logException);
            hookEnabled = false;
        }
Esempio n. 2
0
        public static void Revert()
        {
            if (thisGameObject != null)
            {
                Destroy(thisGameObject);
                thisGameObject = null;
            }

            if (sortDropDown != null)
            {
                Destroy(sortDropDown);
                sortDropDown = null;
            }

            if (!bootstrapped)
            {
                return;
            }

            RedirectionHelper.RevertRedirect(typeof(WorkshopModUploadPanel).GetMethod("SetAssetInternal",
                                                                                      BindingFlags.Instance | BindingFlags.NonPublic), revertState);

            if (modsPanelBootstrapped)
            {
                RedirectionHelper.RevertRedirect(typeof(PackageEntry).GetMethod("FormatPackageName",
                                                                                BindingFlags.Static | BindingFlags.NonPublic), revertState2);

                RedirectionHelper.RevertRedirect(typeof(CustomContentPanel).GetMethod("RefreshPlugins",
                                                                                      BindingFlags.Instance | BindingFlags.NonPublic), revertState3);
            }

            if (GameObject.Find("(Library) CustomContentPanel") != null)
            {
                var customContentPanel = GameObject.Find("(Library) CustomContentPanel").GetComponent <CustomContentPanel>();
                if (customContentPanel != null)
                {
                    typeof(CustomContentPanel).GetMethod("RefreshPlugins",
                                                         BindingFlags.Instance | BindingFlags.NonPublic)
                    .Invoke(customContentPanel, null);
                }
            }

            bootstrapped = false;
        }