mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 14:52:55 +08:00
Fix serlialisation failure during ladder saving causing all existing file content to be deleted
This commit is contained in:
parent
5c7623e68e
commit
ef26b0ba8a
@ -269,17 +269,19 @@ 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();
|
||||||
|
|
||||||
|
string serialisedLadder = JsonConvert.SerializeObject(ladder,
|
||||||
|
new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
Formatting = Formatting.Indented,
|
||||||
|
NullValueHandling = NullValueHandling.Ignore,
|
||||||
|
DefaultValueHandling = DefaultValueHandling.Ignore,
|
||||||
|
Converters = new JsonConverter[] { new JsonPointConverter() }
|
||||||
|
});
|
||||||
|
|
||||||
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(JsonConvert.SerializeObject(ladder,
|
sw.Write(serialisedLadder);
|
||||||
new JsonSerializerSettings
|
|
||||||
{
|
|
||||||
Formatting = Formatting.Indented,
|
|
||||||
NullValueHandling = NullValueHandling.Ignore,
|
|
||||||
DefaultValueHandling = DefaultValueHandling.Ignore,
|
|
||||||
Converters = new JsonConverter[] { new JsonPointConverter() }
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user