Esempio n. 1
0
        public void Initialize(IEnumerable <string> paths, IEnumerable <IScriptPack> scriptPacks)
        {
            References = DefaultReferences.Union(paths);
            var bin = Path.Combine(FileSystem.CurrentDirectory, "bin");

            ScriptEngine.BaseDirectory = bin;

            Logger.Debug("Initializing script packs");
            var scriptPackSession = new ScriptPackSession(scriptPacks);

            scriptPackSession.InitializePacks();
            ScriptPackSession = scriptPackSession;
        }
Esempio n. 2
0
        public virtual void Initialize(IEnumerable <string> paths, IEnumerable <IScriptPack> scriptPacks, params string[] scriptArgs)
        {
            AddReferences(paths.ToArray());
            var bin = Path.Combine(FileSystem.CurrentDirectory, "bin");

            ScriptEngine.BaseDirectory = bin;

            Logger.Debug("Initializing script packs");
            var scriptPackSession = new ScriptPackSession(scriptPacks, scriptArgs);

            scriptPackSession.InitializePacks();
            ScriptPackSession = scriptPackSession;
        }
Esempio n. 3
0
        public virtual void Initialize(
            IEnumerable <string> paths, IEnumerable <IScriptPack> scriptPacks, params string[] scriptArgs)
        {
            AddReferences(paths.ToArray());
            var bin   = Path.Combine(FileSystem.CurrentDirectory, FileSystem.BinFolder);
            var cache = Path.Combine(FileSystem.CurrentDirectory, FileSystem.DllCacheFolder);

            ScriptEngine.BaseDirectory  = bin;
            ScriptEngine.CacheDirectory = cache;

            _log.Debug("Initializing script packs");
            var scriptPackSession = new ScriptPackSession(scriptPacks, scriptArgs);

            ScriptPackSession = scriptPackSession;
            scriptPackSession.InitializePacks();
        }
Esempio n. 4
0
        public void Execute(string script, IEnumerable <string> paths, IEnumerable <IScriptPack> scriptPacks)
        {
            var bin = Path.Combine(_fileSystem.GetWorkingDirectory(script), "bin");

            var references = DefaultReferences.Union(paths);

            _scriptEngine.BaseDirectory = bin;

            _logger.Debug("Initializing script packs");
            var scriptPackSession = new ScriptPackSession(scriptPacks);

            scriptPackSession.InitializePacks();

            var path = Path.IsPathRooted(script) ? script : Path.Combine(_fileSystem.CurrentDirectory, script);

            _logger.DebugFormat("File to process: {0}", path);
            var code = _filePreProcessor.ProcessFile(path);

            _logger.Debug("Starting execution in engine");
            _scriptEngine.Execute(code, references, DefaultNamespaces, scriptPackSession);

            _logger.Debug("Terminating packs");
            scriptPackSession.TerminatePacks();
        }