Merge pull request #3 from Philpax/patch-1

LPL compatibility
This commit is contained in:
goaaats 2021-05-01 12:01:49 +02:00 committed by GitHub
commit 07475f1851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,12 @@ namespace SamplePlugin
private Configuration configuration; private Configuration configuration;
private PluginUI ui; private PluginUI ui;
// When loaded by LivePluginLoader, the executing assembly will be wrong.
// Supplying this property allows LivePluginLoader to supply the correct location, so that
// you have full compatibility when loaded normally and through LPL.
public string AssemblyLocation { get => assemblyLocation; set => assemblyLocation = value; }
private string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
public void Initialize(DalamudPluginInterface pluginInterface) public void Initialize(DalamudPluginInterface pluginInterface)
{ {
this.pi = pluginInterface; this.pi = pluginInterface;
@ -24,7 +30,7 @@ namespace SamplePlugin
this.configuration.Initialize(this.pi); this.configuration.Initialize(this.pi);
// you might normally want to embed resources and load them from the manifest stream // you might normally want to embed resources and load them from the manifest stream
var imagePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"goat.png"); var imagePath = Path.Combine(Path.GetDirectoryName(AssemblyLocation), @"goat.png");
var goatImage = this.pi.UiBuilder.LoadImage(imagePath); var goatImage = this.pi.UiBuilder.LoadImage(imagePath);
this.ui = new PluginUI(this.configuration, goatImage); this.ui = new PluginUI(this.configuration, goatImage);