mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Load beatmap data from an optional osb file.
This commit is contained in:
@ -26,8 +26,9 @@ namespace osu.Game.Beatmaps.IO
|
||||
private Stream archiveStream;
|
||||
private ZipFile archive;
|
||||
private string[] beatmaps;
|
||||
private string storyboard;
|
||||
private Beatmap firstMap;
|
||||
|
||||
|
||||
public OszArchiveReader(Stream archiveStream)
|
||||
{
|
||||
this.archiveStream = archiveStream;
|
||||
@ -36,6 +37,8 @@ namespace osu.Game.Beatmaps.IO
|
||||
.Select(e => e.FileName).ToArray();
|
||||
if (beatmaps.Length == 0)
|
||||
throw new FileNotFoundException(@"This directory contains no beatmaps");
|
||||
storyboard = archive.Entries.Where(e => e.FileName.EndsWith(@".osb"))
|
||||
.Select(e => e.FileName).FirstOrDefault();
|
||||
using (var stream = new StreamReader(GetStream(beatmaps[0])))
|
||||
{
|
||||
var decoder = BeatmapDecoder.GetDecoder(stream);
|
||||
@ -48,6 +51,11 @@ namespace osu.Game.Beatmaps.IO
|
||||
return beatmaps;
|
||||
}
|
||||
|
||||
public override string ReadStoryboard()
|
||||
{
|
||||
return storyboard;
|
||||
}
|
||||
|
||||
public override Stream GetStream(string name)
|
||||
{
|
||||
ZipEntry entry = archive.Entries.SingleOrDefault(e => e.FileName == name);
|
||||
|
Reference in New Issue
Block a user