1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:43:00 +08:00

Merge pull request #21739 from integerrr/score-export-date

Append date to score export filename
This commit is contained in:
Dean Herbert 2023-01-10 23:33:38 +09:00 committed by GitHub
commit cde45cdd3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -33,13 +33,15 @@ namespace osu.Game.Database
UserFileStorage = storage.GetStorageForDirectory(@"files");
}
protected virtual string GetFilename(TModel item) => item.GetDisplayString();
/// <summary>
/// Exports an item to a legacy (.zip based) package.
/// </summary>
/// <param name="item">The item to export.</param>
public void Export(TModel item)
{
string itemFilename = item.GetDisplayString().GetValidFilename();
string itemFilename = GetFilename(item).GetValidFilename();
IEnumerable<string> existingExports = exportStorage.GetFiles("", $"{itemFilename}*{FileExtension}");

View File

@ -20,6 +20,14 @@ namespace osu.Game.Database
{
}
protected override string GetFilename(ScoreInfo score)
{
string scoreString = score.GetDisplayString();
string filename = $"{scoreString} ({score.Date.LocalDateTime:yyyy-MM-dd_HH-mm})";
return filename;
}
public override void ExportModelTo(ScoreInfo model, Stream outputStream)
{
var file = model.Files.SingleOrDefault();