Example #1
0
        private IExecuteScripts LoadExecutor(ScriptLanguage language, AppDomain scriptDomain, TextWriter outputChannel)
        {
            // Load the script runner into the AppDomain
            var launcher = Activator.CreateInstanceFrom(
                scriptDomain,
                typeof(ScriptDomainLauncher).Assembly.LocalFilePath(),
                typeof(ScriptDomainLauncher).FullName)
                           .Unwrap() as ScriptDomainLauncher;

            m_ProjectsForScripts = Activator.CreateInstanceFrom(
                scriptDomain,
                typeof(ScriptFrontEndProjectHub).Assembly.LocalFilePath(),
                typeof(ScriptFrontEndProjectHub).FullName,
                false,
                BindingFlags.Default,
                null,
                new object[] { m_Projects },
                null,
                null)
                                   .Unwrap() as ScriptFrontEndProjectHub;

            var executor = launcher.Launch(language, m_ProjectsForScripts, outputChannel);

            return(executor);
        }
Example #2
0
        public RemoteScriptRunner(ILinkScriptsToProjects projects, TextWriter writer, ScriptEngine engine)
        {
            {
                Enforce.Argument(() => projects);
                Enforce.Argument(() => writer);
                Enforce.Argument(() => engine);
            }

            m_Projects = projects;
            m_Engine   = engine;

            // Should be able to do any kind of stream we like because we're not actually going to use it.
            m_Engine.Runtime.IO.SetErrorOutput(new MemoryStream(), writer);
            m_Engine.Runtime.IO.SetOutput(new MemoryStream(), writer);
        }
        public RemoteScriptRunner(ILinkScriptsToProjects projects, TextWriter writer, ScriptEngine engine)
        {
            {
                Enforce.Argument(() => projects);
                Enforce.Argument(() => writer);
                Enforce.Argument(() => engine);
            }

            m_Projects = projects;
            m_Engine = engine;

            // Should be able to do any kind of stream we like because we're not actually going to use it.
            m_Engine.Runtime.IO.SetErrorOutput(new MemoryStream(), writer);
            m_Engine.Runtime.IO.SetOutput(new MemoryStream(), writer);
        }
 public IExecuteScripts Launch(ScriptLanguage language, ILinkScriptsToProjects projects, TextWriter writer)
 {
     switch (language)
     {
         case ScriptLanguage.None:
             throw new InvalidScriptLanguageException(language);
         case ScriptLanguage.IronPython:
             return new RemoteScriptRunner(projects, writer, Python.CreateEngine());
         case ScriptLanguage.IronRuby:
             throw new NotImplementedException();
         case ScriptLanguage.PowerShell:
             throw new NotImplementedException();
         default:
             throw new NotImplementedException();
     }
 }
        public IExecuteScripts Launch(ScriptLanguage language, ILinkScriptsToProjects projects, TextWriter writer)
        {
            switch (language)
            {
            case ScriptLanguage.None:
                throw new InvalidScriptLanguageException(language);

            case ScriptLanguage.IronPython:
                return(new RemoteScriptRunner(projects, writer, Python.CreateEngine()));

            case ScriptLanguage.IronRuby:
                throw new NotImplementedException();

            case ScriptLanguage.PowerShell:
                throw new NotImplementedException();

            default:
                throw new NotImplementedException();
            }
        }
Example #6
0
        private IExecuteScripts LoadExecutor(ScriptLanguage language, AppDomain scriptDomain, TextWriter outputChannel)
        {
            // Load the script runner into the AppDomain
            var launcher = Activator.CreateInstanceFrom(
                    scriptDomain,
                    typeof(ScriptDomainLauncher).Assembly.LocalFilePath(),
                    typeof(ScriptDomainLauncher).FullName)
                .Unwrap() as ScriptDomainLauncher;

            m_ProjectsForScripts = Activator.CreateInstanceFrom(
                        scriptDomain,
                        typeof(ScriptFrontEndProjectHub).Assembly.LocalFilePath(),
                        typeof(ScriptFrontEndProjectHub).FullName,
                        false,
                        BindingFlags.Default,
                        null,
                        new object[] { m_Projects },
                        null,
                        null)
                    .Unwrap() as ScriptFrontEndProjectHub;

            var executor = launcher.Launch(language, m_ProjectsForScripts, outputChannel);
            return executor;
        }