GameInstaller

Download game files

IGameInstaller checks for the existence and integrity of the file and downloads it if necessary.

The GameInstaller fires events that indicate the progress of the installation. See Event Handling

Example

var installer = ParallelGameInstaller.CreateAsCoreCount(new HttpClient());
var file = new GameFile("name")
{
    Path = "absolute path of the file",
    Hash = "SHA1 checksum, in hex string",
    Size = 1024, // file size
    Url = "URL to download the file",
};
await installer.Install([file], fileProgress, byteProgress, CancellationToken.None);

BasicGameInstaller

Single-threaded installer

var installer = new BasicGameInstaller(new HttpClient());

ParallelGameInstaller

Multi-threaded installer. CreateAsCoreCount method initializes a new ParallelGameInstaller with the number of cores of the current PC.

var installer = ParallelGameInstaller.CreateAsCoreCount(new HttpClient());

You can specify the maximum number of concurrences for each task:

var installer = new ParallelGameInstaller(
    maxChecker: 4,
    maxDownloader: 8,
    boundedCapacity: 2048, // download queue size
    new HttpClient());

Last updated