protected void OnCreated()
 {
     if (PatchManagerSettings.PersistentActive(this.Id) && !PatchManager.IsActive(this.Id))
     {
         EnablePatch();
     }
 }
        public static void DisableAllPatches(bool resetPersistence)
        {
            if (AllowDebugLogs)
            {
                Debug.Log("DISABLE ALL PATCHES");
            }
            foreach (var prov in patchProviders)
            {
                var instance = prov.Value.Instance;
                if (instance.GetIsActive())
                {
                    DisablePatch(instance, false);
                    if (resetPersistence)
                    {
                        continue;
                    }
                    // keep persistence state
                    PatchManagerSettings.SetPersistentActive(instance.ID(), true);
                }
            }

            foreach (var man in KnownPatches)
            {
                if (man.IsActive)
                {
                    man.DisablePatch();
                    if (resetPersistence)
                    {
                        continue;
                    }
                    // keep persistence state
                    PatchManagerSettings.SetPersistentActive(man.Id, true);
                }
            }
        }
 private static void DelayedEnablePatchedThatHadBeenActivePreviously()
 {
     if (!AutomaticallyEnablePersistentPatches)
     {
         return;
     }
     foreach (var patch in registeredPatchProviders)
     {
         if (PatchManagerSettings.PersistentActive(patch))
         {
             EnablePatch(patch);
         }
     }
 }
 public void DisablePatch()
 {
     requestedActivation = false;
     if (!IsActive)
     {
         return;
     }
     if (OnDisablePatch())
     {
         requestedActivation = false;
         IsActive            = false;
         PatchManagerSettings.SetPersistentActive(this.Id, false);
         InternalEditorUtility.RepaintAllViews();
     }
 }
 private void HandleActivationRequestNow()
 {
     // while (!EditorApplication.isPlaying && requestedActivation && !Utils.GUISkinHasLoaded()) await Task.Delay(1);
     if (!requestedActivation || IsActive)
     {
         return;
     }
     if (PatchManager.IsActive(this.Id))
     {
         return;
     }
     requestedActivation = false;
     IsActive            = true;
     if (PatchManager.AllowDebugLogs)
     {
         Debug.Log("ENABLE " + Id);
     }
     if (OnEnablePatch())
     {
         PatchManagerSettings.SetPersistentActive(this.Id, true);
         InternalEditorUtility.RepaintAllViews();
     }
 }
 public static void ClearSettingsCache()
 {
     PatchManagerSettings.Clear(true);
 }