fix: work around bad assembly version in chat extender json

This commit is contained in:
goat 2020-04-26 18:43:40 +02:00
parent 9b591e71d2
commit 62ef6034ee

View file

@ -100,19 +100,6 @@ namespace Dalamud.Plugin
JsonConvert.DeserializeObject<PluginDefinition>( JsonConvert.DeserializeObject<PluginDefinition>(
File.ReadAllText(defJsonFile.FullName)); File.ReadAllText(defJsonFile.FullName));
// Don't wanna fuck this up
// This is a fix for earlier Chat Extender versions, since they break command handlers
try {
if (dllFile.Name.Contains("ChatExtender") &&
int.Parse(pluginDef.AssemblyVersion.Replace(".", "")) < 1410) {
Log.Information("Found banned ChatExtender, skipping...");
return false;
}
} catch (Exception) {
// ignored
}
if (pluginDef.ApplicableVersion != this.dalamud.StartInfo.GameVersion && pluginDef.ApplicableVersion != "any") if (pluginDef.ApplicableVersion != this.dalamud.StartInfo.GameVersion && pluginDef.ApplicableVersion != "any")
{ {
Log.Information("Plugin {0} has not applicable version.", dllFile.FullName); Log.Information("Plugin {0} has not applicable version.", dllFile.FullName);
@ -135,6 +122,23 @@ namespace Dalamud.Plugin
// Assembly.Load() by name here will not load multiple versions with the same name, in the case of updates // Assembly.Load() by name here will not load multiple versions with the same name, in the case of updates
var pluginAssembly = Assembly.LoadFile(dllFile.FullName); var pluginAssembly = Assembly.LoadFile(dllFile.FullName);
// Don't wanna fuck this up
// This is a fix for earlier Chat Extender versions, since they break command handlers
try
{
var ver = int.Parse(pluginAssembly.GetName().Version.ToString().Replace(".", ""));
if (dllFile.Name.Contains("ChatExtender") &&
ver < 1410)
{
Log.Information($"Found banned v{ver} ChatExtender, skipping...");
return false;
}
}
catch (Exception)
{
// ignored
}
if (pluginAssembly != null) if (pluginAssembly != null)
{ {
Log.Information("Loading types for {0}", pluginAssembly.FullName); Log.Information("Loading types for {0}", pluginAssembly.FullName);