Class TuningDescriptionSet
- Namespace
- LlamaLogic.TuningDescriptions
- Assembly
- LlamaLogic.TuningDescriptions.dll
Represents a set of tuning descriptions for a version of The Sims 4, as Maxis distributes it (🔒)
public sealed class TuningDescriptionSet : IDisposable
- Inheritance
-
TuningDescriptionSet
- Implements
- Inherited Members
Remarks
A set is indexed by the paths of its documents when it is opened: instances are */Descriptions/{class}.tdesc, modules are Tuning/{module with . replaced by -}.tdesc, and fragments are TdescFrag/{class}.tdescfrag.
A document is read the first time it is requested, and it may be read again once nothing refers to it any longer, so requesting a document twice does not necessarily return the same object.
A set's members are safe to use from multiple threads.
Properties
FragmentClasses
Gets the names of the classes of the set's fragments
public IReadOnlyCollection<string> FragmentClasses { get; }
Property Value
GameVersion
Gets the version of the game the set describes, if it was opened from a file named as Maxis names them
public Version? GameVersion { get; }
Property Value
InstanceClasses
Gets the names of the classes of the set's instances
public IReadOnlyCollection<string> InstanceClasses { get; }
Property Value
InstanceTypes
Gets the types of instance tuning the set's instances are (their instance_type attributes), such as buff
public IReadOnlyCollection<string> InstanceTypes { get; }
Property Value
Remarks
The types are read from the beginning of each instance's document, which is much faster than reading every instance.
Exceptions
- InvalidDataException
An instance's document is malformed
ModuleNames
Gets the names of the set's modules
public IReadOnlyCollection<string> ModuleNames { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FromDirectory(string)
Opens the set of tuning descriptions extracted to the directory at the specified path (🗑️)
public static TuningDescriptionSet FromDirectory(string path)
Parameters
pathstring
Returns
Exceptions
- DirectoryNotFoundException
There is no directory at
path
FromZip(Stream)
Opens the ZIP archive of tuning descriptions in the specified stream, which must remain open and seekable until the set is disposed (🗑️)
public static TuningDescriptionSet FromZip(Stream stream)
Parameters
streamStream
Returns
FromZip(string)
Opens the ZIP archive of tuning descriptions at the specified path (🗑️)
public static TuningDescriptionSet FromZip(string path)
Parameters
pathstring
Returns
Remarks
When the name of the file is that of a Maxis distribution (such as 1.128.90.1030-TDESC.zip), GameVersion is the version it names.
GetEnum(string)
Gets the enumeration to which an StaticEntries attribute refers, such as sims-sim_info_types.Age, or null if the set does not describe it
public TuningDescriptionClass? GetEnum(string staticEntries)
Parameters
staticEntriesstring
Returns
Exceptions
- InvalidDataException
The module that would describe the enumeration is malformed
GetFragment(string)
Gets the fragment with the specified className, or null if the set does not have it
public TuningDescriptionFragment? GetFragment(string className)
Parameters
classNamestring
Returns
Exceptions
- InvalidDataException
The fragment's document is malformed or describes a different fragment
GetInstance(string)
Gets the instance with the specified className, or null if the set does not have it
public TuningDescriptionInstance? GetInstance(string className)
Parameters
classNamestring
Returns
Exceptions
- InvalidDataException
The instance's document is malformed or describes a different class
GetModule(string)
Gets the module with the specified name, such as sims.sim_info_types, or null if the set does not have it
public TuningDescriptionModule? GetModule(string name)
Parameters
namestring
Returns
Exceptions
- InvalidDataException
The module's document is malformed or describes a different module
Resolve(TunableDescription)
Gets the description the specified description stands for: the description of the fragment it refers to if it is a FragmentReferenceTunableDescription, and otherwise itself
public TunableDescription Resolve(TunableDescription description)
Parameters
descriptionTunableDescription
Returns
Exceptions
- InvalidDataException
The set does not have the fragment to which
descriptionrefers