private static bool killOtherOsu() { #if !Public return(false); #endif try { using (SafeIpcChannel ipcCh = SafeIpcChannel.GetChannel()) { if (ipcCh == null) { return(false); } InterProcessOsu otherOsu = (InterProcessOsu)Activator.GetObject(typeof(InterProcessOsu), "ipc://osu!/loader"); if (otherOsu != null) { otherOsu.Quit(); return(true); } } } catch { } return(false); }
public static SafeIpcChannel GetChannel() { SafeIpcChannel channel = null; try { channel = new SafeIpcChannel(); } catch { if (channel != null) { channel.Dispose(); channel = null; } } return(channel); }
internal static void HandleArguments(string file) { try { using (SafeIpcChannel ipcCh = SafeIpcChannel.GetChannel()) { if (ipcCh == null) { return; } InterProcessOsu otherOsu = (InterProcessOsu)Activator.GetObject(typeof(InterProcessOsu), "ipc://osu!/loader"); if (otherOsu != null) { otherOsu.HandleArguments(file); } } } catch { } }
/// <summary> /// GEt anoter osu! client should it exist. /// </summary> /// <returns></returns> internal static InterProcessOsu GetRunningOsu() { try { using (SafeIpcChannel ipcCh = SafeIpcChannel.GetChannel()) { if (ipcCh == null) { return(null); } InterProcessOsu otherOsu = (InterProcessOsu)Activator.GetObject(typeof(InterProcessOsu), @"ipc://osu!/loader"); return(otherOsu); } } catch { return(null); } }