Skip to end of metadata
Go to start of metadata

Represents the scripting core engine that runs on the current host.

Definition

public class ScriptHost : IScriptHost

Summary

The following table summarizes the members exposed in this class.

Public Constructors

ScriptHost Constructor() Initializes a new instance of ScriptHost.

Static Properties

Current Gets the current instance of the ScriptHost that lives in the application domain.
DefaultConfiguration Gets the default configuration from the Intersoft.Client.Scripting assembly.

Public Properties

Activator Gets or sets a value that represents the default object activator.
AssemblyManager Gets or sets a value that represents the default assembly manager.
Binder Gets or sets a value that represents the default object binding.
IsInitialized Gets a value indicating whether the script engine has been initialized.
ScopeFactory Gets a value that represents the default scope factory.

Fields

NoVariable Gets a value that represents no variable instance.
NullValue Gets a value that represents a null value.

Static Methods

Dispose() Dispose the ScriptHost object.
Initialize(bool) Loads default configuration from RuntimeConfig.xml

Public Methods

AddType(string, Type) Adds a type to the scripting runtime.
AddType<T>(string) Adds a type to the scripting runtime.
GetBinaryOperator(string) Gets the binary operation based on the given name.
GetSetting(string) Returns the setting specified in runtime configuration file.
GetSetting<T>(string) Returns setting item specified in runtime configuration file.
GetType(string) Gets the type which is registered in the assembly manager.
GetUnaryOperator(string) Gets the unary operation based on the given name.
HasType(string) Determines whether the specified type is registered in the assembly manager.
Initialize(Stream) Initializes the scripting engine from the specified configuration.
Initialize(ScriptConfiguration) Initializes the scripting engine from the specified configuration.
InitializeScript(IScriptContext) Initializes the scripting runtime based on the given context.
Lock() Lock the runtime host for threading execution.
RegisterOperatorHandler(string, IOperatorHandler) Registers an operator handler to the scripting runtime.
SetSetting(string, object) Sets a runtime setting based on the given name
Unlock() Unlock the thread.

Events

Initializing This event is when the AssemblyManager is being initialized and starting to create the type system. It can used to subscribe on AssemblyManager's events in order to cancel loading some assemblies and adding particular types.

Public Constructors

public ScriptHost()

Initializes a new instance of ScriptHost.

Static Properties

public static IScriptHost Current { get; set; }

Gets the current instance of the ScriptHost that lives in the application domain.

public static Stream DefaultConfiguration { get; }

Gets the default configuration from the Intersoft.Client.Scripting assembly.

Public Properties

public IObjectActivator Activator { get; set; }

Gets or sets a value that represents the default object activator.

public IAssemblyManager AssemblyManager { get; set; }

Gets or sets a value that represents the default assembly manager.

public IObjectBinding Binder { get; set; }

Gets or sets a value that represents the default object binding.

public bool IsInitialized { get; }

Gets a value indicating whether the script engine has been initialized.

public IScopeFactory ScopeFactory { get; }

Gets a value that represents the default scope factory.

Fields

public static object NoVariable

Gets a value that represents no variable instance.

public static object NullValue

Gets a value that represents a null value.

Static Methods

public static void Dispose()

Dispose the ScriptHost object.

public static void Initialize(bool loadDefaultConfiguration)

Loads default configuration from RuntimeConfig.xml

Parameters

loadDefaultConfiguration

Public Methods

public void AddType(string alias, Type type)

Adds a type to the scripting runtime.

Parameters

alias The short name of the type.
type The type to be registered.

public void AddType<T>(string alias)

Adds a type to the scripting runtime.

Type Parameters

T The type to be registered.

Parameters

alias The short name of the type.

public IOperator GetBinaryOperator(string name)

Gets the binary operation based on the given name.

Parameters

name The name of the operator to get.

public object GetSetting(string name)

Returns the setting specified in runtime configuration file.

Parameters

name

public T GetSetting<T>(string name)

Returns setting item specified in runtime configuration file.

Type Parameters

T

Parameters

name The setting name to get.

Return Types

The value of the setting.

public Type GetType(string name)

Gets the type which is registered in the assembly manager.

Parameters

name The name of the type to get.

Return Types

Returns the System.Type based on the given name.

public IOperator GetUnaryOperator(string name)

Gets the unary operation based on the given name.

Parameters

name The name of the operator to get.

public bool HasType(string name)

Determines whether the specified type is registered in the assembly manager.

Parameters

name The name of the type to get.

Return Types

True, if the specified type is registered.

public void Initialize(Stream configuration)

Initializes the scripting engine from the specified configuration.

Parameters

configuration The configuration used in the initialization process.

public void Initialize(ScriptConfiguration configuration)

Initializes the scripting engine from the specified configuration.

Parameters

configuration The configuration used in the initialization process.

public void InitializeScript(IScriptContext context)

Initializes the scripting runtime based on the given context.

Parameters

context A IScriptContext used to initialize the scripting runtime.

public void Lock()

Lock the runtime host for threading execution.

public void RegisterOperatorHandler(string operatorSymbol, IOperatorHandler handler)

Registers an operator handler to the scripting runtime.

Parameters

operatorSymbol The symbol of the operator.
handler The handler for the operator.

public void SetSetting(string name, object value)

Sets a runtime setting based on the given name

Parameters

name The setting name.
value The value of the setting.

public void Unlock()

Unlock the thread.

Events

public event EventHandler<EventArgs> Initializing

This event is when the AssemblyManager is being initialized and starting to create the type system. It can used to subscribe on AssemblyManager's events in order to cancel loading some assemblies and adding particular types.

  • No labels