SkinBOX - Move IsBasePart and IsOverlyPart from extension to main class

This commit is contained in:
miku-666
2024-05-12 14:50:01 +02:00
parent 0cabf9115b
commit 87df17b4cd
2 changed files with 13 additions and 7 deletions

View File

@@ -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] : "";
}
}
}

View File

@@ -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<string, string> ToProperty()
{
return new KeyValuePair<string, string>("BOX", ToString());