// 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 tracks and uses a value provided to the plugin instead. /// internal class PopulateEmptyTrackNamePlugin : TrackPluginBase { private readonly string _trackName; /// /// 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 PopulateEmptyTrackNamePlugin(ModelPluginMetadata metadata, ITrack inner, string trackName) : base(metadata, inner) { _trackName = trackName; } /// public override string Name => string.IsNullOrWhiteSpace(base.Name) ? _trackName : base.Name; }