コード例 #1
0
        public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = this.GetProperty(name);

            if (prop == null)
            {
                return(null);
            }
            return(prop.Value);
        }
コード例 #2
0
        public bool RemoveProperty(string name)
        {
            MSBuildProperty prop = this.GetProperty(name);

            if (prop != null)
            {
                this.properties.Remove(name);
                base.Element.RemoveChild(prop.Element);
                return(true);
            }
            return(false);
        }
コード例 #3
0
 public MSBuildProperty GetProperty(string name)
 {
     for (int i = this.groups.Count - 1; i >= 0; i--)
     {
         MSBuildPropertyGroup g = this.groups[i];
         MSBuildProperty      p = g.GetProperty(name);
         if (p != null)
         {
             return(p);
         }
     }
     return(null);
 }
コード例 #4
0
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase)
        {
            MSBuildProperty p = this.GetProperty(name);

            if (p != null)
            {
                if (!preserveExistingCase || !string.Equals(value, p.Value, StringComparison.OrdinalIgnoreCase))
                {
                    p.Value = value;
                }
                return(p);
            }
            return(this.groups[0].SetPropertyValue(name, value, preserveExistingCase));
        }
コード例 #5
0
 public void UnMerge(MSBuildPropertySet baseGrp, ISet <string> propsToExclude)
 {
     foreach (MSBuildProperty prop in baseGrp.Properties)
     {
         if (propsToExclude == null || !propsToExclude.Contains(prop.Name))
         {
             MSBuildProperty thisProp = this.GetProperty(prop.Name);
             if (thisProp != null && prop.Value.Equals(thisProp.Value, StringComparison.CurrentCultureIgnoreCase))
             {
                 this.RemoveProperty(prop.Name);
             }
         }
     }
 }
コード例 #6
0
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase)
        {
            MSBuildProperty prop = this.GetProperty(name);

            if (prop == null)
            {
                XmlElement pelem = base.AddChildElement(name);
                prop = new MSBuildProperty(pelem);
                this.properties[name] = prop;
                prop.Value            = value;
            }
            else if (!preserveExistingCase || !string.Equals(value, prop.Value, StringComparison.OrdinalIgnoreCase))
            {
                prop.Value = value;
            }
            return(prop);
        }
コード例 #7
0
        public MSBuildProperty GetProperty(string name)
        {
            MSBuildProperty prop;

            if (this.properties.TryGetValue(name, out prop))
            {
                return(prop);
            }
            XmlElement propElem = base.Element[name, "http://schemas.microsoft.com/developer/msbuild/2003"];

            if (propElem != null)
            {
                prop = new MSBuildProperty(propElem);
                this.properties[name] = prop;
                return(prop);
            }
            return(null);
        }