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

Allow installs and removals to be cancelled #4253

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

HebaruSan
Copy link
Member

Problem

The GUI progress screen has a Cancel button, but it only works while a download is in progress. If you try to cancel after the downloads are finished but installation is still in progress, the button disables itself and nothing else happens.

Cause

The downloaders have their own custom CancelDownload methods, but the ModuleInstaller has nothing equivalent.

Changes

  • Now the downloader classes are refactored to accept CancellationTokens in their constructors and throw CancelledActionKraken in place of their proprietary APIs. The CancelledActionKraken causes the installation transaction to abort, which restores the original state of the game folder.
  • ModuleInstaller is updated to work the same way and checks the token in between installing or removing files
  • The Cancel button now cancels the current CancellationToken

This allows the Cancel button to work regardless of which step is currently in progress.

@HebaruSan HebaruSan added Enhancement New features or functionality GUI Issues affecting the interactive GUI Core (ckan.dll) Issues affecting the core part of CKAN labels Nov 7, 2024
@HebaruSan HebaruSan merged commit f776f02 into KSP-CKAN:master Nov 7, 2024
3 checks passed
@HebaruSan HebaruSan deleted the fix/cancel-install branch November 7, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Enhancement New features or functionality GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant