C# Class Nexus.Client.ModManagement.Scripting.ScriptTypeRegistry

A registry of all supported mod script types.
Inheritance: IScriptTypeRegistry
Show file Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Public Methods

Method Description
DiscoverScriptTypes ( string p_strSearchPath, IGameMode p_gmdGameMode ) : IScriptTypeRegistry

Searches for script type assemblies in the specified path, and loads any script types that are found into a registry.

A script type is loaded if the class implements IScriptType and is not abstract. Once loaded, the type is added to the registry.

GetType ( string p_strScriptTypeId ) : IScriptType

Gets the specified IScriptType.

RegisterType ( IScriptType p_stpType ) : void

Registers the given IScriptType.

ScriptTypeRegistry ( ) : System

The default constructor.

Private Methods

Method Description
CurrentDomain_AssemblyResolve ( object sender, ResolveEventArgs args ) : Assembly

Handles the AppDomain.AssemblyResolve event.

Assemblies that have been load dynamically aren't accessible by assembly name. So, when, for example, Fallout3.XmlScript.dll looks for the XmlScript.dll assembly on which it is dependent, it looks for "XmlScript" (the name of the assembly), but can't find it. This handler searches through loaded assemblies and finds the required assembly.

RegisterScriptTypes ( IScriptTypeRegistry p_stgScriptTypeRegistry, IEnumerable p_enmAssemblies ) : void

Searches the given list of assemblies for script types, and registers any that are found.

Method Details

DiscoverScriptTypes() public static method

Searches for script type assemblies in the specified path, and loads any script types that are found into a registry.
A script type is loaded if the class implements IScriptType and is not abstract. Once loaded, the type is added to the registry.
public static DiscoverScriptTypes ( string p_strSearchPath, IGameMode p_gmdGameMode ) : IScriptTypeRegistry
p_strSearchPath string The path in which to search for script type assemblies.
p_gmdGameMode IGameMode The current game mode.
return IScriptTypeRegistry

GetType() public method

Gets the specified IScriptType.
public GetType ( string p_strScriptTypeId ) : IScriptType
p_strScriptTypeId string The id of the to retrieve.
return IScriptType

RegisterType() public method

Registers the given IScriptType.
public RegisterType ( IScriptType p_stpType ) : void
p_stpType IScriptType A to register.
return void

ScriptTypeRegistry() public method

The default constructor.
public ScriptTypeRegistry ( ) : System
return System