public static IReadOnlyConfigPropertyBase GetOrAddProperty([NotNull] IReadOnlyConfigPropertyBase property) { if (property is null) { throw new ArgumentNullException(nameof(property)); } IPropertyConfigBase config = property.Config; if (config is null) { throw new ArgumentException(@"Cannot add property without config", nameof(property)); } String path = property.Path; if (path is null) { throw new ArgumentException(@"Cannot add property without path", nameof(property)); } lock (Properties) { return(Properties.GetOrAdd(config, CreatePropertyMap).GetOrAdd(path, property)); } }
public static Boolean IsLinked([NotNull] IReadOnlyConfigPropertyBase property) { if (property is null) { throw new ArgumentNullException(nameof(property)); } lock (Properties) { return(Properties.TryGetValue(property.Config, out IIndexMap <String, IReadOnlyConfigPropertyBase> map) && map.ContainsValue(property)); } }
public static void ThrowIfPropertyNotLinked([NotNull] IReadOnlyConfigPropertyBase property) { if (property is null) { throw new ArgumentNullException(nameof(property)); } if (!IsLinked(property)) { throw new InvalidOperationException("Property not linked to config"); } }
public static Boolean RemoveProperty([NotNull] IPropertyConfigBase config, [NotNull] IReadOnlyConfigPropertyBase property) { if (config is null) { throw new ArgumentNullException(nameof(config)); } if (property is null) { throw new ArgumentNullException(nameof(property)); } ThrowIfPropertyNotLinkedTo(config, property); return(RemoveProperty(property)); }
public static Boolean RemoveProperty(IReadOnlyConfigPropertyBase property) { if (property is null) { throw new ArgumentNullException(nameof(property)); } if (property.Config is null) { throw new ArgumentException(@"Cannot remove property without config", nameof(property)); } lock (Properties) { if (!Properties.TryGetValue(property.Config, out IIndexMap <String, IReadOnlyConfigPropertyBase> dictionary)) { return(false); } return(dictionary is not null && dictionary.Remove(property.Path)); } }
public Boolean RemoveValue(IReadOnlyConfigPropertyBase property) { ConfigPropertyObserver.ThrowIfPropertyNotLinked(property); return(RemoveValue(property.Key, property.Sections)); }
public Boolean KeyExist(IReadOnlyConfigPropertyBase property) { ConfigPropertyObserver.ThrowIfPropertyNotLinked(property); return(KeyExist(property.Key, property.Sections)); }
public void RemoveProperty(IReadOnlyConfigPropertyBase property) { ConfigPropertyObserver.RemoveProperty(this, property); ClearProperty(property); }
private static void ClearProperty(IReadOnlyConfigPropertyBase property) { (property as IConfigPropertyBase)?.Dispose(); }
private static void ResetProperty(IReadOnlyConfigPropertyBase property) { (property as IConfigPropertyBase)?.Reset(); }
private static void SaveProperty(IReadOnlyConfigPropertyBase property) { (property as IConfigPropertyBase)?.Save(); }
private static void ReadProperty(IReadOnlyConfigPropertyBase property) { property?.Read(); }
public Boolean RemoveValue(IReadOnlyConfigPropertyBase property) { return(Config.RemoveValue(property)); }
public Boolean KeyExist(IReadOnlyConfigPropertyBase property) { return(Config.KeyExist(property)); }
public void RemoveProperty(IReadOnlyConfigPropertyBase property) { ConfigPropertyObserver.ThrowIfPropertyNotLinkedTo(this, property); ConfigPropertyObserver.RemoveProperty(property); ClearProperty(property); }