mirror of
https://github.com/ppy/osu.git
synced 2024-11-12 03:57:25 +08:00
Merge pull request #12290 from MiraiSubject/ipc-incorrect-read
This commit is contained in:
commit
47c0e672d6
@ -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();
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user