public ScriptingEngine() { _machine = MachineInstance.Current; TypeManager.Initialize(new StandartTypeManager()); TypeManager.RegisterType("Сценарий", typeof(UserScriptContextInstance)); GlobalsManager.Reset(); AttachAssembly(System.Reflection.Assembly.GetExecutingAssembly()); _scriptFactory = new ScriptSourceFactory(); DirectiveResolvers = new DirectiveMultiResolver(); }
private void InitializeDirectiveResolver(ScriptingEngine engine, RuntimeEnvironment env, string libRoot, string[] additionals) { var ignoreDirectiveResolver = new DirectiveIgnorer(); ignoreDirectiveResolver.Add("Region", "Область"); ignoreDirectiveResolver.Add("EndRegion", "КонецОбласти"); var resolversCollection = new DirectiveMultiResolver(); resolversCollection.Add(ignoreDirectiveResolver); var libResolver = new LibraryResolver(engine, env); libResolver.LibraryRoot = libRoot; if (additionals != null) { libResolver.SearchDirectories.AddRange(additionals); } resolversCollection.Add(libResolver); engine.DirectiveResolver = resolversCollection; }