internal TournamentClient(SpriteManager spriteManager, float depth, short id)
        {
            this.id   = id;
            ipcClient = null;

            tryRecover();

            background = new pSprite(GameBase.WhitePixel, TournamentLayout.ClientPositions[id], depth, true, Color.TransparentWhite)
            {
                VectorScale = TournamentLayout.ClientSize, Field = Fields.Native
            };
            spriteManager.Add(background);

            FlashColour(Color.White);
        }
        private void tryRecover()
        {
            if (isRecovering)
            {
                return;
            }
            isRecovering = true;

            var osuProcs = Process.GetProcessesByName(@"osu!");

            if (!osuProcs.Any(p => p.MainWindowTitle.Contains($"Client {id}")))
            {
                ipcClient = null;
                GameBase.Scheduler.Add(() =>
                {
                    Process.Start(OsuMain.FilenameWithoutExtension, $@"-spectateclient {id}");
                    while (ipcClient == null)
                    {
                        try
                        {
                            Thread.Sleep(50);
                            ipcClient = (InterProcessOsu)Activator.GetObject(typeof(InterProcessOsu), $@"ipc://osu!-spectator-{id}/loader");
                            ipcClient.GetCurrentMode();
                        }
                        catch
                        {
                            ipcClient = null;
                        }
                    }

                    isRecovering = false;
                });
            }
            else
            {
                isRecovering = false;
            }
        }
示例#3
0
        private static void startup(string[] args)
        {
            //we can use the argument as the full path if it contains folders.
            //this is faster but not always available.
            string path = args[0].Trim('"');

            if (path.IndexOf(Path.DirectorySeparatorChar) >= 0)
            {
                fullPath = path;
            }

            if (args.Length > 1)
            {
                if (handleArgs(ref args))
                {
                    return;
                }
            }

            bool hasTournamentConfig = File.Exists(Tournament.CONFIG_FILENAME);
            bool hasDrawingsConfig   = File.Exists(Drawings.CONFIG_FILENAME);

            string fileArgs = args.Length > 1 ? string.Join(@" ", args, 1, args.Length - 1) : null;

            bool allowMultipleInstances = fileArgs != null || AllowMultipleInstances || hasTournamentConfig;

            try
            {
                try
                {
                    if (!allowMultipleInstances)
                    {
                        //attempt a wake-up if an existing osu! client is running.
                        InterProcessOsu osu = IPC.GetRunningOsu();
                        if (osu != null && osu.WakeUp())
                        {
                            return;
                        }
                    }
                }
                catch { }

                using (SingleInstance instance = new SingleInstance(ClientGuid, allowMultipleInstances ? -1 : 5000))
                {
                    try
                    {
                        if (!instance.IsFirstInstance && fileArgs != null)
                        {
                            IPC.HandleArguments(fileArgs);
                            return;
                        }

                        runGame(fileArgs, hasTournamentConfig && !GameBase.Tournament, hasDrawingsConfig);
                    }
                    catch (BadImageFormatException e)
                    {
                        handleBadImageFormat(e);
                    }
#if !DEBUG
                    catch { }
#endif
                }
            }
            catch (TooManyInstancesException)
            {
            }

            exitOrRestart();
        }
示例#4
0
 // Token: 0x06001D84 RID: 7556
 // RVA: 0x00018463 File Offset: 0x00016663
 public void method_0(InterProcessOsu.ClientData clientData_0)
 {
     this.int_0 = Math.Min(clientData_0.AudioTime, this.int_0);
 }