Class ModLoadingLocation
- Namespace
- MonkeyLoader.Meta
- Assembly
- MonkeyLoader.dll
Specifies where and how to search for mods.
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public sealed class ModLoadingLocation : IDisposable
- Inheritance
-
ModLoadingLocation
- Implements
- Inherited Members
Constructors
ModLoadingLocation(string, bool, bool, IEnumerable<string>)
Creates a new ModLoadingLocation with the given specification.
public ModLoadingLocation(string path, bool recursive, bool supportHotReload, IEnumerable<string> ignorePatterns)
Parameters
pathstringThe root folder to search.
recursiveboolWhether to search nested folders too.
supportHotReloadboolWhether a FileSystemWatcher gets created to detect changed mods and hot reload them.
ignorePatternsIEnumerable<string>Regular expression patterns that exclude a mod from being loaded if any match.
Patterns are matched case-insensitive.
ModLoadingLocation(string, bool, bool, params string[])
Creates a new ModLoadingLocation with the given specification.
[JsonConstructor]
public ModLoadingLocation(string path, bool recursive, bool supportHotReload, params string[] ignorePatterns)
Parameters
pathstringThe root folder to search.
recursiveboolWhether to search nested folders too.
supportHotReloadboolWhether a FileSystemWatcher gets created to detect changed mods and hot reload them.
ignorePatternsstring[]Regular expression patterns that exclude a mod from being loaded if any match.
Patterns are matched case-insensitive.
Properties
IgnorePatterns
Gets the regex patterns that exclude a mod from being loaded if any match.
Patterns are matched case-insensitive.
public IEnumerable<Regex> IgnorePatterns { get; set; }
Property Value
IgnorePatternsStrings
Gets the regex patterns that exclude a mod from being loaded if any match as strings.
Patterns are matched case-insensitive.
[JsonProperty("IgnorePatterns")]
public IEnumerable<string> IgnorePatternsStrings { get; set; }
Property Value
Path
Gets the root folder to search.
[JsonProperty("Path")]
public string Path { get; }
Property Value
Recursive
Gets whether nested folders get searched too.
[JsonProperty("Recursive")]
public bool Recursive { get; }
Property Value
SupportHotReload
Gets whether a FileSystemWatcher gets created to detect changed mods and hot reload them.
[JsonProperty("SupportHotReload")]
public bool SupportHotReload { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
PassesIgnorePatterns(string)
Checks that none of the IgnorePatterns match the given path.
public bool PassesIgnorePatterns(string path)
Parameters
pathstringThe path to check against the IgnorePatterns.
Returns
- bool
truewhen none match,falseotherwise.
Search()
Conducts a search based on the specifications of this loading location.
public IEnumerable<string> Search()
Returns
- IEnumerable<string>
The full names (including paths) of all files that satisfy the specifications.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Events
LoadMod
Called when a mod should be loaded because its got added or changed.
public event HotReloadModEventHandler? LoadMod
Event Type
UnloadMod
Called when a mod should be unloaded because its file got deleted or changed.
public event HotReloadModEventHandler? UnloadMod