mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-18 14:44:16 +01:00
Merge pull request #1050 from KazWolfe/testing-flag
Add IsTesting to PluginInterface
This commit is contained in:
commit
ae5a842bac
2 changed files with 19 additions and 8 deletions
|
|
@ -42,8 +42,8 @@ public sealed class DalamudPluginInterface : IDisposable
|
||||||
/// <param name="assemblyLocation">Location of the assembly.</param>
|
/// <param name="assemblyLocation">Location of the assembly.</param>
|
||||||
/// <param name="reason">The reason the plugin was loaded.</param>
|
/// <param name="reason">The reason the plugin was loaded.</param>
|
||||||
/// <param name="isDev">A value indicating whether this is a dev plugin.</param>
|
/// <param name="isDev">A value indicating whether this is a dev plugin.</param>
|
||||||
/// <param name="sourceRepository">The repository from which the plugin is installed.</param>
|
/// <param name="manifest">The local manifest for this plugin.</param>
|
||||||
internal DalamudPluginInterface(string pluginName, FileInfo assemblyLocation, PluginLoadReason reason, bool isDev, string sourceRepository)
|
internal DalamudPluginInterface(string pluginName, FileInfo assemblyLocation, PluginLoadReason reason, bool isDev, LocalPluginManifest manifest)
|
||||||
{
|
{
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
var dataManager = Service<DataManager>.Get();
|
var dataManager = Service<DataManager>.Get();
|
||||||
|
|
@ -56,7 +56,8 @@ public sealed class DalamudPluginInterface : IDisposable
|
||||||
this.configs = Service<PluginManager>.Get().PluginConfigs;
|
this.configs = Service<PluginManager>.Get().PluginConfigs;
|
||||||
this.Reason = reason;
|
this.Reason = reason;
|
||||||
this.IsDev = isDev;
|
this.IsDev = isDev;
|
||||||
this.SourceRepository = isDev ? LocalPluginManifest.FlagDevPlugin : sourceRepository;
|
this.SourceRepository = isDev ? LocalPluginManifest.FlagDevPlugin : manifest.InstalledFromUrl;
|
||||||
|
this.IsTesting = manifest.Testing;
|
||||||
|
|
||||||
this.LoadTime = DateTime.Now;
|
this.LoadTime = DateTime.Now;
|
||||||
this.LoadTimeUTC = DateTime.UtcNow;
|
this.LoadTimeUTC = DateTime.UtcNow;
|
||||||
|
|
@ -97,7 +98,11 @@ public sealed class DalamudPluginInterface : IDisposable
|
||||||
public PluginLoadReason Reason { get; }
|
public PluginLoadReason Reason { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the custom repository from which this plugin is installed, <inheritdoc cref="LocalPluginManifest.FlagMainRepo"/>, or <inheritdoc cref="LocalPluginManifest.FlagDevPlugin"/>.
|
/// Gets the repository from which this plugin was installed.
|
||||||
|
///
|
||||||
|
/// If a plugin was installed from the official/main repository, this will return the value of
|
||||||
|
/// <see cref="LocalPluginManifest.FlagMainRepo"/>. Developer plugins will return the value of
|
||||||
|
/// <see cref="LocalPluginManifest.FlagDevPlugin"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SourceRepository { get; }
|
public string SourceRepository { get; }
|
||||||
|
|
||||||
|
|
@ -106,6 +111,14 @@ public sealed class DalamudPluginInterface : IDisposable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsDev { get; }
|
public bool IsDev { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this is a testing release of a plugin.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Dev plugins have undefined behavior for this value, but can be expected to return <c>false</c>.
|
||||||
|
/// </remarks>
|
||||||
|
public bool IsTesting { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the time that this plugin was loaded.
|
/// Gets the time that this plugin was loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ using Dalamud.Logging.Internal;
|
||||||
using Dalamud.Plugin.Internal.Exceptions;
|
using Dalamud.Plugin.Internal.Exceptions;
|
||||||
using Dalamud.Plugin.Internal.Loader;
|
using Dalamud.Plugin.Internal.Loader;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using Dalamud.Utility.Signatures;
|
|
||||||
|
|
||||||
namespace Dalamud.Plugin.Internal.Types;
|
namespace Dalamud.Plugin.Internal.Types;
|
||||||
|
|
||||||
|
|
@ -397,11 +396,10 @@ internal class LocalPlugin : IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the location for the Location and CodeBase patches
|
// Update the location for the Location and CodeBase patches
|
||||||
PluginManager.PluginLocations[this.pluginType.Assembly.FullName] =
|
PluginManager.PluginLocations[this.pluginType.Assembly.FullName] = new PluginPatchData(this.DllFile);
|
||||||
new PluginPatchData(this.DllFile);
|
|
||||||
|
|
||||||
this.DalamudInterface =
|
this.DalamudInterface =
|
||||||
new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, this.DllFile, reason, this.IsDev, this.Manifest.InstalledFromUrl);
|
new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, this.DllFile, reason, this.IsDev, this.Manifest);
|
||||||
|
|
||||||
if (this.Manifest.LoadSync && this.Manifest.LoadRequiredState is 0 or 1)
|
if (this.Manifest.LoadSync && this.Manifest.LoadRequiredState is 0 or 1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue