Table of Contents

Class ModFileManifestModel

Namespace
LlamaLogic.Packages.Models.ModFileManifest
Assembly
LlamaLogic.Packages.dll

Represents a mod file manifest SnippetTuning resource (🔓)

public sealed class ModFileManifestModel : Model, IModel<ModFileManifestModel>, IModel, IXmlSerializable
Inheritance
ModFileManifestModel
Implements
Inherited Members

Remarks

This model allows callers to easily create, read, and update a mod file manifest. These manifests are a format sponsored by the Llama Logic team to permit creators to specify the dependency requirements of their mods.

Use in Mod Package (.package) files

When originally creating packages, place one and only one mod file manifest SnippetTuning resource in the package and use sufficiently unique values for its FullInstance and TuningName. If an external application encounters multiple SnippetTuning manifest resources in a package, it must assume that a manifest un-aware tool has merged multiple manifested packages and process each manifest accordingly.

Avoid using Group 0x00000000 as this is informally reserved for Maxis. It would be a bizarre miracle if they started incorporating dependency information using a community format. Regardless, let's not make them feel unwelcome and hold their spot for them.

Use in Script Mod Archive (.ts4script) files

Because these files are just ZIP archives with a different extension and their contents are not flatly merged by the game as the contents of package files are, there is no risk of collision. Also, since they need not contend with game resource management, they need not be in an arcane format like XML, so they are in YAML instead. The static parsing methods of this type expect YAML representations of manifests and the ToString() method produces them. Name your mod file manifest resource llamalogic.modfilemanifest.yml and put it in the root of your .ts4script archive.

Properties

ContactEmail

Gets/sets the email address which can be used to contact this mod's creator

[YamlMember(Order = 6, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public string? ContactEmail { get; set; }

Property Value

string

ContactUrl

Gets/sets the URL which can be used to contact this mod's creator

[YamlMember(Order = 7, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public Uri? ContactUrl { get; set; }

Property Value

Uri

Creators

Gets the names of the creators of the mod

[YamlMember(Order = 3, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<string> Creators { get; }

Property Value

Collection<string>

Description

Gets/sets the description of the mod

[YamlMember(Order = 2, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public string? Description { get; set; }

Property Value

string

ElectronicArtsPromoCode

Gets/sets the promo code it is suggested the player use during check out in the EA Store if purchasing a pack for use with this mod

[YamlMember(Order = 18, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public string? ElectronicArtsPromoCode { get; set; }

Property Value

string

Exclusivities

Gets the globally unique names of the exclusivities of this mod, causing it to be incompatible with other mods which share one or more of them

[YamlMember(Order = 16, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<string> Exclusivities { get; }

Property Value

Collection<string>

Features

Gets the names of the features unique to this mod which it offers to other mods as a dependency

[YamlMember(Order = 15, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<string> Features { get; }

Property Value

Collection<string>

Hash

Gets/sets the hash of the mod file

[YamlMember(Order = 12, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public ImmutableArray<byte> Hash { get; set; }

Property Value

ImmutableArray<byte>

HashResourceKeys

Gets the resource keys for the resources included in the Hash

[YamlMember(Order = 13, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public HashSet<ResourceKey> HashResourceKeys { get; }

Property Value

HashSet<ResourceKey>

IncompatiblePacks

Gets the list of pack codes identifying the packs incompatible with this mod (e.g. "EP01" for Get to Work)

[YamlMember(Order = 19, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<string> IncompatiblePacks { get; }

Property Value

Collection<string>

MessageToTranslators

Gets/sets the message to translators by this mod's creator

[YamlMember(Order = 9, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public string? MessageToTranslators { get; set; }

Property Value

string

Name

Gets/sets the name of the mod

[YamlMember(Order = 1, DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)]
public required string Name { get; set; }

Property Value

string

RepurposedLanguages

Gets the list of languages repurposed by this mod

[YamlMember(Order = 11, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<ModFileManifestModelRepurposedLanguage> RepurposedLanguages { get; }

Property Value

Collection<ModFileManifestModelRepurposedLanguage>

RequiredMods

Gets the list of mods required by this mod

[YamlMember(Order = 20, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<ModFileManifestModelRequiredMod> RequiredMods { get; }

Property Value

Collection<ModFileManifestModelRequiredMod>

RequiredPacks

Gets the list of pack codes identifying the packs required by this mod (e.g. "EP01" for Get to Work)

[YamlMember(Order = 17, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<string> RequiredPacks { get; }

Property Value

Collection<string>

ResourceName

Gets the name of this resource if it has one

[YamlIgnore]
public override string? ResourceName { get; }

Property Value

string

SubsumedHashes

Gets the hashes of previous versions of this mod in for which I stand even though my hash is different

[YamlMember(Order = 14, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public HashSet<ImmutableArray<byte>> SubsumedHashes { get; }

Property Value

HashSet<ImmutableArray<byte>>

SupportedTypes

Gets a list of resource types that this model supports

public static ISet<ResourceType> SupportedTypes { get; }

Property Value

ISet<ResourceType>

TranslationSubmissionUrl

Gets/sets the URL at which translators may submit translations to this mod's creator

[YamlMember(Order = 10, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public Uri? TranslationSubmissionUrl { get; set; }

Property Value

Uri

Translators

Gets the list of translators who have contributed translations to this mod

[YamlMember(Order = 8, DefaultValuesHandling = DefaultValuesHandling.OmitEmptyCollections)]
public Collection<ModFileManifestModelTranslator> Translators { get; }

Property Value

Collection<ModFileManifestModelTranslator>

TuningFullInstance

Gets the SnippetTuning decimal conversion of the FullInstance for the mod file manifest

[YamlMember(Order = -2, DefaultValuesHandling = DefaultValuesHandling.OmitDefaults)]
public ulong TuningFullInstance { get; set; }

Property Value

ulong

TuningName

Gets the SnippetTuning name for the mod file manifest

[YamlMember(Order = -1, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public string? TuningName { get; set; }

Property Value

string

Url

Gets/sets the URL to which players can go to find more information about this mod

[YamlMember(Order = 5, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public Uri? Url { get; set; }

Property Value

Uri

Version

Gets/sets the version of this mod

[YamlMember(Order = 4, DefaultValuesHandling = DefaultValuesHandling.OmitNull)]
public string? Version { get; set; }

Property Value

string

Methods

Decode(ReadOnlyMemory<byte>)

Decodes the resource in raw format to produce an operable model (🔄️🏃)

public static ModFileManifestModel Decode(ReadOnlyMemory<byte> data)

Parameters

data ReadOnlyMemory<byte>

Returns

ModFileManifestModel

DeleteModFileManifest(ZipArchive)

Deletes all mod file manifest resources in the specified scriptMod

[Obsolete("This method will be removed in a future version. Call DeleteModFileManifests instead.")]
public static void DeleteModFileManifest(ZipArchive scriptMod)

Parameters

scriptMod ZipArchive

DeleteModFileManifests(DataBasePackedFile)

Deletes all mod file manifest resources in the specified package

public static void DeleteModFileManifests(DataBasePackedFile package)

Parameters

package DataBasePackedFile

DeleteModFileManifests(ZipArchive)

Deletes all mod file manifest resources in the specified scriptMod

public static void DeleteModFileManifests(ZipArchive scriptMod)

Parameters

scriptMod ZipArchive

DeleteModFileManifestsAsync(DataBasePackedFile)

Deletes all mod file manifest resources in the specified package, asynchronously

public static Task DeleteModFileManifestsAsync(DataBasePackedFile package)

Parameters

package DataBasePackedFile

Returns

Task

Encode()

Encodes the resource model into raw format (🔄️🏃)

public override ReadOnlyMemory<byte> Encode()

Returns

ReadOnlyMemory<byte>

GetFileSha256Hash(string)

Gets the SHA 256 hash of the content of the file located at filePath

public static ImmutableArray<byte> GetFileSha256Hash(string filePath)

Parameters

filePath string

Returns

ImmutableArray<byte>

GetFileSha256HashAsync(string, CancellationToken)

Gets the SHA 256 hash of the content of the file located at filePath asynchronously

public static Task<ImmutableArray<byte>> GetFileSha256HashAsync(string filePath, CancellationToken cancellationToken = default)

Parameters

filePath string
cancellationToken CancellationToken

Returns

Task<ImmutableArray<byte>>

GetModFileHash(DataBasePackedFile, HashSet<ResourceKey>)

Gets the hash for the specified package using the specified hashResourceKeys

public static ImmutableArray<byte> GetModFileHash(DataBasePackedFile package, HashSet<ResourceKey> hashResourceKeys)

Parameters

package DataBasePackedFile
hashResourceKeys HashSet<ResourceKey>

Returns

ImmutableArray<byte>

GetModFileHash(ZipArchive)

Gets the hash for the specified scriptMod

public static ImmutableArray<byte> GetModFileHash(ZipArchive scriptMod)

Parameters

scriptMod ZipArchive

Returns

ImmutableArray<byte>

GetModFileHashAsync(DataBasePackedFile, HashSet<ResourceKey>, CancellationToken)

Gets the hash for the specified package using the specified hashResourceKeys, asynchronously

public static Task<ImmutableArray<byte>> GetModFileHashAsync(DataBasePackedFile package, HashSet<ResourceKey> hashResourceKeys, CancellationToken cancellationToken = default)

Parameters

package DataBasePackedFile
hashResourceKeys HashSet<ResourceKey>
cancellationToken CancellationToken

Returns

Task<ImmutableArray<byte>>

GetModFileManifest(DataBasePackedFile)

Gets the mod file manifest for the specified package, if it has one

public static ModFileManifestModel? GetModFileManifest(DataBasePackedFile package)

Parameters

package DataBasePackedFile

Returns

ModFileManifestModel

GetModFileManifest(ZipArchive)

Gets the mod file manifest for the specified scriptMod, if it has one

public static ModFileManifestModel? GetModFileManifest(ZipArchive scriptMod)

Parameters

scriptMod ZipArchive

Returns

ModFileManifestModel

GetModFileManifestAndKey(DataBasePackedFile)

Gets the mod file manifest for the specified package and its ResourceKey, if the package has one

public static (ResourceKey, ModFileManifestModel?) GetModFileManifestAndKey(DataBasePackedFile package)

Parameters

package DataBasePackedFile

Returns

(ResourceKey, ModFileManifestModel)

GetModFileManifestAndKeyAsync(DataBasePackedFile)

Gets the mod file manifest for the specified package, asynchronously, if the package has one

public static Task<(ResourceKey, ModFileManifestModel?)> GetModFileManifestAndKeyAsync(DataBasePackedFile package)

Parameters

package DataBasePackedFile

Returns

Task<(ResourceKey, ModFileManifestModel)>

GetModFileManifestAsync(DataBasePackedFile)

Gets the mod file manifest for the specified package, asynchronously, if it has one

public static Task<ModFileManifestModel?> GetModFileManifestAsync(DataBasePackedFile package)

Parameters

package DataBasePackedFile

Returns

Task<ModFileManifestModel>

GetModFileManifestAsync(ZipArchive)

Gets the mod file manifest for the specified scriptMod, asynchronously, if it has one

public static Task<ModFileManifestModel?> GetModFileManifestAsync(ZipArchive scriptMod)

Parameters

scriptMod ZipArchive

Returns

Task<ModFileManifestModel>

GetModFileManifests(DataBasePackedFile)

Gets the mod file manifests for the specified package (for use by editors checking for packages which may have been merged by manifest unaware tooling)

public static IReadOnlyDictionary<ResourceKey, ModFileManifestModel> GetModFileManifests(DataBasePackedFile package)

Parameters

package DataBasePackedFile

Returns

IReadOnlyDictionary<ResourceKey, ModFileManifestModel>

GetModFileManifestsAsync(DataBasePackedFile)

Gets the mod file manifests for the specified package, asynchronously (for use by editors checking for packages which may have been merged by manifest unaware tooling)

public static Task<IReadOnlyDictionary<ResourceKey, ModFileManifestModel>> GetModFileManifestsAsync(DataBasePackedFile package)

Parameters

package DataBasePackedFile

Returns

Task<IReadOnlyDictionary<ResourceKey, ModFileManifestModel>>

GetName(Stream)

Gets the name of a resource from its raw data, if it has one (🔄️💤)

public static string? GetName(Stream stream)

Parameters

stream Stream

Returns

string

GetNameAsync(Stream, CancellationToken)

Gets the name of a resource from its raw data, if it has one, asynchronously (🔄️💤)

public static Task<string?> GetNameAsync(Stream stream, CancellationToken cancellationToken = default)

Parameters

stream Stream
cancellationToken CancellationToken

Returns

Task<string>

Parse(string)

Parses a string into a ModFileManifestModel

public static ModFileManifestModel Parse(string s)

Parameters

s string

The string to parse

Returns

ModFileManifestModel

Exceptions

FormatException

s is not in the correct format

Parse(string, IFormatProvider?)

Parses a string into a ModFileManifestModel

public static ModFileManifestModel Parse(string s, IFormatProvider? provider)

Parameters

s string

The string to parse

provider IFormatProvider

An object that provides culture-specific formatting information about s

Returns

ModFileManifestModel

Exceptions

FormatException

s is not in the correct format

SetModFileManifest(DataBasePackedFile, ModFileManifestModel)

Set the specified manifest for the specified package

public static void SetModFileManifest(DataBasePackedFile package, ModFileManifestModel manifest)

Parameters

package DataBasePackedFile
manifest ModFileManifestModel

SetModFileManifest(ZipArchive, ModFileManifestModel)

Set the specified manifest for the specified scriptMod

public static void SetModFileManifest(ZipArchive scriptMod, ModFileManifestModel manifest)

Parameters

scriptMod ZipArchive
manifest ModFileManifestModel

SetModFileManifestAsync(DataBasePackedFile, ModFileManifestModel)

Set the specified manifest for the specified package, asynchronously

public static Task SetModFileManifestAsync(DataBasePackedFile package, ModFileManifestModel manifest)

Parameters

package DataBasePackedFile
manifest ModFileManifestModel

Returns

Task

SetModFileManifestAsync(ZipArchive, ModFileManifestModel)

Set the specified manifest for the specified scriptMod, asynchronously

public static Task SetModFileManifestAsync(ZipArchive scriptMod, ModFileManifestModel manifest)

Parameters

scriptMod ZipArchive
manifest ModFileManifestModel

Returns

Task

ToString()

Generates the YAML representation of the ModFileManifestModel

public override string ToString()

Returns

string

TryParse(string?, out ModFileManifestModel)

Tries to parse a string into a ModFileManifestModel

public static bool TryParse(string? s, out ModFileManifestModel result)

Parameters

s string

The string to parse

result ModFileManifestModel

When this method returns, contains the result of successfully parsing s or an undefined value on failure

Returns

bool

TryParse(string?, IFormatProvider?, out ModFileManifestModel)

Tries to parse a string into a ResourceKey

public static bool TryParse(string? s, IFormatProvider? provider, out ModFileManifestModel result)

Parameters

s string

The string to parse

provider IFormatProvider

An object that provides culture-specific formatting information about s

result ModFileManifestModel

When this method returns, contains the result of successfully parsing s or an undefined value on failure

Returns

bool