-
-
Notifications
You must be signed in to change notification settings - Fork 6
API and customizations
Emanuele Manzione edited this page Apr 12, 2020
·
24 revisions
You can implement your own downloader for your Launcher, if needed. Just implement IDownloader interface in your own class as following:
public sealed class MyDownloader : MHLab.Patch.Core.Client.IO.IDownloader
{
// The code to implement IDownloader
}then inject it into the Updater/Repairer/PatcherUpdater:
// This is taken from Launcher.cs, Initialize method.
_updater = new Updater(_context);
_updater.Downloader.DownloadComplete += DownloadComplete;
_updater.Downloader.ProgressChanged += DownloadProgressChanged;You can implement your own logger for your Launcher, if needed. Just implement ILogger interface in your own class as following:
public sealed class MyLogger : MHLab.Patch.Core.Loggers.ILogger
{
// The code to implement ILogger
}then inject it into the UpdatingContext:
// This is taken from Launcher.cs, Initialize method.
_context = new UpdatingContext(settings, progress);
_context.Logger = new MyLoggerNormally the Launcher automatically starts the updating process, but for your convenience (and for customization purposes) the UpdatingContext exposes IsUpdateAvailable method. It returns a bool if a new patch exists for the game.
If you call
IsUpdateAvailablebefore the UpdatingContext'sInitialize, you will get an exception.