public IDictionary <string, IScriptModule> GetPublishedModules()
        {
            IDictionary <string, IScriptModule> result = _manager.Environment.GetPublishedModules();

            string[] keys = new string[result.Count];
            result.Keys.CopyTo(keys, 0);

            foreach (string key in keys)
            {
                result[key] = RemoteWrapper.WrapRemotable <IScriptModule>(result[key]);
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Execute code within a given module context and returns the result.
        /// The module must be local with respect to the compiled code object.
        /// </summary>
        public object Evaluate(IScriptModule module)
        {
            ScriptModule localModule;

            if (module == null)
            {
                localModule = RemoteWrapper.TryGetLocal <ScriptModule>(ScriptDomainManager.CurrentManager.Host.DefaultModule);
            }
            else
            {
                localModule = RemoteWrapper.GetLocalArgument <ScriptModule>(module, "module");
            }

            return(_code.Run(localModule));
        }
Пример #3
0
        /// <summary>
        /// Creates a module.
        /// <c>dictionary</c> can be <c>null</c>
        /// </summary>
        /// <returns></returns>
        public IScriptModule CreateModule(string name, ScriptModuleKind kind, IAttributesCollection dictionary, params ICompiledCode[] compiledCodes)
        {
            Contract.RequiresNotNullItems(compiledCodes, "compiledCodes");

            ScriptCode[] script_codes = new ScriptCode[compiledCodes.Length];
            for (int i = 0; i < compiledCodes.Length; i++)
            {
                script_codes[i] = ScriptCode.FromCompiledCode(RemoteWrapper.TryGetLocal <CompiledCode>(compiledCodes[i]));
                if (script_codes[i] == null)
                {
                    throw new ArgumentException(Resources.RemoteCodeModuleComposition, String.Format("{0}[{1}]", "compiledCodes", i));
                }
            }

            return(_manager.CreateModule(name, kind, new Scope(dictionary), script_codes));
        }
Пример #4
0
 public ICompiledCode CompileFileContent(string path, IScriptModule module)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileFileContent(path, module)));
 }
Пример #5
0
 public ICompiledCode CompileFileContent(string path)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileFileContent(path)));
 }
Пример #6
0
 public IScriptModule CompileFile(string path, string moduleName)
 {
     return(RemoteWrapper.WrapRemotable <IScriptModule>(_engine.CompileFile(path, moduleName)));
 }
Пример #7
0
 public ICompiledCode CompileInteractiveCode(string code)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileInteractiveCode(code)));
 }
Пример #8
0
 public virtual SourceUnit TryGetSourceFileUnit(IScriptEngine engine, string path, Encoding encoding)
 {
     Debug.Assert(_remoteHost != null);
     return(_remoteHost.TryGetSourceFileUnit(RemoteWrapper.WrapRemotable <IScriptEngine>(engine), path, encoding));
 }
Пример #9
0
 public ICompiledCode CompileSourceUnit(SourceUnit sourceUnit, IScriptModule module)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileSourceUnit(sourceUnit, module)));
 }
Пример #10
0
 public ICompiledCode CompileStatements(string statement, IScriptModule module)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileStatements(statement, module)));
 }
 public IScriptModule CompileModule(string name, params SourceUnit[] sourceUnits)
 {
     return(RemoteWrapper.WrapRemotable <IScriptModule>(_manager.Environment.CompileModule(name, sourceUnits)));
 }
 public IScriptModule CreateModule(string name, ScriptModuleKind kind, IAttributesCollection dictionary, params ICompiledCode[] compiledCodes)
 {
     return(RemoteWrapper.WrapRemotable <IScriptModule>(_manager.Environment.CreateModule(name, kind, dictionary, compiledCodes)));
 }
 public IScriptModule CreateModule(string name, params ICompiledCode[] compiledCodes)
 {
     return(RemoteWrapper.WrapRemotable <IScriptModule>(_manager.Environment.CreateModule(name, compiledCodes)));
 }
Пример #14
0
 // Gets a LanguageContext for the specified module that captures the current state
 // of the module which will be used for compilation and execution of the next piece of code against the module.
 private CodeContext GetCodeContext(IScriptModule module)
 {
     return(GetCodeContext(RemoteWrapper.GetLocalArgument <ScriptModule>(module ??
                                                                         ScriptDomainManager.CurrentManager.Host.DefaultModule, "module")));
 }
Пример #15
0
 // throws SerializationException
 public virtual bool TryGetVariable(IScriptEngine engine, SymbolId name, out object value)
 {
     Debug.Assert(_remoteHost != null);
     return(_remoteHost.TryGetVariable(RemoteWrapper.WrapRemotable <IScriptEngine>(engine), name, out value));
 }
Пример #16
0
 public virtual void ModuleCreated(IScriptModule module)
 {
     Contract.RequiresNotNull(module, "module");
     Debug.Assert(_remoteHost != null);
     _remoteHost.ModuleCreated(RemoteWrapper.WrapRemotable <IScriptModule>(module));
 }
Пример #17
0
 /// <summary>
 /// TODO: Called under a lock. Should work with the engine via the argument only.
 /// </summary>
 public virtual void EngineCreated(IScriptEngine engine)
 {
     Contract.RequiresNotNull(engine, "engine");
     Debug.Assert(_remoteHost != null);
     _remoteHost.EngineCreated(RemoteWrapper.WrapRemotable <IScriptEngine>(engine));
 }
Пример #18
0
 public ICompiledCode CompileCode(string code, IScriptModule module)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileCode(code, module)));
 }
Пример #19
0
 public ICompiledCode CompileExpression(string expression, IScriptModule module)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileExpression(expression, module)));
 }
 public IScriptModule CompileModule(string name, ScriptModuleKind kind, CompilerOptions options, ErrorSink errorSink, IAttributesCollection dictionary, params SourceUnit[] sourceUnits)
 {
     return(RemoteWrapper.WrapRemotable <IScriptModule>(_manager.Environment.CompileModule(name, kind, options, errorSink, dictionary, sourceUnits)));
 }
Пример #21
0
 public ICompiledCode CompileCodeDom(System.CodeDom.CodeMemberMethod code, IScriptModule module)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileCodeDom(code, module)));
 }
Пример #22
0
 public IScriptModule MakeModule(string name)
 {
     return(RemoteWrapper.WrapRemotable <IScriptModule>(_compiledCode.MakeModule(name)));
 }
Пример #23
0
 public ICompiledCode CompileSourceUnit(SourceUnit sourceUnit, CompilerOptions options, ErrorSink errorSink)
 {
     return(RemoteWrapper.WrapRemotable <ICompiledCode>(_engine.CompileSourceUnit(sourceUnit, options, errorSink)));
 }
Пример #24
0
 public void PublishModule(IScriptModule module, string publicName)
 {
     _manager.PublishModule(RemoteWrapper.GetLocalArgument <ScriptModule>(module, "module"), publicName);
 }