示例#1
0
        public override int Execute()
        {
            if (!System.IO.File.Exists(_path))
            {
                Echo(String.Format("Script file is not found '{0}'", _path));
                return(2);
            }

            SystemLogger.SetWriter(this);

            var hostedScript = new HostedScriptEngine();

            hostedScript.CustomConfig = ScriptFileHelper.CustomConfigPath(_path);
            ScriptFileHelper.OnBeforeScriptRead(hostedScript);
            var source = hostedScript.Loader.FromFile(_path);

            Process process;

            try
            {
                process = hostedScript.CreateProcess(this, source);
            }
            catch (Exception e)
            {
                this.ShowExceptionInfo(e);
                return(1);
            }

            var result = process.Start();

            hostedScript.Finalize();

            return(result);
        }