Example #1
0
        public override void SetCaller(IScriptEvaluator caller)
        {
            foreach (var parameter in _parameters)
            {
                parameter?.SetCaller(caller);
            }

            base.SetCaller(caller);
        }
        public CallbackPipeableStream(IScriptEvaluator evaluator, object callback)
            : base(evaluator)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            Callback = callback;
        }
Example #3
0
 public ModuleLoader(IScriptEvaluator evaluator,
     Dictionary<string, Module> nativeModules,
     Dictionary<string, IModuleCompiler> compilers,
     IModulePathResolver pathResolver)
 {
     Evaluator = evaluator;
     NativeModules = nativeModules;
     LoadedModules = new Dictionary<string, Module>(StringComparer.OrdinalIgnoreCase);
     Compilers = compilers;
     PathResolver = pathResolver;
 }
Example #4
0
        public JArray(IScriptEvaluator evaluator, IEnumerable<object> items)
        {
            dynamic scriptObject = evaluator.Evaluate("[]");
            if (items == null)
            {
                return;
            }

            foreach (var item in items)
            {
                scriptObject.push(item);
            }

            array = scriptObject;
        }
Example #5
0
 internal ScriptObject(IScriptEvaluator host, string refScript = "self", string disposeScript = null)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if (refScript == null)
     {
         throw new ArgumentNullException("refScript");
     }
     this.host          = host;
     this.refScript     = refScript;
     this.disposeScript = disposeScript;
     //Console.WriteLine ("CREATING: {0}", refScript);
 }
        public ScriptingViewPresenter(IScriptingView view, ISharedViewState sharedViewState, IExceptionsHandler exceptionsHandler, ICodeEditorView customFunctionsEditor, IScriptEvaluator eval, ICommandLineHandler commandLineHandler)
        {
            _view                  = view;
            _sharedViewState       = sharedViewState;
            _exceptionsHandler     = exceptionsHandler;
            _customFunctionsEditor = customFunctionsEditor;
            _eval                  = eval;
            _commandLineHandler    = commandLineHandler;
            _view.ProcessClicked  += _view_ProcessClicked;
            _sharedViewState.DefaultActions[ViewName.Scripting] = _view_ProcessClicked;
            var solutionExplorerPresenter = new SolutionExplorerPresenter(_view.SolutionExplorerView,
                                                                          _view.CodeEditorView, true);

            //_view.Load += LoadFileFromCommandLine;
            LoadFileFromCommandLine();
        }
Example #7
0
        public static IScriptEvaluator Create(ScriptEvaluatorTypes scriptEvaluatorType = ScriptEvaluatorTypes.Basic)
        {
            IScriptEvaluator eval = null;

            switch (scriptEvaluatorType)
            {
            case ScriptEvaluatorTypes.Json:
                eval = new JsonScriptEvaluator();
                break;

            case ScriptEvaluatorTypes.Basic:
                eval = new BasicScriptEvaluator();
                break;
            }
            return(eval);
        }
        public static IScriptEvaluator Create(ScriptEvaluatorType scriptEvaluatorType = ScriptEvaluatorType.Json)
        {
            IScriptEvaluator scriptEvaluator = null;

            switch (scriptEvaluatorType)
            {
            case ScriptEvaluatorType.Json:
                scriptEvaluator = new JsonScriptEvaluator();
                break;

            case ScriptEvaluatorType.Basic:
                scriptEvaluator = new BasicScriptEvaluator();
                break;
            }
            return(scriptEvaluator);
        }
Example #9
0
        public Promise(IScriptEvaluator evaluator)
        {
            var bag = (dynamic)evaluator.Evaluate(@"
                (function () {
                    var bag = { };
                    bag.promise = new Promise(function (resolve, reject) {
                        bag.resolve = resolve;
                        bag.reject = reject;
                    });
                    return bag;
                })()");

            promise = bag.promise;
            resolveCallback = bag.resolve;
            rejectCallback = bag.reject;
            Pending = true;
        }
        public ScriptingViewPresenter(IScriptingView view, ISharedViewState sharedViewState, IExceptionsHandler exceptionsHandler, ICodeEditorView customFunctionsEditor, IScriptEvaluator eval, ICommandLineHandler commandLineHandler)
        {
            _view                  = view;
            _sharedViewState       = sharedViewState;
            _exceptionsHandler     = exceptionsHandler;
            _customFunctionsEditor = customFunctionsEditor;
            _eval                  = eval;
            _commandLineHandler    = commandLineHandler;
            _view.ProcessClicked  += _view_ProcessClicked;
            _sharedViewState.DefaultActions[ViewName.Scripting] = _view_ProcessClicked;
            var solutionExplorerPresenter = new SolutionExplorerPresenter(_view.SolutionExplorerView,
                                                                          _view.CodeEditorView, true);

            _view.Load += (o, e) =>
            {
                string filepath;
                if (_commandLineHandler.TryGetCustomFunctionsDocument(out filepath))
                {
                    _view.CodeEditorView.NewDocument(filepath);
                    _sharedViewState.CurrentView = ViewName.Scripting;
                }
            };
        }
 public ScriptsProvider(IScriptEvaluator scriptEvaluator)
 {
     _scriptEvaluator = scriptEvaluator;
 }
Example #12
0
 public ScriptTaskEvaluator(IScriptEvaluator scriptEvaluator, TemplateFileProvider templateFileProvider, ScriptPathProvider scriptPathProvider)
 {
     this.scriptEvaluator      = scriptEvaluator;
     this.templateFileProvider = templateFileProvider;
     this.scriptPathProvider   = scriptPathProvider;
 }
Example #13
0
 public RequireFunction(IScriptEvaluator scriptEvaluator, IModuleLoader loader, Module module)
 {
     this.scriptEvaluator = scriptEvaluator;
     Loader = loader;
     Module = module;
 }
Example #14
0
        public override void SetCaller(IScriptEvaluator caller)
        {
            _value?.SetCaller(caller);

            base.SetCaller(caller);
        }
Example #15
0
 public JArray(IScriptEvaluator evaluator)
     : this (evaluator, null)
 {
 }
Example #16
0
 /// <summary>
 /// Initializes a new ScriptHost class.
 /// </summary>
 /// <param name="evaluator">The ScriptEvaluator.</param>
 public ScriptHost(IScriptEvaluator <T> evaluator)
 {
     _methods   = new Dictionary <string, MethodInfo>();
     _evaluator = evaluator;
     SGL.Components.Add(this);
 }
Example #17
0
 public PipeableStream(IScriptEvaluator evaluator)
     : base(evaluator)
 { }
Example #18
0
 public IModuleLoader Create(IScriptEvaluator evaluator, Dictionary<string, Module> nativeModules, Dictionary<string, IModuleCompiler> compilers,
     IModulePathResolver pathResolver)
 {
     return new ModuleLoader(evaluator, nativeModules, compilers, pathResolver);
 }
Example #19
0
 public StandardInputStream(IScriptEvaluator evaluator, ConsoleColor decoratorColor)
     : base(evaluator)
 {
     this.decoratorColor = decoratorColor;
 }
Example #20
0
 protected BaseReadableStream(IScriptEvaluator evaluator)
 {
     Evaluator = evaluator;
     pipes = new List<IPipe>();
     promises = new List<Promise>();
 }
Example #21
0
 public virtual void SetCaller(IScriptEvaluator caller)
 {
     _caller = caller;
 }