From 46dee9a483fd886b453be35a3cb182823ecc7e60 Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Sun, 19 Oct 2025 22:54:34 +0200 Subject: [PATCH] Inherit documentation in DalamudPluginInterface --- Dalamud/Plugin/DalamudPluginInterface.cs | 196 ++++++----------------- 1 file changed, 53 insertions(+), 143 deletions(-) diff --git a/Dalamud/Plugin/DalamudPluginInterface.cs b/Dalamud/Plugin/DalamudPluginInterface.cs index 603bed7a5..6fd9064b6 100644 --- a/Dalamud/Plugin/DalamudPluginInterface.cs +++ b/Dalamud/Plugin/DalamudPluginInterface.cs @@ -86,126 +86,73 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa configuration.DalamudConfigurationSaved += this.OnDalamudConfigurationSaved; } - /// - /// Event that gets fired when loc is changed - /// + /// public event IDalamudPluginInterface.LanguageChangedDelegate? LanguageChanged; - /// - /// Event that is fired when the active list of plugins is changed. - /// + /// public event IDalamudPluginInterface.ActivePluginsChangedDelegate? ActivePluginsChanged; - /// - /// Gets the reason this plugin was loaded. - /// + /// public PluginLoadReason Reason { get; } - /// - /// Gets a value indicating whether auto-updates have already completed this session. - /// + /// public bool IsAutoUpdateComplete => Service.GetNullable()?.IsAutoUpdateComplete ?? false; - /// - /// 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 - /// . Developer plugins will return the value of - /// . - /// + /// public string SourceRepository { get; } - /// - /// Gets the current internal plugin name. - /// + /// public string InternalName => this.plugin.InternalName; - /// - /// Gets the plugin's manifest. - /// + /// public IPluginManifest Manifest => this.plugin.Manifest; - /// - /// Gets a value indicating whether this is a dev plugin. - /// + /// public bool IsDev => this.plugin.IsDev; - /// - /// Gets a value indicating whether this is a testing release of a plugin. - /// - /// - /// Dev plugins have undefined behavior for this value, but can be expected to return false. - /// + /// public bool IsTesting { get; } - /// - /// Gets the time that this plugin was loaded. - /// + /// public DateTime LoadTime { get; } - /// - /// Gets the UTC time that this plugin was loaded. - /// + /// public DateTime LoadTimeUTC { get; } - /// - /// Gets the timespan delta from when this plugin was loaded. - /// + /// public TimeSpan LoadTimeDelta => DateTime.Now - this.LoadTime; - /// - /// Gets the directory Dalamud assets are stored in. - /// + /// public DirectoryInfo DalamudAssetDirectory => Service.Get().AssetDirectory; - /// - /// Gets the location of your plugin assembly. - /// + /// public FileInfo AssemblyLocation => this.plugin.DllFile; - /// - /// Gets the directory your plugin configurations are stored in. - /// + /// public DirectoryInfo ConfigDirectory => new(this.GetPluginConfigDirectory()); - /// - /// Gets the config file of your plugin. - /// + /// public FileInfo ConfigFile => this.configs.GetConfigFile(this.plugin.InternalName); - /// - /// Gets the instance which allows you to draw UI into the game via ImGui draw calls. - /// + /// public IUiBuilder UiBuilder { get; private set; } - /// - /// Gets a value indicating whether Dalamud is running in Debug mode or the /xldev menu is open. This can occur on release builds. - /// + /// public bool IsDevMenuOpen => Service.GetNullable() is { IsDevMenuOpen: true }; // Can be null during boot - /// - /// Gets a value indicating whether a debugger is attached. - /// + /// public bool IsDebugging => Debugger.IsAttached; - /// - /// Gets the current UI language in two-letter iso format. - /// + /// public string UiLanguage { get; private set; } - /// - /// Gets serializer class with functions to remove special characters from strings. - /// + /// public ISanitizer Sanitizer { get; } - /// - /// Gets the chat type used by default for plugin messages. - /// + /// public XivChatType GeneralChatType { get; private set; } - /// - /// Gets a list of installed plugins along with their current state. - /// + /// public IEnumerable InstalledPlugins => Service.Get().InstalledPlugins.Select(p => new ExposedPlugin(p)); @@ -214,12 +161,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa /// internal UiBuilder LocalUiBuilder => this.uiBuilder; - /// - /// Opens the , with an optional search term. - /// - /// The page to open the installer to. Defaults to the "All Plugins" page. - /// An optional search text to input in the search box. - /// Returns false if the DalamudInterface was null. + /// public bool OpenPluginInstallerTo(PluginInstallerOpenKind openTo = PluginInstallerOpenKind.AllPlugins, string? searchText = null) { var dalamudInterface = Service.GetNullable(); // Can be null during boot @@ -234,12 +176,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa return true; } - /// - /// Opens the , with an optional search term. - /// - /// The tab to open the settings to. Defaults to the "General" tab. - /// An optional search text to input in the search box. - /// Returns false if the DalamudInterface was null. + /// public bool OpenDalamudSettingsTo(SettingsOpenKind openTo = SettingsOpenKind.General, string? searchText = null) { var dalamudInterface = Service.GetNullable(); // Can be null during boot @@ -254,10 +191,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa return true; } - /// - /// Opens the dev menu bar. - /// - /// Returns false if the DalamudInterface was null. + /// public bool OpenDeveloperMenu() { var dalamudInterface = Service.GetNullable(); // Can be null during boot @@ -296,102 +230,91 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa #region IPC - /// + /// public T GetOrCreateData(string tag, Func dataGenerator) where T : class => Service.Get().GetOrCreateData(tag, dataGenerator); - /// + /// public void RelinquishData(string tag) => Service.Get().RelinquishData(tag); - /// + /// public bool TryGetData(string tag, [NotNullWhen(true)] out T? data) where T : class => Service.Get().TryGetData(tag, out data); - /// + /// public T? GetData(string tag) where T : class => Service.Get().GetData(tag); - /// - /// Gets an IPC provider. - /// - /// The return type for funcs. Use object if this is unused. - /// The name of the IPC registration. - /// An IPC provider. - /// This is thrown when the requested types do not match the previously registered types are different. + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// + /// public ICallGateProvider GetIpcProvider(string name) => new CallGatePubSub(name); - /// - /// Gets an IPC subscriber. - /// - /// The return type for funcs. Use object if this is unused. - /// The name of the IPC registration. - /// An IPC subscriber. + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); - /// + /// public ICallGateSubscriber GetIpcSubscriber(string name) => new CallGatePubSub(name); @@ -399,10 +322,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa #region Configuration - /// - /// Save a plugin configuration(inheriting IPluginConfiguration). - /// - /// The current configuration. + /// public void SavePluginConfig(IPluginConfiguration? currentConfig) { if (currentConfig == null) @@ -411,10 +331,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa this.configs.Save(currentConfig, this.plugin.InternalName, this.plugin.EffectiveWorkingPluginId); } - /// - /// Get a previously saved plugin configuration or null if none was saved before. - /// - /// A previously saved config or null if none was saved before. + /// public IPluginConfiguration? GetPluginConfig() { // This is done to support json deserialization of plugin configurations @@ -438,16 +355,10 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa return this.configs.Load(this.plugin.InternalName, this.plugin.EffectiveWorkingPluginId); } - /// - /// Get the config directory. - /// - /// directory with path of AppData/XIVLauncher/pluginConfig/PluginInternalName. + /// public string GetPluginConfigDirectory() => this.configs.GetDirectory(this.plugin.InternalName); - /// - /// Get the loc directory. - /// - /// directory with path of AppData/XIVLauncher/pluginConfig/PluginInternalName/loc. + /// public string GetPluginLocDirectory() => this.configs.GetDirectory(Path.Combine(this.plugin.InternalName, "loc")); #endregion @@ -508,8 +419,7 @@ internal sealed class DalamudPluginInterface : IDalamudPluginInterface, IDisposa #endregion - /// Unregister the plugin and dispose all references. - /// Dalamud internal use only. + /// public void Dispose() { Service.Get().RemoveChatLinkHandler(this.plugin.InternalName);