JackettTray: fix running detection

This commit is contained in:
kaso17 2017-12-01 10:39:50 +01:00
parent 0f5937b387
commit 4f93f1efc6
1 changed files with 2 additions and 2 deletions

View File

@ -15,11 +15,11 @@ namespace JackettTray
[STAThread]
static void Main()
{
var JacketTrayProcessName = Process.GetCurrentProcess().ProcessName;
var JacketTrayProcess = Process.GetCurrentProcess();
var runningProcesses = Process.GetProcesses();
var currentSessionID = Process.GetCurrentProcess().SessionId;
var sameAsThisSession = runningProcesses.Where(p => p.SessionId == currentSessionID);
var sameAsThisSessionJacketTray = sameAsThisSession.Where(p => p.ProcessName == JacketTrayProcessName);
var sameAsThisSessionJacketTray = sameAsThisSession.Where(p => p.ProcessName == JacketTrayProcess.ProcessName && p.Id != JacketTrayProcess.Id);
if (sameAsThisSessionJacketTray.Any())
{
MessageBox.Show("JackettTray is already running");