public static bool DoesNotHaveApiStyle(this XmlElement element, ApiStyle style) { string styleString = style.ToString().ToLowerInvariant(); string apistylevalue = element.GetAttribute("apistyle"); return(apistylevalue != styleString || string.IsNullOrWhiteSpace(apistylevalue)); }
/// <param name="ns">The namespace that is being dropped.</param> /// <param name="style">The style that is being dropped.</param> /// <param name="frameworkName">Name of the framework, which should be used to filter out any other API</param> public MDocFileSource(string ns, ApiStyle style, string frameworkName) { droppedNamespace = ns; shouldDropNamespace = !string.IsNullOrWhiteSpace(ns); styleToDrop = style; framework = frameworkName; }
public static void RemoveApiStyle(this XmlNode node, ApiStyle style) { var styleAttribute = node.Attributes["apistyle"]; if (styleAttribute != null && styleAttribute.Value == style.ToString().ToLowerInvariant()) { node.Attributes.Remove(styleAttribute); } }
public static void RemoveApiStyle(this XmlElement element, ApiStyle style) { string styleString = style.ToString().ToLowerInvariant(); string existingValue = element.GetAttribute("apistyle"); if (string.IsNullOrWhiteSpace(existingValue) || existingValue == styleString) { element.RemoveAttribute("apistyle"); } }
public static void AddApiStyle(this XmlNode node, ApiStyle style) { string styleString = style.ToString().ToLowerInvariant(); var existingAttribute = node.Attributes["apistyle"]; if (existingAttribute == null) { existingAttribute = node.OwnerDocument.CreateAttribute("apistyle"); node.Attributes.Append(existingAttribute); } existingAttribute.Value = styleString; }
public static void AddApiStyle(this XmlElement element, ApiStyle style) { string styleString = style.ToString().ToLowerInvariant(); var existingValue = element.GetAttribute("apistyle"); if (string.IsNullOrWhiteSpace(existingValue) || existingValue != styleString) { element.SetAttribute("apistyle", styleString); } // Propagate the API style up to the membernode if necessary if (element.LocalName == "AssemblyInfo" && element.ParentNode != null && element.ParentNode.LocalName == "Member") { var member = element.ParentNode; var unifiedAssemblyNode = member.SelectSingleNode("AssemblyInfo[@apistyle='unified']"); var classicAssemblyNode = member.SelectSingleNode("AssemblyInfo[not(@apistyle) or @apistyle='classic']"); var parentAttribute = element.ParentNode.Attributes["apistyle"]; Action removeStyle = () => element.ParentNode.Attributes.Remove(parentAttribute); Action propagateStyle = () => { if (parentAttribute == null) { // if it doesn't have the attribute, then add it parentAttribute = element.OwnerDocument.CreateAttribute("apistyle"); parentAttribute.Value = styleString; element.ParentNode.Attributes.Append(parentAttribute); } }; if ((style == ApiStyle.Classic && unifiedAssemblyNode != null) || (style == ApiStyle.Unified && classicAssemblyNode != null)) { removeStyle(); } else { propagateStyle(); } } }
public static bool HasApiStyle(this XmlNode node, ApiStyle style) { var attribute = node.Attributes["apistyle"]; return(attribute != null && attribute.Value == style.ToString().ToLowerInvariant()); }
public static bool HasApiStyle(this XmlElement element, ApiStyle style) { string styleString = style.ToString().ToLowerInvariant(); return(element.GetAttribute("apistyle") == styleString); }
/// <param name="ns">The namespace that is being dropped.</param> /// <param name="style">The style that is being dropped.</param> public MDocFileSource(string ns, ApiStyle style) { droppedNamespace = ns; shouldDropNamespace = !string.IsNullOrWhiteSpace (ns); styleToDrop = style; }