Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public static SafeIpcChannel GetChannel()
        {
            SafeIpcChannel channel = null;

            try
            {
                channel = new SafeIpcChannel();
            }
            catch
            {
                if (channel != null)
                {
                    channel.Dispose();
                    channel = null;
                }
            }

            return(channel);
        }
Ejemplo n.º 3
0
        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 { }
        }
Ejemplo n.º 4
0
        /// <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);
            }
        }