private async void ShutdownServer(object sender, DoWorkEventArgs e)
 {
     if (Process.HasExited == true)
     {
         OnSDaysTDieServerStoppedHandler?.Invoke(this, new OnSDaysTDieServerStoppedEventArgs("*** Server already down! ***"));
         TelnetHandler.BackgroundWorker.CancelAsync();
         return;
     }
     TelnetHandler.WriteLine("shutdown");
     for (int tryShutDownCounter = 30; tryShutDownCounter > 0; tryShutDownCounter--)
     {
         TelnetHandler.WriteLine("shutdown");
         OnSDaysTDieServerStoppingHandler?.Invoke(this, new OnSDaysTDieServerStoppingEventArgs("*** Check if shutdown successfull try: '" + tryShutDownCounter + "' ***"));
         if (Process.HasExited == true)
         {
             OnSDaysTDieServerStoppedHandler?.Invoke(this, new OnSDaysTDieServerStoppedEventArgs("*** Shutdown successful ***"));
             TelnetHandler.BackgroundWorker.CancelAsync();
             return;
         }
         await Task.Delay(1000);
     }
     OnSDaysTDieServerStoppingHandler?.Invoke(this, new OnSDaysTDieServerStoppingEventArgs("*** Proper Shutdown not successful - Killing 7days2die process ***"));
     Process.Kill();
     TelnetHandler.BackgroundWorker.CancelAsync();
     OnSDaysTDieServerStoppedHandler?.Invoke(this, new OnSDaysTDieServerStoppedEventArgs("*** Shutdown done with killing process ***"));
 }
        public void Start()
        {
            string logDateTime = DateTime.Now.ToString("yyyyMMddHHmmss");

            Process = new Process();

            // Configure the process using the StartInfo properties.
            Process.StartInfo.FileName = Folder + SEP + "7daystodie.exe";
            string logFilePath = "\"" + Folder + SEP + "7DaysToDie_Data" + SEP + "output_log_dedi" + logDateTime + ".txt \"";

            if (!File.Exists(Folder + SEP + ServerSettings.ServerConfigFilepath))
            {
                throw new FileNotFoundException("Config file not found at " + Folder + SEP + ServerSettings.ServerConfigFilepath);
            }
            //Process.StartInfo.Arguments = "-logfile 7DaysToDie_Data" + SEP + "output_log_dedi" + logDateTime + ".txt -quit -batchmode -nographics -configfile=" + ServerSettings.ServerConfigFilepath + " -dedicated";
            Process.StartInfo.Arguments = "-logfile " + logFilePath + " -quit -batchmode -nographics -configfile=" + ServerSettings.ServerConfigFilepath + " -dedicated";
            Process.Start();
            TelnetHandler = new TelnetHandler(TelnetCredentials);
            TelnetHandler.OnTelnetReceivedHandler += TelnetHandler_OnTelnetReceivedHandler;
        }