public ConsoleProcessAsynchronousHandle(string strFilePath, string strArguments, int intTimeOut, ConsoleProcessResultInterpreter objInterpreter) { TimeOut = intTimeOut; FilePath = strFilePath; Arguments = strArguments; Interpreter = objInterpreter; HandleUid = Guid.NewGuid().ToString(); Cancelled = false; }
public ConsoleProcessResult(string strFilePath, string strArguments, ConsoleProcessResultType enuProcessResult, int intExitCode, IEnumerable <string> objOutputLines, ConsoleProcessResultInterpreter objInterpreter) { FilePath = strFilePath; Arguments = strArguments; ProcessResult = enuProcessResult; ExitCode = intExitCode; ProcessException = null; Interpreter = objInterpreter; _objOutputLines = new List <string>(objOutputLines); }
public ConsoleProcessAsynchronousHandle(string strFilePath, int intTimeOut, ConsoleProcessResultInterpreter objInterpreter) : this(strFilePath, string.Empty, intTimeOut, objInterpreter) { }
public ConsoleProcessAsynchronousHandle(string strFilePath, string strArguments, ConsoleProcessResultInterpreter objInterpreter) : this(strFilePath, strArguments, ConsoleProcess.DefaultTimeOut, objInterpreter) { }
public ConsoleProcessResult ExecuteSynchronous(string strFilePath, string strArguments, int intTimeOut, ConsoleProcessResultInterpreter objInterpreter) { ConsoleProcessResult objResult = null; ProcessStartInfo objStartInfo = CreateProcessStartInfo(strFilePath, strArguments); try { using (Process objProcess = Process.Start(objStartInfo)) { bool blnResult = objProcess.WaitForExit(intTimeOut * 1000); if (blnResult == true) { string strOutputLine; List <string> objOutputLines = new List <string>(); while ((strOutputLine = objProcess.StandardOutput.ReadLine()) != null) { objOutputLines.Add(strOutputLine); } objResult = new ConsoleProcessResult(strFilePath, strArguments, ConsoleProcessResultType.Completed, objProcess.ExitCode, objOutputLines, objInterpreter); } else { objResult = new ConsoleProcessResult(strFilePath, strArguments, ConsoleProcessResultType.TimedOut, -1, objInterpreter); } } } catch (Exception objException) { objResult = new ConsoleProcessResult(strFilePath, strArguments, objException, objInterpreter); } return(objResult); }
public ConsoleProcessResult ExecuteSynchronous(string strFilePath, string strArguments, ConsoleProcessResultInterpreter objInterpreter) { return(ExecuteSynchronous(strFilePath, strArguments, DefaultTimeOut, objInterpreter)); }
public ConsoleProcessResult ExecuteSynchronous(string strFilePath, int intTimeOut, ConsoleProcessResultInterpreter objInterpreter) { return(ExecuteSynchronous(strFilePath, string.Empty, intTimeOut, objInterpreter)); }
public ConsoleProcessAsynchronousHandle ExecuteAsynchronous(string strFilePath, string strArguments, int intTimeOut, ConsoleProcessResultInterpreter objInterpreter) { ParameterizedThreadStart objParameterizedThreadStart = new ParameterizedThreadStart(ExecuteAsynchronousProc); Thread objExecuteAsynchronousThread = new Thread(objParameterizedThreadStart); objExecuteAsynchronousThread.IsBackground = true; ConsoleProcessAsynchronousHandle objHandle = new ConsoleProcessAsynchronousHandle(strFilePath, strArguments, intTimeOut, objInterpreter); objExecuteAsynchronousThread.Start(objHandle); return(objHandle); }
public ConsoleProcessAsynchronousHandle ExecuteAsynchronous(string strFilePath, ConsoleProcessResultInterpreter objInterpreter) { return(ExecuteAsynchronous(strFilePath, string.Empty, DefaultTimeOut, objInterpreter)); }
public ConsoleProcessResult(string strFilePath, string strArguments, ConsoleProcessResultType enuProcessResult, int intExitCode, ConsoleProcessResultInterpreter objInterpreter) : this(strFilePath, strArguments, enuProcessResult, intExitCode, new string[] {}, objInterpreter) { }
public ConsoleProcessResult(string strFilePath, string strArguments, Exception objProcessException, ConsoleProcessResultInterpreter objInterpreter) : this(strFilePath, strArguments, ConsoleProcessResultType.Failed, -1, new string[] {}, objInterpreter) { ProcessException = objProcessException; }