Class ModInfo
A mod info is a set of properties that every Mod instance is assigned
public class ModInfo : IDisposable
- Inheritance
-
ModInfo
- Implements
- Inherited Members
- Extension Methods
Fields
Content
A MLEM.Data.Content.RawContentManager that this mod can use to load its content. This content manager's base directory automatically points to the mod's Content folder.
public readonly RawContentManager Content
Field Value
- RawContentManager
Harmony
The Harmony instance that this mod can use, whose PatchAll(Assembly) method is called automatically after this mod is loaded. This value is only set if RequiresHarmony was true when the Mod was loaded.
public readonly Harmony Harmony
Field Value
Id
The id of the mod, which is based on the Mod's class name
public readonly string Id
Field Value
Logger
The Logger that this mod can use to log information about itself. By default, this logger has the same sinks as the game's logger.
public readonly Logger Logger
Field Value
- Logger
Mod
The actual mod instance
public readonly Mod Mod
Field Value
OptionsFile
The options file for this mod. This is used in LoadOptions<T>(Func<T>) and SaveOptions<T>(T).
public readonly FileInfo OptionsFile
Field Value
Properties
Errored
Whether this mod errored in some way while loading. If this is true, features usually expected from this mod may not have been loaded properly, or may not work correctly.
public bool Errored { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
LoadOptions<T>(Func<T>)
Loads options of the given type from this mod's OptionsFile. To load custom options, you can create a custom class, each of whose members will be loaded by this method. This method uses a CreateSerializer(SerializerContext, EventHandler<ErrorEventArgs>, bool) JSON serializer, so using DataContractAttribute and DataMemberAttribute attributes is supported.
public T LoadOptions<T>(Func<T> createDefaultInstance)
Parameters
createDefaultInstance
Func<T>
Returns
- T
Type Parameters
T
SaveOptions<T>(T)
Saves the given options into this mod's OptionsFile. To save custom options, you can create a custom class, each of whose members will be saved by this method. This method uses a CreateSerializer(SerializerContext, EventHandler<ErrorEventArgs>, bool) JSON serializer, so using DataContractAttribute and DataMemberAttribute attributes is supported.
public void SaveOptions<T>(T options)
Parameters
options
TThe options to save.
Type Parameters
T
The type of the options to save.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.