Resolve review comments

This commit is contained in:
Craftplacer
2020-08-23 15:08:02 +02:00
parent cfd82104db
commit e6646b9877
9 changed files with 59 additions and 42 deletions

View File

@ -195,8 +195,8 @@ namespace osu.Game.Beatmaps
/// </summary>
/// <param name="info">The <see cref="BeatmapInfo"/> to save the content against. The file referenced by <see cref="BeatmapInfo.Path"/> will be replaced.</param>
/// <param name="beatmapContent">The <see cref="IBeatmap"/> content to write.</param>
/// <param name="skin">Optional beatmap skin for inline skin configuration in beatmap files.</param>
public void Save(BeatmapInfo info, IBeatmap beatmapContent, ISkin skin)
/// <param name="beatmapSkin">The beatmap <see cref="ISkin"/> content to write, or null if not to be changed.</param>
public void Save(BeatmapInfo info, IBeatmap beatmapContent, LegacyBeatmapSkin beatmapSkin = null)
{
var setInfo = QueryBeatmapSet(s => s.Beatmaps.Any(b => b.ID == info.ID));
@ -204,7 +204,13 @@ namespace osu.Game.Beatmaps
{
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
{
new LegacyBeatmapEncoder(beatmapContent, skin).Encode(sw);
if (beatmapSkin == null)
{
var workingBeatmap = GetWorkingBeatmap(info);
beatmapSkin = (workingBeatmap.Skin is LegacyBeatmapSkin legacy) ? legacy : null;
}
new LegacyBeatmapEncoder(beatmapContent, beatmapSkin).Encode(sw);
}
stream.Seek(0, SeekOrigin.Begin);