2021-11-25 07:36:30 +00: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.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-11-25 07:36:30 +00:00
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Platform;
|
|
|
|
using osu.Game.Extensions;
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Database
|
|
|
|
{
|
|
|
|
public class LegacyScoreExporter : LegacyExporter<ScoreInfo>
|
|
|
|
{
|
|
|
|
protected override string FileExtension => ".osr";
|
|
|
|
|
2021-11-25 09:36:01 +00:00
|
|
|
public LegacyScoreExporter(Storage storage)
|
|
|
|
: base(storage)
|
2021-11-25 07:36:30 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void ExportModelTo(ScoreInfo model, Stream outputStream)
|
|
|
|
{
|
|
|
|
var file = model.Files.SingleOrDefault();
|
|
|
|
if (file == null)
|
|
|
|
return;
|
|
|
|
|
2021-12-06 13:47:00 +00:00
|
|
|
using (var inputStream = UserFileStorage.GetStream(file.File.GetStoragePath()))
|
2021-11-25 07:36:30 +00:00
|
|
|
inputStream.CopyTo(outputStream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|