mirror of
https://github.com/osukey/osukey.git
synced 2025-06-29 23:28:00 +09:00
Inline single usage of StoryboardFile
to avoid interface default method woes
This commit is contained in:
parent
8bfdfe3672
commit
4df5f93152
@ -107,12 +107,14 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
var decoder = Decoder.GetDecoder<Storyboard>(stream);
|
var decoder = Decoder.GetDecoder<Storyboard>(stream);
|
||||||
|
|
||||||
|
var storyboardFilename = BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename;
|
||||||
|
|
||||||
// todo: support loading from both set-wide storyboard *and* beatmap specific.
|
// todo: support loading from both set-wide storyboard *and* beatmap specific.
|
||||||
if (BeatmapSetInfo?.StoryboardFile == null)
|
if (string.IsNullOrEmpty(storyboardFilename))
|
||||||
storyboard = decoder.Decode(stream);
|
storyboard = decoder.Decode(stream);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using (var secondaryStream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(BeatmapSetInfo.StoryboardFile))))
|
using (var secondaryStream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(storyboardFilename))))
|
||||||
storyboard = decoder.Decode(stream, secondaryStream);
|
storyboard = decoder.Decode(stream, secondaryStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
|
||||||
@ -62,9 +61,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public string Hash { get; set; }
|
public string Hash { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string StoryboardFile => ((IBeatmapSetInfo)this).StoryboardFile;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the storage path for the file in this beatmapset with the given filename, if any exists, otherwise null.
|
/// Returns the storage path for the file in this beatmapset with the given filename, if any exists, otherwise null.
|
||||||
/// The path returned is relative to the user file storage.
|
/// The path returned is relative to the user file storage.
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
@ -49,10 +48,5 @@ namespace osu.Game.Beatmaps
|
|||||||
/// The maximum BPM of all beatmaps in this set.
|
/// The maximum BPM of all beatmaps in this set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double MaxBPM { get; }
|
double MaxBPM { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The filename for the storyboard.
|
|
||||||
/// </summary>
|
|
||||||
string StoryboardFile => Files.FirstOrDefault(f => f.Filename.EndsWith(@".osb", StringComparison.OrdinalIgnoreCase))?.Filename ?? string.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user