ImageHelpers.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace Emby.Drawing.Net
  5. {
  6. internal static class ImageHelpers
  7. {
  8. internal static List<string> ProjectPaths(List<string> paths, int count)
  9. {
  10. if (count <= 0)
  11. {
  12. throw new ArgumentOutOfRangeException("count");
  13. }
  14. if (paths.Count == 0)
  15. {
  16. throw new ArgumentOutOfRangeException("paths");
  17. }
  18. var list = new List<string>();
  19. AddToList(list, paths, count);
  20. return list.Take(count).ToList();
  21. }
  22. private static void AddToList(List<string> list, List<string> paths, int count)
  23. {
  24. while (list.Count < count)
  25. {
  26. foreach (var path in paths)
  27. {
  28. list.Add(path);
  29. if (list.Count >= count)
  30. {
  31. return;
  32. }
  33. }
  34. }
  35. }
  36. }
  37. }