Add comment

This commit is contained in:
cdwcgt 2022-11-19 12:34:35 +09:00
parent 4e457871f3
commit 28867fbbb1
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2
2 changed files with 20 additions and 4 deletions

View File

@ -1,6 +1,7 @@
// 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.
using System.IO;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -14,6 +15,9 @@
namespace osu.Game.Database
{
/// <summary>
/// A class which centrally manage legacy file exports.
/// </summary>
[ExcludeFromDynamicCompile]
public class LegacyExportManager : Component
{
@ -26,7 +30,13 @@ public class LegacyExportManager : Component
[Resolved]
private INotificationOverlay? notifications { get; set; }
public async Task ExportAsync(IHasGuidPrimaryKey item)
/// <summary>
/// Identify the model type and and automatically assigned to the corresponding exporter.
/// </summary>
/// <param name="item">The model should export.</param>
/// <param name="stream">The stream if requires a specific output-stream</param>
/// <returns></returns>
public async Task ExportAsync(IHasGuidPrimaryKey item, Stream? stream = null)
{
var notification = new ProgressNotification
{
@ -39,15 +49,15 @@ public async Task ExportAsync(IHasGuidPrimaryKey item)
switch (item)
{
case SkinInfo:
await new LegacySkinExporter(exportStorage, realmAccess, notification).ExportASync(item);
await new LegacySkinExporter(exportStorage, realmAccess, notification, stream).ExportASync(item);
break;
case ScoreInfo:
await new LegacyScoreExporter(exportStorage, realmAccess, notification).ExportASync(item);
await new LegacyScoreExporter(exportStorage, realmAccess, notification, stream).ExportASync(item);
break;
case BeatmapSetInfo:
await new LegacyBeatmapExporter(exportStorage, realmAccess, notification).ExportASync(item);
await new LegacyBeatmapExporter(exportStorage, realmAccess, notification, stream).ExportASync(item);
break;
}
}

View File

@ -48,6 +48,12 @@ protected LegacyModelExporter(Storage storage, RealmAccess realm, ProgressNotifi
ShouldDisposeStream = false;
}
/// <summary>
/// Export model to <see cref="OutputStream"/>
/// if <see cref="OutputStream"/> is null, model will export to default folder.
/// </summary>
/// <param name="uuid">The model which have Guid.</param>
/// <returns></returns>
public virtual async Task ExportASync(IHasGuidPrimaryKey uuid)
{
Guid id = uuid.ID;