|
@@ -172,13 +172,16 @@ namespace BepInEx.Bootstrap
|
|
var dependencies = BepInDependency.FromCecilType(type);
|
|
var dependencies = BepInDependency.FromCecilType(type);
|
|
var incompatibilities = BepInIncompatibility.FromCecilType(type);
|
|
var incompatibilities = BepInIncompatibility.FromCecilType(type);
|
|
|
|
|
|
|
|
+ var bepinVersion = type.Module.AssemblyReferences.FirstOrDefault(reference => reference.Name == "BepInEx")?.Version ?? new Version();
|
|
|
|
+
|
|
return new PluginInfo
|
|
return new PluginInfo
|
|
{
|
|
{
|
|
Metadata = metadata,
|
|
Metadata = metadata,
|
|
Processes = filters,
|
|
Processes = filters,
|
|
Dependencies = dependencies,
|
|
Dependencies = dependencies,
|
|
Incompatibilities = incompatibilities,
|
|
Incompatibilities = incompatibilities,
|
|
- TypeName = type.FullName
|
|
|
|
|
|
+ TypeName = type.FullName,
|
|
|
|
+ TargettedBepInExVersion = bepinVersion
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
@@ -195,6 +198,15 @@ namespace BepInEx.Bootstrap
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static bool PluginTargetsNewerBepin(PluginInfo pluginInfo)
|
|
|
|
+ {
|
|
|
|
+ var pluginTarget = pluginInfo.TargettedBepInExVersion;
|
|
|
|
+ // X.X.X.x - compare normally. x.x.x.X - nightly build number, ignore
|
|
|
|
+ return pluginTarget.Major > CurrentAssemblyVersion.Major
|
|
|
|
+ || pluginTarget.Minor > CurrentAssemblyVersion.Minor
|
|
|
|
+ || pluginTarget.Build > CurrentAssemblyVersion.Build;
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// The entrypoint for the BepInEx plugin system.
|
|
/// The entrypoint for the BepInEx plugin system.
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -276,6 +288,12 @@ namespace BepInEx.Bootstrap
|
|
DependencyErrors.Add(message);
|
|
DependencyErrors.Add(message);
|
|
Logger.LogError(message);
|
|
Logger.LogError(message);
|
|
}
|
|
}
|
|
|
|
+ else if (PluginTargetsNewerBepin(pluginInfo))
|
|
|
|
+ {
|
|
|
|
+ string message = $@"Plugin [{pluginInfo.Metadata.Name}] targets a newer version of BepInEx ({pluginInfo.TargettedBepInExVersion}) and might not work until you update";
|
|
|
|
+ DependencyErrors.Add(message);
|
|
|
|
+ Logger.LogWarning(message);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
var emptyDependencies = new string[0];
|
|
var emptyDependencies = new string[0];
|