| 1 | using System; |
| 2 | using System.Collections.Generic; |
| 3 | using System.Diagnostics; |
| 4 | using System.Linq; |
| 5 | using System.Text; |
| 6 | using System.Threading.Tasks; |
| 7 | |
| 8 | namespace Core.Librarys |
| 9 | { |
| 10 | public class ProcessHelper |
| 11 | { |
| 12 | public static bool Run(string filename, string[] args) |
| 13 | { |
| 14 | try |
| 15 | { |
| 16 | string arguments = ""; |
| 17 | foreach (string arg in args) |
| 18 | { |
| 19 | arguments += $"\"{arg}\" "; |
| 20 | } |
| 21 | arguments = arguments.Trim(); |
| 22 | Process process = new Process(); |
| 23 | ProcessStartInfo startInfo = new ProcessStartInfo(filename, arguments); |
| 24 | process.StartInfo = startInfo; |
| 25 | process.Start(); |
| 26 | return true; |
| 27 | } |
| 28 | catch (Exception ex) |
| 29 | { |
| 30 | Logger.Error(ex.ToString()); |
| 31 | return false; |
| 32 | } |
| 33 | |
| 34 | } |
| 35 | } |
| 36 | } |