mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 18:32:55 +08:00
fix code style and naming
This commit is contained in:
parent
d392d1a5c0
commit
272288c9aa
@ -33,7 +33,7 @@ namespace osu.Game.Database
|
||||
UserFileStorage = storage.GetStorageForDirectory(@"files");
|
||||
}
|
||||
|
||||
protected virtual string GetItemExportString(TModel item) => item.GetDisplayString().GetValidFilename();
|
||||
protected virtual string GetFilename(TModel item) => item.GetDisplayString();
|
||||
|
||||
/// <summary>
|
||||
/// Exports an item to a legacy (.zip based) package.
|
||||
@ -41,9 +41,11 @@ namespace osu.Game.Database
|
||||
/// <param name="item">The item to export.</param>
|
||||
public void Export(TModel item)
|
||||
{
|
||||
IEnumerable<string> existingExports = exportStorage.GetFiles("", $"{GetItemExportString(item)}*{FileExtension}");
|
||||
string itemFilename = GetFilename(item).GetValidFilename();
|
||||
|
||||
string filename = NamingUtils.GetNextBestFilename(existingExports, $"{GetItemExportString(item)}{FileExtension}");
|
||||
IEnumerable<string> existingExports = exportStorage.GetFiles("", $"{itemFilename}*{FileExtension}");
|
||||
|
||||
string filename = NamingUtils.GetNextBestFilename(existingExports, $"{itemFilename}{FileExtension}");
|
||||
using (var stream = exportStorage.CreateFileSafely(filename))
|
||||
ExportModelTo(item, stream);
|
||||
|
||||
|
@ -20,12 +20,12 @@ namespace osu.Game.Database
|
||||
{
|
||||
}
|
||||
|
||||
protected override string GetItemExportString(ScoreInfo score)
|
||||
protected override string GetFilename(ScoreInfo score)
|
||||
{
|
||||
string scoreString = score.GetDisplayString();
|
||||
string filename = $"{scoreString} ({score.Date.LocalDateTime:yyyy-MM-dd})";
|
||||
|
||||
return filename.GetValidFilename();
|
||||
return filename;
|
||||
}
|
||||
|
||||
public override void ExportModelTo(ScoreInfo model, Stream outputStream)
|
||||
|
Loading…
Reference in New Issue
Block a user