Client LuaCsForBarotrauma
CsPackageManager Class Reference
Inheritance diagram for CsPackageManager:

Public Member Functions

bool LuaTryRegisterPackageTypes (string name, bool caseSensitive=false)
 Searches for all types in all loaded assemblies from content packages who's names contain the name string and registers them with the Lua Interpreter. More...
 
IEnumerable< ContentPackage > GetCurrentPackagesByLoadOrder ()
 
bool TryGetPackageForPlugin< T > (out ContentPackage package)
 Tries to find the content package that a given plugin belongs to. More...
 
bool TryGetLoadedPluginsForPackage (ContentPackage package, out IEnumerable< IAssemblyPlugin > loadedPlugins)
 Tries to get the loaded plugins for a given package. More...
 
void Dispose ()
 
AssemblyLoadingSuccessState LoadAssemblyPackages ()
 Begins the loading process of scanning packages for scripts and binary assemblies, compiling and executing them. More...
 
void RunPluginsInit ()
 Executes instantiated plugins' Initialize() and OnLoadCompleted() methods. More...
 
void RunPluginsPreInit ()
 Executes instantiated plugins' PreInitPatching() method. More...
 
void InstantiatePlugins (bool force=false)
 Initializes plugin types that are registered. More...
 
void UnloadPlugins ()
 

Static Public Member Functions

static bool GetOrCreateRunConfig (ContentPackage package, out RunConfig config)
 Gets the RunConfig.xml for the given package located at [cp_root]/CSharp/RunConfig.xml. Generates a default config if one is not found. More...
 

Properties

bool AssembliesLoaded [get]
 Whether or not assemblies have been loaded. More...
 
bool PluginsPreInit [get]
 Whether or not loaded plugins had their preloader run. More...
 
bool PluginsInitialized [get]
 Whether or not plugins' types have been instantiated. More...
 
bool PluginsLoaded [get]
 Whether or not plugins are fully loaded. More...
 

Events

Action OnDispose
 Called when clean up is being performed. Use when relying on or making use of references from this manager. More...
 

Detailed Description

Definition at line 20 of file CsPackageManager.cs.

Member Function Documentation

◆ Dispose()

void CsPackageManager.Dispose ( )

Definition at line 221 of file CsPackageManager.cs.

◆ GetCurrentPackagesByLoadOrder()

IEnumerable<ContentPackage> CsPackageManager.GetCurrentPackagesByLoadOrder ( )

◆ GetOrCreateRunConfig()

static bool CsPackageManager.GetOrCreateRunConfig ( ContentPackage  package,
out RunConfig  config 
)
static

Gets the RunConfig.xml for the given package located at [cp_root]/CSharp/RunConfig.xml. Generates a default config if one is not found.

Parameters
packageThe package to search for.
configRunConfig data.
Returns
True if a config is loaded, false if one was created.

Definition at line 810 of file CsPackageManager.cs.

◆ InstantiatePlugins()

void CsPackageManager.InstantiatePlugins ( bool  force = false)

Initializes plugin types that are registered.

Parameters
force

Definition at line 728 of file CsPackageManager.cs.

◆ LoadAssemblyPackages()

AssemblyLoadingSuccessState CsPackageManager.LoadAssemblyPackages ( )

Begins the loading process of scanning packages for scripts and binary assemblies, compiling and executing them.

Returns

Definition at line 300 of file CsPackageManager.cs.

◆ LuaTryRegisterPackageTypes()

bool CsPackageManager.LuaTryRegisterPackageTypes ( string  name,
bool  caseSensitive = false 
)

Searches for all types in all loaded assemblies from content packages who's names contain the name string and registers them with the Lua Interpreter.

Parameters
name
caseSensitive
Returns

Definition at line 117 of file CsPackageManager.cs.

◆ RunPluginsInit()

void CsPackageManager.RunPluginsInit ( )

Executes instantiated plugins' Initialize() and OnLoadCompleted() methods.

Definition at line 652 of file CsPackageManager.cs.

◆ RunPluginsPreInit()

void CsPackageManager.RunPluginsPreInit ( )

Executes instantiated plugins' PreInitPatching() method.

Definition at line 693 of file CsPackageManager.cs.

◆ TryGetLoadedPluginsForPackage()

bool CsPackageManager.TryGetLoadedPluginsForPackage ( ContentPackage  package,
out IEnumerable< IAssemblyPlugin loadedPlugins 
)

Tries to get the loaded plugins for a given package.

Parameters
packagePackage to find.
loadedPluginsThe collection of loaded plugins.
Returns

Definition at line 203 of file CsPackageManager.cs.

◆ TryGetPackageForPlugin< T >()

bool CsPackageManager.TryGetPackageForPlugin< T > ( out ContentPackage  package)

Tries to find the content package that a given plugin belongs to.

Parameters
packagePackage if found, null otherwise.
Template Parameters
TThe IAssemblyPlugin type to find.
Returns
Type Constraints
T :IAssemblyPlugin 

Definition at line 180 of file CsPackageManager.cs.

◆ UnloadPlugins()

void CsPackageManager.UnloadPlugins ( )

Unloads all plugins by calling Dispose() on them. Note: This does not remove their external references nor unregister their types.

Definition at line 784 of file CsPackageManager.cs.

Property Documentation

◆ AssembliesLoaded

bool CsPackageManager.AssembliesLoaded
get

Whether or not assemblies have been loaded.

Definition at line 154 of file CsPackageManager.cs.

◆ PluginsInitialized

bool CsPackageManager.PluginsInitialized
get

Whether or not plugins' types have been instantiated.

Definition at line 165 of file CsPackageManager.cs.

◆ PluginsLoaded

bool CsPackageManager.PluginsLoaded
get

Whether or not plugins are fully loaded.

Definition at line 170 of file CsPackageManager.cs.

◆ PluginsPreInit

bool CsPackageManager.PluginsPreInit
get

Whether or not loaded plugins had their preloader run.

Definition at line 160 of file CsPackageManager.cs.

Event Documentation

◆ OnDispose

Action CsPackageManager.OnDispose

Called when clean up is being performed. Use when relying on or making use of references from this manager.

Definition at line 218 of file CsPackageManager.cs.