Table of Contents

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 string

The root folder to search.

recursive bool

Whether to search nested folders too.

supportHotReload bool

Whether 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 string

The root folder to search.

recursive bool

Whether to search nested folders too.

supportHotReload bool

Whether 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

IEnumerable<Regex>

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

IEnumerable<string>

Path

Gets the root folder to search.

[JsonProperty("Path")]
public string Path { get; }

Property Value

string

Recursive

Gets whether nested folders get searched too.

[JsonProperty("Recursive")]
public bool Recursive { get; }

Property Value

bool

SupportHotReload

Gets whether a FileSystemWatcher gets created to detect changed mods and hot reload them.

[JsonProperty("SupportHotReload")]
public bool SupportHotReload { get; }

Property Value

bool

Methods

PassesIgnorePatterns(string)

Checks that none of the IgnorePatterns match the given path.

public bool PassesIgnorePatterns(string path)

Parameters

path string

The path to check against the IgnorePatterns.

Returns

bool

true when none match, false otherwise.

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

string

Events

LoadMod

Called when a mod should be loaded because its got added or changed.

public event HotReloadModEventHandler? LoadMod

Event Type

HotReloadModEventHandler

UnloadMod

Called when a mod should be unloaded because its file got deleted or changed.

public event HotReloadModEventHandler? UnloadMod

Event Type

HotReloadModEventHandler