/// <summary> /// Single process execution of the filter. /// </summary> /// <param name="e"></param> /// <returns></returns> public void Run() { // Prepare the process to run //string retMessage; Process aProcess = new Process(); ProcessStartInfo aProcessStartInfo = new ProcessStartInfo(); aProcessStartInfo.Arguments = mJob.GetCommandLine(); aProcessStartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + Properties.Settings.Default.PythonExe; //Debug.Assert(false, aProcessStartInfo.FileName + " " + aProcessStartInfo.Arguments); aProcessStartInfo.WindowStyle = ProcessWindowStyle.Hidden; aProcessStartInfo.UseShellExecute = false; aProcessStartInfo.RedirectStandardInput = true; aProcessStartInfo.RedirectStandardError = true; aProcessStartInfo.RedirectStandardOutput = true; aProcessStartInfo.CreateNoWindow = true; aProcess.StartInfo = aProcessStartInfo; aProcess.Start(); // START DEBUG WITH BREAKPOINTS AND VISUALIZATION OF THE VARIABLE VALUE // // Read in all the text from the process with the StreamReader. // /*using (StreamReader reader = aProcess.StandardError) * { * retMessage = reader.ReadToEnd(); * //Console.Write(retMessage); * }*/ // END DEBUG // Now clean up after ourselves: //aProcess.Dispose(); //aProcessStartInfo = null; // // Log some infos (thread safe execution): // /*if ((retMessage != String.Empty) || (aErrorOccured)) * { * SetTextPropertyValue(aLog, "Text", "\n" + DateTime.Now.ToString("dd/MM/yyyy HH:mm") + " - Error while converting " + e.Name + ": " + retMessage); * SetSelectionStartPropertyValue(aLog, "SelectionStart"); * } * else * { * SetTextPropertyValue(aLog, "Text", "\n" + DateTime.Now.ToString("dd/MM/yyyy HH:mm") + " - " + e.Name + " converted successfully."); * SetSelectionStartPropertyValue(aLog, "SelectionStart"); * } * SetFocusMethod(aLog, "ScrollToCaret");*/ /*aExitCode = aProcess.ExitCode; * * //Now we need to see if the process was successful * if ((aExitCode > 0) & (!aProcess.HasExited)) * { * aProcess.Kill(); * aErrorOccured = true; * } * * //now clean up after ourselves * aProcess.Dispose(); * aProcessStartInfo = null; * * return 1;*/ }
/// <summary> /// Single process execution of the filter. /// </summary> /// <param name="e"></param> /// <returns></returns> public void Run() { // Run asynchronously: new Task(() => { SYRMEP_HPC.Execute(mJob.GetCommandLine()); }).Start(); }