1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Merge pull request #12290 from MiraiSubject/ipc-incorrect-read

This commit is contained in:
Bartłomiej Dach 2021-04-04 15:39:02 +02:00 committed by GitHub
commit 47c0e672d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Tests.Visual;
using osu.Game.Tournament.IO;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models;
using osu.Game.Users;
@ -28,7 +29,7 @@ namespace osu.Game.Tournament.Tests
protected MatchIPCInfo IPCInfo { get; private set; } = new MatchIPCInfo();
[BackgroundDependencyLoader]
private void load(Storage storage)
private void load(TournamentStorage storage)
{
Ladder.Ruleset.Value ??= rulesetStore.AvailableRulesets.First();

View File

@ -27,17 +27,16 @@ namespace osu.Game.Tournament.Models
private const string config_path = "stable.json";
private readonly Storage storage;
private readonly Storage configStorage;
public StableInfo(Storage storage)
public StableInfo(TournamentStorage storage)
{
TournamentStorage tStorage = (TournamentStorage)storage;
this.storage = tStorage.AllTournaments;
configStorage = storage.AllTournaments;
if (!storage.Exists(config_path))
if (!configStorage.Exists(config_path))
return;
using (Stream stream = storage.GetStream(config_path, FileAccess.Read, FileMode.Open))
using (Stream stream = configStorage.GetStream(config_path, FileAccess.Read, FileMode.Open))
using (var sr = new StreamReader(stream))
{
JsonConvert.PopulateObject(sr.ReadToEnd(), this);
@ -46,7 +45,7 @@ namespace osu.Game.Tournament.Models
public void SaveChanges()
{
using (var stream = storage.GetStream(config_path, FileAccess.Write, FileMode.Create))
using (var stream = configStorage.GetStream(config_path, FileAccess.Write, FileMode.Create))
using (var sw = new StreamWriter(stream))
{
sw.Write(JsonConvert.SerializeObject(this,