// Copyright (c) Arlo Godfrey. All Rights Reserved. // Licensed under the GNU Lesser General Public License, Version 3.0 with additional terms. // See the LICENSE, LICENSE.LESSER and LICENSE.ADDITIONAL files in the project root for more information. using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using OwlCore.ComponentModel; using OwlCore.Events; using StrixMusic.Sdk.AdapterModels; using StrixMusic.Sdk.AppModels; using StrixMusic.Sdk.CoreModels; namespace StrixMusic.Sdk.Plugins.Model { /// /// An implementation of which delegates all member access to the implementation, /// unless the member is overridden in a derived class which changes the behavior. /// public class StrixDataRootPluginBase : IModelPlugin, IStrixDataRoot, IDelegatable { /// /// Creates a new instance of . /// /// Metadata about the plugin which was provided during registration. /// The implementation which all member access is delegated to, unless the member is overridden in a derived class which changes the behavior. internal protected StrixDataRootPluginBase(ModelPluginMetadata registration, IStrixDataRoot inner) { Metadata = registration; Inner = inner; } /// public ModelPluginMetadata Metadata { get; } /// public virtual IStrixDataRoot Inner { get; } /// public event EventHandler? SourcesChanged { add => Inner.SourcesChanged += value; remove => Inner.SourcesChanged -= value; } /// public virtual event EventHandler? PinsChanged { add => Inner.PinsChanged += value; remove => Inner.PinsChanged -= value; } /// public virtual event EventHandler? SearchChanged { add => Inner.SearchChanged += value; remove => Inner.SearchChanged -= value; } /// public virtual event EventHandler? RecentlyPlayedChanged { add => Inner.RecentlyPlayedChanged += value; remove => Inner.RecentlyPlayedChanged -= value; } /// public virtual event EventHandler? DiscoverablesChanged { add => Inner.DiscoverablesChanged += value; remove => Inner.DiscoverablesChanged -= value; } /// public virtual event CollectionChangedEventHandler? DevicesChanged { add => Inner.DevicesChanged += value; remove => Inner.DevicesChanged -= value; } /// public IReadOnlyList Sources => Inner.Sources; /// public virtual MergedCollectionConfig MergeConfig => Inner.MergeConfig; /// public virtual IReadOnlyList Devices => Inner.Devices; /// public virtual ILibrary Library => Inner.Library; /// public virtual IPlayableCollectionGroup? Pins => Inner.Pins; /// public virtual ISearch? Search => Inner.Search; /// public virtual IRecentlyPlayed? RecentlyPlayed => Inner.RecentlyPlayed; /// public virtual IDiscoverables? Discoverables => Inner.Discoverables; /// public virtual bool IsInitialized => Inner.IsInitialized; /// public virtual ValueTask DisposeAsync() => Inner.DisposeAsync(); /// public virtual bool Equals(ICoreImage other) => Inner.Equals(other); /// public bool Equals(ICore other) => Inner.Equals(other); /// public Task InitAsync(CancellationToken cancellationToken = default) => Inner.InitAsync(cancellationToken); } }