X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMicrosoft.Build%2FMicrosoft.Build.Construction%2FProjectExtensionsElement.cs;h=d6bcbbb12bcfe947a8d77148327e6d197d623a48;hb=2628dbd1f83b235dcf68f8896bf424db7fdbbcab;hp=50a0180b72b8260a5311b0d2bc35aa8753e1541e;hpb=882c29a0af59fc2c390c1cb3ae0953ec06f21917;p=mono.git diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectExtensionsElement.cs b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectExtensionsElement.cs index 50a0180b72b..d6bcbbb12bc 100644 --- a/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectExtensionsElement.cs +++ b/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectExtensionsElement.cs @@ -28,6 +28,7 @@ using System; using System.Xml; +using System.Text; namespace Microsoft.Build.Construction { @@ -37,19 +38,53 @@ namespace Microsoft.Build.Construction { ContainingProject = containingProject; } - public override string Condition { get { return null; } set { throw new InvalidOperationException( - "Can not set Condition."); } } - public string Content { get; set; } + public override string Condition { + get { return null; } + set { + throw new InvalidOperationException ("Can not set Condition."); + } + } + public string Content { + get { return element.InnerXml; } + set { element.InnerXml = value; } + } public string this[string name] { get { - throw new NotImplementedException (); + var child = element[name]; + return child == null ? string.Empty : child.InnerXml; } set { - throw new NotImplementedException (); + var child = element[name]; + if (child == null) { + if (string.IsNullOrEmpty (name)) + return; + child = document.CreateElement (name); + element.AppendChild (child); + } + if (string.IsNullOrEmpty (value)) + element.RemoveChild (child); + else + child.InnerXml = value; } } + internal override void Load (XmlReader reader) + { + while (reader.Read () && reader.NodeType != XmlNodeType.Element) + ; + using (XmlReader subReader = reader.ReadSubtree ()) { + document = new XmlDocument (); + document.Load (subReader); + element = document.DocumentElement; + } + } + internal override void SaveValue (XmlWriter writer) + { + element.WriteContentTo (writer); + } internal override string XmlName { - get { return "ProjectExtentions"; } + get { return "ProjectExtensions"; } } + XmlDocument document; + XmlElement element; } }