1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 15:40:14 +08:00

Export legacy converted beatmaps as .osz and non-converted beatmaps as .osz2

This commit is contained in:
OliBomby
2023-07-11 21:04:09 +02:00
Unverified
parent 2db25722cb
commit b577b6b6ae
3 changed files with 30 additions and 5 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps
/// </summary>
public class BeatmapImporter : RealmArchiveModelImporter<BeatmapSetInfo>
{
public override IEnumerable<string> HandledExtensions => new[] { ".osz" };
public override IEnumerable<string> HandledExtensions => new[] { ".osz", ".osz2" };
protected override string[] HashableFileTypes => new[] { ".osu" };
@@ -145,7 +145,7 @@ namespace osu.Game.Beatmaps
}
}
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path).ToLowerInvariant() == ".osz";
protected override bool ShouldDeleteArchive(string path) => HandledExtensions.Contains(Path.GetExtension(path).ToLowerInvariant());
protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader? archive, Realm realm, CancellationToken cancellationToken = default)
{
+10 -3
View File
@@ -44,7 +44,9 @@ namespace osu.Game.Beatmaps
private readonly WorkingBeatmapCache workingBeatmapCache;
private readonly LegacyBeatmapExporter beatmapExporter;
private readonly BeatmapExporter beatmapExporter;
private readonly LegacyBeatmapExporter legacyBeatmapExporter;
public ProcessBeatmapDelegate? ProcessBeatmap { private get; set; }
@@ -81,7 +83,12 @@ namespace osu.Game.Beatmaps
workingBeatmapCache = CreateWorkingBeatmapCache(audioManager, gameResources, userResources, defaultBeatmap, host);
beatmapExporter = new LegacyBeatmapExporter(storage)
beatmapExporter = new BeatmapExporter(storage)
{
PostNotification = obj => PostNotification?.Invoke(obj)
};
legacyBeatmapExporter = new LegacyBeatmapExporter(storage)
{
PostNotification = obj => PostNotification?.Invoke(obj)
};
@@ -443,7 +450,7 @@ namespace osu.Game.Beatmaps
});
}
return beatmapExporter.ExportAsync(new RealmLiveUnmanaged<BeatmapSetInfo>(clone));
return legacyBeatmapExporter.ExportAsync(new RealmLiveUnmanaged<BeatmapSetInfo>(clone));
}
private void convertAndEncodeLegacyBeatmap(IBeatmap beatmapContent, ISkin beatmapSkin, Stream stream)
+18
View File
@@ -0,0 +1,18 @@
// 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 osu.Framework.Platform;
using osu.Game.Beatmaps;
namespace osu.Game.Database
{
public class BeatmapExporter : LegacyArchiveExporter<BeatmapSetInfo>
{
public BeatmapExporter(Storage storage)
: base(storage)
{
}
protected override string FileExtension => @".osz2";
}
}