-
-
Notifications
You must be signed in to change notification settings - Fork 39
How updates are installed
In Onova, update installation is performed in two high-level steps:
- Prepare the update -- done in
PrepareUpdateAsync()
. - Apply the update -- started by
LaunchUpdater()
.
In this step, Onova downloads and extracts the update package. This process is the most time-consuming one and is usually done in a background thread.
The steps are as following:
- Create temporary folder structure in
%localappdata%/Onova/{AssemblyName}
. - Download the package to a temporary directory, using specified
IPackageResolver
. - Extract the package contents to a temporary directory, using specified
IPackageExtractor
. - Delete the downloaded package after the contents have been extracted.
- Extract
Onova.Updater.exe
(external updater) from library's resources to a temporary directory, also renaming it according to the assembly name ({AssemblyName}.Updater.exe
).
Since the application cannot overwrite its own files while it's running, an external updater (Onova.Updater
) is used. Calling LaunchUpdater
simply launches the updater, passing required command line arguments. It also determines whether the updater needs to be launched with elevated privileges by checking if it can write to the target directory.
Once the updater is launched, it waits for the application to exit and copies the new files.
The steps are as following:
- Wait until application exits, using process ID.
- Copy the contents of the downloaded package to the updatee's directory, overwriting target files.
- Delete package contents from temporary storage.
- If instructed to, re-launch the application.
Onova.Updater
writes its own log file for diagnostic purposes, it's saved next to the executable, at %localappdata%/Onova/{AssemblyName}/Log.txt
.
Onova deletes temporary files once it's done using them, but there are two that cannot be deleted during update -- the external updater executable and the log file. If you wish to delete everything you can call the Cleanup()
method (e.g. at startup) which deletes the entire temporary directory.