Beispiel #1
0
        public void CheckIPCLocation()
        {
            // don't use clean run because files are being written before osu! launches.
            using (var host = new TestRunHeadlessGameHost(nameof(CheckIPCLocation), null))
            {
                string basePath = Path.Combine(host.UserStoragePaths.First(), nameof(CheckIPCLocation));

                // Set up a fake IPC client for the IPC Storage to switch to.
                string testStableInstallDirectory = Path.Combine(basePath, "stable-ce");
                Directory.CreateDirectory(testStableInstallDirectory);

                string ipcFile = Path.Combine(testStableInstallDirectory, "ipc.txt");
                File.WriteAllText(ipcFile, string.Empty);

                try
                {
                    var osu = LoadTournament(host);
                    TournamentStorage storage = (TournamentStorage)osu.Dependencies.Get <Storage>();
                    FileBasedIPC      ipc     = null;

                    WaitForOrAssert(() => (ipc = osu.Dependencies.Get <MatchIPCInfo>() as FileBasedIPC)?.IsLoaded == true, @"ipc could not be populated in a reasonable amount of time");

                    Assert.True(ipc.SetIPCLocation(testStableInstallDirectory));
                    Assert.True(storage.AllTournaments.Exists("stable.json"));
                }
                finally
                {
                    host.Exit();
                }
            }
        }
Beispiel #2
0
        private void load(TournamentStorage storage)
        {
            string startupTournament = storage.CurrentTournament.Value;

            dropdown.Current = storage.CurrentTournament;
            dropdown.Items   = storage.ListTournaments();
            dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true);

            Action = () => game.GracefullyExit();

            ButtonText = "Close osu!";
        }
Beispiel #3
0
        private void load(TournamentStorage storage)
        {
            Ladder.Ruleset.Value ??= rulesetStore.AvailableRulesets.First();

            match = CreateSampleMatch();

            Ladder.Rounds.Add(match.Round.Value);
            Ladder.Matches.Add(match);
            Ladder.Teams.Add(match.Team1.Value);
            Ladder.Teams.Add(match.Team2.Value);

            Ruleset.BindTo(Ladder.Ruleset);
            Dependencies.CacheAs(new StableInfo(storage));
        }
Beispiel #4
0
        public StableInfo(TournamentStorage storage)
        {
            configStorage = storage.AllTournaments;

            if (!configStorage.Exists(config_path))
            {
                return;
            }

            using (Stream stream = configStorage.GetStream(config_path, FileAccess.Read, FileMode.Open))
                using (var sr = new StreamReader(stream))
                {
                    JsonConvert.PopulateObject(sr.ReadToEnd(), this);
                }
        }
Beispiel #5
0
        private void load(TournamentStorage storage)
        {
            var stream = storage.GetStream($@"videos/{filename}");

            if (stream != null)
            {
                InternalChild = video = new Video(stream, false)
                {
                    RelativeSizeAxes = Axes.Both,
                    FillMode         = FillMode.Fit,
                    Clock            = new FramedClock(manualClock = new ManualClock()),
                    Loop             = loop,
                };
            }
            else if (drawFallbackGradient)
            {
                InternalChild = new Box
                {
                    Colour           = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
                    RelativeSizeAxes = Axes.Both,
                };
            }
        }