Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background / motivation
After KSP-CKAN/CKAN-meta#2159, many users opted in to the Kopernicus Bleeding Edge repo to use Kopernicus on recent game versions.
This PR attempts to modernize repo updates somewhat.
Problems
IUser
implementation always prints\r\n
beforeRaiseProgress
and afterRaiseMessage
(implicitly viaWriteLine
). This means that if you alternate them, you end up with separate messages combined onto one line or extra blank lines. The existing code has a number of workarounds in place due to this.CKAN/registry.json
is truncated and can no longer be loaded. I had this happen once myself far too long ago to be able to investigate it (and probably not related to updating CKAN).Changes
Core:
IUser.RaiseProgress
to announce the start of each step it performs andIUser.RaiseMessage
to announce the completion of each step it performs. This way, you can look at the progress bar to see what CKAN is doing right now and the text box to see what has already been finished.IUser.RaiseError
instead ofIUser.RaiseMessage
when there's a download error, and it usesException.Message
instead ofException.ToString()
to omit the stack traceCmdLine:
ConsoleUser
internally tracks whether its last output left the cursor at the start of the line or not. This allows it to alternateRaiseProgress
andRaiseMessage
calls with no missing or extra line breaks. This makes the above Core changes look right forckan update
.ckan update
no longer prints a message at the start, because the Core code will take care of thatConsoleUI:
(I'm kind of proud how easy it was to do this, just a few lines to add a whole new screen flow.)
GUI: