Quellcode durchsuchen

Added a method to check for IDs on load

Bepis vor 6 Jahren
Ursprung
Commit
03341afa14
1 geänderte Dateien mit 14 neuen und 0 gelöschten Zeilen
  1. 14 0
      BepInEx/Chainloader.cs

+ 14 - 0
BepInEx/Chainloader.cs

@@ -64,6 +64,20 @@ namespace BepInEx
         }
 
         /// <summary>
+        /// Checks all plugins to see if a plugin with a certain ID is loaded.
+        /// </summary>
+        /// <param name="ID">The ID to check for.</param>
+        /// <returns></returns>
+        public static bool IsIDLoaded(string ID)
+        {
+            foreach (var plugin in Plugins)
+                if (plugin != null && plugin.enabled && plugin.ID == ID)
+                    return true;
+
+            return false;
+        }
+
+        /// <summary>
         /// Loads a list of types from a directory containing assemblies, that derive from a base type.
         /// </summary>
         /// <typeparam name="T">The specfiic base type to search for.</typeparam>