private void SetNodeIcon(DtsContainer container, TreeNode childNode)
        {
            string key = PackageHelper.GetContainerKey(container);

            if (!this.imageList.Images.ContainsKey(key))
            {
                if (PackageHelper.ControlFlowInfos.ContainsKey(key))
                {
                    this.imageList.Images.Add(key, PackageHelper.ControlFlowInfos[key].Icon);
                }
                else
                {
                    MessageBox.Show(container.Name);
                }
            }

            childNode.ImageKey         = key;
            childNode.SelectedImageKey = key;
        }
Exemplo n.º 2
0
        private void CheckProperties(IDTSPropertiesProvider propProvider, BackgroundWorker worker, string path)
        {
            if (worker.CancellationPending)
            {
                return;
            }

            if (propProvider is DtsContainer)
            {
                DtsContainer container      = (DtsContainer)propProvider;
                string       containerKey   = PackageHelper.GetContainerKey(container);
                string       objectTypeName = container.GetType().Name;

                if (container is TaskHost)
                {
                    if (((TaskHost)container).InnerObject is MainPipe)
                    {
                        objectTypeName = typeof(MainPipe).Name; // Prevents it from saying COM Object
                    }
                    else
                    {
                        objectTypeName = ((TaskHost)container).InnerObject.GetType().Name;
                    }

                    ScanProperties(worker, path, typeof(TaskHost), objectTypeName, container.ID, container.ID, container.Name, propProvider, containerKey);
                }
                else if (container is ForEachLoop)
                {
                    ForEachLoop loop = container as ForEachLoop;
                    ScanProperties(worker, path, typeof(ForEachLoop), objectTypeName, container.ID, container.ID, container.Name, propProvider, containerKey);
                    ScanProperties(worker, path + "\\ForEachEnumerator.", typeof(ForEachEnumerator), objectTypeName, container.ID, loop.ForEachEnumerator.ID, container.Name, loop.ForEachEnumerator, containerKey);
                }
                else
                {
                    ScanProperties(worker, path, container.GetType(), objectTypeName, container.ID, container.ID, container.Name, propProvider, containerKey);
                }

                ScanVariables(worker, path, objectTypeName, container.ID, container.Variables);
            }
        }
        private void CheckProperties(IDTSPropertiesProvider propProvider, BackgroundWorker worker, string path)
        {
            if (worker.CancellationPending)
            {
                return;
            }

            if (propProvider is DtsContainer)
            {
                DtsContainer container      = (DtsContainer)propProvider;
                string       containerKey   = PackageHelper.GetContainerKey(container);
                string       objectTypeName = container.GetType().Name;

                TaskHost taskHost = container as TaskHost;
                if (taskHost != null)
                {
                    objectTypeName = CheckTaskHost(taskHost, worker, path, container, containerKey);
                }
                else if (container is ForEachLoop)
                {
                    ForEachLoop loop = container as ForEachLoop;
                    ScanProperties(worker, path, typeof(ForEachLoop), objectTypeName, container.ID, container.ID, container.Name, propProvider, containerKey);
                    if (loop.ForEachEnumerator != null)
                    {
                        // A For Each Loop that has not been configured yet will not have an enumerator, so ensure we check
                        ScanProperties(worker, path + "\\ForEachEnumerator.", typeof(ForEachEnumerator), objectTypeName, container.ID, loop.ForEachEnumerator.ID, container.Name, loop.ForEachEnumerator, containerKey);
                    }
                }
                else
                {
                    ScanProperties(worker, path, container.GetType(), objectTypeName, container.ID, container.ID, container.Name, propProvider, containerKey);
                }

                ScanVariables(worker, path, objectTypeName, container.ID, container.Variables);
            }
        }
        private void ProcessObject(object component, TreeNode parentNode)
        {
            if (this.CancellationPending)
            {
                return;
            }

            Package package = component as Package;

            if (package != null)
            {
                // Package node is created in calling function.
                CheckConnectionManagers(package, parentNode);
            }

            DtsContainer container = component as DtsContainer;

            if (container != null)
            {
                string   containerKey = PackageHelper.GetContainerKey(container);
                TaskHost taskHost     = null;

                if (package == null)
                {
                    int imageIndex = GetControlFlowImageIndex(containerKey);
                    parentNode = AddNode(parentNode, container.Name, imageIndex, component);
                    taskHost   = container as TaskHost;
                }

                if (taskHost != null)
                {
                    CheckTask(taskHost, parentNode);
                }
                else if (containerKey == PackageHelper.ForLoopCreationName)
                {
                    CheckForLoop(container as IDTSPropertiesProvider, parentNode);
                }
                else if (containerKey == PackageHelper.ForEachLoopCreationName)
                {
                    CheckForEachLoop(container as ForEachLoop, parentNode);
                }
                else if (containerKey == PackageHelper.SequenceCreationName)
                {
                    ScanProperties(container as IDTSPropertiesProvider, parentNode);
                }
                else
                {
                    // Package, Event Handlers etc
                    ScanProperties(container as IDTSPropertiesProvider, parentNode);
                }

                string          currentPath = string.Empty;
                IDTSPackagePath packagePath = component as IDTSPackagePath;
                if (packagePath != null)
                {
                    currentPath = packagePath.GetPackagePath();
                }

                ScanVariables(container.Variables, parentNode, currentPath);
            }

            EventsProvider eventsProvider = component as EventsProvider;

            if (eventsProvider != null)
            {
                TreeNode eventsNode = AddFolder("EventHandlers", parentNode);
                foreach (DtsEventHandler eventhandler in eventsProvider.EventHandlers)
                {
                    ProcessObject(eventhandler, eventsNode);
                }
            }

            IDTSSequence sequence = component as IDTSSequence;

            if (sequence != null)
            {
                ProcessSequence(sequence, parentNode);
                ScanPrecedenceConstraints(container.ID, sequence.PrecedenceConstraints, parentNode);
            }
        }