From 722564c19dbb63deb3e1f03aaa05cfbc3f830f22 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 18 Oct 2022 15:05:21 +0200 Subject: [PATCH 1/2] Expose the InstalledFromUrl as SourceRepository in the DalamudPluginInterface. --- Dalamud/Plugin/DalamudPluginInterface.cs | 9 ++++++++- Dalamud/Plugin/Internal/Types/LocalPlugin.cs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index e0fa641cc..623c524d2 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -40,7 +40,8 @@ namespace Dalamud.Plugin /// Location of the assembly. /// The reason the plugin was loaded. /// A value indicating whether this is a dev plugin. - internal DalamudPluginInterface(string pluginName, FileInfo assemblyLocation, PluginLoadReason reason, bool isDev) + /// The repository from which the plugin is installed. + internal DalamudPluginInterface(string pluginName, FileInfo assemblyLocation, PluginLoadReason reason, bool isDev, string sourceRepository) { var configuration = Service.Get(); var dataManager = Service.Get(); @@ -53,6 +54,7 @@ namespace Dalamud.Plugin this.configs = Service.Get().PluginConfigs; this.Reason = reason; this.IsDev = isDev; + this.SourceRepository = isDev ? "DevPlugin" : sourceRepository; this.LoadTime = DateTime.Now; this.LoadTimeUTC = DateTime.UtcNow; @@ -122,6 +124,11 @@ namespace Dalamud.Plugin /// public FileInfo AssemblyLocation { get; } + /// + /// Gets the custom repository from which this plugin is installed, the main repo flag or "DevPlugin". + /// + public string SourceRepository { get; } + /// /// Gets the directory your plugin configurations are stored in. /// diff --git a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs index f34990b94..f30e0632c 100644 --- a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs +++ b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs @@ -400,7 +400,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) { From f0e5424a7a70e2c93a2ccf85292d8ab845d766ba Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 18 Oct 2022 15:26:07 +0200 Subject: [PATCH 2/2] Improve comment. --- Dalamud/Plugin/DalamudPluginInterface.cs | 5 +++-- Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index 623c524d2..baac551a8 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -17,6 +17,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; @@ -54,7 +55,7 @@ namespace Dalamud.Plugin this.configs = Service.Get().PluginConfigs; this.Reason = reason; this.IsDev = isDev; - this.SourceRepository = isDev ? "DevPlugin" : sourceRepository; + this.SourceRepository = isDev ? LocalPluginManifest.FlagDevPlugin : sourceRepository; this.LoadTime = DateTime.Now; this.LoadTimeUTC = DateTime.UtcNow; @@ -125,7 +126,7 @@ namespace Dalamud.Plugin public FileInfo AssemblyLocation { get; } /// - /// Gets the custom repository from which this plugin is installed, the main repo flag or "DevPlugin". + /// Gets the custom repository from which this plugin is installed, , or . /// public string SourceRepository { get; } diff --git a/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs b/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs index e3c44c21d..c4cec48bf 100644 --- a/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs +++ b/Dalamud/Plugin/Internal/Types/LocalPluginManifest.cs @@ -12,9 +12,14 @@ namespace Dalamud.Plugin.Internal.Types; /// internal record LocalPluginManifest : PluginManifest { + /// "OFFICIAL" [JsonIgnore] public const string FlagMainRepo = "OFFICIAL"; - + + /// "DEVPLUGIN" + [JsonIgnore] + public const string FlagDevPlugin = "DEVPLUGIN"; + /// /// Gets or sets a value indicating whether the plugin is disabled and should not be loaded. /// This value supersedes the ".disabled" file functionality and should not be included in the plugin master.