C# Class csscript.DefaultPrecompiler

The interface that all CS-Script precompilers need to implement.

The following is an example of the precompiler for sanitizing the script containing hashbang string on Linux.

public class HashBangPrecompiler : IPrecompiler { public bool Compile(ref string code, PrecompilationContext context) { if (code.StartsWith("#!")) { code = "//" + code; //comment the Linux hashbang line to keep C# compiler happy return true; } return false; } } /// Compiles/modifies the specified code. ///

///

///
显示文件 Open project: oleg-shilo/cs-script

Public Methods

Method Description
Compile ( string &code, string scriptFile, bool IsPrimaryScript, Hashtable context ) : bool

Method Details

Compile() public static method

public static Compile ( string &code, string scriptFile, bool IsPrimaryScript, Hashtable context ) : bool
code string
scriptFile string
IsPrimaryScript bool
context System.Collections.Hashtable
return bool