ClrPlus.Scripting.MsBuild.Packaging.ProjectPlus.LookupPropertyGroup C# (CSharp) Method

LookupPropertyGroup() private method

private LookupPropertyGroup ( string condition ) : Microsoft.Build.Construction.ProjectPropertyGroupElement
condition string
return Microsoft.Build.Construction.ProjectPropertyGroupElement
        internal ProjectPropertyGroupElement LookupPropertyGroup(string condition)
        {
            // look it up or create it.
            var label = Pivots.GetExpressionLabel(condition);
            ProjectPropertyGroupElement propertyGroup;

            if(string.IsNullOrEmpty(condition)) {
                propertyGroup = Xml.PropertyGroups.FirstOrDefault(each => string.IsNullOrEmpty(each.Label));
                if(propertyGroup != null) {
                    return propertyGroup;
                }
            }
            else {
                propertyGroup = Xml.PropertyGroups.FirstOrDefault(each => label == each.Label);
                if(propertyGroup != null) {
                    return propertyGroup;
                }
            }

            propertyGroup = Xml.AddPropertyGroup();
            if(!string.IsNullOrEmpty(condition)) {
                propertyGroup.Label = label;
                propertyGroup.Condition = Pivots.GetMSBuildCondition(Name, condition);
            }
            return propertyGroup;
        }