2019-01-24 16:43:03 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-11-28 17:45:17 +08:00
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.IO.Stores;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
using osu.Game.Scoring.Legacy;
|
|
|
|
|
|
|
|
namespace osu.Game.Scoring
|
|
|
|
{
|
|
|
|
public class LegacyDatabasedScore : Score
|
|
|
|
{
|
2018-11-30 14:18:52 +08:00
|
|
|
public LegacyDatabasedScore(ScoreInfo score, RulesetStore rulesets, BeatmapManager beatmaps, IResourceStore<byte[]> store)
|
2018-11-28 17:45:17 +08:00
|
|
|
{
|
2018-11-30 14:18:52 +08:00
|
|
|
ScoreInfo = score;
|
2018-11-28 17:45:17 +08:00
|
|
|
|
2018-11-30 14:18:52 +08:00
|
|
|
var replayFilename = score.Files.First(f => f.Filename.EndsWith(".osr", StringComparison.InvariantCultureIgnoreCase)).FileInfo.StoragePath;
|
2018-11-28 17:45:17 +08:00
|
|
|
|
|
|
|
using (var stream = store.GetStream(replayFilename))
|
|
|
|
Replay = new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream).Replay;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|