Exemplo n.º 1
0
        public static bool KillProcess()
        {
            Process[] pname = Process.GetProcessesByName(ConfigHolder.GetProcessName());

            foreach (Process p in pname)
            {
                p.Kill();
            }

            return(pname.Length != 0);
        }
Exemplo n.º 2
0
        public static bool ExitProcess()
        {
            Process[] pname = Process.GetProcessesByName(ConfigHolder.GetProcessName());

            foreach (Process p in pname)
            {
                p.CloseMainWindow();
            }

            return(pname.Length != 0);
        }
Exemplo n.º 3
0
        private bool IsServerRunning()
        {
            Process[] pname = Process.GetProcessesByName(ConfigHolder.GetProcessName());

            if (pname.Length != 0 && !pname[0].Responding && timer == null && ConfigHolder.killNonRespProcess)
            {
                timer           = new System.Timers.Timer();
                timer.Elapsed  += new ElapsedEventHandler(OnTimedEvent);
                timer.Interval  = 30000;
                timer.AutoReset = false;
                timer.Start();
            }

            if (pname.Length == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }