Beispiel #1
0
 private IReplFormatter GetReplFormatter(Repl instance)
 {
     _neutralFormatter = new LanguageNeutralFormatter(this);
     if (_engine.Setup.FileExtensions.Count > 0)
     {
         string path = string.Format("repl_formatter{0}", _engine.Setup.FileExtensions[0]);
         string code = DynamicApplication.GetResource(path);
         if (code != null)
         {
             var scope = _engine.CreateScope();
             try {
                 _engine.CreateScriptSourceFromString(code, path).Execute(scope);
                 var CreateReplFormatter = scope.GetVariable <Func <Repl, IReplFormatter, IReplFormatter> >("create_repl_formatter");
                 if (CreateReplFormatter != null)
                 {
                     return(CreateReplFormatter(this, _neutralFormatter));
                 }
             } catch (Exception e) {
                 DynamicApplication.Current.HandleException(this, e);
             }
         }
     }
     return(_neutralFormatter);
 }
Beispiel #2
0
 private IReplFormatter GetReplFormatter(Repl instance) {
     _neutralFormatter = new LanguageNeutralFormatter(this);
     if (_engine.Setup.FileExtensions.Count > 0) {
         string path = string.Format("repl_formatter{0}", _engine.Setup.FileExtensions[0]);
         string code = DynamicApplication.GetResource(path);
         if (code != null) {
             var scope = _engine.CreateScope();
             try {
                 _engine.CreateScriptSourceFromString(code, path).Execute(scope);
                 var CreateReplFormatter = scope.GetVariable<Func<Repl, IReplFormatter, IReplFormatter>>("create_repl_formatter");
                 if (CreateReplFormatter != null) {
                     return CreateReplFormatter(this, _neutralFormatter);
                 }
             } catch (Exception e) {
                 DynamicApplication.Current.HandleException(this, e);
             }
         }
     }
     return _neutralFormatter;
 }