Barotrauma Client
Loading...
Searching...
No Matches
Barotrauma.MemoryFileAssemblyContextLoader Class Reference

AssemblyLoadContext to compile from syntax trees in memory and to load from disk/file. Provides dependency resolution. [IMPORTANT] Only supports 1 in-memory compiled assembly at a time. Use more instances if you need more. [IMPORTANT] All file assemblies required for the compilation of syntax trees should be loaded first. More...

Inheritance diagram for Barotrauma.MemoryFileAssemblyContextLoader:

Public Member Functions

 MemoryFileAssemblyContextLoader (AssemblyManager assemblyManager)
 
AssemblyLoadingSuccessState LoadFromFiles ([NotNull] IEnumerable< string > assemblyFilePaths)
 Try to load the list of disk-file assemblies.
 
AssemblyLoadingSuccessState CompileAndLoadScriptAssembly ([NotNull] string assemblyName, [NotNull] IEnumerable< SyntaxTree > syntaxTrees, IEnumerable< MetadataReference > externMetadataReferences, [NotNull] CSharpCompilationOptions compilationOptions, out string compilationMessages, IEnumerable< Assembly > externFileAssemblyReferences=null)
 Compiles the supplied syntaxtrees and options into an in-memory assembly image. Builds metadata from loaded assemblies, only supply your own if you have in-memory images not managed by the AssemblyManager class.
 

Protected Member Functions

override Assembly Load (AssemblyName assemblyName)
 

Protected Attributes

bool IsResolving
 

Properties

string FriendlyName [get, set]
 
Assembly CompiledAssembly [get]
 
byte[] CompiledAssemblyImage [get]
 
bool IsTemplateMode [get, set]
 
bool IsDisposed [get]
 

Detailed Description

AssemblyLoadContext to compile from syntax trees in memory and to load from disk/file. Provides dependency resolution. [IMPORTANT] Only supports 1 in-memory compiled assembly at a time. Use more instances if you need more. [IMPORTANT] All file assemblies required for the compilation of syntax trees should be loaded first.

Constructor & Destructor Documentation

◆ MemoryFileAssemblyContextLoader()

Barotrauma.MemoryFileAssemblyContextLoader.MemoryFileAssemblyContextLoader ( AssemblyManager assemblyManager)

Member Function Documentation

◆ CompileAndLoadScriptAssembly()

AssemblyLoadingSuccessState Barotrauma.MemoryFileAssemblyContextLoader.CompileAndLoadScriptAssembly ( [NotNull] string assemblyName,
[NotNull] IEnumerable< SyntaxTree > syntaxTrees,
IEnumerable< MetadataReference > externMetadataReferences,
[NotNull] CSharpCompilationOptions compilationOptions,
out string compilationMessages,
IEnumerable< Assembly > externFileAssemblyReferences = null )

Compiles the supplied syntaxtrees and options into an in-memory assembly image. Builds metadata from loaded assemblies, only supply your own if you have in-memory images not managed by the AssemblyManager class.

Parameters
assemblyNameName of the assembly. Must be supplied for in-memory assemblies.
syntaxTreesSyntax trees to compile into the assembly.
externMetadataReferencesMetadata to be used for compilation. [IMPORTANT] This method builds metadata from loaded assemblies, only supply your own if you have in-memory images not managed by the AssemblyManager class.
compilationOptionsCSharp compilation options. This method automatically adds the 'IgnoreAccessChecks' property for compilation.
compilationMessagesWill contain any diagnostic messages for compilation failure.
externFileAssemblyReferencesAdditional assemblies located in the FileSystem to build metadata references from. Assemblies here will have duplicates by the same name that are currently loaded filtered out.
Returns
Success state of the operation.
Exceptions
ArgumentNullExceptionThrows exception if any of the required arguments are null.

◆ Load()

override Assembly Barotrauma.MemoryFileAssemblyContextLoader.Load ( AssemblyName assemblyName)
protected

◆ LoadFromFiles()

AssemblyLoadingSuccessState Barotrauma.MemoryFileAssemblyContextLoader.LoadFromFiles ( [NotNull] IEnumerable< string > assemblyFilePaths)

Try to load the list of disk-file assemblies.

Parameters
assemblyFilePathsOperation success or failure reason.

Member Data Documentation

◆ IsResolving

bool Barotrauma.MemoryFileAssemblyContextLoader.IsResolving
protected

Property Documentation

◆ CompiledAssembly

Assembly Barotrauma.MemoryFileAssemblyContextLoader.CompiledAssembly
get

◆ CompiledAssemblyImage

byte [] Barotrauma.MemoryFileAssemblyContextLoader.CompiledAssemblyImage
get

◆ FriendlyName

string Barotrauma.MemoryFileAssemblyContextLoader.FriendlyName
getset

◆ IsDisposed

bool Barotrauma.MemoryFileAssemblyContextLoader.IsDisposed
get

◆ IsTemplateMode

bool Barotrauma.MemoryFileAssemblyContextLoader.IsTemplateMode
getset

The documentation for this class was generated from the following file: