mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-04 04:25:50 +00:00
Add convenient functions to PCKProperties
This commit is contained in:
@@ -8,5 +8,25 @@ namespace PckStudio.Classes.FileTypes
|
||||
{
|
||||
public class PCKProperties : List<ValueTuple<string, string>> // class because `using` is file scoped :|
|
||||
{
|
||||
public bool HasProperty(string property)
|
||||
{
|
||||
return GetProperty(property) != default;
|
||||
}
|
||||
|
||||
public ValueTuple<string, string> GetProperty(string property)
|
||||
{
|
||||
return this.FirstOrDefault(p => p.Item1.Equals(property));
|
||||
}
|
||||
|
||||
public void SetProperty(string property, string value)
|
||||
{
|
||||
if (HasProperty(property))
|
||||
{
|
||||
this[IndexOf(GetProperty(property))] = (property, value);
|
||||
return;
|
||||
}
|
||||
Add((property, value));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user