| 235 | } |
| 236 | |
| 237 | public void Start(string path, string workDirectory) |
| 238 | { |
| 239 | if (_Process != null && !_Process.HasExited) |
| 240 | throw new InvalidOperationException(); |
| 241 | |
| 242 | ProcessStartInfo tInfo = new ProcessStartInfo(path); |
| 243 | tInfo.Arguments = "/debugger:" + DebuggerPort.ToString(); |
| 244 | tInfo.WorkingDirectory = workDirectory; |
| 245 | |
| 246 | DebugMonitor.Start(); |
| 247 | |
| 248 | Thread.Sleep(500); |
| 249 | |
| 250 | try |
| 251 | { |
| 252 | _Process = Process.Start(tInfo); |
| 253 | _Process.EnableRaisingEvents = true; |
| 254 | _Process.Exited += Process_Exited; |
| 255 | } |
| 256 | catch |
| 257 | { |
| 258 | DebugMonitor.Stop(); |
| 259 | throw; |
| 260 | } |
| 261 | |
| 262 | _WorkingSet = new PerformanceCounter("Process", "Working Set", _Process.ProcessName); |
| 263 | _PrivateWorkingSet = new PerformanceCounter("Process", "Working Set - Private", _Process.ProcessName); |
| 264 | _CpuTime = new PerformanceCounter("Process", "% Processor Time", _Process.ProcessName); |
| 265 | } |
| 266 | |
| 267 | public void CloseSocket() |
| 268 | { |