示例#1
0
        private void ProcessTaskParameter(TaskParameterEventArgs args)
        {
            string itemName = args.ItemName;
            var    items    = args.Items.OfType <ITaskItem>().ToArray();

            NamedNode parent = null;
            BaseNode  node   = null;

            if (args.Kind == TaskParameterMessageKind.TaskInput || args.Kind == TaskParameterMessageKind.TaskOutput)
            {
                var task = GetTask(args);
                if (task == null || IgnoreParameters(task))
                {
                    return;
                }

                string folderName = args.Kind == TaskParameterMessageKind.TaskInput ? Strings.Parameters : Strings.OutputItems;
                parent = task.GetOrCreateNodeWithName <Folder>(folderName);

                node = CreateParameterNode(itemName, items);
            }
            else if (args.Kind == TaskParameterMessageKind.AddItem || args.Kind == TaskParameterMessageKind.RemoveItem)
            {
                parent = GetTarget(args);

                NamedNode named;
                if (args.Kind == TaskParameterMessageKind.AddItem)
                {
                    named = new AddItem();
                }
                else
                {
                    named = new RemoveItem();
                }

                named.Name = itemName;

                AddItems(items, named);
                node = named;
            }

            if (node != null && parent != null)
            {
                parent.AddChild(node);
            }
        }
        private void ProcessTaskParameter(TaskParameterEventArgs args)
        {
            string itemType = args.ItemType;
            var    items    = args.Items;
            var    kind     = args.Kind;

            NamedNode parent = null;
            BaseNode  node   = null;

            if (kind == TaskParameterMessageKind.TaskInput || kind == TaskParameterMessageKind.TaskOutput)
            {
                var task = GetTask(args);
                if (task == null || IgnoreParameters(task))
                {
                    return;
                }

                bool isOutput = kind == TaskParameterMessageKind.TaskOutput;

                string folderName = isOutput ? Strings.OutputItems : Strings.Parameters;
                parent = task.GetOrCreateNodeWithName <Folder>(folderName);

                node = CreateParameterNode(itemType, items, isOutput);
            }
            else if (
                kind == TaskParameterMessageKind.AddItem ||
                kind == TaskParameterMessageKind.RemoveItem ||
                kind == TaskParameterMessageKind.SkippedTargetInputs ||
                kind == TaskParameterMessageKind.SkippedTargetOutputs)
            {
                parent = GetTarget(args);

                NamedNode named;
                if (kind == TaskParameterMessageKind.AddItem)
                {
                    named = new AddItem
                    {
                        LineNumber = args.LineNumber
                    };
                }
                else if (kind == TaskParameterMessageKind.RemoveItem)
                {
                    named = new RemoveItem
                    {
                        LineNumber = args.LineNumber
                    };
                }
                else
                {
                    named = new Folder();
                    if (kind == TaskParameterMessageKind.SkippedTargetInputs)
                    {
                        itemType = Strings.Inputs;
                    }
                    else
                    {
                        itemType = Strings.Outputs;
                    }
                }

                named.Name = itemType;

                AddItems(items, named);
                node = named;
            }

            if (node != null && parent != null)
            {
                parent.AddChild(node);
            }
        }