public void Start(StartupOptions opt) { // Kill Ombi Process var p = new ProcessProvider(); try { p.Kill(opt); } catch (Exception e) { Console.WriteLine(e); } // Make sure the process has been killed while (p.FindProcessByName(opt.ProcessName).Any()) { Thread.Sleep(500); _log.LogDebug("Found another process called {0}, KILLING!", opt.ProcessName); var proc = p.FindProcessByName(opt.ProcessName).FirstOrDefault(); if (proc != null) { _log.LogDebug($"[{proc.Id}] - {proc.Name} - Path: {proc.StartPath}"); opt.OmbiProcessId = proc.Id; p.Kill(opt); } } _log.LogDebug("Starting to move the files"); MoveFiles(opt); _log.LogDebug("Files replaced"); // Start Ombi StartOmbi(opt); }
public void Start(StartupOptions opt) { // Kill Ombi Process var p = new ProcessProvider(); bool killed = false; try { killed = p.Kill(opt); } catch (Exception e) { Console.WriteLine(e); } if (!killed) { _log.LogDebug("Couldn't kill the ombi process"); return; } _log.LogDebug("Starting to move the files"); MoveFiles(opt); _log.LogDebug("Files replaced"); // Start Ombi StartOmbi(opt); }