-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
32 lines (25 loc) · 959 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace Multi_Launcher_V2 {
static class Program {
/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (IsRunning()) {
var errorMsg = $"Erreur, {Process.GetCurrentProcess().ProcessName} est déjà lancé.\nCette instance va se quitter.";
MessageBox.Show(errorMsg, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
FileManager.CreateResourcesFile();
Application.Run(new MainForm());
}
private static bool IsRunning() {
return Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1;
}
}
}