Пример #1
0
        public List <Dictionary <string, Type> > GetParameters(string name)
        {
            var executerFileName = ScriptList[name];
            var executer         = new PSExecutor(executerFileName);

            return(executer.Parameters);
        }
Пример #2
0
        public async Task RunScript(string name, Dictionary <string, object> parameters)
        {
            var executerFileName = ScriptList[name];
            var executer         = new PSExecutor(executerFileName);

            var id = $"{name}.{Guid.NewGuid()}.{DateTime.Now.Ticks}";

            using (var logWriter = File.AppendText($"{_logPath}/{id}.log"))
            {
                executer.OnStdErrorData += async(sender, args) => await OnErrorEventHandler(logWriter, id, args);

                executer.OnStdOutData += async(sender, args) => await OnUpdateEventHandler(logWriter, id, args);

                await OnScriptStartedEventHandler(logWriter, id);

                var ret = await executer.Run(parameters);

                await OnScriptFinishedEventHandler(logWriter, id, ret);
            }
        }