// 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 StrixMusic.Sdk.AppModels; using StrixMusic.Sdk.Plugins.Model; namespace StrixMusic.Sdk.Plugins.PopulateEmptyNames; /// /// A plugin that intercepts null or whitespaces names on albums and uses a value provided to the plugin instead. /// internal class PopulateEmptyAlbumNamePlugin : AlbumPluginBase { private readonly string _albumName; /// /// Initializes a new instance of the class. /// /// Contains metadata for a plugin. Used to identify a plugin before instantiation. /// An implementation which member access is delegated to, unless the member is overridden in a derived class which changes the behavior. /// The name to use instead when the existing name is empty. public PopulateEmptyAlbumNamePlugin(ModelPluginMetadata metadata, IAlbum inner, string albumName) : base(metadata, inner) { _albumName = albumName; } /// public override string Name => string.IsNullOrWhiteSpace(base.Name) ? _albumName : base.Name; }