diff --git a/PCK-Studio/Extensions/SkinBOXExtensions.cs b/PCK-Studio/Extensions/SkinBOXExtensions.cs index 37af2c50..7a403099 100644 --- a/PCK-Studio/Extensions/SkinBOXExtensions.cs +++ b/PCK-Studio/Extensions/SkinBOXExtensions.cs @@ -67,14 +67,12 @@ namespace PckStudio.Extensions return SkinBOX.BaseTypes.IndexInRange(index) ? SkinBOX.BaseTypes[index] : ""; } - public static bool IsBasePart(this SkinBOX skinBox) + public static string GetBaseType(string type) { - return SkinBOX.BaseTypes.Contains(skinBox.Type); - } - - public static bool IsOverlayPart(this SkinBOX skinBox) - { - return SkinBOX.OverlayTypes.Contains(skinBox.Type); + if (!SkinBOX.IsValidType(type)) + return ""; + int index = Array.IndexOf(SkinBOX.OverlayTypes, type); + return SkinBOX.BaseTypes.IndexInRange(index) ? SkinBOX.BaseTypes[index] : ""; } } } diff --git a/PCK-Studio/Internal/SkinBOX.cs b/PCK-Studio/Internal/SkinBOX.cs index 39620f8c..c6523672 100644 --- a/PCK-Studio/Internal/SkinBOX.cs +++ b/PCK-Studio/Internal/SkinBOX.cs @@ -93,6 +93,14 @@ namespace PckStudio.Internal public static bool IsValidType(string type) => ValidBoxTypes.Contains(type); + public bool IsBasePart() => IsBasePart(Type); + + public static bool IsBasePart(string type) => BaseTypes.Contains(type); + + public bool IsOverlayPart() => IsOverlayPart(Type); + + public static bool IsOverlayPart(string type) => OverlayTypes.Contains(type); + public KeyValuePair ToProperty() { return new KeyValuePair("BOX", ToString());