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

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

            return(channel);
        }
Esempio 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 { }
        }
Esempio 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);
            }
        }