static void Main(string[] args) { if (Cli.Parse <ApplicationSettings>(args).CliExitEarly) { return; } Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath)); EnableLogging(); Logger.Debug("Launched from {launchDirectory} with args {launchOptions}.", Directory.GetCurrentDirectory(), string.Join(" ", args)); // Single instance handling _singleInstanceMutex = new Mutex(true, ApplicationSettings.Instance.MumbleMapName != null ? $"{APP_GUID}:{ApplicationSettings.Instance.MumbleMapName}" : $"{APP_GUID}"); if (!_singleInstanceMutex.WaitOne(TimeSpan.Zero, true)) { Logger.Warn("Blish HUD is already running!"); return; } using (var game = new BlishHud()) { game.Run(); } _singleInstanceMutex.ReleaseMutex(); }
static void Main() { if (IsMoreThanOneInstance()) { Logger.Warn("Blish HUD is already running!"); return; } // Needed by textboxes to enable CTRL + A selection Application.EnableVisualStyles(); using (var game = new BlishHud()) game.Run(); SingleInstanceMutex.ReleaseMutex(); }