Skip to content

Conversation

@Bentroen
Copy link
Member

When a new update is available, instead of opening the website, the program will attempt to download it automatically. The installer for the new version will be saved as Minecraft Note Block Studio Setup.exe on the program's root directory, and when successfully downloaded, it will be opened automatically, followed by the closure of the program. In case the download fails, only then the user will be prompted if they want to go to the website and update manually.

This change should not only make it easier to distribute updates, but more convenient for the user to get them -- especially if new updates are released on a frequent basis. It allows the user to access new versions without even opening a browser.

The function which previously only checked if an update was available (control_http) was split into two different functions, check_updates (previous functionality) and get_update, which will attempt to download the file.

draw_loading, an obsolete function to draw a loading bar to the screen, was repurposed and now shows, in MB, how much is left for the download to complete (as well as the percentage).

The program version was temporarily changed to 3.6.0 in order for it to detect updates (remember to revert this later, lol).

Currently, if the connection is interrupted during the download, the program will still think the download was successful, even though the file was only partially downloaded. This happens because both the download status and HTTP status return the same value (0 and 200, respectively) both when the file is downloaded completely, and when it fails. A way for detecting if the download didn't complete is being investigated.
The update system now detects if the download failed by comparing the file size against the total size sent by the server. This is done as soon as the "success" status is received and triggers either the success message, which closes the program and opens the installer, or an error message which asks if the user wants to open the website to update manually.

Renamed the installer to 'Minecraft Note Block Studio Installer.exe' (more user-friendly in the User Account Control popup).
Restored the original loading bar drawing code for historical reasons (despite unused, it's still mentioned in a few places in the code). Moved the download progress bar drawing code to a new script called draw_downloadprogress().
- Add quotation marks to the shell command to allow spaces in the filename
- Draw a placeholder in the download progress bar while the file size isn't retrieved (-.-- instead of 0.00)
- Restore original draw_loading() code (for sure this time)
- Change "Setup" to "Installer" in the filename
- Delete old installers on startup
- Shift some stuff in the startup code
- Restore version number to current version
@Bentroen Bentroen merged commit d8af355 into development Jan 19, 2020
@Bentroen Bentroen deleted the auto-updater branch January 19, 2020 06:11
@ShinkoNet
Copy link
Collaborator

very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants