public void Start() { try { _runtime = ScriptRuntime.CreateFromConfiguration(); // this reads from app.config for configured Dynamic Language Runtime libraries // now get all the file extensions of scripting types, as creatted from the Configuration foreach (LanguageSetup ls in _runtime.Setup.LanguageSetups) { foreach (string fext in ls.FileExtensions) { _scriptingManager.RegisterLanguageExtensions(this, fext); } } IEnumerable<string> lg = from setup in _runtime.Setup.LanguageSetups select setup.Names[0]; foreach (string ln in lg) _scriptingManager.RegisterLanguageNames(this, ln); _scopevariables = new ScopeVariables(); // setup the initial scopevariables that are shared by all scopes _librarypaths = new List<string>(); // list of Lib directories, or others that contain standard libraries for this script collection } catch (Exception ex) { _scriptingManager.IsScriptEngineActive = false; CompositionManager.Get<IExceptionReporter>().ReportHandledException(ex); } }
public override void DeclareVar(string Name, Type BaseT) { if (ScopeVariables.Any(x => __GetName(x) == Name)) { return; } ScopeVariables.Add(Expression.MakeIndex( Expression.MakeMemberAccess( ThisAccess , VariablesField), VariablesField.FieldType.GetRuntimeProperty("Item"), new Expression[] { Expression.Constant(Name, typeof(string)) })); }
public override void DeclareVar(string Name, Type BaseT) { ScopeVariables.Add( Expression.MakeMemberAccess(null, Destination.DefineField(Name, BaseT, System.Reflection.FieldAttributes.Public | System.Reflection.FieldAttributes.Static))); }