mirror of
https://github.com/osukey/osukey.git
synced 2025-06-27 22:27:57 +09:00
Merge pull request #13370 from smoogipoo/beatmap-collections-safeguard
Attempt to safeguard against collections database corruptions
This commit is contained in:
commit
be53b521fc
@ -264,14 +264,18 @@ namespace osu.Game.Collections
|
|||||||
using (var sw = new SerializationWriter(storage.GetStream(database_name, FileAccess.Write)))
|
using (var sw = new SerializationWriter(storage.GetStream(database_name, FileAccess.Write)))
|
||||||
{
|
{
|
||||||
sw.Write(database_version);
|
sw.Write(database_version);
|
||||||
sw.Write(Collections.Count);
|
|
||||||
|
|
||||||
foreach (var c in Collections)
|
var collectionsCopy = Collections.ToArray();
|
||||||
|
sw.Write(collectionsCopy.Length);
|
||||||
|
|
||||||
|
foreach (var c in collectionsCopy)
|
||||||
{
|
{
|
||||||
sw.Write(c.Name.Value);
|
sw.Write(c.Name.Value);
|
||||||
sw.Write(c.Beatmaps.Count);
|
|
||||||
|
|
||||||
foreach (var b in c.Beatmaps)
|
var beatmapsCopy = c.Beatmaps.ToArray();
|
||||||
|
sw.Write(beatmapsCopy.Length);
|
||||||
|
|
||||||
|
foreach (var b in beatmapsCopy)
|
||||||
sw.Write(b.MD5Hash);
|
sw.Write(b.MD5Hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user