mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 20:42:54 +08:00
Fix imported beatmap paths not correctly matching files
This commit is contained in:
parent
ddff9882cf
commit
cffee1fd5e
@ -89,7 +89,7 @@ namespace osu.Game.Beatmaps
|
|||||||
protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (archive != null)
|
if (archive != null)
|
||||||
beatmapSet.Beatmaps = createBeatmapDifficulties(archive);
|
beatmapSet.Beatmaps = createBeatmapDifficulties(beatmapSet.Files);
|
||||||
|
|
||||||
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
||||||
{
|
{
|
||||||
@ -279,13 +279,13 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create all required <see cref="BeatmapInfo"/>s for the provided archive.
|
/// Create all required <see cref="BeatmapInfo"/>s for the provided archive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<BeatmapInfo> createBeatmapDifficulties(ArchiveReader reader)
|
private List<BeatmapInfo> createBeatmapDifficulties(List<BeatmapSetFileInfo> files)
|
||||||
{
|
{
|
||||||
var beatmapInfos = new List<BeatmapInfo>();
|
var beatmapInfos = new List<BeatmapInfo>();
|
||||||
|
|
||||||
foreach (var name in reader.Filenames.Where(f => f.EndsWith(".osu")))
|
foreach (var file in files.Where(f => f.Filename.EndsWith(".osu")))
|
||||||
{
|
{
|
||||||
using (var raw = reader.GetStream(name))
|
using (var raw = Files.Store.GetStream(file.FileInfo.StoragePath))
|
||||||
using (var ms = new MemoryStream()) //we need a memory stream so we can seek
|
using (var ms = new MemoryStream()) //we need a memory stream so we can seek
|
||||||
using (var sr = new StreamReader(ms))
|
using (var sr = new StreamReader(ms))
|
||||||
{
|
{
|
||||||
@ -295,7 +295,7 @@ namespace osu.Game.Beatmaps
|
|||||||
var decoder = Decoder.GetDecoder<Beatmap>(sr);
|
var decoder = Decoder.GetDecoder<Beatmap>(sr);
|
||||||
IBeatmap beatmap = decoder.Decode(sr);
|
IBeatmap beatmap = decoder.Decode(sr);
|
||||||
|
|
||||||
beatmap.BeatmapInfo.Path = name;
|
beatmap.BeatmapInfo.Path = file.Filename;
|
||||||
beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash();
|
beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash();
|
||||||
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
|
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user