コード例 #1
0
        public override void OnEnabled()
        {
            Singleton = this;
            Harmony   = new Harmony($"com.remindme.ce-{DateTime.Now.Ticks}");

            try
            {
                foreach (MethodBase method in Events.Instance.Harmony.GetPatchedMethods())
                {
                    if (method.DeclaringType != null && method.Name == "UserCode_CmdRegisterEscape")
                    {
                        Events.DisabledPatchesHashSet.Add(method);
                    }
                }

                Events.Instance.ReloadDisabledPatches();
            }
            catch (Exception e)
            {
                Log.Error($"Exiled broke: {e}");
            }

            Harmony.PatchAll();

            Config.TryCreateFile();

            Server.RoundEnded        += EventHandlers.OnRoundEnded;
            Points.LoadedSpawnPoints += EventHandlers.OnLoadedSpawnPoints;

            base.OnEnabled();
        }
コード例 #2
0
        public override void OnDisabled()
        {
            Server.RoundEnded        -= EventHandlers.OnRoundEnded;
            Points.LoadedSpawnPoints -= EventHandlers.OnLoadedSpawnPoints;

            Harmony.UnpatchAll();
            Singleton = null;

            base.OnDisabled();
        }