diff --git a/osu.Game/Database/LegacyExportManager.cs b/osu.Game/Database/LegacyExportManager.cs index 08594ab020..19fca623c5 100644 --- a/osu.Game/Database/LegacyExportManager.cs +++ b/osu.Game/Database/LegacyExportManager.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . 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 @@ using osu.Game.Skinning; namespace osu.Game.Database { + /// + /// A class which centrally manage legacy file exports. + /// [ExcludeFromDynamicCompile] public class LegacyExportManager : Component { @@ -26,7 +30,13 @@ namespace osu.Game.Database [Resolved] private INotificationOverlay? notifications { get; set; } - public async Task ExportAsync(IHasGuidPrimaryKey item) + /// + /// Identify the model type and and automatically assigned to the corresponding exporter. + /// + /// The model should export. + /// The stream if requires a specific output-stream + /// + public async Task ExportAsync(IHasGuidPrimaryKey item, Stream? stream = null) { var notification = new ProgressNotification { @@ -39,15 +49,15 @@ namespace osu.Game.Database 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; } } diff --git a/osu.Game/Database/LegacyModelExporter.cs b/osu.Game/Database/LegacyModelExporter.cs index a4b0f7ba9d..d734d3341c 100644 --- a/osu.Game/Database/LegacyModelExporter.cs +++ b/osu.Game/Database/LegacyModelExporter.cs @@ -48,6 +48,12 @@ namespace osu.Game.Database ShouldDisposeStream = false; } + /// + /// Export model to + /// if is null, model will export to default folder. + /// + /// The model which have Guid. + /// public virtual async Task ExportASync(IHasGuidPrimaryKey uuid) { Guid id = uuid.ID;