Core - Add ResourcePackImporter.cs

This commit is contained in:
miku-666
2025-12-02 19:20:35 +01:00
parent 440dadec35
commit 8a8c4330fd
28 changed files with 3384 additions and 126 deletions

View File

@@ -17,17 +17,22 @@ namespace PckStudio.Core.Extensions
yield break;
}
public static ImageList ToImageList(this Image[] images)
public static ImageList ToImageList(this IEnumerable<Image> images)
{
ImageList imageList = new ImageList
{
ColorDepth = ColorDepth.Depth32Bit
};
imageList.Images.AddRange(images);
imageList.Images.AddRange(images.ToArray());
return imageList;
}
public static string ToString<T>(this IEnumerable<T> range, string seperator)
=> range
.Select(t => t.ToString())
.Aggregate((res, next) => string.IsNullOrWhiteSpace(next) ? res : res + seperator + next);
public static bool EqualsAny<T>(this T type, params T[] items)
{
foreach (T item in items)
@@ -38,14 +43,6 @@ namespace PckStudio.Core.Extensions
return false;
}
public static bool ContainsAny<T>(this IEnumerable<T> array, params T[] items)
{
foreach (T item in array)
{
if (items.Contains(item))
return true;
}
return false;
}
public static bool ContainsAny<T>(this IEnumerable<T> source, params T[] items) => source.Any(t => items.Contains(t));
}
}