mirror of
https://github.com/ppy/osu
synced 2024-12-26 17:02:59 +00:00
Export legacy converted beatmaps as .osz and non-converted beatmaps as .osz2
This commit is contained in:
parent
2db25722cb
commit
b577b6b6ae
@ -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)
|
||||
{
|
||||
|
@ -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
osu.Game/Database/BeatmapExporter.cs
Normal file
18
osu.Game/Database/BeatmapExporter.cs
Normal 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";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user