mirror of
https://github.com/ppy/osu.git
synced 2025-03-24 04:49:28 +08:00
Fix checks disallowing import of older beatmaps with no embedded online IDs
This commit is contained in:
parent
5330ca1fa9
commit
2e1dfa16a2
@ -497,15 +497,21 @@ namespace osu.Game.Beatmaps
|
|||||||
using (var stream = new StreamReader(reader.GetStream(mapName)))
|
using (var stream = new StreamReader(reader.GetStream(mapName)))
|
||||||
metadata = Decoder.GetDecoder(stream).DecodeBeatmap(stream).Metadata;
|
metadata = Decoder.GetDecoder(stream).DecodeBeatmap(stream).Metadata;
|
||||||
|
|
||||||
|
|
||||||
// check if a set already exists with the same online id.
|
// check if a set already exists with the same online id.
|
||||||
beatmapSet = beatmaps.BeatmapSets.FirstOrDefault(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID) ?? new BeatmapSetInfo
|
if (metadata.OnlineBeatmapSetID != null)
|
||||||
{
|
beatmapSet = beatmaps.BeatmapSets.FirstOrDefault(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID);
|
||||||
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
|
|
||||||
Beatmaps = new List<BeatmapInfo>(),
|
if (beatmapSet == null)
|
||||||
Hash = hash,
|
beatmapSet = new BeatmapSetInfo
|
||||||
Files = fileInfos,
|
{
|
||||||
Metadata = metadata
|
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
|
||||||
};
|
Beatmaps = new List<BeatmapInfo>(),
|
||||||
|
Hash = hash,
|
||||||
|
Files = fileInfos,
|
||||||
|
Metadata = metadata
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu"));
|
var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu"));
|
||||||
|
|
||||||
@ -525,7 +531,7 @@ namespace osu.Game.Beatmaps
|
|||||||
beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash();
|
beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash();
|
||||||
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
|
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
|
||||||
|
|
||||||
var existing = beatmaps.Beatmaps.FirstOrDefault(b => b.Hash == beatmap.BeatmapInfo.Hash || b.OnlineBeatmapID == beatmap.BeatmapInfo.OnlineBeatmapID);
|
var existing = beatmaps.Beatmaps.FirstOrDefault(b => b.Hash == beatmap.BeatmapInfo.Hash || (beatmap.BeatmapInfo.OnlineBeatmapID != null && b.OnlineBeatmapID == beatmap.BeatmapInfo.OnlineBeatmapID));
|
||||||
|
|
||||||
if (existing == null)
|
if (existing == null)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user