jellyfin/Emby.Drawing.ImageMagick/ImageHelpers.cs

44 lines
1 KiB
C#
Raw Normal View History

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