Merge pull request #563 from daemitus/isdev

feat: implement dpi.IsDev
This commit is contained in:
goaaats 2021-09-14 20:51:15 +02:00 committed by GitHub
commit 245742589c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View file

@ -107,7 +107,7 @@ namespace Dalamud.Interface.Internal.Scratchpad
var pluginType = script.ContinueWith<Type>("return typeof(ScratchPlugin);")
.RunAsync().GetAwaiter().GetResult().ReturnValue;
var pi = new DalamudPluginInterface($"Scratch-{doc.Id}", PluginLoadReason.Unknown);
var pi = new DalamudPluginInterface($"Scratch-{doc.Id}", PluginLoadReason.Unknown, false);
var ioc = Service<ServiceContainer>.Get();
var plugin = ioc.Create(pluginType, pi);

View file

@ -36,7 +36,8 @@ namespace Dalamud.Plugin
/// </summary>
/// <param name="pluginName">The internal name of the plugin.</param>
/// <param name="reason">The reason the plugin was loaded.</param>
internal DalamudPluginInterface(string pluginName, PluginLoadReason reason)
/// <param name="isDev">A value indicating whether this is a dev plugin.</param>
internal DalamudPluginInterface(string pluginName, PluginLoadReason reason, bool isDev)
{
var configuration = Service<DalamudConfiguration>.Get();
var dataManager = Service<DataManager>.Get();
@ -47,6 +48,7 @@ namespace Dalamud.Plugin
this.pluginName = pluginName;
this.configs = Service<PluginManager>.Get().PluginConfigs;
this.Reason = reason;
this.IsDev = isDev;
this.LoadTime = DateTime.Now;
this.LoadTimeUTC = DateTime.UtcNow;
@ -86,6 +88,11 @@ namespace Dalamud.Plugin
/// </summary>
public PluginLoadReason Reason { get; }
/// <summary>
/// Gets a value indicating whether this is a dev plugin.
/// </summary>
public bool IsDev { get; }
/// <summary>
/// Gets the time that this plugin was loaded.
/// </summary>

View file

@ -288,7 +288,7 @@ namespace Dalamud.Plugin.Internal
// Update the location for the Location and CodeBase patches
PluginManager.PluginLocations[this.pluginType.Assembly.FullName] = new(this.DllFile);
this.DalamudInterface = new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, reason);
this.DalamudInterface = new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, reason, this.IsDev);
var ioc = Service<ServiceContainer>.Get();
this.instance = ioc.Create(this.pluginType, this.DalamudInterface) as IDalamudPlugin;