Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Install All Plugins buttons on Debug compilation #1616

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,16 @@ public void SetSearchText(string text)
/// </summary>
/// <param name="manifest">The manifest to install.</param>
/// <param name="useTesting">Install the testing version.</param>
public void StartInstall(RemotePluginManifest manifest, bool useTesting)
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
public Task StartInstall(RemotePluginManifest manifest, bool useTesting)
{
var pluginManager = Service<PluginManager>.Get();
var notifications = Service<NotificationManager>.Get();

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
Expand Down Expand Up @@ -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<RemotePluginManifest>()
.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);

Expand Down
Loading