mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Add mention of why the serialisation happens outside stream usage
This commit is contained in:
@ -269,6 +269,7 @@ namespace osu.Game.Tournament
|
|||||||
ladder.Matches.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true)))
|
ladder.Matches.Where(p => p.LosersProgression.Value != null).Select(p => new TournamentProgression(p.ID, p.LosersProgression.Value.ID, true)))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
// Serialise before opening stream for writing, so if there's a failure it will leave the file in the previous state.
|
||||||
string serialisedLadder = JsonConvert.SerializeObject(ladder,
|
string serialisedLadder = JsonConvert.SerializeObject(ladder,
|
||||||
new JsonSerializerSettings
|
new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
@ -280,10 +281,8 @@ namespace osu.Game.Tournament
|
|||||||
|
|
||||||
using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create))
|
using (var stream = storage.GetStream(bracket_filename, FileAccess.Write, FileMode.Create))
|
||||||
using (var sw = new StreamWriter(stream))
|
using (var sw = new StreamWriter(stream))
|
||||||
{
|
|
||||||
sw.Write(serialisedLadder);
|
sw.Write(serialisedLadder);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected override UserInputManager CreateUserInputManager() => new TournamentInputManager();
|
protected override UserInputManager CreateUserInputManager() => new TournamentInputManager();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user