ClrPlus.Scripting.MsBuild.Packaging.ProjectPlus.LookupItemDefinition C# (CSharp) Méthode

LookupItemDefinition() private méthode

private LookupItemDefinition ( Microsoft.Build.Construction.ProjectItemDefinitionGroupElement parent, string itemType, string condition = null ) : Microsoft.Build.Construction.ProjectItemDefinitionElement
parent Microsoft.Build.Construction.ProjectItemDefinitionGroupElement
itemType string
condition string
Résultat Microsoft.Build.Construction.ProjectItemDefinitionElement
        internal ProjectItemDefinitionElement LookupItemDefinition(ProjectItemDefinitionGroupElement parent, string itemType, string condition = null)
        {
            ProjectItemDefinitionElement itemDefinition = null;

            var label = Pivots.GetExpressionLabel(condition);

            if(string.IsNullOrEmpty(condition)) {
                itemDefinition = parent.ItemDefinitions.FirstOrDefault(each => itemType == each.ItemType && string.IsNullOrEmpty(each.Condition));
                if(itemDefinition != null) {
                    return itemDefinition;
                }
                return parent.AddItemDefinition(itemType);
            }

            var conditionExpression = Pivots.GetMSBuildCondition(Name, condition);
            itemDefinition = parent.ItemDefinitions.FirstOrDefault(each => itemType == each.ItemType && each.Condition == conditionExpression);
            if(itemDefinition != null) {
                return itemDefinition;
            }

            itemDefinition = parent.AddItemDefinition(itemType);

            itemDefinition.Label = label;
            itemDefinition.Condition = conditionExpression;
            return itemDefinition;
        }

Same methods

ProjectPlus::LookupItemDefinition ( string itemType, string condition = null ) : Microsoft.Build.Construction.ProjectItemDefinitionElement