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
Overrides
Gets the package's overrides of game tuning
public IReadOnlyList<TuningPackageOverride> Overrides { get; }
Property Value
PackagePath
Gets the path of the package
public string PackagePath { get; }
Property Value
Target
Gets the snapshot of the game version the package is being updated for
public TuningArchiveSnapshot Target { get; }
Property Value
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
archiveTuningArchiveFileThe archive with the game versions
targetTuningArchiveSnapshotThe game version to update the package for
packagePathstringThe path of the package
simDataTuningSimDataDrafterA drafter for the
targetsnapshot, to check the package's SimData against what its overrides need, or null not todeclaredBaseTuningArchiveSnapshotThe 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
progressIProgress<TuningArchiveProgress>Receives progress
cancellationTokenCancellationTokenThe token to monitor for cancellation requests
Returns
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
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
pathstringWhere to write the updated package, which must not be the package's own path
tuningIReadOnlyDictionary<ResourceKey, string>The tuning to write in place of overrides, by key, such as from GetRecommendedTuning()
simDataChangesTuningPackageSimDataChangesWhich changes to make to the SimData, to make it what each override's tuning needs
commenterTuningCommenterComments the tuning written in place of overrides, if specified
cancellationTokenCancellationTokenThe token to monitor for cancellation requests
Returns
- Task<IReadOnlyList<TuningPackageUpdateChange>>
What was changed