Add convenient functions to PCKProperties

This commit is contained in:
miku-666
2022-07-30 21:45:28 +02:00
parent 1ee12be96e
commit c6e0b7cbdc

View File

@@ -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));
}
}
}