mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Add comment
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -14,6 +15,9 @@ using osu.Game.Skinning;
|
|||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A class which centrally manage legacy file exports.
|
||||||
|
/// </summary>
|
||||||
[ExcludeFromDynamicCompile]
|
[ExcludeFromDynamicCompile]
|
||||||
public class LegacyExportManager : Component
|
public class LegacyExportManager : Component
|
||||||
{
|
{
|
||||||
@ -26,7 +30,13 @@ namespace osu.Game.Database
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private INotificationOverlay? notifications { get; set; }
|
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
|
var notification = new ProgressNotification
|
||||||
{
|
{
|
||||||
@ -39,15 +49,15 @@ namespace osu.Game.Database
|
|||||||
switch (item)
|
switch (item)
|
||||||
{
|
{
|
||||||
case SkinInfo:
|
case SkinInfo:
|
||||||
await new LegacySkinExporter(exportStorage, realmAccess, notification).ExportASync(item);
|
await new LegacySkinExporter(exportStorage, realmAccess, notification, stream).ExportASync(item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScoreInfo:
|
case ScoreInfo:
|
||||||
await new LegacyScoreExporter(exportStorage, realmAccess, notification).ExportASync(item);
|
await new LegacyScoreExporter(exportStorage, realmAccess, notification, stream).ExportASync(item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BeatmapSetInfo:
|
case BeatmapSetInfo:
|
||||||
await new LegacyBeatmapExporter(exportStorage, realmAccess, notification).ExportASync(item);
|
await new LegacyBeatmapExporter(exportStorage, realmAccess, notification, stream).ExportASync(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,12 @@ namespace osu.Game.Database
|
|||||||
ShouldDisposeStream = false;
|
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)
|
public virtual async Task ExportASync(IHasGuidPrimaryKey uuid)
|
||||||
{
|
{
|
||||||
Guid id = uuid.ID;
|
Guid id = uuid.ID;
|
||||||
|
Reference in New Issue
Block a user