Table of Contents

Class TuningPackageUpdate

Namespace
LlamaLogic.TuningArchive
Assembly
LlamaLogic.TuningArchive.dll

Finds a mod package's overrides of game tuning, works out what a game version means for each, and writes an updated copy of the package

public sealed class TuningPackageUpdate
Inheritance
TuningPackageUpdate
Inherited Members

Remarks

For each override, the base (the game version the mod was most likely made from) is the archive snapshot, up to the target, whose version of the tuning has the fewest differences from the override. When versions with different content are as close, the base is the oldest of them, because they tie when the mod changed what the game later changed, and the older base shows that as a conflict rather than taking the mod's version as up to date. If the game changed the tuning between the base and the target, the mod's changes are merged onto the target's version (see TuningMerge).

The package is never changed: WriteAsync(string, IReadOnlyDictionary<ResourceKey, string?>, TuningPackageSimDataChanges, TuningCommenter?, CancellationToken) writes a new one, copying every resource it is not told to change.

Properties

ChecksSimData

Gets whether the package's SimData was checked against what its overrides need, and can be made what they need when the updated package is written

public bool ChecksSimData { get; }

Property Value

bool

Overrides

Gets the package's overrides of game tuning

public IReadOnlyList<TuningPackageOverride> Overrides { get; }

Property Value

IReadOnlyList<TuningPackageOverride>

PackagePath

Gets the path of the package

public string PackagePath { get; }

Property Value

string

Target

Gets the snapshot of the game version the package is being updated for

public TuningArchiveSnapshot Target { get; }

Property Value

TuningArchiveSnapshot

Methods

AnalyzeAsync(TuningArchiveFile, TuningArchiveSnapshot, string, TuningSimDataDrafter?, TuningArchiveSnapshot?, IProgress<TuningArchiveProgress>?, CancellationToken)

Finds the overrides of game tuning in the package at the specified packagePath and works out what the target game version in the specified archive means for each (🏃)

public static Task<TuningPackageUpdate> AnalyzeAsync(TuningArchiveFile archive, TuningArchiveSnapshot target, string packagePath, TuningSimDataDrafter? simData = null, TuningArchiveSnapshot? declaredBase = null, IProgress<TuningArchiveProgress>? progress = null, CancellationToken cancellationToken = default)

Parameters

archive TuningArchiveFile

The archive with the game versions

target TuningArchiveSnapshot

The game version to update the package for

packagePath string

The path of the package

simData TuningSimDataDrafter

A drafter for the target snapshot, to check the package's SimData against what its overrides need, or null not to

declaredBase TuningArchiveSnapshot

The game version the creator says the package was last updated for, to use as the base instead of inferring it (for each tuning that version has), or null to infer it

progress IProgress<TuningArchiveProgress>

Receives progress

cancellationToken CancellationToken

The token to monitor for cancellation requests

Returns

Task<TuningPackageUpdate>

GetRecommendedTuning()

Gets the tuning the update recommends writing: the merge, for each override whose changes merge onto the game's new version without conflicts

public IReadOnlyDictionary<ResourceKey, string?> GetRecommendedTuning()

Returns

IReadOnlyDictionary<ResourceKey, string>

Remarks

Nothing else is recommended, because only the creator knows whether an override that undoes the game's changes, or does nothing, is meant to.

WriteAsync(string, IReadOnlyDictionary<ResourceKey, string?>, TuningPackageSimDataChanges, TuningCommenter?, CancellationToken)

Writes a copy of the package to the specified path with the specified tuning in place of the overrides it has keys for (null to remove an override), and, if the update has a SimData drafter, the specified simDataChanges made to each override's SimData (🏃)

public Task<IReadOnlyList<TuningPackageUpdateChange>> WriteAsync(string path, IReadOnlyDictionary<ResourceKey, string?> tuning, TuningPackageSimDataChanges simDataChanges = TuningPackageSimDataChanges.All, TuningCommenter? commenter = null, CancellationToken cancellationToken = default)

Parameters

path string

Where to write the updated package, which must not be the package's own path

tuning IReadOnlyDictionary<ResourceKey, string>

The tuning to write in place of overrides, by key, such as from GetRecommendedTuning()

simDataChanges TuningPackageSimDataChanges

Which changes to make to the SimData, to make it what each override's tuning needs

commenter TuningCommenter

Comments the tuning written in place of overrides, if specified

cancellationToken CancellationToken

The token to monitor for cancellation requests

Returns

Task<IReadOnlyList<TuningPackageUpdateChange>>

What was changed