Пример #1
0
        /// <summary>
        /// First check if an Output with the given name exists on the Component.
        ///     If it exists, then assign that output to the Output property
        ///     If it does not exist:
        ///         Check if more outputs can be added or not.
        ///         If more outputs can be added, then add a new output
        ///         If more outputs cannot be added, then assign the first (non error ) output in the component's collection to the Output property
        /// </summary>
        /// <param name="parentComponent"></param>
        /// <param name="name"></param>
        public ISOutput(ISPipelineComponent parentComponent, string name, int referenceOutputIndex = 0, InsertPlacement beforeOrAfter = InsertPlacement.IP_BEFORE)
        {
            ParentComponent = parentComponent;

            bool outputExists = false;

            for (int i = 0; i < ParentComponent.ComponentMetaData.OutputCollection.Count; i++)
            {
                if (ParentComponent.ComponentMetaData.OutputCollection[i].Name == name)
                {
                    Output       = ParentComponent.ComponentMetaData.OutputCollection[i];
                    outputExists = true;
                }
            }

            //  check if more outputs can be added
            int existingOutputCount = parentComponent.ComponentMetaData.OutputCollection.Count;

            if (ParentComponent._numberOfOutputsAllowed == -1)
            {
                if (!(outputExists))
                {
                    Output = parentComponent.DesignTimeComponent.InsertOutput(DtsUtility.EnumAToEnumB <InsertPlacement, DTSInsertPlacement>(beforeOrAfter), ParentComponent.GetOutputFromIndex(referenceOutputIndex).ID);
                    Name   = name;
                }
            }
            else
            {
                if (existingOutputCount < parentComponent._numberOfOutputsAllowed)
                {
                    if (!(outputExists))
                    {
                        Output = parentComponent.DesignTimeComponent.InsertOutput(DTSInsertPlacement.IP_BEFORE, ParentComponent.GetOutputFromIndex(referenceOutputIndex).ID);
                        Name   = name;
                    }
                }
                else
                {
                    if (!outputExists)
                    {
                        Console.WriteLine("WARN::: Only {1} output(s) are allowed. A new output with the name '{0}' cannot be added. Therefore, the name '{0}' is assigned to the first non error output in the collection", name, existingOutputCount.ToString());
                        Output = parentComponent.ComponentMetaData.OutputCollection[0];
                        Name   = name;
                    }
                }
            }
        }
Пример #2
0
 public DropEventArgs(InsertPlacement sourcePlacement)
 {
     SourcePlacement = sourcePlacement;
 }