From 06cb3a012730f614fed337b253016b012861557e Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Fri, 19 Jan 2024 08:43:14 +0900 Subject: [PATCH] Add Install All Plugins buttons on Debug compilation --- .../PluginInstaller/PluginInstallerWindow.cs | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 4233c169b2..f4c462fca8 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -337,7 +337,8 @@ public void SetSearchText(string text) /// /// The manifest to install. /// Install the testing version. - public void StartInstall(RemotePluginManifest manifest, bool useTesting) + /// A representing the asynchronous operation. + public Task StartInstall(RemotePluginManifest manifest, bool useTesting) { var pluginManager = Service.Get(); var notifications = Service.Get(); @@ -345,7 +346,7 @@ public void StartInstall(RemotePluginManifest manifest, bool useTesting) this.installStatus = OperationStatus.InProgress; this.loadingIndicatorKind = LoadingIndicatorKind.Installing; - Task.Run(() => pluginManager.InstallPluginAsync(manifest, useTesting || manifest.IsTestingExclusive, PluginLoadReason.Installer)) + return Task.Run(() => pluginManager.InstallPluginAsync(manifest, useTesting || manifest.IsTestingExclusive, PluginLoadReason.Installer)) .ContinueWith(task => { // There is no need to set as Complete for an individual plugin installation @@ -677,6 +678,32 @@ private void DrawFooter() } } +#if DEBUG + if (!pluginManager.SafeMode) + { + ImGui.SameLine(); + if (ImGui.Button("DEV: Install All Plugins (see /xllog for progress)")) + { + async void DoInstall() + { + var manifests = this.categoryManager.GetCurrentCategoryContent( + this.pluginListAvailable.Where(rm => !this.IsManifestFiltered(rm))) + .OfType() + .Where(rm => !this.IsManifestInstalled(rm).IsInstalled) + .ToList(); + + for (var i = 0; i < manifests.Count; i++) + { + Log.Information("Installing plugin {i} of {count}...", i + 1, manifests.Count); + await this.StartInstall(manifests[i], pluginManager.UseTesting(manifests[i])); + } + } + + _ = Task.Run(DoInstall); + } + } +#endif + var closeText = Locs.FooterButton_Close; var closeButtonSize = ImGuiHelpers.GetButtonSize(closeText);