mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
actually fix devPlugins...
This commit is contained in:
parent
1e3b39b8d9
commit
821bcab17a
1 changed files with 27 additions and 13 deletions
|
|
@ -101,24 +101,23 @@ namespace Dalamud.Plugin
|
||||||
var defJsonFile = new FileInfo(Path.Combine(dllFile.Directory.FullName, $"{Path.GetFileNameWithoutExtension(dllFile.Name)}.json"));
|
var defJsonFile = new FileInfo(Path.Combine(dllFile.Directory.FullName, $"{Path.GetFileNameWithoutExtension(dllFile.Name)}.json"));
|
||||||
|
|
||||||
PluginDefinition pluginDef = null;
|
PluginDefinition pluginDef = null;
|
||||||
|
// load the definition if it exists, even for raw/developer plugins
|
||||||
if (defJsonFile.Exists)
|
if (defJsonFile.Exists)
|
||||||
{
|
{
|
||||||
if (!raw)
|
Log.Information("Loading definition for plugin DLL {0}", dllFile.FullName);
|
||||||
|
|
||||||
|
pluginDef =
|
||||||
|
JsonConvert.DeserializeObject<PluginDefinition>(
|
||||||
|
File.ReadAllText(defJsonFile.FullName));
|
||||||
|
|
||||||
|
if (pluginDef.ApplicableVersion != this.dalamud.StartInfo.GameVersion && pluginDef.ApplicableVersion != "any")
|
||||||
{
|
{
|
||||||
Log.Information("Loading definition for plugin DLL {0}", dllFile.FullName);
|
Log.Information("Plugin {0} has not applicable version.", dllFile.FullName);
|
||||||
|
return false;
|
||||||
pluginDef =
|
|
||||||
JsonConvert.DeserializeObject<PluginDefinition>(
|
|
||||||
File.ReadAllText(defJsonFile.FullName));
|
|
||||||
|
|
||||||
if (pluginDef.ApplicableVersion != this.dalamud.StartInfo.GameVersion && pluginDef.ApplicableVersion != "any")
|
|
||||||
{
|
|
||||||
Log.Information("Plugin {0} has not applicable version.", dllFile.FullName);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
// but developer plugins don't require one to load
|
||||||
|
else if (!raw)
|
||||||
{
|
{
|
||||||
Log.Information("Plugin DLL {0} has no definition.", dllFile.FullName);
|
Log.Information("Plugin DLL {0} has no definition.", dllFile.FullName);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -126,6 +125,21 @@ namespace Dalamud.Plugin
|
||||||
|
|
||||||
var plugin = (IDalamudPlugin)Activator.CreateInstance(type);
|
var plugin = (IDalamudPlugin)Activator.CreateInstance(type);
|
||||||
|
|
||||||
|
// this happens for raw plugins that don't specify a PluginDefinition - just generate a dummy one to avoid crashes anywhere
|
||||||
|
if (pluginDef == null)
|
||||||
|
{
|
||||||
|
pluginDef = new PluginDefinition
|
||||||
|
{
|
||||||
|
Author = "developer",
|
||||||
|
Name = plugin.Name,
|
||||||
|
InternalName = "devPlugin_" + plugin.Name,
|
||||||
|
AssemblyVersion = plugin.GetType().Assembly.GetName().Version.ToString(),
|
||||||
|
Description = "",
|
||||||
|
ApplicableVersion = "any",
|
||||||
|
IsHide = false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var dalamudInterface = new DalamudPluginInterface(this.dalamud, type.Assembly.GetName().Name, this.pluginConfigs);
|
var dalamudInterface = new DalamudPluginInterface(this.dalamud, type.Assembly.GetName().Name, this.pluginConfigs);
|
||||||
plugin.Initialize(dalamudInterface);
|
plugin.Initialize(dalamudInterface);
|
||||||
Log.Information("Loaded plugin: {0}", plugin.Name);
|
Log.Information("Loaded plugin: {0}", plugin.Name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue