|
@@ -271,6 +271,20 @@ namespace InABox.Core
|
|
|
|
|
|
_properties[master] = newDict.ToImmutableSortedDictionary();
|
|
|
}
|
|
|
+ private static void UnregisterProperties(Type master, IEnumerable<IProperty> toRemove)
|
|
|
+ {
|
|
|
+ if (!_properties.TryGetValue(master, out var properties))
|
|
|
+ {
|
|
|
+ properties = ImmutableSortedDictionary<string, IProperty>.Empty;
|
|
|
+ }
|
|
|
+ var newDict = properties.ToDictionary(x => x.Key, x => x.Value);
|
|
|
+ foreach(var prop in toRemove)
|
|
|
+ {
|
|
|
+ newDict.Remove(prop.Name);
|
|
|
+ }
|
|
|
+
|
|
|
+ _properties[master] = newDict.ToImmutableSortedDictionary();
|
|
|
+ }
|
|
|
|
|
|
public static void RegisterProperty(IProperty entry)
|
|
|
{
|
|
@@ -295,6 +309,17 @@ namespace InABox.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void Unload(CustomProperty[] customProperties)
|
|
|
+ {
|
|
|
+ var perType = customProperties.GroupBy(x => x.ClassType);
|
|
|
+ foreach(var group in perType)
|
|
|
+ {
|
|
|
+ if (group.Key is null) continue;
|
|
|
+
|
|
|
+ UnregisterProperties(group.Key, group);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private static ImmutableSortedDictionary<string, IProperty>? CheckPropertiesInternal(Type type)
|
|
|
{
|
|
|
try
|