// 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.Threading; using System.Threading.Tasks; using OwlCore.ComponentModel; using StrixMusic.Sdk.AppModels; 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 DownloadablePluginBase : IModelPlugin, IDownloadable, 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 DownloadablePluginBase(ModelPluginMetadata registration, IDownloadable inner) { Metadata = registration; Inner = inner; } /// public ModelPluginMetadata Metadata { get; } /// public IDownloadable Inner { get; set; } /// public virtual DownloadInfo DownloadInfo => Inner.DownloadInfo; /// public virtual event EventHandler? DownloadInfoChanged { add => Inner.DownloadInfoChanged += value; remove => Inner.DownloadInfoChanged -= value; } /// public virtual ValueTask DisposeAsync() => Inner.DisposeAsync(); /// public virtual Task StartDownloadOperationAsync(DownloadOperation operation, CancellationToken cancellationToken = default) => Inner.StartDownloadOperationAsync(operation, cancellationToken); } }