/// <summary>
        ///     Adds a component to the specified stage
        /// </summary>
        /// <param name="component">Component to add to the stage</param>
        /// <param name="stage">Stage to add it to</param>
        public void AddComponent(IBaseComponent component, PpStage stage)
        {
            if (component == null)
                throw new ArgumentNullException("component");
            if (stage == null)
                throw new ArgumentNullException("stage");

            if (stage.IsReceiveStage != _isReceivePipeline)
                throw new ArgumentException("Invalid Stage", "stage");

            PStage theStage = FindStage(stage);
            theStage.AddComponent(component);
        }
        //
        // Protected Methods
        //

        /// <summary>
        ///     Finds a stage in the pipeline
        /// </summary>
        /// <param name="stage">Stage definition</param>
        /// <returns>The stage, if found, or a new stage if necessary</returns>
        protected PStage FindStage(PpStage stage)
        {
            PStage theStage = null;
            foreach (PStage pstage in _pipeline.Stages)
            {
                if (pstage.Id == stage.StageID)
                {
                    theStage = pstage;
                    break;
                }
            }
            if (theStage == null)
            {
                theStage = new PStage(stage.StageName, stage.ExecuteMethod, stage.StageID, _pipeline);
                _pipeline.Stages.Add(theStage);
            }
            return theStage;
        }
Exemple #3
0
        public void Addppomponent(IBaseComponent _component, ppStage _stage)
        {
            if (_component == null)
            {
                throw new ArgumentNullException("No component present");
            }
            if (_stage == null)
            {
                throw new ArgumentNullException(" No stage present");
            }

            if (_stage.IsReceiveStage != _isReceivePipeline)
            {
                throw new ArgumentException("Invalid Stage", "stage");
            }

            PStage theStage = checkStage(_stage);

            theStage.AddComponent(_component);
        }