protected static void CheckServerProcess()
{
try
{
Process[] processCollection = Process.GetProcessesByName("bf2_w32ded");
foreach (Process P in processCollection)
{
if (Path.GetDirectoryName(P.MainModule.FileName) == RootPath)
{
// Hook into the proccess so we know when its running, and register a closing event
ServerProcess = P;
ServerProcess.EnableRaisingEvents = true;
ServerProcess.Exited += ServerProcess_Exited;
// Fire Event
if (Started != null)
Started();
break;
}
}
}
catch { } // Who cares?
}