Skip to content

Installer

The Installer class is an abstract base class within the Cobra Updater framework, responsible for managing the installation process of software updates. It defines a generic interface for installing both base packages and patches across different platforms. By abstracting the installation process, it allows for platform-specific implementations while maintaining a consistent interface for managing installations.

Example Usage

To use the Installer class, it must be subclassed with concrete implementations of its abstract methods, tailored to specific platforms. Here's an example of how to extend the Installer class for a particular platform:

using ByteCobra.Updater.Models;
using System.Threading.Tasks;

namespace ByteCobra.Updater
{
    public class MyWindowsInstaller : Installer
    {
        public override Platform Platform => Platform.StandaloneWindows64;

        public override async Task InstallBaseAsync(PackageZipFile package)
        {
            // Implement custom logic for installing the base package on Windows
        }

        public override async Task InstallPatchAsync(PackageZipFile package)
        {
            // Implement custom logic for installing patches on Windows
        }
    }
}

In this example, MyWindowsInstaller is a subclass of the Installer class, specifically tailored for Windows platform. It provides concrete implementations for InstallBaseAsync and InstallPatchAsync, defining how base packages and patches should be installed on Windows systems. This subclassing approach allows for the development of platform-specific installation strategies while keeping the overall framework consistent across different environments.