Minor refactor to use yield return

This commit is contained in:
Malte Rosenbjerg 2025-10-17 15:08:13 +02:00
parent 1a49b4eec3
commit bfcb1b9544

View file

@ -70,17 +70,14 @@ public static class FFMpegDownloader
private static IEnumerable<string> ExtractZipAndSave(Stream zipStream, string binaryFolder) private static IEnumerable<string> ExtractZipAndSave(Stream zipStream, string binaryFolder)
{ {
using var archive = new ZipArchive(zipStream, ZipArchiveMode.Read); using var archive = new ZipArchive(zipStream, ZipArchiveMode.Read);
List<string> files = new();
foreach (var entry in archive.Entries) foreach (var entry in archive.Entries)
{ {
if (entry.Name is "ffmpeg" or "ffmpeg.exe" or "ffprobe.exe" or "ffprobe" or "ffplay.exe" or "ffplay") if (entry.Name is "ffmpeg" or "ffmpeg.exe" or "ffprobe.exe" or "ffprobe" or "ffplay.exe" or "ffplay")
{ {
var filePath = Path.Combine(binaryFolder, entry.Name); var filePath = Path.Combine(binaryFolder, entry.Name);
entry.ExtractToFile(filePath, true); entry.ExtractToFile(filePath, true);
files.Add(filePath); yield return filePath;
} }
} }
return files;
} }
} }