Exemplo n.º 1
0
        public bool RemoveProperty(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop != null)
            {
                properties.Remove(name);
                Element.RemoveChild(prop.Element);
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                return(null);
            }
            else
            {
                return(prop.Value);
            }
        }
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase)
        {
            MSBuildProperty p = GetProperty(name);

            if (p != null)
            {
                if (!preserveExistingCase || !string.Equals(value, p.Value, StringComparison.OrdinalIgnoreCase))
                {
                    p.Value = value;
                }
                return(p);
            }
            return(groups[0].SetPropertyValue(name, value, preserveExistingCase));
        }
 public MSBuildProperty GetProperty(string name)
 {
     // Find property in reverse order, since the last set
     // value is the good one
     for (int n = groups.Count - 1; n >= 0; n--)
     {
         MSBuildPropertyGroup g = groups[n];
         MSBuildProperty      p = g.GetProperty(name);
         if (p != null)
         {
             return(p);
         }
     }
     return(null);
 }
Exemplo n.º 5
0
 public void UnMerge(MSBuildPropertySet baseGrp, ISet <string> propsToExclude)
 {
     foreach (MSBuildProperty prop in baseGrp.Properties)
     {
         if (propsToExclude != null && propsToExclude.Contains(prop.Name))
         {
             continue;
         }
         MSBuildProperty thisProp = GetProperty(prop.Name);
         if (thisProp != null && prop.Value.Equals(thisProp.Value, StringComparison.CurrentCultureIgnoreCase))
         {
             RemoveProperty(prop.Name);
         }
     }
 }
 public MSBuildProperty GetProperty(string name)
 {
     MSBuildProperty prop;
     if (properties.TryGetValue(name, out prop))
         return prop;
     XmlElement propElem = Element[name, MSBuildProject.Schema];
     if (propElem != null)
     {
         prop = new MSBuildProperty(propElem);
         properties[name] = prop;
         return prop;
     }
     else
         return null;
 }
Exemplo n.º 7
0
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                XmlElement pelem = AddChildElement(name);
                prop             = new MSBuildProperty(pelem);
                properties[name] = prop;
                prop.Value       = value;
            }
            else if (!preserveExistingCase || !string.Equals(value, prop.Value, StringComparison.OrdinalIgnoreCase))
            {
                prop.Value = value;
            }
            return(prop);
        }
Exemplo n.º 8
0
        public MSBuildProperty GetProperty(string name)
        {
            MSBuildProperty prop;

            if (properties.TryGetValue(name, out prop))
            {
                return(prop);
            }
            XmlElement propElem = Element[name, MSBuildProject.Schema];

            if (propElem != null)
            {
                prop             = new MSBuildProperty(propElem);
                properties[name] = prop;
                return(prop);
            }
            else
            {
                return(null);
            }
        }
        public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            return(prop != null ? prop.Value : null);
        }
Exemplo n.º 10
0
 public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase)
 {
     MSBuildProperty prop = GetProperty(name);
     if (prop == null)
     {
         XmlElement pelem = AddChildElement(name);
         prop = new MSBuildProperty(pelem);
         properties[name] = prop;
         prop.Value = value;
     }
     else if (!preserveExistingCase || !string.Equals(value, prop.Value, StringComparison.OrdinalIgnoreCase))
     {
         prop.Value = value;
     }
     return prop;
 }