Merge pull request #1027 from Ottermandias/ParentRepo

This commit is contained in:
goat 2022-11-03 22:02:10 +01:00 committed by GitHub
commit e5b53c9ce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -18,6 +18,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Internal.Types;
using Dalamud.Plugin.Ipc;
using Dalamud.Plugin.Ipc.Exceptions;
using Dalamud.Plugin.Ipc.Internal;
@ -41,7 +42,8 @@ public sealed class DalamudPluginInterface : IDisposable
/// <param name="assemblyLocation">Location of the assembly.</param>
/// <param name="reason">The reason the plugin was loaded.</param>
/// <param name="isDev">A value indicating whether this is a dev plugin.</param>
internal DalamudPluginInterface(string pluginName, FileInfo assemblyLocation, PluginLoadReason reason, bool isDev)
/// <param name="sourceRepository">The repository from which the plugin is installed.</param>
internal DalamudPluginInterface(string pluginName, FileInfo assemblyLocation, PluginLoadReason reason, bool isDev, string sourceRepository)
{
var configuration = Service<DalamudConfiguration>.Get();
var dataManager = Service<DataManager>.Get();
@ -54,6 +56,7 @@ public sealed class DalamudPluginInterface : IDisposable
this.configs = Service<PluginManager>.Get().PluginConfigs;
this.Reason = reason;
this.IsDev = isDev;
this.SourceRepository = isDev ? LocalPluginManifest.FlagDevPlugin : sourceRepository;
this.LoadTime = DateTime.Now;
this.LoadTimeUTC = DateTime.UtcNow;
@ -92,6 +95,11 @@ public sealed class DalamudPluginInterface : IDisposable
/// Gets the reason this plugin was loaded.
/// </summary>
public PluginLoadReason Reason { get; }
/// <summary>
/// Gets the custom repository from which this plugin is installed, <inheritdoc cref="LocalPluginManifest.FlagMainRepo"/>, or <inheritdoc cref="LocalPluginManifest.FlagDevPlugin"/>.
/// </summary>
public string SourceRepository { get; }
/// <summary>
/// Gets a value indicating whether this is a dev plugin.

View file

@ -401,7 +401,7 @@ internal class LocalPlugin : IDisposable
new PluginPatchData(this.DllFile);
this.DalamudInterface =
new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, this.DllFile, reason, this.IsDev);
new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, this.DllFile, reason, this.IsDev, this.Manifest.InstalledFromUrl );
if (this.Manifest.LoadSync && this.Manifest.LoadRequiredState is 0 or 1)
{

View file

@ -17,6 +17,10 @@ internal record LocalPluginManifest : PluginManifest
/// </summary>
[JsonIgnore]
public const string FlagMainRepo = "OFFICIAL";
/// <summary> "DEVPLUGIN" </summary>
[JsonIgnore]
public const string FlagDevPlugin = "DEVPLUGIN";
/// <summary>
/// Gets or sets a value indicating whether the plugin is disabled and should not be loaded.