mirror of https://github.com/Jackett/Jackett
parent
4eda11f79e
commit
0f5937b387
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
@ -14,9 +15,21 @@ namespace JackettTray
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
var JacketTrayProcessName = Process.GetCurrentProcess().ProcessName;
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
var runningProcesses = Process.GetProcesses();
|
||||||
Application.Run(new Main());
|
var currentSessionID = Process.GetCurrentProcess().SessionId;
|
||||||
|
var sameAsThisSession = runningProcesses.Where(p => p.SessionId == currentSessionID);
|
||||||
|
var sameAsThisSessionJacketTray = sameAsThisSession.Where(p => p.ProcessName == JacketTrayProcessName);
|
||||||
|
if (sameAsThisSessionJacketTray.Any())
|
||||||
|
{
|
||||||
|
MessageBox.Show("JackettTray is already running");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Main());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue