1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 16:12:57 +08:00

Add GetStream to IWorkingBeatmap

This is necessary to obtain the filesize of the audio and background files.
This commit is contained in:
Naxess 2021-04-17 17:47:13 +02:00
parent 448574e7e6
commit 400f8b3938
9 changed files with 21 additions and 0 deletions

View File

@ -168,6 +168,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
protected override Texture GetBackground() => throw new NotImplementedException();
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
}
}
}

View File

@ -52,6 +52,8 @@ namespace osu.Game.Tests
protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile));
public override Stream GetStream(string storagePath) => null;
protected override Track GetBeatmapTrack() => trackStore.Get(firstAudioFile);
private string firstAudioFile

View File

@ -526,6 +526,7 @@ namespace osu.Game.Beatmaps
protected override IBeatmap GetBeatmap() => beatmap;
protected override Texture GetBackground() => null;
protected override Track GetBeatmapTrack() => null;
public override Stream GetStream(string storagePath) => null;
}
}

View File

@ -4,6 +4,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.IO;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Framework.Logging;
@ -142,6 +143,8 @@ namespace osu.Game.Beatmaps
return null;
}
}
public override Stream GetStream(string storagePath) => resources.Files.GetStream(storagePath);
}
}
}

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using JetBrains.Annotations;
using osu.Framework.Audio;
@ -48,6 +49,8 @@ namespace osu.Game.Beatmaps
protected override Track GetBeatmapTrack() => GetVirtualTrack();
public override Stream GetStream(string storagePath) => null;
private class DummyRulesetInfo : RulesetInfo
{
public override Ruleset CreateInstance() => new DummyRuleset();

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -326,6 +327,8 @@ namespace osu.Game.Beatmaps
protected virtual ISkin GetSkin() => new DefaultSkin();
private readonly RecyclableLazy<ISkin> skin;
public abstract Stream GetStream(string storagePath);
public class RecyclableLazy<T>
{
private Lazy<T> lazy;

View File

@ -116,6 +116,8 @@ namespace osu.Game.Screens.Edit
protected override Texture GetBackground() => throw new NotImplementedException();
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
}
}
}

View File

@ -215,6 +215,8 @@ namespace osu.Game.Tests.Beatmaps
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
protected override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
{
var converter = base.CreateBeatmapConverter(beatmap, ruleset);

View File

@ -1,6 +1,7 @@
// 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 System.IO;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
@ -35,6 +36,8 @@ namespace osu.Game.Tests.Beatmaps
protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();
public override Stream GetStream(string storagePath) => null;
protected override Texture GetBackground() => null;
protected override Track GetBeatmapTrack() => null;