From 7a82b99417217051f3329c53590e4f930ddf24ca Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 28 Nov 2018 17:02:14 +0900 Subject: [PATCH] Add storage for a few more parsed fields --- osu.Game/Scoring/Legacy/LegacyScoreParser.cs | 20 ++++++++------------ osu.Game/Scoring/Score.cs | 6 ++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs index 9a683cf555..60c7b03cf2 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs @@ -30,17 +30,13 @@ namespace osu.Game.Scoring.Legacy currentRuleset = GetRuleset(sr.ReadByte()); score = new Score { Ruleset = currentRuleset.RulesetInfo }; - /* score.Pass = true;*/ var version = sr.ReadInt32(); - /* score.FileChecksum = */ currentBeatmap = GetBeatmap(sr.ReadString()).Beatmap; score.Beatmap = currentBeatmap.BeatmapInfo; - /* score.PlayerName = */ score.User = new User { Username = sr.ReadString() }; - /* var localScoreChecksum = */ - sr.ReadString(); + score.MD5Hash = sr.ReadString(); var count300 = sr.ReadUInt16(); var count100 = sr.ReadUInt16(); @@ -58,23 +54,23 @@ namespace osu.Game.Scoring.Legacy score.TotalScore = sr.ReadInt32(); score.MaxCombo = sr.ReadUInt16(); + /* score.Perfect = */ sr.ReadBoolean(); - /* score.EnabledMods = (Mods)*/ + score.Mods = currentRuleset.ConvertLegacyMods((LegacyMods)sr.ReadInt32()).ToArray(); + /* score.HpGraphString = */ sr.ReadString(); - /* score.Date = */ - sr.ReadDateTime(); + + score.Date = sr.ReadDateTime(); var compressedReplay = sr.ReadByteArray(); if (version >= 20140721) - /*OnlineId =*/ - sr.ReadInt64(); + score.OnlineScoreID = sr.ReadInt64(); else if (version >= 20121008) - /*OnlineId =*/ - sr.ReadInt32(); + score.OnlineScoreID = sr.ReadInt32(); switch (score.Ruleset.ID) { diff --git a/osu.Game/Scoring/Score.cs b/osu.Game/Scoring/Score.cs index 36f37f5d7a..5d3e05f006 100644 --- a/osu.Game/Scoring/Score.cs +++ b/osu.Game/Scoring/Score.cs @@ -73,6 +73,12 @@ namespace osu.Game.Scoring public Dictionary Statistics = new Dictionary(); + /// + /// MD5 is kept for legacy support. + /// + [JsonProperty("file_md5")] + public string MD5Hash { get; set; } + public List Files { get; set; } public bool DeletePending { get; set; }