Пример #1
0
 public PyProcessContext(IScriptContext scriptContext,
     dynamic processHandler,
     ProcessFactory processFactory,
     string command,
     string commandArguments,
     string workingDirectory,
     ICommandParameters commandParameters)
 {
     _commandParameters = commandParameters;
     _scriptContext = scriptContext;
     _command = command;
     _commandArguments = commandArguments;
     _workingDirectory = workingDirectory;
     _processFactory = processFactory;
     var processContext = _processFactory.CreateProcessContext(command,
         commandArguments,
         workingDirectory);
     _processHandler = processHandler;
     processContext.OnMessage += (message) =>
     {
         _processHandler.OnMessage(message);
         //  Console.WriteLine(message);
     };
     processContext.OnError += (message) =>
     {
         _processHandler.OnError(message);
     };
     _processHandler.OnInit(this, _commandParameters);
     _processContext = processContext;
 }
Пример #2
0
        public ProcessContext(
            ProcessFactory factory,
            Process process, int waitFor = 0, bool killOnTimeOut = false)
        {
            this.KillOnTimeOut = killOnTimeOut;
            this.Process = process;
            this.WaitFor = waitFor;
            this._factory = factory;

            _standardOutput = new ConsoleOutput();
            _errorOutput = new ConsoleOutput();
        }
Пример #3
0
 public PyRunner(string command, string script, string args, string workingDirectory,
     ICommandParameters commandParameters)
 {
     this.command = command;
     this.script = script;
     this.args = args;
     this.workingDirectory = workingDirectory;
      _processFactory = new ProcessFactory();
      _commandParameters = commandParameters;
 }