Only check each video file once

This commit is contained in:
Naxesss
2021-10-11 13:55:50 +02:00
parent 6aa054b5fa
commit f0cd18a721

View File

@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Edit.Checks
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
{
var beatmapSet = context.Beatmap.BeatmapInfo.BeatmapSet;
var videoPaths = new List<string>();
foreach (var layer in context.WorkingBeatmap.Storyboard.Layers)
{
@ -32,7 +33,14 @@ namespace osu.Game.Rulesets.Edit.Checks
if (!(element is StoryboardVideo video))
continue;
string filename = video.Path;
// Ensures we don't check the same video file multiple times in case of multiple elements using it.
if (!videoPaths.Contains(video.Path))
videoPaths.Add(video.Path);
}
}
foreach (var filename in videoPaths)
{
string storagePath = beatmapSet.GetPathForFile(filename);
if (storagePath == null)
@ -52,7 +60,6 @@ namespace osu.Game.Rulesets.Edit.Checks
yield return new IssueTemplateHasAudioTrack(this).Create(filename);
}
}
}
public class IssueTemplateHasAudioTrack : IssueTemplate
{