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
configServerConfigThe server whose content is packed.
indexInstalledContentIndexShared 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.
storeModrinthServiceAsked for each project's client and server support.
howToPlayFunc<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
destinationstringWhere to write the zip.
includeEverythingboolSkip the reasoning and pack the folder as it stands.
ctCancellationTokenCancels the build.
Returns
NoticeFor(ModpackResult)
The sentence the notice shows for one finished export.
public static string NoticeFor(ModpackResult result)
Parameters
resultModpackResult