protected override Storyboard GetStoryboard() { Storyboard storyboard; try { using (var stream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path)))) { var decoder = Decoder.GetDecoder <Storyboard>(stream); // todo: support loading from both set-wide storyboard *and* beatmap specific. if (BeatmapSetInfo?.StoryboardFile == null) { storyboard = decoder.Decode(stream); } else { using (var secondaryStream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(BeatmapSetInfo.StoryboardFile)))) storyboard = decoder.Decode(stream, secondaryStream); } } } catch (Exception e) { Logger.Error(e, "Storyboard failed to load"); storyboard = new Storyboard(); } storyboard.BeatmapInfo = BeatmapInfo; return(storyboard); }
protected override Storyboard GetStoryboard() { Storyboard storyboard; try { using (var stream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path)))) { var decoder = Decoder.GetDecoder <Storyboard>(stream); string storyboardFilename = BeatmapSetInfo?.Files.FirstOrDefault(f => f.Filename.EndsWith(".osb", StringComparison.OrdinalIgnoreCase))?.Filename; // todo: support loading from both set-wide storyboard *and* beatmap specific. if (string.IsNullOrEmpty(storyboardFilename)) { storyboard = decoder.Decode(stream); } else { using (var secondaryStream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(storyboardFilename)))) storyboard = decoder.Decode(stream, secondaryStream); } } } catch (Exception e) { Logger.Error(e, "Storyboard failed to load"); storyboard = new Storyboard(); } storyboard.BeatmapInfo = BeatmapInfo; return(storyboard); }
protected override Track GetBeatmapTrack() { if (Metadata?.AudioFile == null) { return(null); } try { return(resources.Tracks.Get(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile))); } catch (Exception e) { Logger.Error(e, "Track failed to load"); return(null); } }
protected override bool BackgroundStillValid(Texture b) => false; // bypass lazy logic. we want to return a new background each time for refcounting purposes. protected override Texture GetBackground() { if (Metadata?.BackgroundFile == null) { return(null); } try { return(resources.LargeTextureStore.Get(BeatmapSetInfo.GetPathForFile(Metadata.BackgroundFile))); } catch (Exception e) { Logger.Error(e, "Background failed to load"); return(null); } }
protected override Waveform GetWaveform() { if (Metadata?.AudioFile == null) { return(null); } try { var trackData = GetStream(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile)); return(trackData == null ? null : new Waveform(trackData)); } catch (Exception e) { Logger.Error(e, "Waveform failed to load"); return(null); } }
protected override IBeatmap GetBeatmap() { if (BeatmapInfo.Path == null) { return new Beatmap { BeatmapInfo = BeatmapInfo } } ; try { using (var stream = new LineBufferedReader(GetStream(BeatmapSetInfo.GetPathForFile(BeatmapInfo.Path)))) return(Decoder.GetDecoder <Beatmap>(stream).Decode(stream)); } catch (Exception e) { Logger.Error(e, "Beatmap failed to load"); return(null); } }
protected override Track GetBeatmapTrack() { if (string.IsNullOrEmpty(Metadata?.AudioFile)) { return(null); } if (Metadata.AudioFile == virtual_track_filename) { return(null); } try { return(resources.Tracks.Get(BeatmapSetInfo.GetPathForFile(Metadata.AudioFile))); } catch (Exception e) { Logger.Error(e, "Track failed to load"); return(null); } }