diff --git a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs index 943b62a4fa..9c1c631566 100644 --- a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs +++ b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs @@ -121,10 +121,8 @@ namespace osu.Game.Tests.Scores.IO } } - private ScoreInfo loadIntoOsu(OsuGameBase osu, ScoreInfo score, string guidOverride = null) + private ScoreInfo loadIntoOsu(OsuGameBase osu, ScoreInfo score) { - score.MD5Hash = guidOverride ?? Guid.NewGuid().ToString(); - var beatmapManager = osu.Dependencies.Get(); score.Beatmap = beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First(); @@ -133,9 +131,7 @@ namespace osu.Game.Tests.Scores.IO var scoreManager = osu.Dependencies.Get(); scoreManager.Import(score); - var imported = scoreManager.Query(s => s.MD5Hash == score.MD5Hash); - - return imported; + return scoreManager.GetAllUsableScores().First(); } private string createTemporaryBeatmap() diff --git a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs index edc8ed65d8..caa32020cc 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs @@ -46,7 +46,9 @@ namespace osu.Game.Scoring.Legacy score.ScoreInfo.Beatmap = currentBeatmap.BeatmapInfo; score.ScoreInfo.User = score.Replay.User = new User { Username = sr.ReadString() }; - score.ScoreInfo.MD5Hash = sr.ReadString(); + + // MD5Hash + sr.ReadString(); var count300 = (int)sr.ReadUInt16(); var count100 = (int)sr.ReadUInt16(); diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index bd8a8901d7..2f1c924707 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -110,14 +110,10 @@ namespace osu.Game.Scoring } } - /// - /// MD5 is kept for legacy support. - /// - [JsonProperty("file_md5")] - public string MD5Hash { get; set; } - public List Files { get; set; } + public string Hash { get; set; } + public bool DeletePending { get; set; } [Serializable] diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 5d16d40346..a2f156f6c3 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -20,20 +20,18 @@ namespace osu.Game.Scoring { public override string[] HandledExtensions => new[] { ".osr" }; + protected override string[] HashableFileTypes => new[] { ".osr" }; + protected override string ImportFromStablePath => "Replays"; private readonly RulesetStore rulesets; private readonly BeatmapManager beatmaps; - private readonly ScoreStore scores; - public ScoreManager(RulesetStore rulesets, BeatmapManager beatmaps, Storage storage, IDatabaseContextFactory contextFactory, IIpcHost importHost = null) : base(storage, contextFactory, new ScoreStore(contextFactory, storage), importHost) { this.rulesets = rulesets; this.beatmaps = beatmaps; - - scores = (ScoreStore)ModelStore; } protected override ScoreInfo CreateModel(ArchiveReader archive) @@ -55,18 +53,6 @@ namespace osu.Game.Scoring } } - protected override ScoreInfo CheckForExisting(ScoreInfo model) - { - var existingHashMatch = scores.ConsumableItems.FirstOrDefault(s => s.MD5Hash != null && s.MD5Hash == model.MD5Hash); - if (existingHashMatch != null) - { - Undelete(existingHashMatch); - return existingHashMatch; - } - - return null; - } - public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps, Files.Store); public List GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList();