jellyfin-server/Emby.Drawing.ImageMagick/ImageHelpers.cs

44 lines
1.0 KiB
C#
Raw Normal View History

2015-05-11 16:32:15 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
2016-11-11 17:33:10 +00:00
namespace Emby.Drawing.ImageMagick
2015-05-11 16:32:15 +00:00
{
internal static class ImageHelpers
{
internal static List<string> ProjectPaths(List<string> paths, int count)
{
if (count <= 0)
{
throw new ArgumentOutOfRangeException("count");
}
if (paths.Count == 0)
{
throw new ArgumentOutOfRangeException("paths");
}
var list = new List<string>();
AddToList(list, paths, count);
return list.Take(count).ToList();
}
private static void AddToList(List<string> list, List<string> paths, int count)
{
while (list.Count < count)
{
foreach (var path in paths)
{
list.Add(path);
if (list.Count >= count)
{
return;
}
}
}
}
}
}