using System; using System.Collections.Generic; using System.Reactive.Subjects; namespace Wabbajack.Common; public class CustomObservable : IObservable { private readonly Subject _subject = new(); private readonly IEqualityComparer _equalityComparer; private T _value; public T Value { get => _value; set { if (_equalityComparer.Equals(value, _value)) return; _value = value; _subject.OnNext(value); } } public CustomObservable(T value, IEqualityComparer? equalityComparer = null) { _value = value; _equalityComparer = equalityComparer ?? EqualityComparer.Default; } public IDisposable Subscribe(IObserver observer) => _subject.Subscribe(observer); }