/// <summary> /// Checks a mutex to see if an instance is running and decides how to proceed based on this and args /// </summary> /// <param name="args"></param> public static void InstanceCheck(string[] args) { Func <string[], bool> ArgCheck = a => a != null && a.Length > 0 && File.Exists(a[0]); bool isOnlyInstance = false; if (ArgCheck(args) || args.Length == 0) { mutex = new Mutex(true, "WDBXEditorMutex", out isOnlyInstance); if (!isOnlyInstance) { Program.PrimaryInstance = false; SendData(args); //Send args to the primary instance } else { Program.PrimaryInstance = true; pipeServer = new NamedPipeManager(); pipeServer.ReceiveString += OpenRequest; pipeServer.StartServer(); } } }
public static void Start() { pipeServer?.StartServer(); }