BF2Statistics.BF2Server.CheckServerProcess C# (CSharp) Method

CheckServerProcess() protected static method

Assigns the Server Process if the process is running
protected static CheckServerProcess ( ) : void
return void
        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?
        }