상속: MSBuildObject
예제 #1
0
        public void RemoveProperty(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop != null)
            {
                properties.Remove(name);
                Element.RemoveChild(prop.Element);
            }
        }
예제 #2
0
 public void UnMerge(MSBuildPropertyGroup baseGrp)
 {
     foreach (MSBuildProperty prop in baseGrp.Properties)
     {
         MSBuildProperty thisProp = GetProperty(prop.Name);
         if (thisProp != null && prop.Value == thisProp.Value)
         {
             RemoveProperty(prop.Name);
         }
     }
 }
예제 #3
0
        public bool RemoveProperty(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop != null)
            {
                properties.Remove(name);
                Element.RemoveChild(prop.Element);
                return(true);
            }
            return(false);
        }
예제 #4
0
        public void SetPropertyValue(string name, string value)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                XmlElement pelem = AddChildElement(name);
                prop = new MSBuildProperty(pelem);
                properties [name] = prop;
            }
            prop.Value = value;
        }
예제 #5
0
        public void SetPropertyValue(string name, string value)
        {
            MSBuildProperty p = GetProperty(name);

            if (p != null)
            {
                p.Value = value;
            }
            else
            {
                groups [0].SetPropertyValue(name, value);
            }
        }
예제 #6
0
        public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                return(null);
            }
            else
            {
                return(prop.Value);
            }
        }
예제 #7
0
        public string GetPropertyValue(string name, bool isXml = false)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                return(null);
            }
            else
            {
                return(prop.GetValue(isXml));
            }
        }
예제 #8
0
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase, bool isXml = false)
        {
            MSBuildProperty p = GetProperty(name);

            if (p != null)
            {
                if (!preserveExistingCase || !string.Equals(value, p.GetValue(isXml), StringComparison.OrdinalIgnoreCase))
                {
                    p.SetValue(value, isXml);
                }
                return(p);
            }
            return(groups [0].SetPropertyValue(name, value, preserveExistingCase, isXml));
        }
예제 #9
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.GetValue(true).Equals(thisProp.GetValue(true), StringComparison.OrdinalIgnoreCase))
         {
             RemoveProperty(prop.Name);
         }
     }
 }
예제 #10
0
 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--)
     {
         var             g = groups [n];
         MSBuildProperty p = g.GetProperty(name);
         if (p != null)
         {
             return(p);
         }
     }
     return(null);
 }
예제 #11
0
        public MSBuildProperty SetPropertyValue(string name, string value, bool preserveExistingCase, bool isXml = false)
        {
            MSBuildProperty prop = GetProperty(name);

            if (prop == null)
            {
                XmlElement pelem = AddChildElement(name);
                prop = new MSBuildProperty(pelem);
                properties [name] = prop;
                prop.SetValue(value, isXml);
            }
            else if (!preserveExistingCase || !string.Equals(value, prop.GetValue(isXml), StringComparison.OrdinalIgnoreCase))
            {
                prop.SetValue(value, isXml);
            }
            return(prop);
        }
예제 #12
0
        public MSBuildPropertyGroup(MSBuildProject parent, XmlElement elem) : base(elem)
        {
            this.parent = parent;

            foreach (var pelem in Element.ChildNodes.OfType <XmlElement> ())
            {
                MSBuildProperty prevSameName;
                if (properties.TryGetValue(pelem.Name, out prevSameName))
                {
                    prevSameName.Overwritten = true;
                }

                var prop = new MSBuildProperty(pelem);
                propertyList.Add(prop);
                properties [pelem.Name] = prop;                 // If a property is defined more than once, we only care about the last registered value
            }
        }
예제 #13
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);
            }
        }
예제 #14
0
        public string GetPropertyValue(string name, bool isXml = false)
        {
            MSBuildProperty prop = GetProperty(name);

            return(prop != null?prop.GetValue(isXml) : null);
        }
예제 #15
0
		public MSBuildProperty SetPropertyValue (string name, string value, bool preserveExistingCase, bool isXml = false)
		{
			MSBuildProperty prop = GetProperty (name);
			if (prop == null) {
				XmlElement pelem = AddChildElement (name);
				prop = new MSBuildProperty (pelem);
				properties [name] = prop;
				prop.SetValue (value, isXml);
			} else if (!preserveExistingCase || !string.Equals (value, prop.GetValue (isXml), StringComparison.OrdinalIgnoreCase)) {
				prop.SetValue (value, isXml);
			}
			return prop;
		}
예제 #16
0
		public void SetPropertyValue (string name, string value)
		{
			MSBuildProperty prop = GetProperty (name);
			if (prop == null) {
				XmlElement pelem = AddChildElement (name);
				prop = new MSBuildProperty (pelem);
				properties [name] = prop;
			}
			prop.Value = value;
		}
예제 #17
0
        public string GetPropertyValue(string name)
        {
            MSBuildProperty prop = GetProperty(name);

            return(prop != null ? prop.Value : null);
        }
예제 #18
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;
		}
예제 #19
0
		public MSBuildPropertyGroup (MSBuildProject parent, XmlElement elem): base (elem)
		{
			this.parent = parent;

			foreach (var pelem in Element.ChildNodes.OfType<XmlElement> ()) {
				MSBuildProperty prevSameName;
				if (properties.TryGetValue (pelem.Name, out prevSameName))
					prevSameName.Overwritten = true;

				var prop = new MSBuildProperty (pelem);
				propertyList.Add (prop);
				properties [pelem.Name] = prop; // If a property is defined more than once, we only care about the last registered value
			}
		}