using System.Collections.Generic; namespace LibationFileManager { public partial class Configuration : PropertyChangeFilter { /* * Use this type in the getter for any Dictionary settings, * and be sure to clone it before returning. This allows Configuration to * accurately detect if an of the Dictionary's elements have changed. */ private class EquatableDictionary : Dictionary { public EquatableDictionary(IEnumerable> keyValuePairs) : base(keyValuePairs) { } public EquatableDictionary Clone() => new(this); public override bool Equals(object obj) { if (obj is Dictionary dic && Count == dic.Count) { foreach (var pair in this) if (!dic.TryGetValue(pair.Key, out var value) || !pair.Value.Equals(value)) return false; return true; } return false; } public override int GetHashCode() => base.GetHashCode(); } } }