Преглед на файлове

Fix process filter logic

ghorsington преди 5 години
родител
ревизия
7f5f600d0c
променени са 2 файла, в които са добавени 2 реда и са изтрити 5 реда
  1. 1 4
      BepInEx/Bootstrap/Chainloader.cs
  2. 1 1
      BepInEx/Contract/Attributes.cs

+ 1 - 4
BepInEx/Bootstrap/Chainloader.cs

@@ -120,8 +120,7 @@ namespace BepInEx.Bootstrap
 
 			//Perform a filter for currently running process
 			var filters = BepInProcess.FromCecilType(type);
-
-			bool invalidProcessName = filters.Any(x => !string.Equals(x.ProcessName.Replace(".exe", ""), Paths.ProcessName, StringComparison.InvariantCultureIgnoreCase));
+			bool invalidProcessName = filters.Count != 0 && filters.All(x => !string.Equals(x.ProcessName.Replace(".exe", ""), Paths.ProcessName, StringComparison.InvariantCultureIgnoreCase));
 
 			if (invalidProcessName)
 			{
@@ -183,9 +182,7 @@ namespace BepInEx.Bootstrap
 				UnityEngine.Object.DontDestroyOnLoad(ManagerObject);
 
 				var pluginsToLoad = TypeLoader.FindPluginTypes(Paths.PluginPath, ToPluginInfo, HasBepinPlugins);
-
 				var pluginInfos = pluginsToLoad.SelectMany(p => p.Value).ToList();
-
 				var loadedAssemblies = new Dictionary<AssemblyDefinition, Assembly>();
 
 				Logger.LogInfo($"{pluginInfos.Count} plugins to load");

+ 1 - 1
BepInEx/Contract/Attributes.cs

@@ -123,7 +123,7 @@ namespace BepInEx
 			this.ProcessName = ProcessName;
 		}
 
-		internal static IEnumerable<BepInProcess> FromCecilType(TypeDefinition td)
+		internal static List<BepInProcess> FromCecilType(TypeDefinition td)
 		{
 			var attrs = MetadataHelper.GetCustomAttributes<BepInProcess>(td, true);
 			return attrs.Select(customAttribute => new BepInProcess((string)customAttribute.ConstructorArguments[0].Value)).ToList();