Class ModLoadingLocation
- Namespace
- MonkeyLoader.Meta
- Assembly
- MonkeyLoader.dll
Specifies where and how to search for mods.
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public sealed class ModLoadingLocation
- Inheritance
-
ModLoadingLocation
- 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
path
stringThe root folder to search.
recursive
boolWhether to search nested folders too.
supportHotReload
boolWhether a FileSystemWatcher gets created to detect changed mods and hot reload them.
ignorePatterns
IEnumerable<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
path
stringThe root folder to search.
recursive
boolWhether to search nested folders too.
supportHotReload
boolWhether a FileSystemWatcher gets created to detect changed mods and hot reload them.
ignorePatterns
string[]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
PassesIgnorePatterns(string)
Checks that none of the IgnorePatterns match the given path
.
public bool PassesIgnorePatterns(string path)
Parameters
path
stringThe path to check against the IgnorePatterns.
Returns
- bool
true
when none match,false
otherwise.
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()
public override string ToString()
Returns
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