diff --git a/BepInEx.Core/Bootstrap/BaseChainloader.cs b/BepInEx.Core/Bootstrap/BaseChainloader.cs index bfa430a..3220fdf 100644 --- a/BepInEx.Core/Bootstrap/BaseChainloader.cs +++ b/BepInEx.Core/Bootstrap/BaseChainloader.cs @@ -84,16 +84,16 @@ namespace BepInEx.Bootstrap foreach (var pluginInfoGroup in plugins.GroupBy(info => info.Metadata.GUID)) { - var alreadyLoaded = false; + PluginInfo loadedVersion = null; foreach (var pluginInfo in pluginInfoGroup.OrderByDescending(x => x.Metadata.Version)) { - if (alreadyLoaded) + if (loadedVersion != null) { - Logger.LogWarning($"Skipping because a newer version exists [{pluginInfo.Metadata.Name} {pluginInfo.Metadata.Version}]"); + Logger.LogWarning($"Skipping [{pluginInfo}] because a newer version exists [{loadedVersion}]"); continue; } - alreadyLoaded = true; + loadedVersion = pluginInfo; // Perform checks that will prevent loading plugins in this run var filters = pluginInfo.Processes.ToList(); @@ -101,7 +101,8 @@ namespace BepInEx.Bootstrap if (invalidProcessName) { - Logger.LogWarning($"Skipping because of process filters [{pluginInfo.Metadata.Name} {pluginInfo.Metadata.Version}]"); + Logger.LogWarning($"Skipping [{pluginInfo}] because of process filters"); + Logger.LogDebug($"[{pluginInfo}] has the following process filters: {string.Join(", ", pluginInfo.Processes.Select(p => p.ProcessName).ToArray())}"); continue; } @@ -118,13 +119,13 @@ namespace BepInEx.Bootstrap dependencyDict.Remove(pluginInfo.Metadata.GUID); var incompatiblePlugins = pluginInfo.Incompatibilities.Select(x => x.IncompatibilityGUID).Where(x => pluginsByGuid.ContainsKey(x)).ToArray(); - string message = $@"Could not load [{pluginInfo.Metadata.Name}] because it is incompatible with: {string.Join(", ", incompatiblePlugins)}"; + string message = $@"Could not load [{pluginInfo}] because it is incompatible with: {string.Join(", ", incompatiblePlugins)}"; DependencyErrors.Add(message); Logger.LogError(message); } else if (PluginTargetsWrongBepin(pluginInfo)) { - string message = $@"Plugin [{pluginInfo.Metadata.Name}] targets a wrong version of BepInEx ({pluginInfo.TargettedBepInExVersion}) and might not work until you update"; + string message = $@"Plugin [{pluginInfo}] targets a wrong version of BepInEx ({pluginInfo.TargettedBepInExVersion}) and might not work until you update"; DependencyErrors.Add(message); Logger.LogWarning(message); } @@ -181,7 +182,7 @@ namespace BepInEx.Bootstrap if (dependsOnInvalidPlugin) { - string message = $"Skipping [{plugin.Metadata.Name}] because it has a dependency that was not loaded. See previous errors for details."; + string message = $"Skipping [{plugin}] because it has a dependency that was not loaded. See previous errors for details."; DependencyErrors.Add(message); Logger.LogWarning(message); continue; @@ -191,7 +192,7 @@ namespace BepInEx.Bootstrap { bool IsEmptyVersion(Version v) => v.Major == 0 && v.Minor == 0 && v.Build <= 0 && v.Revision <= 0; - string message = $@"Could not load [{plugin.Metadata.Name}] because it has missing dependencies: { + string message = $@"Could not load [{plugin}] because it has missing dependencies: { string.Join(", ", missingDependencies.Select(s => IsEmptyVersion(s.MinimumVersion) ? s.DependencyGUID : $"{s.DependencyGUID} (v{s.MinimumVersion} or newer)").ToArray()) }"; DependencyErrors.Add(message); @@ -203,7 +204,7 @@ namespace BepInEx.Bootstrap try { - Logger.LogInfo($"Loading [{plugin.Metadata.Name} {plugin.Metadata.Version}]"); + Logger.LogInfo($"Loading [{plugin}]"); if (!loadedAssemblies.TryGetValue(plugin.Location, out var ass)) loadedAssemblies[plugin.Location] = ass = Assembly.LoadFile(plugin.Location); @@ -218,7 +219,7 @@ namespace BepInEx.Bootstrap invalidPlugins.Add(plugin.Metadata.GUID); Plugins.Remove(plugin.Metadata.GUID); - Logger.LogError($"Error loading [{plugin.Metadata.Name}] : {ex.Message}"); + Logger.LogError($"Error loading [{plugin}] : {ex.Message}"); if (ex is ReflectionTypeLoadException re) Logger.LogDebug(TypeLoader.TypeLoadExceptionToString(re)); else diff --git a/BepInEx.Core/Contract/PluginInfo.cs b/BepInEx.Core/Contract/PluginInfo.cs index fbafe9e..9a0b2cc 100644 --- a/BepInEx.Core/Contract/PluginInfo.cs +++ b/BepInEx.Core/Contract/PluginInfo.cs @@ -88,5 +88,8 @@ namespace BepInEx TargettedBepInExVersion = new Version(br.ReadString()); } + + /// + public override string ToString() => $"{Metadata?.Name} {Metadata?.Version}"; } }