Table of Contents

Class ModpackExporter

Namespace
McServerLauncher.ViewModels
Assembly
McServerLauncher.dll

Builds the zip a server's owner hands to their players: the mods the players' game needs, the instructions for installing them, and the scripts that do it.

public sealed class ModpackExporter
Inheritance
ModpackExporter
Inherited Members

Remarks

It takes a path rather than opening a picker, which is the point: the decision about what goes in is the part worth testing, and it was unreachable without a main window while it lived in the Mods tab's view model. The tab keeps the file picker and the notice that follows; this class keeps everything between "here is where to write it" and "here is what it contained".

Which jars a player needs is decided by ExportSelection from what each jar declares about itself and, when it can be asked in time, what the store says about each side of the game.

Constructors

ModpackExporter(ServerConfig, InstalledContentIndex, ModrinthService, Func<string>)

public ModpackExporter(ServerConfig config, InstalledContentIndex index, ModrinthService store, Func<string> howToPlay)

Parameters

config ServerConfig

The server whose content is packed.

index InstalledContentIndex

Shared with the update scan and the installs: hashing a jar is the expensive part, and what the store said a jar is is the same answer for all of them.

store ModrinthService

Asked for each project's client and server support.

howToPlay Func<string>

The instructions for joining, depending on the server's type.

Methods

BuildAsync(string, bool, CancellationToken)

Builds the pack at destination, replacing whatever was there.

public Task<ModpackResult> BuildAsync(string destination, bool includeEverything, CancellationToken ct)

Parameters

destination string

Where to write the zip.

includeEverything bool

Skip the reasoning and pack the folder as it stands.

ct CancellationToken

Cancels the build.

Returns

Task<ModpackResult>

NoticeFor(ModpackResult)

The sentence the notice shows for one finished export.

public static string NoticeFor(ModpackResult result)

Parameters

result ModpackResult

Returns

string