IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.ScriptLoaderIGLib Class Reference

Base script loader class for IGLib. More...

+ Inheritance diagram for IG.Lib.ScriptLoaderIGLib:
+ Collaboration diagram for IG.Lib.ScriptLoaderIGLib:

Classes

class  ScriptLoaderTest
 ScriptLoader used for testing. More...
 

Public Member Functions

 ScriptLoaderIGLib ()
 Creates a new ScriptLoaderIGLib. More...
 
- Public Member Functions inherited from IG.Lib.ScriptLoaderBase
 ScriptLoaderBase ()
 
virtual void InitializeScriptLoader ()
 Initializes the current script loader. More...
 
virtual void ClearLogger ()
 Clears the logger. More...
 
virtual string GetExampleCode ()
 Gets example code base (a template code for compiling) where names of classes, methods etc. are properly set. More...
 
virtual string GetExampleCode (string pureScript)
 Returns a complete example code that can be loaded and run. More...
 
void CheckAndCorrectNames ()
 Corrects the ClassName (if the current class name has already been used) and namespace and class name in the loaded scritp code (if they don't correspond to ClassNamespace and ClassName, respectively). More...
 
virtual string GetExecutableDirectory ()
 Returns the directory containing the executable that started the current application. More...
 
virtual void AddReferencedAssembly (string assemblyFile)
 Adds an additional referenced assembly by name of the assembly file. Assmebly is only added if it is not yet contained in the list of referenced assemblies and if the specified assembly file name is not null or empty string. More...
 
virtual void AddReferencedAssemblies (params string[] assemblyFiles)
 Adds the specified assemblies to the list of referenced assemblies. Assemblise are added only if not yet on the list and if their names are not null or empty strings. More...
 
virtual void SetReferencedAssemblies (params string[] assemblyFiles)
 Sets the list of referenced assemblies in such a way that it contains only the specified assemblies. More...
 
virtual void RemoveReferencedAssembly (string assemblyFile)
 Removes the specified assembly from the list of referenced assemblies. If the specified assembly does not exist on the list or it is a null or empty string then nothing happens. More...
 
virtual void RemoveReferencedAssemblies (params string[] assemblyFiles)
 Removes the specified assemblies from the list of referenced assemblies. More...
 
virtual void RemoveAllReferencedAssemblies ()
 Removes all assemblies from tehe list of referenced assemblies. More...
 
virtual string[] GetReferencedAssemblies ()
 Returns an array of assemblies (paths, sometimes only file names) that are currently referenced by the compiler on the current script loader. More...
 
virtual string Compile ()
 Compiles the code that is currently loaded by the current loader, and returns full name of the compiled script class. More...
 
virtual void UnloadApplicationDomain ()
 Unloads the application domain used by the current script loader. More...
 
virtual ILoadableScript CreateObject (string[] initializationArguments)
 Creates and returns an object of the class that has been last compiled. The created object is also stored such that it can later be accessed through the CreatedObject property. More...
 
virtual ILoadableScript CreateLoadableObject (string[] initializationArguments, bool storeObject)
 Creates and returns an object of the class that has been last compiled. More...
 
virtual ILoadableScript CreateLoadableObject (string[] initializationArguments, string classFullName)
 Creates and returns an object of the specified loadable class. More...
 
virtual void Run (string[] initializationAndRunArguments)
 Runs the object of the compiled loadable class (calls its Run() method) that is currently loaded by the current loader. Compiles the code and creates the object if necessary. More...
 
virtual void Run (string[] initializationArguments, string[] runArguments)
 Runs the object of the compiled loadable class (calls its Run() method) that is currently loaded by the current loader. Compiles the code and creates the object if necessary. More...
 
void LoadCode (string code, string classFullName)
 Loads code form a string. More...
 
void LoadCode (string code)
 Loads code form a string. Class name is extracted from the code. More...
 
ILoadableScript CreateObjectFromCode (string code, string className, string[] initializationArguments)
 Creates and returns a loadable script object form code. More...
 
ILoadableScript CreateObjectFromCode (string code, string[] initializationArguments)
 Creates and returns a loadable script object form code. Class name is extracted from code. More...
 
string RunCode (string code, string className, string[] initializationArguments, string[] runArguments)
 Creates and runs a loadable script object form code. More...
 
string RunCode (string code, string[] initializationArguments, string[] runArguments)
 Creates and returns a loadable script object form code. Class name is extracted from code. More...
 
string RunCode (string code, string className, string[] initializationAndRunArguments)
 Runs a loadable script object form code. More...
 
string RunCode (string code, string[] initializationAndRunArguments)
 Creates and returns a loadable script object form code. Class name is extracted from code. More...
 
void LoadFile (string filePath, string className)
 Loads loadable script code form the specified file. More...
 
void LoadFile (string filePath)
 Loads loadable script code form a file. Name of the class is extracted from the file contents. More...
 
ILoadableScript CreateObjectFromFile (string filePath, string className, string[] initializationArguments)
 Creates and returns a loadable script object form a file containing its code. More...
 
ILoadableScript CreateObjectFromFile (string filePath, string[] initializationArguments)
 Creates and returns a loadable script object form code. Class name is extracted from code. More...
 
string RunFile (string filePath, string className, string[] initializationArguments, string[] runArguments)
 Executes a loadable script form a file. The file must contain definition of the loadable script class that is used to instantiate an object and execute it. More...
 
string RunFile (string filePath, string[] initializationArguments, string[] runArguments)
 Executes a loadable script form a file. The file must contain definition of the loadable script class that is used to instantiate an object and execute it. Class name is extracted from code. More...
 
string RunFile (string filePath, string className, string[] initializationAndRunArguments)
 Executes a loadable script form a file. The file must contain definition of the loadable script class that is used to instantiate an object and execute it. The same arguments are taken for initialization of the loadable script object and for execution of the script. More...
 
string RunFile (string filePath, string[] initializationAndRunArguments)
 Executes a loadable script form a file. The file must contain definition of the loadable script class that is used to instantiate an object and execute it. The same arguments are taken for initialization of the loadable script object and for execution of the script. Class name is extracted from code. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IG.Lib.ScriptLoaderBase
static void InitializeScripting ()
 Initializes the scripting system. More...
 
static ILoadableScript GetLoadableScriptC (ILoadableScript scriptObject)
 Returns the loadable script object if the script object is actually loadable, or null if it is not meant as loadable. More...
 
static byte[] LoadFileBytes (string filePath)
 Copies the specified file to byte array and returns it. More...
 
static ILoadableScript CreateScriptObject (string scriptClassFullName)
 Creates and returns a new script obect of the specified type. More...
 
static ILoadableScript CreateScriptObject (string scriptClassFullName, int outputLevel)
 Creates and returns a new script obect of the specified type. More...
 
static void AddDefaultAssemblies (params string[] assemblies)
 Add the specified assemblies (just their names) to the list of assemblies that are referenced by newly created script loaders by default. More...
 
static void RemoveDefaultAssemblies (params string[] assemblies)
 Removes the specified assemblies from the list of default assemblies that are referenced by newly created script loaders. More...
 
static void ClearDefaultAssemblies ()
 Clears the list of assemblies that are referenced by default by newly created script loaders. More...
 
static bool IsClassFullNameUsed (string classFillName)
 Returns a flag indicating whether the specified class full name has already been used or not. More...
 
static string FindNameAfterKeyword (string code, string keyword, string allowedCharacters)
 In the specified string, finds a name that follows the specified keyword, and returns it. Name must directly follow the keyword with only blank characters between them, and it end at the first character that is not alphanumeric and is also not contained in the specified string of allowed characters. More...
 
static string FindNamespace (string code)
 Finds and returns the name of the first namespace that is defined in the specified C# code block. A null string is returned if the name can not be found. More...
 
static string FindClassName (string code)
 Finds and returns the name of the first class that is defined in the specified C# code block. A null string is returned if the name can not be found. More...
 
static string GetFileContents (string filePath)
 Returns contents of the specified file. More...
 
- Protected Member Functions inherited from IG.Lib.ScriptLoaderBase
void AddDefaultReferencedAssemblies ()
 Add assemblies that are referenced by default to the list of assemblies that are referenced by the current script loader. More...
 
void CreateNonexistentLibraryPath ()
 Modifies library path in such a way that it points to an non-existent file. More...
 
virtual void AddReferencedAssemblies (System.CodeDom.Compiler.CompilerParameters compilerParameters)
 Adds referenced assemblies to the specified compiler parameters, according to current settings. More...
 
- Static Protected Member Functions inherited from IG.Lib.ScriptLoaderBase
static string CreateNonexistentFilePath (string originalPath)
 Returns a file path that does not exist and is derived form the specified file path by adding a suffix composed of underscore and a number. More...
 
- Protected Attributes inherited from IG.Lib.ScriptLoaderBase
string _code = null
 
string _libraryFilename = null
 
string _originalLibraryPath = null
 
List< string > _referencedAssimblies = new List<string>()
 
bool _referenceAllLoadedAssemblies = true
 
- Properties inherited from IG.Lib.ScriptLoaderBase
bool IsScriptLoaderInitialized [get, protected set]
 Whether the current script loader is initialized or not. More...
 
static bool IsScriptingInitialized [get, protected set]
 Whether scripting system is initialized or not. More...
 
object Lock [get]
 This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
 
static List< string > DefaultAssemblies [get]
 Gets the list of assemblies that are added to all newly created script loaders by default. More...
 
static SortedList< string, string > UsedClassFullNames [get]
 Stores used class names, i.e. class names that have already been used for dynamiically loaded classes. More...
 
static ScriptLoaderBase Global [get, set]
 Global script loader. Getter always returns a non-null object. More...
 
int OutputLevel [get, set]
 Definbes level of output on console that is generated by some operations. 0 means that no output will be written to the console. More...
 
virtual Logger Logger [get]
 Gets the logger that is used to log errors and warnings. More...
 
virtual string Code [get, set]
 Gets or sets code to be compiled. Get: If not assigned explicitly then CodeBase is taken. More...
 
bool PerformNamesCorrection [get, set]
 Specifies whether automatic checking and correction of the class and namespace name in the loaded code is performed. If correction is switched on, it is performed before every compilation. Correction first checks if the class name has already been used, and if this is the case, it changes the name to the one that has not yet been used. It is then checked whether the namespace and class names used in the code are the same as those set on the current script loader. If not then names are replaced. At this stage, the assumed namespace class names are the first namespace and the first class found in the code block. More...
 
virtual string LanguageName [get, protected set]
 Language used by compiler. More...
 
virtual string ClassNamespace [get, protected set]
 Namespace in which the compiled class is defined. More...
 
virtual string ClassInterface [get]
 Interface that is implemented by the compiled class. More...
 
virtual string ClassName [get, set]
 
virtual string ClassFullName [get]
 Name of the compiled class that contains loadable script. More...
 
virtual string AppDomainName [get, set]
 Name of the application domain in which the class is loaded. More...
 
virtual string RunFunctionName [get, protected set]
 Name of the method of dynamically loadable classes that contains the runnable script. More...
 
virtual string InitFunctionName [get, protected set]
 Name of the initialization method of dynamically loadable classes. More...
 
virtual string ArgumentsName [get, set]
 Agreed formal name of the arguments parameter. Agreement upon this name makes possible to execute scripts in which run arguments are referenced. More...
 
virtual string LibraryFilename [get, set]
 
virtual string LibraryDirectory [get, protected set]
 Returns directory where library will be compiled, which will be the directory of the executable that started the application. More...
 
virtual string LibraryPath [get, protected set]
 Path to the dll where code is compiled. We take the directory where executable is located. More...
 
virtual bool IsCodeLoaded [get, protected set]
 Whether scripting code to be compiled is loaded. More...
 
virtual bool IsCompiled [get, protected set]
 Whether the code is compiled. More...
 
virtual bool IsClassLoaded [get, protected set]
 Whether the compiled class corresponding to the script is prepared. More...
 
virtual bool IsObjectPrepared [get, protected set]
 Whether an instance of the object is prepared to be used. More...
 
virtual CompilerResults CompilerResults [get, protected set]
 Results of compilation. More...
 
virtual List< String > ReferencedAssemblies [get]
 List of assemblies that are referenced when compiling the code. Contains names of files containing referenced assemblies. More...
 
virtual bool ReferenceAllLoadedAssemblies [get, set]
 If true then all assemblies that are currently loaded by the application are also added to the referenced assemblies when script code is compiled. This makes sure that all that is necessary is actually referenced. More...
 
virtual AppDomain ApplicationDomain [get, set]
 Application domain used by the current script loader for loading assemblies. More...
 
virtual Assembly Assembly [get, protected set]
 Gets or sets the assembly that has been compiled and loaded into the current application domain from the source code. More...
 
virtual ILoadableScript CreatedObject [get, protected set]
 Object of the compiled class that has beeen created. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Detailed Description

Base script loader class for IGLib.

See also
ScriptLoaderBase

$A Igor Jul09;

Constructor & Destructor Documentation

IG.Lib.ScriptLoaderIGLib.ScriptLoaderIGLib ( )
inline

Creates a new ScriptLoaderIGLib.


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