Clarify load warning

Rebase of 1100e9c
This commit is contained in:
Bepis committed 2020-11-05 23:37:55 +11:00
1 parent 46d18dce4f
commit 34c50501a3
2 files changed
+15 -11

No files matched your search

+12 -11
View File
@@ -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
+3
View File
@@ -88,5 +88,8 @@ namespace BepInEx
TargettedBepInExVersion = new Version(br.ReadString());
}
/// <inheritdoc />
public override string ToString() => $"{Metadata?.Name} {Metadata?.Version}";
}
}