Table of Contents

Class MinecraftVersionService

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Gets the list of Minecraft versions from Mojang's official manifest and downloads the server.jar of the chosen version.

public class MinecraftVersionService
Inheritance
MinecraftVersionService
Inherited Members

Methods

DownloadFileAsync(string, string, IProgress<string>?, string?, CancellationToken)

Downloads a file to disk. If expectedSha1 is given (Mojang returns one for every server.jar), the download is verified against it; a mismatch deletes the file and throws.

public Task DownloadFileAsync(string url, string destPath, IProgress<string>? log, string? expectedSha1 = null, CancellationToken ct = default)

Parameters

url string
destPath string
log IProgress<string>
expectedSha1 string
ct CancellationToken

Returns

Task

GetServerJarUrlAsync(MinecraftVersion, CancellationToken)

Resolves the server.jar URL for a specific version.

public Task<string> GetServerJarUrlAsync(MinecraftVersion version, CancellationToken ct = default)

Parameters

version MinecraftVersion
ct CancellationToken

Returns

Task<string>

GetVersionDetailsAsync(MinecraftVersion, CancellationToken)

Resolves the server download and the Java version that version needs.

public Task<MinecraftVersionService.VersionDetails> GetVersionDetailsAsync(MinecraftVersion version, CancellationToken ct = default)

Parameters

version MinecraftVersion
ct CancellationToken

Returns

Task<MinecraftVersionService.VersionDetails>

GetVersionsAsync(CancellationToken)

Downloads the manifest and returns (latest release version, list of versions).

public Task<(string LatestRelease, List<MinecraftVersion> Versions)> GetVersionsAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<(string LatestRelease, List<MinecraftVersion> Versions)>