forked from IlliumIv/AutoQuit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoeProcessHandler.cs
32 lines (28 loc) · 1.01 KB
/
PoeProcessHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Diagnostics;
namespace AutoQuit
{
class PoeProcessHandler
{
public static int ExitPoe(string ExeName, string arguments)
{
// Prepare the process to run
ProcessStartInfo start = new ProcessStartInfo();
// Enter in the command line arguments, everything you would enter after the executable name itself
start.Arguments = arguments;
// Enter the executable to run, including the complete path
start.FileName = ExeName;
// Do you want to show a console window?
start.WindowStyle = ProcessWindowStyle.Hidden;
start.CreateNoWindow = true;
int exitCode;
// Run the external process & wait for it to finish
using (Process proc = Process.Start(start))
{
proc.WaitForExit();
// Retrieve the app's exit code
exitCode = proc.ExitCode;
}
return exitCode;
}
}
}