Ejemplo n.º 1
0
        // *******************************************************************
        // Constructors.
        // *******************************************************************

        #region Constructors

        /// <summary>
        /// This constructor creates a new instance of the <see cref="ProviderBase"/>
        /// class.
        /// </summary>
        /// <param name="source">A source for the provider.</param>
        protected ProviderBase(
            IBuilderSource source
            )
        {
            // Validate the parameter before attempting to use it.
            new Guard().ThrowIfNull(source, nameof(source));

            // Save the reference.
            _source = source;
        }
Ejemplo n.º 2
0
        // *******************************************************************

        /// <summary>
        /// This method adds a child to the source.
        /// </summary>
        /// <param name="source">The source to add.</param>
        void IBuilderSource.AddChild(
            IBuilderSource source
            )
        {
            // Validate the parameter before attempting to use it.
            new Guard().ThrowIfNull(source, nameof(source));

            // Add the child source.
            _children.Add(source);
        }
Ejemplo n.º 3
0
        // *******************************************************************

        /// <summary>
        /// This method exposes the <see cref="IBuilderSource.AddChild(IBuilderSource)"/> method
        /// on a <see cref="SourceBase"/> object, in order to avoid the need to
        /// constantly downcast.
        /// </summary>
        /// <param name="source">A <see cref="SourceBase"/> reference.</param>
        /// <param name="child">The source to add as a child.</param>
        public static void AddChild(
            this SourceBase source,
            IBuilderSource child
            )
        {
            // Validate the parameters before attempting to use them.
            new Guard().ThrowIfNull(source, nameof(source))
            .ThrowIfNull(child, nameof(child));

            // Downcast and perform the operation.
            ((IBuilderSource)source).AddChild(child);
        }
Ejemplo n.º 4
0
        // *******************************************************************

        /// <summary>
        /// This method exposes the <see cref="IBuilder.AddSource(IBuilderSource)"/>
        /// method on a <see cref="BuilderBase"/> object, in order to avoid the
        /// need to contantly downcast.
        /// </summary>
        /// <param name="builder">A <see cref="BuilderBase"/> reference.</param>
        /// <param name="source">The source to add.</param>
        public static void AddSource(
            this BuilderBase builder,
            IBuilderSource source
            )
        {
            // Validate the parameters before attempting to use them.
            new Guard().ThrowIfNull(builder, nameof(builder))
            .ThrowIfNull(source, nameof(source));

            // Downcast and perform the operation.
            ((IBuilder)builder).AddSource(source);
        }
Ejemplo n.º 5
0
        // *******************************************************************

        /// <summary>
        /// This method is used to add a new source to the builder.
        /// </summary>
        /// <param name="source">The source to be added.</param>
        /// <returns>The builder instance.</returns>
        IBuilder IBuilder.AddSource(
            IBuilderSource source
            )
        {
            // Validate the parameter before attempting to use it.
            new Guard().ThrowIfNull(source, nameof(source));

            // Add the source.
            _sources.Add(source);

            // Return the builder instance.
            return(this);
        }
Ejemplo n.º 6
0
        public static void build(XmlNode xAuto, IBuilderSource source)
        {
            if (xAuto is XmlElement)
            {
                var         conf    = new pdb.podcast.Tuning.Auto(xAuto as XmlElement);
                var         name    = conf.name;
                AutoBuilder builder = list.Find(a => a.name == name);
                if (builder == null)
                {
                    builder = new AutoBuilder(conf);
                    list.Add(builder);
                    builder.naturalOrder = list.Count;
                    index = list.Count - 1;
                    if (main == null)
                    {
                        main = builder;
                    }
                }

                builder.conf   = conf;
                builder.source = source;
            }
        }
Ejemplo n.º 7
0
        // *******************************************************************
        // Constructors.
        // *******************************************************************

        #region Constructors

        /// <summary>
        /// This constructor creates a new instance of the <see cref="TypedProviderBase{TSource}"/>
        /// class.
        /// </summary>
        /// <param name="source">A source for the provider.</param>
        protected TypedProviderBase(
            IBuilderSource source
            ) : base(source)
        {
        }