示例#1
0
        public void kill()
        {
            if (hasstarted)
            {
                waskilled = true;
                ServerProc.Kill();
            }

            try
            {
                foreach (Process proc in Process.GetProcessesByName("java"))
                {
                    proc.Kill();
                }
            }
            catch (Exception ex)
            {
                output += ex.ToString();
            }
        }
示例#2
0
 public string StopServer()
 {
     try
     {
         ServerProc.StandardInput.WriteLine("stop");
         ServerProc.WaitForExit(10000);
         if (!ServerProc.HasExited)
         {
             kill();
             return("ERROR: The Server didn't want to Stop !\r\n");
         }
         else
         {
             return("Server has stopped.");
         }
     }
     catch {
         return("Exception thrown when trying to stop server.");
     }
 }